:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1f2329;
  --muted: #5f6b79;
  --primary: #2563eb;
  --primary-d: #1d4ed8;
  --ok: #2ba471;
  --warn: #e6a23c;
  --danger: #cc4444;
  --info: #2b8cf0;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --hover: rgba(0, 0, 0, 0.05);
  --bg-soft: #f0f2f5;
  --shadow-lg: 0 10px 28px rgba(16, 24, 40, 0.18);
  --text-dim: #7e8794;
  --font-family-primary: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--primary-d); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eaf2ff 0%, #f5f8ff 100%);
}
.login-card {
  background: var(--panel);
  padding: 40px 36px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  width: 360px;
  text-align: center;
}
.login-card h1 { margin: 0 0 18px; font-size: 22px; }
.login-card p.sub { color: var(--muted); margin: 0 0 4px; }
.oauth-btns { display: flex; flex-direction: column; gap: 12px; }
.oauth-tip { font-size: 12px; color: var(--primary-d); text-align: center; font-weight: 600; margin: 0 0 2px; }
.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; border: none; border-radius: 10px; color: #fff; font-size: 15px; font-weight: 600;
}
.btn-qq { background: #12b7f5; }
.btn-bili { background: #fb7299; }
.dev-form { margin-top: 22px; border-top: 1px dashed var(--border); padding-top: 18px; }
.dev-form input {
  width: 100%; padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px;
}
.btn-dev {
  width: 100%; padding: 11px; border: none; border-radius: 8px; background: var(--text); color: #fff; font-weight: 600;
}
.hint { color: var(--muted); font-size: 12px; margin-top: 10px; }
.rec-tip { margin-top: 6px; margin-bottom: 12px; line-height: 1.6; max-width: 720px; }

/* ---------- 布局 ---------- */
.topbar {
  height: 56px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.topbar .user { display: flex; align-items: center; gap: 10px; }
.topbar .user img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.topbar .user .name { font-weight: 600; }
.layout { display: flex; height: calc(100vh - 56px); }
.sidebar {
  position: fixed; top: 56px; left: 0; bottom: 0; width: 220px;
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 14px 10px; flex-shrink: 0; overflow-y: auto;
}
.nav-item {
  display: block; width: 100%; text-align: left; padding: 10px 14px; border: none; background: transparent;
  border-radius: 8px; color: var(--text); font-size: 14px; margin-bottom: 4px;
}
.nav-item:hover { background: #f0f2f5; }
.nav-item.active { background: #eaf2ff; color: var(--primary-d); font-weight: 600; }
.nav-group-title { font-size: 12px; color: var(--muted); padding: 14px 14px 6px; }

.main { flex: 1; margin-left: 220px; padding: 22px 26px; overflow-y: auto; }

/* ── 滚动条：全局统一为细圆角风格（与 kirie_fun/tools 一致） ── */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}
html::-webkit-scrollbar { width: 8px; height: 8px; }
html::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 8px;
}
html::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 75%, var(--text));
}
html::-webkit-scrollbar-track { background: transparent; }

/* 侧边栏滚动条 */
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--muted);
  border-radius: 6px;
}
.sidebar::-webkit-scrollbar-track { background: transparent; }

.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 20px; }
.head-actions { display: flex; align-items: center; gap: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  padding: 8px 14px; border: 1px solid var(--border); background: var(--panel); border-radius: 8px;
  font-size: 13px; color: var(--text);
}
.btn:hover { border-color: var(--primary); color: var(--primary-d); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); border-color: var(--primary-d); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f3c6c6; }
.btn-danger:hover { background: #fdeaea; border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-ghost { border: none; background: transparent; }
.btn:disabled,
.btn[disabled] {
  opacity: .45; color: var(--muted); background: var(--bg); border-color: var(--border);
  cursor: not-allowed; pointer-events: none;
}
.btn:disabled:hover,
.btn[disabled]:hover { border-color: var(--border); color: var(--muted); background: var(--bg); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 7px 14px; border: 1px solid var(--border); background: var(--panel); border-radius: 20px; font-size: 13px;
  color: var(--text); transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.tab:hover { border-color: var(--primary); color: var(--primary-d); }
.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab.active:hover { color: #fff; }

/* ---------- 表格 ---------- */
.section-title { font-weight: 700; margin: 4px 0 10px; font-size: 15px; }
.table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: #fafbfc; font-size: 12px; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table td .cell-text { display: inline-block; vertical-align: middle; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-hidden { background: #fdeaea; color: var(--danger); }
.badge-visible { background: #e7f6ee; color: var(--ok); }
.badge-downloaded { background: #e8f1fd; color: #2f74d0; }
.badge-stock { background: #eef2f7; color: #5a6b82; }
.badge-stock-zero { background: #fdeaea; color: var(--danger); }
.badge-stock-unlimited { background: #f3eefe; color: #6f4fd8; }
.badge-limit { background: #fff3e0; color: #d9822b; }
.badge-deleted { background: #efe7fd; color: #6f4fd8; }
.badge-persist { background: #e6f7f1; color: #1b9e7e; }
.badge-cond { background: #eef2ff; color: #4f5fd8; }
.badge-mail { background: #fff3e0; color: #d9822b; }
.row-deleted { opacity: 0.72; }
.row-deleted td:first-child { text-decoration: line-through; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }

/* ---------- url 列表 ---------- */
.url-row { display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; box-shadow: var(--shadow); }
.url-row input[type="text"] { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; }
.url-row img.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.url-row.hidden-row { opacity: 0.55; }

/* ---------- 弹窗 ---------- */
.modal-root { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow: auto; }
.modal-root.open { display: flex; }
.modal { background: var(--panel); border-radius: 14px; width: 720px; max-width: 100%; padding: 22px 24px; box-shadow: var(--shadow); }
.modal.forgot-modal { width: 360px; max-width: 92vw; }
.modal h3 { margin: 0 0 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; }
/* 发站内信表单行间距 */
#smCard > .form-row, #smCard > .field { margin-bottom: 10px; }
/* 站内信管理：类型下拉框与开始/结束日期输入宽度统一 150px */
#mgTypeDd .dd-trigger { width: 150px; }
#mgFrom, #mgTo { width: 150px; min-width: 0; }
/* 按区间发放积分：开始/结束/过期时间 175px；类别下拉框与倍率输入框 80px */
#paStart, #paEnd, #paExpire { width: 175px; min-width: 0; }
#paCatDd .dd-trigger { width: 80px; }
#paMult { width: 80px; min-width: 0; }
/* 发站内信：发送方式切换 / 条件构造器 / 邮件勾选 */
.sm-mode .seg-tab { font-size: 13px; padding: 6px 14px; }
.sm-mode-hint { font-size: 12px; margin: -4px 0 6px; }
.chk-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.chk-inline input { width: 16px; height: 16px; }
.sm-cond-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.sm-cond-op { color: var(--muted); font-weight: 600; }
.sm-cond-val .dd { min-width: 130px; }
.sm-cond-num { width: 120px; }
.field.full { grid-column: 1 / -1; }
/* 地址表单：收货人+电话、省+市+区 合并为同一行 */
.form-grid .form-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; }
.form-grid .form-row > .field { flex: 1 1 0; min-width: 0; }
/* 关键：input 默认 min-width 约 170px，会阻止 flex 子项收缩导致整行超出卡片；置 0 让其随容器收缩 */
.form-grid .form-row > .field input,
.form-grid .form-row > .field select,
.form-grid .form-row > .field textarea { min-width: 0; }
/* 「礼物上架」专用：扣费级别 + 倍率 合并为同一行的左半边（各占 25% 总宽），与右侧的「类型」并列；
   切到积分级时 JS 移除 .half 类使整行回到 50/50 标准布局（与扣除积分 对齐） */
.form-grid .form-row.half { grid-column: 1 / 2; display: flex; gap: 12px; }
.form-grid .form-row.half > .field { flex: 1 1 0; min-width: 0; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input[type="text"], .field textarea, .field select {
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; width: 100%;
}
.field textarea { min-height: 84px; resize: vertical; }
.tpl-html { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace; font-size: 12px; line-height: 1.5; color: var(--text); background: var(--bg); white-space: pre; }
.tpl-sep { border: none; border-top: 1px dashed var(--border, #e3ecf7); margin: 20px 0 16px; }
.field .checkbox {
  display: inline-flex; flex-direction: row; align-items: center; gap: 8px;
  align-self: flex-start; width: auto;
  font-size: 14px; color: var(--text); font-weight: 400;
  white-space: nowrap; cursor: pointer;
}
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }
.addr-edit-actions { display: flex; gap: 10px; margin-top: 10px; }

/* ---------- B站 登录模式切换 ---------- */
.mode-switch { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 10px 0 14px; padding: 10px 12px; background: rgba(127,127,127,0.06); border-radius: 10px; }
[data-theme="dark"] .mode-switch { background: rgba(255,255,255,0.03); }
.mode-switch .chk { margin: 0; }

/* ---------- B站 内置验证弹窗 ---------- */
.bili-verify-modal { width: 440px; text-align: left; }
.bili-verify-modal .modal-actions { justify-content: center; }
/* 双身份登录：手动选择进入哪个端 */
.role-choice-modal { width: 420px; text-align: center; }
.role-choice-modal .bv-sub { font-size: 14px; color: var(--text); line-height: 1.6; margin: 0 0 18px; }
.role-choice-btns { display: flex; flex-direction: column; gap: 12px; }
.role-choice-btns .btn-lg { padding: 14px 18px; font-size: 16px; font-weight: 600; }
.bili-verify-modal h3 { font-size: 18px; }
.bili-verify-modal .bv-sub { font-size: 14px; color: var(--text); line-height: 1.6; margin: 0 0 14px; }
.bili-cmd {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px;
}
.bili-cmd code {
  flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 18px; font-weight: 700; color: var(--primary); letter-spacing: 1px; word-break: break-all;
}
.bili-bot { font-size: 14px; margin-bottom: 14px; color: var(--text); }
.bili-bot a { color: #fb7299; font-weight: 600; text-decoration: none; }
.bili-bot a:hover { text-decoration: underline; }
.bv-uid { color: var(--muted); font-size: 13px; margin-left: 4px; }
.bili-jump { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 16px; }
.bili-jump-link { color: var(--primary); font-weight: 600; font-size: 14px; text-decoration: none; }
.bili-jump-link:hover { text-decoration: underline; }
.bili-jump-link.muted { color: var(--muted); font-weight: 400; }
.bili-qr { text-align: center; margin-bottom: 16px; }
.bili-qr-img { display: inline-flex; padding: 10px; background: #fff; border: 1px solid var(--border); border-radius: 10px; }
.bili-qr-img svg { display: block; width: 168px; height: 168px; }
.bili-qr .hint { margin: 8px 0 0; }
.bili-steps { margin: 0 0 16px; padding-left: 20px; color: var(--text); font-size: 14px; line-height: 1.9; }
.bili-status {
  font-size: 14px; font-weight: 600; padding: 10px 12px; border-radius: 8px; text-align: center;
  background: rgba(59,130,246,0.1); color: var(--primary);
}
.bili-status.ok { background: rgba(16,185,129,0.14); color: #059669; }
.bili-status.err { background: rgba(239,68,68,0.12); color: #dc2626; }
.bili-timer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 8px; }
.bili-footer { text-align: center; font-size: 12px; color: var(--muted); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.bili-footer a { color: var(--muted); text-decoration: underline; }
.addr-edit-btn { display: table; margin: 10px 0 0 auto; }
/* 手动代兑换：地址信息合并为一块可选区 */
.addr-block { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; background: rgba(127, 127, 127, 0.06); }
.addr-block-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
[data-theme="dark"] .addr-block { background: rgba(255, 255, 255, 0.03); }
.ma-btns { display: flex; gap: 10px; }
.cf-foot-hint { flex: 1; text-align: right; margin-right: 12px; font-size: 12px; color: var(--muted); }

/* ---------- 页面文件 / 管理员 ---------- */
.card-list { display: flex; flex-direction: column; gap: 8px; }
.card-row { display: flex; align-items: center; gap: 12px; background: var(--panel); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); }
.card-row .grow { flex: 1; }
.card-row .meta { color: var(--muted); font-size: 12px; }
.upload-box { border: 2px dashed var(--border); border-radius: 10px; padding: 18px; text-align: center; color: var(--muted); margin-bottom: 14px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #32363b; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 100; font-size: 13px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: #c0392b; }

.empty { color: var(--muted); padding: 30px; text-align: center; }

/* ---------- 加载状态（按钮内联 spinner / 全屏遮罩） ---------- */
.spinner {
  display: inline-block; width: 14px; height: 14px; margin-right: 6px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: ui-spin .6s linear infinite; vertical-align: -2px;
}
.spinner.lg { width: 26px; height: 26px; border-width: 3px; margin: 0; }
@keyframes ui-spin { to { transform: rotate(360deg); } }
.btn.btn-loading { opacity: .75; }
.view-overlay {
  position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .5); backdrop-filter: blur(1px);
}
[data-theme="dark"] .view-overlay { background: rgba(12, 14, 18, .5); }

/* ---------- 拖拽排序 ---------- */
.drag-col { width: 30px; text-align: center; color: var(--muted); cursor: grab; user-select: none; font-size: 15px;
  border-radius: 8px; transition: background .15s, color .15s, transform .15s; }
.drag-col:active { cursor: grabbing; }
.drag-col:hover { background: var(--bg); color: var(--primary); }
.data-row { transition: box-shadow .18s ease, background-color .18s ease, transform .18s cubic-bezier(.2,.8,.3,1); }
.data-row .drag-col { transition: background .15s, color .15s; }
.data-row.dragging { opacity: .5; z-index: 5; position: relative;
  box-shadow: 0 10px 26px rgba(0,0,0,.18); background: #fff; outline: 2px dashed var(--primary); outline-offset: -2px; }
.data-row.dragging .drag-col { background: var(--primary); color: #fff; }
/* 占位符：实时显示落点，随拖动移动 */
.drag-placeholder { height: 6px; margin: 3px 0; border: 2px dashed var(--primary); border-radius: 5px; background: #eaf2ff; }
tr.drag-placeholder td { height: 0 !important; padding: 0 !important; border: 2px dashed var(--primary); background: #eaf2ff; }

/* ---------- 卡片（非表格的对象区块） ---------- */
.data-cards { gap: 0; }
.data-card { display: flex; gap: 10px; align-items: stretch; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; margin-bottom: 8px; }
.data-card .card-body { flex: 1; min-width: 0; }
.kv-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 18px; }
.kv { font-size: 13px; overflow: hidden; }
.kv .k { color: var(--muted); margin-right: 6px; }
.kv .v { color: var(--text); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 10px; }

/* ---------- + 添加一行（数据列底部） ---------- */
.add-row-bottom { margin-top: 12px; }

/* ---------- 链接输入框（悬浮预览触发） ---------- */
.url-box { cursor: text; }
.preview-trigger { position: relative; }

/* ---------- 粘贴原始数据并解析 ---------- */
.raw-paste { border: 1px dashed var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.raw-paste summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; outline: none; }
.raw-paste textarea {
  width: 100%; min-height: 96px; margin-top: 8px; padding: 9px 11px;
  border: 1px solid var(--border); border-radius: 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical;
}
.raw-paste #parseRaw { margin-top: 8px; }

/* ---------- 过期标记三态按钮 ---------- */
.expired-radios { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.expired-radios .ex-radio {
  display: inline-flex; flex-direction: row; align-items: center; gap: 6px;
  font-size: 14px; color: var(--text); font-weight: 500;
  cursor: pointer; white-space: nowrap;
}
.expired-radios .ex-radio input[type="radio"],
.field .checkbox input[type="checkbox"] { flex-shrink: 0; margin: 0; }
.expired-num {
  width: 78px; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none;
}
.expired-num:focus { border-color: var(--primary); }
.expired-num:disabled { background: var(--bg); color: var(--muted); cursor: not-allowed; }

/* ---------- 从 B站链接导入 ---------- */
.bili-import { margin-bottom: 14px; padding: 12px 14px; border: 1px dashed #bcd6f0; border-radius: 10px; background: #f7fbff; }
.bili-import > b { display: block; margin-bottom: 2px; }
.bili-import .hint { margin-top: 8px; }

/* ---------- 状态徽章 ---------- */
.badge-warn { background: #fdf3e3; color: var(--warn); }
.badge-info { background: #e8f1fd; color: var(--info); }

/* ---------- 链接 ---------- */
.url-link { color: var(--primary-d); text-decoration: none; }
.url-link:hover { text-decoration: underline; }

/* ---------- 画廊悬浮预览气泡（最大 180x180） ---------- */
.img-preview {
  position: fixed; display: none; z-index: 200; background: #fff; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: var(--shadow); padding: 6px; max-width: 180px; pointer-events: none;
}
.img-preview img { max-width: 180px; max-height: 180px; display: block; border-radius: 4px; object-fit: contain; }
.img-preview .img-err { color: var(--muted); font-size: 12px; text-align: center; padding: 24px 8px; line-height: 1.5; }

/* ---------- 拖入页面文件区 ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 18px; text-align: center;
  color: var(--muted); margin-top: 16px; transition: all .15s;
}
.dropzone.drag-over { border-color: var(--primary); color: var(--primary-d); background: #eaf2ff; }
.dropzone .hint { font-size: 12px; }

/* ---------- 操作日志 ---------- */
.log-wrap { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); overflow-x: auto; margin-top: 4px; }
.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table thead th { text-align: left; padding: 10px 12px; background: var(--bg); color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.log-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.log-table tbody tr:last-child td { border-bottom: none; }
.log-table tbody tr:hover { background: #eef5ff; }
.log-time { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.log-ip { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.log-detail { color: var(--text); word-break: break-all; }

/* ---------- 基础卡片 ---------- */
.card { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 18px 20px; }
.card h3 { margin: 0 0 14px; font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.card-head .btn { white-space: nowrap; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.muted { color: var(--muted); font-size: 12px; }
.chk { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; cursor: pointer; }
.settings-grid code { background: var(--bg); padding: 1px 6px; border-radius: 5px; font-size: 12px; word-break: break-all; }

/* ---------- 数据表格（用户 / 日志） ---------- */
.table-wrap { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th { text-align: left; padding: 11px 14px; background: var(--bg); color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #eef5ff; }

/* ---------- 字段输入兜底（含 password 等） ---------- */
.field input, .field select, .field textarea { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }

/* ---------- 登录页：密码卡 ---------- */
.pw-card { margin: 18px 0; border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: #fafcff; }
.pw-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.pw-tab { flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 600; color: var(--muted); }
.pw-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.pw-form { display: flex; flex-direction: column; gap: 10px; }
.pw-form input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; }
.pw-form input:focus { border-color: var(--primary); }
.captcha-row { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 100%; }
.captcha-row input {
  flex: 1 1 auto !important; min-width: 0 !important;
  box-sizing: border-box; text-align: center;
  text-transform: uppercase; letter-spacing: 1px;
  /* 下沉登录页验证码输入框基础样式，使其脱离 .pw-form 也能与登录页一致 */
  padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; outline: none;
}
.captcha-row input:focus { border-color: var(--primary); }
.captcha-img { height: 38px; width: 104px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; background: #fff; flex: 0 0 auto; display: block; }
.captcha-img:hover { border-color: var(--primary); }
.email-code-row { display: flex; align-items: center; gap: 8px; max-width: 100%; }
.email-code-row input {
  flex: 0 0 150px !important; width: 150px !important; max-width: 150px !important;
  box-sizing: border-box; text-align: center; letter-spacing: 2px;
}
.email-hint { font-size: 12px; color: var(--muted); margin: -4px 0 0; }
/* 邮箱后缀非法：输入框红框 + 提示标红 */
.pw-form input.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(245, 108, 108, 0.16); }
.hint.err { color: var(--danger) !important; }
.email-bind-form { display: flex; flex-direction: column; gap: 10px; max-width: 340px; }
.email-bind-form input { padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; outline: none; font-family: inherit; width: 100%; box-sizing: border-box; }
.email-bind-form input:focus { border-color: var(--primary); }
.email-bind-form .captcha-row, .email-bind-form .email-code-row { width: 100%; max-width: 100%; }
.btn-link { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 13px; padding: 4px 6px; }
.btn-link:hover { text-decoration: underline; }
.btn-link:disabled { color: var(--muted); cursor: not-allowed; text-decoration: none; }

/* ---------- 角色徽章 ---------- */
.role-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; margin-left: 8px; vertical-align: middle; }
.role-badge.admin { background: #eaf3ff; color: #1f6fd6; }
.role-badge.user { background: #eaf2ff; color: var(--primary-d); }

/* ---------- 我的记录 ---------- */
.my-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.my-meta-row { line-height: 1.7; }
.my-meta b { color: var(--text); }
.rec-body { background: var(--panel); border-radius: 12px; box-shadow: var(--shadow); padding: 8px 0; min-height: 120px; }
.rec-list { list-style: none; margin: 0; padding: 6px 0; }
.rec-list li { padding: 9px 18px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: baseline; }
.rec-list li:last-child { border-bottom: none; }
.rec-time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
/* 我的记录：块状记录项（第一行 时间+记录 / 第二行 UID块 / 第三行 过期标记+原因 超边界滚动） */
.rec-list li.rec-item { display: block; }
.rec-item .rec-line1 { display: flex; gap: 10px; align-items: baseline; }
.rec-item .rec-text { flex: 1; }
.rec-item .rec-uid-block { margin-top: 5px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.rec-item .rec-exp-block { margin-top: 5px; display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; }
.rec-item .rec-exp-badge { flex-shrink: 0; display: inline-block; background: #c0392b; color: #fff; border-radius: 3px; padding: 0 5px; font-size: 12px; }
.rec-item .rec-exp-track { flex: 1; min-width: 0; overflow: hidden; }
.rec-item .rec-exp-marquee { display: inline-flex; white-space: nowrap; will-change: transform; }
.rec-item .rec-exp-reason { flex: 0 0 auto; color: #c0392b; font-size: 12px; padding-right: 16px; }
/* 未超宽时只显示一份内容（第二份 aria-hidden 副本隐藏） */
.rec-item .rec-exp-marquee .rec-exp-reason:last-child { display: none; }
/* 内容超宽时启用无缝循环滚动：双份内容整体左移 50%（即一份宽度）后复位，形成无限循环 */
.rec-item .rec-exp-marquee.marquee .rec-exp-reason:last-child { display: inline-block; }
.rec-item .rec-exp-marquee.marquee { animation: rec-exp-marquee 12s linear infinite; }
@keyframes rec-exp-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
.empty-page { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty-page h3 { margin: 0 0 8px; color: var(--text); }
.empty-page p { margin: 0; font-size: 13px; line-height: 1.6; }

/* ---------- 个人资料 ---------- */
.profile-card { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 10px; }
.profile-avatar { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); }
.profile-avatar.placeholder { display: flex; align-items: center; justify-content: center; background: var(--bg); color: var(--muted); font-size: 13px; }
.profile-info { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 10px; }
.profile-info .lbl { display: inline-block; min-width: 72px; color: var(--muted); font-size: 13px; font-weight: 600; }
.profile-info input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 9px; font-family: inherit; font-size: 13px; outline: none; }
.profile-info input:focus { border-color: var(--primary); }
.profile-info > div { display: flex; align-items: center; gap: 8px; }
/* 个人资料编辑区：电脑端 头像 + 输入框垂直组（带标签）+ 保存按钮（紧挨输入框、居左、垂直居中） */
.profile-info .pf-edit-row { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.profile-info .pf-edit-row .pf-fields { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.profile-info .pf-edit-row .pf-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.profile-info .pf-edit-row .pf-fields input { max-width: 300px; min-width: 0; }
.profile-info .pf-edit-row #pfSave { flex-shrink: 0; white-space: nowrap; }
/* 手机端：头像 + 输入框垂直组 + 保存按钮 同行显示（修复窄屏换行），隐藏标签、输入框撑满
   双保险：body.is-mobile（JS 按 UA/宽度注入，不依赖 CSS 视口宽） + @media 兜底 */
body.is-mobile .profile-card { position: relative; flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
/* 手机端头像绝对定位悬浮在卡片左上角：不占用文档流占位，避免把 profile-info 整列右移 */
body.is-mobile .profile-avatar { position: absolute; top: 10px; left: 0; width: 56px; height: 56px; flex-shrink: 0; background: var(--bg); }
body.is-mobile .profile-info { width: 100%; min-width: 0; }
/* 仅编辑行左侧预留头像空间（56px 头像 + 10px 间距），下方账号ID等行不再右移 */
body.is-mobile .profile-info .pf-edit-row { flex: 1; min-width: 0; padding-left: 66px; }
body.is-mobile .profile-info .pf-edit-row .pf-fields { flex: 1; min-width: 0; }
body.is-mobile .profile-info .pf-edit-row .pf-row .lbl { display: none; }
body.is-mobile .profile-info .pf-edit-row .pf-fields input { width: 100%; max-width: none; }
@media (max-width: 860px) {
  .profile-card { position: relative; flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
  .profile-avatar { position: absolute; top: 10px; left: 0; width: 56px; height: 56px; flex-shrink: 0; background: var(--bg); }
  .profile-info { width: 100%; min-width: 0; }
  .profile-info .pf-edit-row { flex: 1; min-width: 0; padding-left: 66px; }
  .profile-info .pf-edit-row .pf-fields { flex: 1; min-width: 0; }
  .profile-info .pf-edit-row .pf-row .lbl { display: none; }
  .profile-info .pf-edit-row .pf-fields input { width: 100%; max-width: none; }
}
.profile-info b { font-weight: 600; }

/* 个人资料：上船用户「集合」卡片（悬浮二维码，风格参照 dexiao 联系卡） */
.ship-collection-lbl { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 12px; }
.ship-collection-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.qr-card {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; background: var(--panel);
  flex: 1 1 200px; min-width: 180px; max-width: 260px;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.qr-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.qr-card-icon { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: #fff; overflow: hidden; }
.qr-card-icon svg { width: 24px; height: 24px; display: block; }
.qr-card-body { flex: 1 1 auto; min-width: 0; }
.qr-card-name { font-size: 14px; font-weight: 600; color: var(--text); }
.qr-card-id { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-all; }
.qr {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  border: none; background: transparent; color: var(--muted);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  -webkit-appearance: none; appearance: none;
  transition: color .18s ease, background .18s ease;
}
.qr:hover { color: var(--primary); background: rgba(37, 99, 235, 0.08); }
.qr svg { width: 18px; height: 18px; display: block; }
.qr-pop {
  position: absolute; right: 8px; bottom: calc(100% - 2px);
  width: 150px; padding: 12px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); text-align: center; z-index: 30;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
  pointer-events: none;
}
.qr-pop svg { width: 126px; height: 126px; display: block; margin: 0 auto; background: #fff; }
.qr-pop .qr-cap { margin-top: 8px; font-size: 11px; color: var(--muted); word-break: break-all; line-height: 1.4; }
.qr-pop::after {
  content: ""; position: absolute; top: 100%; right: 22px;
  border: 7px solid transparent; border-top-color: var(--panel);
  filter: drop-shadow(0 1px 0 var(--border));
}
.qr-card.show-qr .qr-pop { opacity: 1; visibility: visible; transform: translateY(0); }
/* 仅桌面端（可悬停设备）保留 hover / 键盘聚焦预览；移动端改用点击切换 */
@media (hover: hover) and (min-width: 641px) {
  .qr:hover + .qr-pop,
  .qr:focus-visible + .qr-pop { opacity: 1; visibility: visible; transform: translateY(0); }
}

/* ---------- 开关（密码登录） ---------- */
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text); cursor: pointer; font-weight: 500; }

/* ---------- 小复选（权限） ---------- */
.mini-chk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; cursor: pointer; margin-right: 10px; }
.mini-chk input { width: 15px; height: 15px; accent-color: var(--primary); }

/* ---------- 日志 UID 输入 ---------- */
.uid-input { width: 170px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; font-family: inherit; outline: none; }
.uid-input:focus { border-color: var(--primary); }

/* ---------- 绑定下拉 ---------- */
/* 日志分析：绑定用户的「搜索 + 下拉」组合框（参照 log-analyzer 的 dd 组件） */
.dd { position: relative; display: inline-block; vertical-align: middle; }
.dd .dd-trigger {
  height: 32px;
  min-width: 160px;
  width: 200px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 28px 0 10px;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  position: relative;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.dd .dd-trigger::after {
  content: "";
  position: absolute;
  right: 11px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.dd .dd-trigger:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,123,219,.18); outline: none; }
.dd .dd-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  max-height: 240px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16,24,40,.18);
  margin: 0;
  padding: 4px;
  list-style: none;
  min-width: 200px;
}
.dd .dd-list li { padding: 6px 12px; border-radius: 6px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.dd .dd-list li:hover { background: var(--hover, rgba(0,0,0,.05)); }
.dd .dd-list li[aria-selected="true"] { background: var(--primary); color: #fff; }
.dd .dd-list li:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
[data-theme="dark"] .dd .dd-trigger { background: #1e2127; }
[data-theme="dark"] .dd .dd-list { background: #1e2127; }
[data-theme="dark"] .dd .dd-list li:hover { background: rgba(91,155,255,.14); }

/* ---------- 日志分析：用户名 + 记录编辑 ---------- */
.log-uname { color: var(--muted); font-size: 12px; margin-left: 4px; }
/* 上船记录按舰级拆分显示（列表列 + 详情标签页共用） */
.ship-breakdown { font-size: 12px; white-space: nowrap; }
.ship-lvl { display: inline-block; padding: 1px 6px; border-radius: 6px; margin: 0 2px; font-weight: 600; white-space: nowrap; }
.ship-lvl .ship-num { font-size: 16px; margin-left: 3px; font-weight: 700; vertical-align: -1px; }
.ship-zero { color: var(--text-dim); }
.ship-lvl.lvl-舰长 { background: rgba(52,152,219,.16); color: #2e86c1; }
.ship-lvl.lvl-提督 { background: rgba(155,89,182,.16); color: #8e44ad; }
.ship-lvl.lvl-总督 { background: rgba(241,196,15,.22); color: #b9770e; }
[data-theme="dark"] .ship-lvl.lvl-舰长 { color: #5dade2; }
[data-theme="dark"] .ship-lvl.lvl-提督 { color: #bb8fce; }
[data-theme="dark"] .ship-lvl.lvl-总督 { color: #f5c542; }
.rec-cat { margin: 16px 0 8px; font-size: 14px; }
.rec-edit-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.rec-fields { display: flex; flex-wrap: wrap; gap: 10px; flex: 1; }
.rec-field { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 3px; font-size: 12px; margin: 0; }
.rec-field input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; font-family: inherit; outline: none; width: 150px; }
.rec-field input:focus { border-color: var(--primary); }
.rec-acts { display: flex; gap: 6px; flex-shrink: 0; }

/* 管理员手动添加上船记录的标记与备注 */
.badge-manual {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.7;
  background: rgba(178, 106, 0, 0.12);
  color: #b26a00;
  border: 1px solid rgba(178, 106, 0, 0.35);
  vertical-align: middle;
}
.rec-note { margin-top: 3px; font-size: 12px; color: var(--muted); }
.rec-manual-tag { width: 100%; margin-top: 4px; font-size: 11px; color: #b26a00; }

/* ---------- 页眉图标按钮（菜单 / 铃铛） ---------- */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0; margin: 0;
  border: none; background: transparent; color: var(--text);
  border-radius: 9px; cursor: pointer; position: relative;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: rgba(127,127,127,.14); color: var(--primary); }
.icon-btn svg { width: 20px; height: 20px; display: block; }

/* ---------- 页眉铃铛 + 站内信红点 ---------- */
.bell-btn { color: var(--text); }
.bell-btn:hover { color: var(--primary); }
.bell-btn svg { width: 19px; height: 19px; }
.bell-dot {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  box-sizing: border-box;
  border-radius: 9px;
  background: #e5484d; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 14px; text-align: center;
  border: 2px solid var(--panel, #fff);
  pointer-events: none;
}
[data-theme="dark"] .bell-dot { border-color: #1b1e24; }

/* ---------- 站内信管理列表 ---------- */
.msg-admin-list { margin-top: 4px; overflow-x: auto; }
.msg-admin-list .data-table { width: 100%; }
.msg-admin-list .mg-title { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-admin-list .mg-time { white-space: nowrap; color: var(--muted); }
button.dd-trigger { cursor: pointer; text-align: left; font-family: inherit; }
/* 抑制与 .dd-trigger 箭头重复的 .dd::after 小三角，避免双箭头 */
.dd.dd-sel::after { display: none; }

/* ---------- 站内信列表 ---------- */
.msg-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.msg-item {
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--panel); padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.msg-item:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-1px); }
.msg-item.unread { border-left: 3px solid var(--primary); background: rgba(91,123,219,.07); }
.msg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.msg-title { font-size: 15px; font-weight: 600; color: var(--text); }
.msg-time { font-size: 12px; color: var(--muted); white-space: nowrap; }
.msg-body { margin-top: 8px; font-size: 14px; color: var(--text); white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.msg-from { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* 站内信 Markdown 正文渲染样式 */
.msg-body.md { white-space: normal; }
.md-h { margin: 10px 0 5px; line-height: 1.35; }
.md-h1 { font-size: 1.35em; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.md-h2 { font-size: 1.15em; }
.md-h3 { font-size: 1.06em; }
.md-h4, .md-h5, .md-h6 { font-size: 1em; color: var(--muted); }
.msg-body.md > .md-h:first-child, .md-preview > .md-h:first-child { margin-top: 0; }
.md-p { margin: 6px 0; }
.md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(127,127,127,.14); border-radius: 3px; padding: 1px 5px; font-size: .88em; color: #c2255c;
}
.md-pre {
  background: rgba(127,127,127,.08); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 14px; overflow: auto; margin: 10px 0;
}
.md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .84em; }
.md-quote {
  margin: 8px 0; padding: 7px 14px; border-left: 3px solid var(--primary);
  color: var(--muted); background: rgba(91,123,219,.04);
}
.md-list { margin: 6px 0; padding-left: 22px; }
.md-list li { margin: 2px 0; }
.md-hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.md-link { color: var(--primary); text-decoration: underline; }
.md-del { color: var(--muted); text-decoration: line-through; }
.md-img { max-width: 100%; height: auto; border-radius: 6px; margin: 10px 0; display: block; }
.md-table-wrap { overflow-x: auto; margin: 10px 0; }
.md-table { border-collapse: collapse; width: 100%; font-size: .9em; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md-table th { background: rgba(127,127,127,.06); font-weight: 600; }

/* Markdown 工具栏（位于输入框上方） */
.md-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.md-btn {
  font: inherit; font-size: 12px; line-height: 1; cursor: pointer;
  padding: 6px 9px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.md-btn:hover { border-color: var(--primary); color: var(--primary); }
.md-btn:active { transform: translateY(1px); }
.md-btn-toggle.active { border-color: var(--primary); color: var(--primary); background: rgba(91,123,219,.10); }
.md-preview {
  display: none; min-height: 84px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--panel);
  font-size: 13px; line-height: 1.6; word-break: break-word; overflow: auto;
}
.md-preview.open { display: block; }
.md-preview .muted { color: var(--muted); }
.msg-item.unread .msg-title::before {
  content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); margin-right: 8px; vertical-align: 1px;
}
[data-theme="dark"] .msg-item.unread { background: rgba(91,155,255,.10); }
.manual-add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 8px;
  padding: 12px;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
}
.manual-add-form .full { flex-basis: 100%; }
.manual-add-form .rec-field input,
.manual-add-form .rec-field select { width: 160px; }

/* ---------- 管理日志弹窗：类别切换（分段滑扭）+ 分页 ---------- */
.lm-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.lm-cats { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; }
.lm-cat {
  border: 0; background: transparent; color: var(--text);
  font-size: 13px; font-weight: 500; line-height: 1;
  padding: 7px 12px; border-radius: 7px; cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.lm-cat:hover { background: var(--hover, rgba(120,120,140,.10)); }
.lm-cat.active {
  background: var(--primary, #4f7cff); color: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.lm-pagesize { font-size: 13px; color: var(--muted); white-space: nowrap; }
.lm-pagesize select { margin-left: 4px; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); }
.lm-rows { max-height: 52vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; }
.lm-pager { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.lm-pager .btn:disabled { opacity: .45; cursor: not-allowed; }
.lm-info { margin-left: auto; font-size: 12px; color: var(--muted); }
.lm-cat:empty { display: none; }

/* ---------- 个人资料：第三方绑定 ---------- */
.bind-box { display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.bind-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.bind-row .btn { white-space: nowrap; }
/* 第三方绑定：哔哩哔哩 / QQ 各自独立卡片 */
.bind-cards { display: flex; flex-direction: column; gap: 12px; }
.bind-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--panel); }
.bind-card-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }

/* 哔哩哔哩区块：左侧 OAuth 绑定，右侧关联日志UID（用户自助验证绑定更多 B站UID） */
.bili-block { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.bili-block > .bili-main { flex: 0 0 auto; min-width: 220px; padding-top: 2px; text-align: left; }
.bili-main .bind-row { justify-content: flex-start; }
.qq-bind .bind-row { justify-content: flex-start; gap: 15px; }
.email-bound-row { display: flex; align-items: center; gap: 15px; flex-wrap: wrap; }
.loguids-box { flex: 1 1 280px; border-left: 1px solid var(--border); padding-left: 16px; }
@media (max-width: 560px) {
  .loguids-box { border-left: none; padding-left: 0; }
}
.loguids-head { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); margin-bottom: 8px; }
.loguid-list { display: flex; flex-wrap: wrap; gap: 8px; }
.loguid-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-soft, #f5f5f7); border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px 3px 10px; font-size: 12px; }
.btn-xs { padding: 1px 7px; font-size: 12px; line-height: 1.6; border-radius: 999px; }
.btn-xs.btn-danger { background: transparent; color: var(--danger, #e23b3b); border-color: transparent; }
.btn-xs.btn-danger:hover { background: var(--danger, #e23b3b); color: #fff; }

/* ---------- 通用搜索 + 分页工具栏 ---------- */
.lv-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: var(--panel, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  position: sticky;
  top: 0;
  z-index: 6;
}
.lv-search {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--bg, #fff);
  color: inherit;
}
.lv-search:focus { border-color: var(--primary); }
.lv-pagesize { font-size: 13px; color: var(--muted); white-space: nowrap; }
/* 我的记录：来源 UID 筛选下拉框（搜索框右侧） */
.lv-uidfilter { height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg, #fff); color: inherit; font-size: 13px; font-family: inherit; outline: none; }
.lv-uidfilter:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91,123,219,.18); }
[data-theme="dark"] .lv-uidfilter { background: #1e2127; }
/* 记录中的来源 UID 标记，如 （得翛 UID：479297261） */
.rec-uid { color: var(--muted); font-size: 12px; margin-left: 2px; white-space: nowrap; }
.lv-size {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: var(--bg, #fff);
  color: inherit;
}
.lv-size:focus { border-color: var(--primary); }
.lv-info { font-size: 12px; color: var(--muted); white-space: nowrap; }
.lv-pager { display: inline-flex; gap: 6px; margin-left: auto; }
.lv-pager .btn { white-space: nowrap; }
.lv-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--panel, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.lv-info2 { font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ============================================================
   暗黑模式（在 <html data-theme="dark"> 时生效）
   仅覆盖颜色变量与少量硬编码的浅色背景，结构保持不变。
   ============================================================ */
[data-theme="dark"] {
  --bg: #15171c;
  --panel: #1e2127;
  --border: #2c313a;
  --text: #e6e8ec;
  --muted: #9aa3af;
  --primary: #5b9bff;
  --primary-d: #8ab4ff;
  --ok: #3fbf87;
  --warn: #e6a23c;
  --danger: #f56c6c;
  --info: #4ea0f5;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --hover: rgba(255, 255, 255, 0.08);
  --bg-soft: #262a32;
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.45);
  --text-dim: #79808c;
}

/* 登录页渐变在暗色下压暗，避免刺眼 */
[data-theme="dark"] .login-wrap {
  background: linear-gradient(135deg, #16243c 0%, #18202e 100%);
}
[data-theme="dark"] .btn-danger { border-color: rgba(245, 108, 108, 0.5); }
[data-theme="dark"] .btn-danger:hover { background: rgba(245, 108, 108, 0.16); border-color: var(--danger); color: var(--danger); }

/* 侧边栏导航 hover / 选中态 */
[data-theme="dark"] .nav-item:hover { background: #262a32; }
[data-theme="dark"] .nav-item.active { background: #16243c; color: var(--primary-d); }

/* 表格表头 / 列表工具栏底色（原硬编码 #fafbfc / var(--bg)） */
[data-theme="dark"] .table th { background: #23272f; }
[data-theme="dark"] .log-table thead th,
[data-theme="dark"] .data-table thead th { background: #23272f; }

/* 行 hover 高亮（原 #fff7fb 浅粉） */
[data-theme="dark"] .log-table tbody tr:hover,
[data-theme="dark"] .data-table tbody tr:hover { background: #24262d; }

/* 状态 / 角色徽章（原浅色底，暗色下用半透明描边更协调） */
[data-theme="dark"] .badge-hidden { background: rgba(245, 108, 108, 0.16); color: #ff9b9b; }
[data-theme="dark"] .badge-visible { background: rgba(63, 191, 135, 0.16); color: #6fe0ad; }
[data-theme="dark"] .badge-downloaded { background: rgba(47, 116, 208, 0.18); color: #79b0ef; }
[data-theme="dark"] .badge-stock { background: rgba(120, 140, 170, 0.18); color: #aab8cc; }
[data-theme="dark"] .badge-stock-zero { background: rgba(245, 108, 108, 0.16); color: #ff9b9b; }
[data-theme="dark"] .badge-stock-unlimited { background: rgba(111, 79, 216, 0.18); color: #b79bf0; }
[data-theme="dark"] .badge-limit { background: rgba(217, 130, 43, 0.18); color: #f0b56a; }
[data-theme="dark"] .badge-deleted { background: rgba(111, 79, 216, 0.2); color: #b79bf0; }
[data-theme="dark"] .badge-persist { background: rgba(27, 158, 126, 0.2); color: #6fe0c0; }
[data-theme="dark"] .badge-cond { background: rgba(79, 95, 216, 0.22); color: #9aa6f0; }
[data-theme="dark"] .badge-mail { background: rgba(217, 130, 43, 0.2); color: #f0b56a; }
[data-theme="dark"] .gift-limit { background: rgba(217, 130, 43, 0.18); color: #f0b56a; }
[data-theme="dark"] .gift-limit.no { background: rgba(192, 57, 43, 0.2); color: #ef8a7d; }
[data-theme="dark"] .badge-warn { background: rgba(230, 162, 60, 0.16); color: #f0bd6c; }
[data-theme="dark"] .badge-info { background: rgba(78, 160, 245, 0.16); color: #7fbcf8; }
[data-theme="dark"] .role-badge.admin { background: rgba(78, 160, 245, 0.16); color: #7fbcf8; }
[data-theme="dark"] .role-badge.user { background: rgba(91, 155, 255, 0.16); color: var(--primary-d); }

/* B站导入提示框 */
[data-theme="dark"] .bili-import { background: #1a2533; border-color: #2d4a66; }

/* 拖拽占位 / 拖动中卡片（原 #fff0f6 / #fff） */
[data-theme="dark"] .drag-placeholder { background: #1a2533; }
[data-theme="dark"] tr.drag-placeholder td { background: #1a2533; }
[data-theme="dark"] .data-row.dragging { background: #23262e; }
[data-theme="dark"] .data-row.dragging .drag-col { background: var(--primary); color: #fff; }

/* 拖入文件区高亮（原 #fff5f9 浅粉） */
[data-theme="dark"] .dropzone.drag-over { background: #1a2533; }

/* 图片悬浮预览气泡（原 #fff） */
[data-theme="dark"] .img-preview { background: #23272f; }

/* 密码卡 / 密码 tab 底色 */
[data-theme="dark"] .pw-card { background: #1c2026; }
[data-theme="dark"] .pw-tab { background: #23272f; color: var(--muted); }
[data-theme="dark"] .pw-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* 表单控件：浏览器默认白底，暗色下显式改为深色底 + 浅色字 */
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: #15171c;
  color: var(--text);
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder { color: var(--muted); }
/* 开发者登录按钮原为 text 色底 + 白字，暗色下改为中性深底 */
[data-theme="dark"] .btn-dev { background: #2f343c; color: var(--text); }
[data-theme="dark"] .btn-dev:hover { background: #3a4049; }

/* 链接输入框悬浮预览触发区兜底 */
[data-theme="dark"] .url-box { background: transparent; }

/* 主题切换按钮（固定右下角，浮于所有视图之上） */
.theme-toggle {
  position: fixed; right: 14px; bottom: 14px; z-index: 200;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-size: 16px; line-height: 1; box-shadow: var(--shadow); cursor: pointer;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary-d); }

/* 登录副标题第二行 */
.sub2 { color: var(--muted); font-size: 13px; margin: 4px 0 0; line-height: 1.5; }

/* 礼物卡片网格（礼物上架 / 舰礼兑换共用） */
.gift-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.gift-card { position: relative; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.gift-card.is-hidden { opacity: .6; }
.gift-card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary), var(--shadow); }
/* 礼物上架：卡片右下角拖拽把手（按住拖动排序，与其他数据逻辑一致） */
.drag-grip {
  position: absolute; right: 6px; bottom: 6px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: var(--bg); color: var(--muted);
  border: 1px solid var(--border); cursor: grab; user-select: none; font-size: 14px; line-height: 1;
  opacity: .7; transition: opacity .15s, color .15s, background .15s, border-color .15s;
}
.drag-grip:hover { opacity: 1; color: var(--primary); border-color: var(--primary); }
.drag-grip:active { cursor: grabbing; }
.gift-card.dragging .drag-grip { background: var(--primary); color: #fff; border-color: var(--primary); }
[data-theme="dark"] .drag-grip { background: #23262e; }
.gift-img { height: 130px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; }
.gift-img img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.gift-img-ph { color: var(--muted); font-size: 13px; }
/* 桌面（有 hover 的设备）保留 zoom-in 放大镜光标；触屏用 pointer 以触发 iOS 的 click 事件 */
@media (hover: hover) { .gift-img, .gift-img img { cursor: zoom-in; } }

/* 礼物图片 Lightbox（参考 index/gallery 效果，省略下载按钮） */
.lightbox { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.86); z-index: 1200; opacity: 0; pointer-events: none; transition: opacity .18s ease; }
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox .lightbox-inner { display: flex; flex-direction: column; align-items: center; gap: 25px; max-width: 90vw; max-height: 90vh; }
.lightbox img { max-width: 100%; max-height: calc(90vh - 65px); border-radius: 8px; cursor: grab; -webkit-user-drag: none; user-select: none; touch-action: none; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }
.lightbox.grabbing, .lightbox.grabbing img { cursor: grabbing; }
.lightbox.grabbing { user-select: none; }
.lightbox .lightbox-close { position: absolute; top: 20px; right: 20px; background: transparent; border: none; color: #fff; font-size: 30px; line-height: 1; cursor: pointer; padding: 12px; margin: -10px; z-index: 1300; transition: color .15s ease, transform .15s ease; }
.lightbox .lightbox-close:hover { color: var(--primary); transform: scale(1.12); }
.lightbox .lightbox-nav { position: absolute; top: 20%; bottom: 20%; width: 20%; display: flex; align-items: center; justify-content: center; background: transparent; border: none; color: #fff; opacity: 0; font-size: 40px; font-weight: 700; cursor: pointer; transition: opacity .18s ease; }
.lightbox .lightbox-nav.lightbox-prev { left: 0; }
.lightbox .lightbox-nav.lightbox-next { right: 0; }
.lightbox .lightbox-nav:hover { opacity: 1; }
.lightbox.single .lightbox-nav { display: none; }
@media (max-width: 900px) { .lightbox .lightbox-nav { opacity: 1; top: 20%; bottom: 20%; } }
@media (prefers-reduced-motion: reduce) { .lightbox, .lightbox img, .gift-img img, .lightbox .lightbox-close { transition: none; } }
.gift-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.gift-foot { margin-top: auto; }
.gift-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gift-name-group { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.gift-name { font-weight: 600; font-size: 15px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gift-desc { font-size: 13px; color: var(--muted); min-height: 18px; }
.gift-meta { font-size: 12px; }
.gift-avail { font-size: 13px; color: var(--text); }
.gift-avail.no { color: #c0392b; font-weight: 600; }
.gift-stock { font-size: 13px; color: var(--text); margin-top: 2px; }
.gift-stock.no { color: #c0392b; font-weight: 600; }
.gift-limit { font-size: 12px; color: #d9822b; background: #fff3e0; border-radius: 6px; padding: 2px 8px; display: inline-block; margin-top: 2px; }
.gift-limit.no { color: #c0392b; background: #fdecea; }
.gift-ex { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.gift-select { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 13px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); user-select: none; }
.gift-select input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.multi-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 12px 16px; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); position: sticky; bottom: 12px; }
.multi-count { font-size: 13px; color: var(--muted); }
.qty-stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.qty-stepper .qty-btn { width: 30px; height: 32px; border: none; background: var(--bg); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; }
.qty-stepper .qty-btn:hover:not(:disabled) { background: var(--primary); color: #fff; }
.qty-stepper .qty-btn:disabled { opacity: .45; cursor: not-allowed; }
.qty-stepper .qty-input { width: 52px; text-align: center; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border); border-radius: 0; background: var(--bg); color: var(--text); -moz-appearance: textfield; }
.qty-stepper .qty-input::-webkit-outer-spin-button, .qty-stepper .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper .qty-input:focus { outline: none; }
/* 舰礼兑换：多选模式通过 .exch-multimode 类切换显示，默认隐藏选择框 / 兑换按钮 / 底部条，避免整页重渲染闪烁 */
.gift-ex .gift-select { display: none; }
.exch-multimode .gift-ex .gift-select { display: inline-flex; }
.exch-multimode .gift-ex [data-redeem] { display: none; }
.multi-bar { display: none; }
.exch-multimode .multi-bar { display: flex; }

.gift-actions { display: flex; gap: 8px; margin-top: 4px; }

/* 总览导航卡片（C2 纯导航入口，不含统计数据） */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 16px; }
.dash-card { text-align: left; padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.dash-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,.06); transform: translateY(-1px); }
.dash-card-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.dash-card-desc { font-size: 12px; color: var(--muted); line-height: 1.5; }
.dash-card-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.dash-card-row .dash-card-title { margin-bottom: 0; }
.dash-card-badge { font-size: 12px; font-weight: 600; color: #2f6fd0; background: rgba(47,111,208,.10); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
[data-theme="dark"] .dash-card { background: #1d2128; border-color: #2a2f38; }
[data-theme="dark"] .dash-card-badge { color: #9fc0ff; background: rgba(127,176,255,.15); }
[data-theme="dark"] .dash-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(0,0,0,.3); }

/* 日志分析卡片：标题不可压缩（保持单行）；徽标去掉 nowrap，允许在日期/时间的空格处换行 */
.dash-card[data-type="logs"] .dash-card-title { white-space: nowrap; flex-shrink: 0; }
/* 日志分析徽标：两行各自独立小药丸，每行紧贴自身文字，整体右对齐 */
.dash-card[data-type="logs"] .dash-card-badge { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; white-space: normal; text-align: right; background: transparent; padding: 0; border-radius: 0; }
.dash-card[data-type="logs"] .badge-pill { display: inline-block; font-size: 12px; font-weight: 600; color: #2f6fd0; background: rgba(47,111,208,.10); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
[data-theme="dark"] .dash-card[data-type="logs"] .badge-pill { color: #9fc0ff; background: rgba(127,176,255,.15); }

/* 总览：移动端每行两列（每列约 260px，居中），更窄放不下时退化为单列 */
@media (max-width: 860px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 260px)); justify-content: center; gap: 12px; }
}
@media (max-width: 560px) {
  .dash-grid { grid-template-columns: minmax(0, 260px); }
}

/* 扣费级别徽章 */
.lvl-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.lvl-舰长 { background: rgba(52,152,219,.16); color: #2e86c1; }
.lvl-提督 { background: rgba(155,89,182,.16); color: #8e44ad; }
.lvl-总督 { background: rgba(241,196,15,.22); color: #b9770e; }
[data-theme="dark"] .lvl-舰长 { color: #5dade2; }
[data-theme="dark"] .lvl-提督 { color: #bb8fce; }
[data-theme="dark"] .lvl-总督 { color: #f5c542; }

/* 虚拟礼物标记 */
.type-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.type-virtual { background: rgba(243, 156, 18, .16); color: #c97a09; }
[data-theme="dark"] .type-virtual { color: #f0b860; }
/* 兑换页虚拟礼物提示条 */
.gift-virtual-tip { margin-top: 8px; font-size: 12px; color: #c97a09; background: rgba(243, 156, 18, .1); padding: 6px 10px; border-radius: 6px; }
[data-theme="dark"] .gift-virtual-tip { color: #f0b860; }

/* 上船可用统计 */
.ship-summary { margin-top: 12px; font-size: 14px; color: var(--text); }
.ship-summary b { margin: 0 2px; }

/* 收货地址卡片 */
.addr-card { max-width: 640px; margin-top: 14px; }
.addr-card h3 { margin: 0 0 12px; }
.addr-cell { font-size: 12px; color: var(--muted); max-width: 280px; }
.order-no { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; color: var(--muted); white-space: nowrap; }
.order-user { font-family: var(--font-family-primary); font-size: 13px; color: var(--text); margin-top: 4px; white-space: nowrap; }

/* 用户端多选：剩余船数「（已选 N）」提示 */
.ship-summary .ship-selected { color: var(--primary); font-weight: 600; margin-left: 2px; }
/* 发送方式：多个虚拟子项下载链接并排 + 混合订单实体发货标记 */
.vs-dl-list { display: flex; flex-wrap: wrap; gap: 6px; }
.phys-ship { font-size: 12px; color: var(--muted); }
/* 管理员订单多选批量操作条 */
.ro-batch-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); position: sticky; bottom: 12px; }
.ro-batch-count { font-weight: 600; margin-right: auto; }
.col-sel { width: 34px; text-align: center; }
.col-sel input { width: 16px; height: 16px; cursor: pointer; }

/* ===== 截止时间选择器（对齐 unix-timestamp-converter.html：原生日期 + 下拉微调器） ===== */
.tp {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
  max-width: 100%;
}
.tp-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}
.tp-row .tp { flex: 0 1 auto; }
.tp-row #gfDeadlineClear { flex: none; white-space: nowrap; }
.tp-dt {
  height: 36px;
  min-width: 220px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.tp-dt:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: none;
}
.tp-dt::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .7; }
.tp-dt::-webkit-calendar-picker-indicator:hover { opacity: 1; }
/* 批量过期区间：对齐参考项目 gift-count-tool.html 的 .tinput 观感（原生 datetime-local，不再固定高度，用 padding 撑高，border/圆角一致） */
.rec-field input.tp-dt {
  height: auto;
  width: 210px;
  min-width: 210px;
  padding: 8px 11px;
  border: 1.4px solid var(--border);
  border-radius: 11px;
  font-size: 13px;
  box-sizing: border-box;
}
.time-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  flex: none;
}
.time-group .colon {
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  user-select: none;
  padding: 0 1px;
}
.dd { position: relative; display: inline-block; }
.dd::after {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  margin-top: -2px;
  pointer-events: none;
  border: 4px solid transparent;
  border-top-color: var(--muted);
}
.dd.open::after {
  margin-top: -6px;
  border-top-color: transparent;
  border-bottom-color: var(--muted);
}
.dd .dd-trigger {
  height: 36px;
  min-width: 34px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  padding: 0 14px 0 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  position: relative;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.dd-input { width: 24px; text-align: center; padding: 0 12px 0 4px; cursor: pointer; }
.dd-input::placeholder { color: var(--muted); }
.dd-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: none;
}
.dd .dd-list {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  left: 0;
  max-height: 232px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, 0.18);
  margin: 0;
  padding: 4px;
  list-style: none;
  min-width: 62px;
}
.dd .dd-list li {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  white-space: nowrap;
}
.dd .dd-list li:hover { background: rgba(37, 99, 235, 0.12); }
.dd .dd-list li[aria-selected="true"] { background: var(--primary); color: #fff; }
.dd .dd-list li:focus { outline: 2px solid var(--primary); outline-offset: -2px; }

/* 暗色 */
[data-theme="dark"] .tp-dt,
[data-theme="dark"] .dd .dd-trigger { background: #1e2127; color: var(--text); }
[data-theme="dark"] .dd .dd-list { background: #1e2127; border-color: var(--border); }
[data-theme="dark"] .dd .dd-list li:hover { background: rgba(91, 155, 255, 0.18); }

/* 礼物兑换截止时间 */
.gift-deadline { font-size: 12px; color: var(--warn); margin-top: 4px; }

/* 兑换确认弹窗 */
.confirm-box { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin: 8px 0; }
.confirm-box p { margin: 0 0 8px; font-size: 13px; }
.cf-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.cf-row:last-of-type { border-bottom: none; }
.cf-row span { color: var(--muted); }
.cf-row b { color: var(--text); text-align: right; }

/* 订单筛选/排序工具条 */
.ro-tools { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 4px 0 12px; }
.ro-tools label { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.ro-tools select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); }
.ro-tools .ro-search input,
.ro-tools .ro-date input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 13px; }
.ro-tools .ro-search input { width: 220px; }
.ro-tools .ro-chk { cursor: pointer; }
.ro-tools .ro-chk input { width: 15px; height: 15px; cursor: pointer; }
/* 下单日期范围：合并为一个胶囊控件（开始日期 至 结束日期） */
.ro-range { gap: 8px; }
.date-range { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-sep { color: var(--muted); font-size: 13px; }
/* 导出按钮移至筛选行末尾（靠右对齐） */
.ro-export-btn { margin-left: auto; }
/* 礼物多选下拉 */
.ms-wrap { position: relative; display: inline-block; }
.ms-toggle { padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); font-size: 13px; cursor: pointer; white-space: nowrap; }
.ms-toggle:hover { border-color: var(--primary); }
.ms-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 180px; max-height: 260px; overflow: auto; padding: 6px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); }
.ms-opt { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); }
.ms-opt:hover { background: var(--hover, rgba(0,0,0,.05)); }
.ms-opt input { width: 15px; height: 15px; cursor: pointer; }

/* 导出列选择 */
.export-cols { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 4px; }
.export-cols .mini-chk { margin: 4px 0; }

/* 找回密码入口 & 弹窗内表单间距 */
/* 登录表单内 hint 默认空（仅报错时才有内容），从 flex 流中剔除，避免与表单 gap 叠加制造过大空隙 */
.pw-form .hint { margin-top: 0; }
.pw-form .hint:empty { display: none; }
.forgot-link { display: inline-block; margin-top: 0; font-size: 13px; cursor: pointer; }
.modal .field { margin: 8px 0; }
.modal .field input { width: 100%; box-sizing: border-box; }

/* ============================================================
   响应式适配（窄屏布局收敛，避免元素挤压 / 表格被裁切）
   ============================================================ */
@media (max-width: 860px) {
  .sidebar { width: 180px; }
  .main { padding: 16px 16px; }
  .topbar { padding: 0 14px; }
}
@media (max-width: 640px) {
  .sidebar { width: 150px; padding: 12px 8px; }
  .main { padding: 14px 12px; }
  .topbar { padding: 0 12px; }
  .topbar .brand { font-size: 14px; gap: 6px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-head { flex-wrap: wrap; gap: 8px; }
  .page-head h2 { font-size: 18px; }
  .gift-grid, .dash-grid { grid-template-columns: 1fr; }
  .modal { padding: 18px 16px; }
  .modal-root { padding: 16px 8px; }
  .table th, .table td, .data-table thead th, .data-table tbody td { padding: 9px 10px; }
  .ro-tools, .lv-tools { gap: 10px; }
  .head-actions { flex-wrap: wrap; }
}

/* ============================================================
   移动端侧边栏抽屉（点击显示 / 点击隐藏，仿 tools 站点）
   桌面端：菜单按钮与遮罩隐藏，侧栏保持原有左侧常驻布局（不破坏桌面）
   ============================================================ */
.topbar .brand-group { display: flex; align-items: center; gap: 10px; }
.icon-btn.menu-btn {
  display: none; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; margin: 0;
  border: none; background: transparent; color: var(--text); border-radius: 8px; cursor: pointer;
}
.icon-btn.menu-btn:hover { background: rgba(127,127,127,.12); }
.icon-btn.menu-btn svg { width: 22px; height: 22px; display: block; }
.sidebar-overlay { display: none; }

@media (max-width: 860px) {
  .icon-btn.menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; z-index: 40;
    width: 240px; max-width: 80vw; height: auto;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 12px 32px rgba(0,0,0,.18);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block; position: fixed; inset: 56px 0 0 0; z-index: 39;
    background: rgba(0,0,0,.4); opacity: 0; visibility: hidden;
    transition: opacity .2s ease, visibility .2s ease;
  }
  .sidebar-overlay.show { opacity: 1; visibility: visible; }
  body.sidebar-open { overflow: hidden; }
  .layout { height: auto; }
  .main { margin-left: 0; }
}

/* B站 验证弹窗：PC / 手机跳转按钮加大并带图标 */
.bili-jump-btn {
  display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px;
  padding: 12px 16px; font-size: 15px; line-height: 1.2; min-height: 46px;
}
.bili-jump-btn .bj-icon { width: 20px; height: 20px; flex-shrink: 0; }

@media (max-width: 480px) {
  .bili-jump-btn { flex: 1 1 100%; justify-content: center; }
}

/* ============================================================
   邮件模板弹窗：分段器（Tab）与宽屏弹窗
   ============================================================ */
.modal-wide { max-width: 680px; width: 92vw; }
.seg-tabs {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel);
  margin-bottom: 14px;
}
.seg-tab {
  border: none;
  background: transparent;
  color: var(--text);
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.seg-tab:not(:last-child) { border-right: 1px solid var(--border); }
.seg-tab:hover { background: var(--hover, rgba(0,0,0,.04)); }
.seg-tab.active {
  background: var(--primary);
  color: #fff;
}
.seg-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; z-index: 1; }
[data-theme="dark"] .seg-tabs { background: #1e2127; border-color: #2a2f38; }
[data-theme="dark"] .seg-tab:not(:last-child) { border-color: #2a2f38; }
[data-theme="dark"] .seg-tab:hover { background: rgba(91,155,255,.12); }

/* ============================================================
   显示 / 隐藏 滑扭（左「隐藏」· 右「显示」）
   用于集合（礼物上架 / 画廊等）列表中的显隐切换，替代原文字按钮
   ============================================================ */
.hs-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.hs-switch .hs-label {
  font-size: 13px;
  font-weight: 400;
  color: var(--text);
}
.hs-track {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex: none;
}
.hs-track input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.hs-track .slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background .2s;
}
.hs-track .slider::before {
  content: ""; position: absolute;
  height: 18px; width: 18px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .2s;
}
.hs-track input:checked + .slider { background: var(--primary); }
.hs-track input:checked + .slider::before { transform: translateX(18px); }
.hs-track input:focus-visible + .slider { outline: 2px solid var(--primary); outline-offset: 2px; }
[data-theme="dark"] .hs-track .slider { background: #3a4150; }
[data-theme="dark"] .hs-track input:checked + .slider { background: var(--primary); }

/* 过期标记：选中「停止并屏蔽」后出现的「屏蔽第 N 张图片」子字段（独占一行，逻辑清晰，避免与分段器混成一个占位） */
.expired-num-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; background: var(--bg); }
.expired-num-label { font-size: 13px; font-weight: 600; color: var(--text); }
.expired-num-row { display: inline-flex; align-items: center; gap: 8px; }
.expired-num-hint { font-size: 12px; color: var(--muted); }
[data-theme="dark"] .expired-num-wrap { background: #1a1d23; border-color: #2a2f38; }

/* 兑换订单：下单日期输入框收窄（200 → 150） */
.ro-range input.tp-dt { min-width: 175px; width: 175px; }

/* 操作日志 / 用户管理：在移动端将「修改内容」「操作」拆为整行（桌面端保持内联） */
.log-detail-row { display: none; }
.user-actions-row { display: none; }

@media (max-width: 860px) {
  /* 日志分析：隐藏「绑定用户」列；UID 与名字换行；上船级别一行一个 */
  .col-binduser { display: none !important; }
  .log-uname { display: block; margin-left: 0; margin-top: 2px; }
  .ship-breakdown { white-space: normal; }
  .ship-breakdown .ship-lvl { display: block; margin: 2px 0; }
  /* 操作日志：修改内容另起一行；表头随之隐藏；与本条记录同一行、去分割线 */
  .log-detail-cell { display: none; }
  .log-detail-row { display: table-row; }
  .col-detail { display: none !important; }
  .log-main-row td { border-bottom: none; }
  .log-detail-row td { border-top: none; }
  /* 用户管理：操作列另起一行并居右对齐；表头随之隐藏；与本条记录同一行、去分割线 */
  .user-actions-cell { display: none; }
  .user-actions-row { display: table-row; }
  .user-actions-row-cell { text-align: right; white-space: nowrap; }
  .col-actions { display: none !important; }
  .user-main-row td { border-bottom: none; }
  .user-actions-row td { border-top: none; }
  /* 舰礼动态（集合列表）：移动端隐藏「来源链接」与「过期标记」 */
  .col-source, .col-expired, .col-status, .kv-col-source, .card-status { display: none !important; }
}

/* ============================================================
   我的兑换（用户侧）：手机端订单表改为卡片式 + 弹窗表单优化
   桌面端保持原 9 列表格，不改动；以下规则仅在窄屏生效
   ============================================================ */
/* 移动端专属元素（合并单元格 / 收货地址）在桌面端隐藏，不干扰原表格列数 */
.mo-combo, .mo-addr { display: none; }

@media (max-width: 640px) {
  /* 订单表 → 每行一张卡片，字段名由 data-label 显示 */
  .mo-table thead { display: none; }
  .mo-table, .mo-table tbody, .mo-table tr, .mo-table td { display: block; width: 100%; box-sizing: border-box; }
  .mo-table tr { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; padding: 4px 0; box-shadow: var(--shadow); }
  .mo-table tbody tr:last-child { margin-bottom: 0; }
  .mo-table td { border: none; padding: 9px 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; text-align: right; }
  .mo-table td::before { content: attr(data-label); font-size: 12px; font-weight: 600; color: var(--muted); flex-shrink: 0; text-align: left; }
  .mo-table td > * { text-align: right; }
  .mo-table .order-no { font-size: 14px; font-weight: 600; color: var(--text); }
  /* 隐藏桌面端拆分的礼物/级别/数量/状态/发送方式列，改由合并单元格呈现 */
  .mo-table td.mo-hide { display: none; }
  /* 合并单元格：礼物（级别 badge + 名 + x数量）、发送方式（状态 badge + 单号） */
  .mo-table td.mo-combo { display: flex; }
  .mo-table td.mo-combo .mo-v { display: block; text-align: right; line-height: 1.4; word-break: break-word; }
  .mo-table td.mo-combo .mo-track { font-size: 12px; color: var(--muted); }
  /* 收货人：信息（名称/电话/地址）整体居右，地址在名称下方 */
  .mo-table td[data-label="收货人"] .mo-rcv { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 2px; }
  .mo-table .mo-addr { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.5; text-align: right; word-break: break-all; }
  /* 「操作」列：隐藏字段名、按钮改为紧凑宽度（不再占满整行）并右对齐 */
  .mo-table td[data-label="操作"] { padding: 12px 14px; justify-content: flex-end; }
  .mo-table td[data-label="操作"]::before { display: none; }
  .mo-table td[data-label="操作"] .btn { width: auto; justify-content: center; min-height: 44px; padding: 8px 18px; }
  /* 弹窗表单：输入框升到 16px，避免 iOS 聚焦自动放大；按钮触摸目标 ≥44px */
  .field input, .field select, .field textarea { font-size: 16px; }
  /* 日志分析：粘贴日志 / 过期原因 / 备注原因 三处文本框在窄屏保持与宽屏一致字号（13px），不特意放大 */
  #logPaste, #expNote, #paReason { font-size: 13px; }
  .modal-actions .btn { min-height: 44px; }
}

/* ============================================================
   快递发货（易达 API）弹窗：报价列表 / 轨迹 / 操作区
   仅在 admin 订单发货弹窗内使用，不影响其它模块
   ============================================================ */
.courier-quote { margin: 6px 0 12px; }
.courier-list { display: flex; flex-direction: column; gap: 8px; }
.courier-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s;
}
.courier-opt:hover { border-color: var(--primary); }
.courier-opt input[type="radio"] { margin: 0; flex: none; }
.courier-opt .co-name { flex: 1; font-weight: 600; color: var(--text); }
.courier-opt .co-price { color: #c2691b; font-weight: 700; font-variant-numeric: tabular-nums; }
.courier-opt .co-eta { color: var(--muted); font-size: 12px; }
.courier-opt:has(input:checked) { border-color: var(--primary); background: #eaf2ff; }
[data-theme="dark"] .courier-opt:has(input:checked) { background: rgba(91,155,255,.14); }
.courier-opt.co-recent { border-color: #c2691b; }
.courier-opt .co-badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; line-height: 1.6; color: #fff; background: #c2691b; vertical-align: middle;
}
[data-theme="dark"] .courier-opt.co-recent { border-color: #e08a2e; }
[data-theme="dark"] .courier-opt .co-badge { background: #e08a2e; }
/* 批量发货：重量/托寄物设置区 + 地区分组 + 最便宜/总金额 */
.bc-setup { display: flex; gap: 14px; flex-wrap: wrap; margin: 4px 0 10px; }
.bc-setup .field { flex: 1 1 220px; margin: 0; }
.bc-goods-preview { padding: 8px 10px; border: 1px dashed var(--border); border-radius: 8px; color: var(--muted); font-size: 13px; background: var(--panel); word-break: break-all; }
.bc-region { margin: 8px 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.bc-region-h { padding: 7px 12px; background: var(--panel-2, #f3f5f8); font-weight: 700; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border); }
[data-theme="dark"] .bc-region-h { background: rgba(255,255,255,.04); }
.bc-region .courier-opt { border: none; border-bottom: 1px solid var(--border); border-radius: 0; }
.bc-region .courier-opt:last-child { border-bottom: none; }
.courier-opt.co-cheapest { border-left: 3px solid #2e9e5b; }
.courier-opt.co-chosen { border-left: 3px solid var(--primary); }
.co-unsupported { color: #c0392b !important; }
[data-theme="dark"] .co-unsupported { color: #ff7a6b !important; }
[data-theme="dark"] .courier-opt.co-cheapest { border-left-color: #45c178; }
.bc-total { margin: 10px 0 0; font-size: 14px; }
.bc-total b { color: #c2691b; font-size: 16px; }
[data-theme="dark"] .bc-total b { color: #e08a2e; }
.sh-track-wrap { margin-top: 6px; }
.sh-track-head { display: flex; justify-content: space-between; align-items: center; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.courier-track {
  max-height: 240px; overflow: auto; margin-top: 4px;
  border: 1px solid var(--border); border-radius: 10px; padding: 10px;
  background: var(--bg, #fafcff);
}
.track-list { list-style: none; margin: 0; padding: 0; }
.track-list li { padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; color: var(--text); }
.track-list li:last-child { border-bottom: none; }
.track-list .t-time { color: var(--muted); margin-right: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* 进度条：细、扁平（纯色填充，无渐变）、跟随站点明暗主题 */
.bar { display: flex; align-items: center; gap: 8px; margin: 5px 0; font-size: 12.5px; }
.bar .lbl { width: 60px; flex: none; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { flex: 1; height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--primary); border-radius: 999px; transition: width .3s ease; }
.bar .num { width: 52px; flex: none; text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
[data-theme="dark"] .bar .track { background: #2a2e38; }
[data-theme="dark"] .bar .fill { background: var(--primary); }
[data-theme="dark"] .courier-track { background: #1a1d23; }
.btn-warn { background: #f5a623; border-color: #f5a623; color: #fff; }
.btn-warn:hover { background: #e08a12; border-color: #e08a12; color: #fff; }

/* ---------- 全站纵向布局：页脚贴底 ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.layout { flex: 1 1 auto; min-height: 0; height: auto; }

/* ---------- 全站页脚：用户协议 / 隐私政策 链接 ---------- */
.app-footer { text-align: center; font-size: 12px; color: var(--muted); padding: 12px 14px; border-top: 1px solid var(--border); background: var(--panel); }
.app-footer a { color: var(--muted); text-decoration: underline; }
.app-footer a:hover { color: var(--primary-d); }
.app-footer .dot { margin: 0 8px; opacity: .5; }

/* ---------- 登录页：同意《用户协议》《隐私政策》勾选 ---------- */
.agree-row { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; }
.agree-row a { color: var(--primary-d); text-decoration: underline; }
.agree-row input { vertical-align: middle; margin-right: 4px; }
.agree-row.invalid { color: #e2483c; }
.agree-row.invalid input { outline: 1px solid #e2483c; }

