/* ============================================================================
   DistHub 管理后台样式
   参考 _reference/tomi/admin-assets/admin.css 的视觉语言（浅色、圆角卡片、
   左侧树形导航）重写，并补充表格 / 模态框 / 上传进度 / 令牌 / 响应式等模块。
   注意：不引入任何外网资源；Layui 仅用于图标字体（来自 /assets/layui/）。
   ========================================================================== */

:root {
  --ink: #1c2940;
  --ink-2: #354561;
  --muted: #7b89a2;
  --muted-2: #93a0b3;
  --blue: #4c70f2;
  --blue-deep: #3f5fe0;
  --green: #258156;
  --orange: #c47a25;
  --red: #c34e4e;
  --line: #e5ebf4;
  --line-soft: #edf1f7;
  --bg: #f4f7fc;
  --white: #fff;
  --card-shadow: 0 12px 38px rgba(51, 75, 112, 0.06);
  --radius: 16px;
  --radius-sm: 9px;
  --sidebar-width: 252px;
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }
body.admin-body {
  background: radial-gradient(ellipse at 78% 4%, #e2eaff 0, transparent 27%), var(--bg);
  color: var(--ink);
  font: 14px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-deep); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- 启动加载 / 资源告警 / noscript ---------- */
.boot-loading {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  background: var(--bg); color: var(--muted); font-size: 13px;
}
.boot-loading[hidden] { display: none !important; }
.spinner {
  width: 20px; height: 20px; flex: none;
  border: 2px solid #c9d6f5; border-top-color: var(--blue);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.asset-warning {
  position: relative; z-index: 40;
  margin: 12px; padding: 14px 18px;
  border: 1px solid #f0b7b2; border-radius: 10px;
  background: #fff1f0; color: #a63731; line-height: 1.7;
}
.noscript-warning {
  margin: 24px auto; max-width: 720px; padding: 18px 22px;
  border: 1px solid #f0b7b2; border-radius: 12px; background: #fff1f0; color: #a63731;
}

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 38px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  background: #eef2f9; color: var(--ink-2);
}
.btn:hover { background: #e6ecf6; }
.btn:focus-visible { outline: 2px solid #a9bcfb; outline-offset: 2px; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn .layui-icon { font-size: 14px; }

.btn-primary { background: linear-gradient(130deg, #567cf6, #4266e6); color: #fff; box-shadow: 0 6px 16px rgba(76, 112, 242, 0.24); }
.btn-primary:hover { background: linear-gradient(130deg, #4a70ee, #3a5ddd); color: #fff; }
.btn-ghost { background: #fff; border-color: #dfe7f2; color: #5e6e88; }
.btn-ghost:hover { background: #f6f9ff; border-color: #c9d6ec; color: var(--ink-2); }
.btn-danger { background: #d9534f; color: #fff; }
.btn-danger:hover { background: #c9433f; }
.btn-danger-ghost { background: #fff; border-color: #efc9c7; color: #b94a45; }
.btn-danger-ghost:hover { background: #fff4f3; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.55); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
.btn-ghost.is-loading::after { border-color: #b9c8e4; border-top-color: var(--blue); }

.link-btn {
  border: 0; background: none; padding: 0; margin-left: 6px;
  color: var(--blue); font: inherit; font-size: 12px; cursor: pointer;
}
.link-btn:hover { text-decoration: underline; }

/* ---------- 表单控件 ---------- */
.text-input, .text-area, select.text-input {
  width: 100%; height: 38px; padding: 0 12px;
  border: 1px solid #dfe6f0; border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font: inherit; font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  appearance: auto;
}
.text-input-sm { width: auto; height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.text-area {
  height: auto; min-height: 84px; padding: 10px 12px;
  line-height: 1.7; resize: vertical;
}
.text-input:focus, .text-area:focus, select.text-input:focus {
  outline: none; border-color: #91a8f8; box-shadow: 0 0 0 3px rgba(76, 112, 242, 0.12);
}
.text-input:disabled, .text-area:disabled { background: #f4f6fa; color: var(--muted); cursor: not-allowed; }
select.text-input { cursor: pointer; }
textarea.text-area { display: block; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12px; color: #5f6e86; font-weight: 600; }
.field-label em { color: var(--red); font-style: normal; }
.field-hint { margin: 2px 0 0; font-size: 11px; color: var(--muted-2); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; margin-bottom: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.form-status { font-size: 12px; min-height: 18px; color: var(--muted); }
.form-status.error { color: var(--red); }
.form-status.ok { color: var(--green); }
.form-status.warn { color: var(--orange); }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; min-height: 38px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--blue); cursor: pointer; margin: 0; }

/* ---------- 登录视图 ---------- */
.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(420px, 100%); background: #fff; padding: 38px 36px 28px;
  border-radius: 22px; box-shadow: 0 24px 80px rgba(41, 61, 102, 0.16); text-align: center;
}
.brand-mark {
  width: 44px; height: 44px; flex: none; border-radius: 14px;
  background: linear-gradient(140deg, #567cf6, #9a6cf5);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px;
  box-shadow: 0 8px 20px rgba(86, 124, 246, 0.3);
}
.brand-mark-lg { width: 62px; height: 62px; border-radius: 18px; font-size: 28px; margin: 0 auto 18px; }
.login-card h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.login-subtitle { color: var(--muted); font-size: 12px; margin: 8px 0 26px; }
.login-form { text-align: left; display: flex; flex-direction: column; gap: 14px; }
.login-form .btn { height: 44px; font-size: 14px; margin-top: 4px; }
.login-form .form-status { text-align: left; min-height: 18px; }
.login-foot { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 11px; color: var(--muted-2); }

/* ---------- 整体布局 ---------- */
.admin-shell { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 10;
  width: var(--sidebar-width); padding: 26px 17px 20px;
  background: #fff; border-right: 1px solid #e8edf5;
  display: flex; flex-direction: column; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 28px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-text { min-width: 0; }
.brand strong { display: block; font-size: 16px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.nav-label { font-size: 11px; color: #a0aabc; padding: 0 13px 10px; letter-spacing: 0.08em; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 13px; border-radius: 11px;
  color: #66758f; font-size: 13.5px; transition: background 0.15s ease, color 0.15s ease;
}
.nav-item .layui-icon { font-size: 17px; }
.nav-item:hover { background: #f5f7fb; color: var(--ink-2); }
.nav-item.is-active { background: #edf2ff; color: var(--blue); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 14px 13px 0; display: flex; flex-direction: column; gap: 6px; }
.sidebar-link { font-size: 12px; color: var(--muted); }
.sidebar-link:hover { color: var(--blue); }
.sidebar-build { font-size: 10.5px; color: #a4afc0; word-break: break-all; }

.main-area {
  margin-left: var(--sidebar-width);
  padding: 30px clamp(20px, 3.4vw, 54px) 18px;
  min-height: 100vh; display: flex; flex-direction: column;
}
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 auto 22px; max-width: 1360px; width: 100%; }
.topbar-caption { font-size: 10px; letter-spacing: 0.17em; color: #7e91b5; }
.topbar h1 { font-size: 24px; margin: 6px 0 0; letter-spacing: -0.02em; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.72); border: 1px solid #fff;
  color: #61708a; font-size: 12px;
}
.user-badge .layui-icon { color: var(--blue); font-size: 13px; }

.global-alert {
  max-width: 1360px; width: 100%; margin: 0 auto 16px;
  padding: 11px 16px; border-radius: 10px;
  background: #fff6ec; border: 1px solid #f3dcbe; color: #94622a; font-size: 12.5px;
}
.content-area { max-width: 1360px; width: 100%; margin: 0 auto; flex: 1; }
.page-foot { max-width: 1360px; width: 100%; margin: 22px auto 0; color: #a4afc0; font-size: 10.5px; }

/* ---------- 卡片 / 面板 ---------- */
.metric-grid {
  display: grid; gap: 16px; margin-bottom: 18px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.metric-card, .panel {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid #fff; border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}
.metric-card { min-height: 120px; padding: 18px; display: flex; gap: 12px; align-items: flex-start; }
.metric-icon {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
}
.metric-icon .layui-icon { font-size: 17px; }
.metric-icon.blue { background: #edf2ff; color: #4b70f0; }
.metric-icon.green { background: #e9f7ef; color: #299667; }
.metric-icon.orange { background: #fff3e8; color: #d3842c; }
.metric-icon.purple { background: #f3edff; color: #8865d6; }
.metric-label { font-size: 12px; color: #7e8ba2; margin: 1px 0 6px; }
.metric-card strong { display: block; font-size: 25px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; color: #9aa5b5; font-size: 10px; margin-top: 6px; line-height: 1.5; }

.panel { padding: 22px; margin-bottom: 17px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-heading h2 { font-size: 16px; margin: 0 0 6px; }
.panel-heading p { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.7; max-width: 860px; }
.panel-foot { margin: 12px 0 0; font-size: 11px; color: var(--muted-2); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.grid-2 .panel { margin-bottom: 0; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.note-panel { display: flex; gap: 13px; align-items: flex-start; color: #697891; }
.note-panel > .layui-icon { font-size: 20px; color: #6987ec; margin-top: 1px; }
.note-panel strong { font-size: 12.5px; }
.note-panel p { font-size: 11.5px; line-height: 1.85; margin: 6px 0 0; color: #8290a5; }

/* ---------- 表格 ---------- */
.table-wrap { width: 100%; overflow: auto; border-radius: 10px; border: 1px solid var(--line-soft); }
.table-scroll { max-height: 340px; }
.table-scroll-lg { max-height: 520px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 640px; }
.data-table th, .data-table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: #f8faff; color: #66758f; font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table .actions-col { white-space: nowrap; text-align: right; }
.data-table td.actions-col { text-align: right; }
.data-table .cell-actions { display: inline-flex; gap: 5px; flex-wrap: nowrap; }
.data-table .cell-main strong { font-size: 13px; display: block; }
.data-table .cell-main small { display: block; color: var(--muted-2); font-size: 10.5px; margin-top: 2px; }
.data-table .cell-sub { color: var(--muted-2); font-size: 10.5px; }
.data-table .cell-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .cell-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; color: #5c6b83; }
.table-empty { text-align: center !important; color: #9aa5b5; padding: 30px 12px !important; }
.app-icon {
  width: 32px; height: 32px; border-radius: 9px; object-fit: contain; flex: none;
  background: #f1f4fb; border: 1px solid #e8edf6; padding: 2px;
}
.app-icon-fallback {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px;
  background: linear-gradient(140deg, #6a8bf8, #9a6cf5);
}
.cell-app { display: flex; align-items: center; gap: 10px; min-width: 0; }

/* ---------- 徽标 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 99px; font-size: 10.5px; line-height: 1.7;
  background: #f0f3f8; color: #71809a; white-space: nowrap;
}
.badge + .badge { margin-left: 4px; }
.badge.live { background: #e8f7ef; color: var(--green); }
.badge.current { background: #edf2ff; color: var(--blue); }
.badge.draft { background: #fff4e6; color: var(--orange); }
.badge.yanked { background: #f3f4f6; color: #8a94a4; }
.badge.warn { background: #fff1ef; color: #bd4b47; }
.badge.force { background: #fdeef1; color: #b7495c; }
.badge.internal { background: #fff4e6; color: #a2601a; }

/* ---------- 上传区域 ---------- */
.upload-form { margin: 0; }
.upload-hint { margin: 0 0 14px; font-size: 11.5px; color: var(--muted-2); line-height: 1.8; }
.upload-hint strong { color: var(--ink-2); }

.drop-zone {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 30px 20px; border: 1.5px dashed #cfdcf2; border-radius: 14px;
  background: #fafcff; color: var(--muted); text-align: center; cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.is-dragover {
  border-color: #8ba5f7; background: #f4f8ff; outline: none;
}
.drop-zone.is-disabled { opacity: 0.6; pointer-events: none; }
.drop-icon { font-size: 30px; color: #8ba5f7; }
.drop-zone strong { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.drop-sub { font-size: 11px; color: var(--muted-2); }
.selected-file {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 12px; border-radius: 9px;
  background: #edf2ff; color: #3d55b8; font-size: 12px;
}
.selected-file .layui-icon { font-size: 15px; }
.selected-file-name { font-weight: 600; overflow-wrap: anywhere; }
.selected-file-size { color: #6b7bb0; }

.upload-progress { margin-top: 16px; }
.progress {
  height: 12px; border-radius: 99px; background: #e9eef8; overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #567cf6, #7d6cf5);
  border-radius: 99px; transition: width 0.18s ease;
}
.upload-progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; flex-wrap: wrap; }
.progress-text { font-size: 12px; color: #415bd1; font-variant-numeric: tabular-nums; }
.progress-chunk { font-size: 11px; color: var(--muted-2); }

.resume-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 17px; padding: 13px 17px;
  border-radius: 13px; border: 1px solid #f3dcbe; background: #fff8ef; color: #8d6127;
  font-size: 12.5px;
}
.resume-text { display: flex; align-items: center; gap: 9px; min-width: 0; }
.resume-text .layui-icon { font-size: 17px; color: #d1902f; }
.resume-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 设置 / 通知编辑器 ---------- */
.settings-form .setting-divider {
  display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--line-soft); margin: 22px 0 16px; padding-top: 18px;
}
.setting-divider strong { font-size: 13px; }
.setting-divider span { font-size: 11px; color: var(--muted-2); }
.notice-editor {
  border: 1px solid #e6ebf4; border-radius: 12px;
  padding: 16px; margin: 0 0 16px; min-width: 0;
}
.notice-editor legend { padding: 0 8px; color: #354561; font-weight: 600; font-size: 13px; }
.notice-editor > .checkbox { margin-bottom: 12px; }
.notice-grid { margin-bottom: 0; }

/* ---------- 令牌 ---------- */
.token-result {
  margin-top: 18px; padding: 16px 18px;
  border: 1px solid #cfe0ff; border-radius: 12px; background: #f4f8ff;
}
.token-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.token-result-head strong { font-size: 12.5px; color: #3d55b8; }
.token-plain-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.token-plain {
  flex: 1; min-width: 240px; padding: 10px 12px; border-radius: 8px;
  background: #fff; border: 1px solid #dbe6fa;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; color: #283e86; word-break: break-all; user-select: all;
}

/* ---------- 模态框 ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(24, 36, 58, 0.42);
  backdrop-filter: blur(2px);
}
.modal-dialog {
  width: min(720px, 100%); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: 18px; box-shadow: 0 30px 90px rgba(20, 35, 66, 0.3);
  animation: modal-in 0.16s ease;
}
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-dialog.modal-wide { width: min(880px, 100%); }
.modal-dialog.modal-narrow { width: min(460px, 100%); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 22px 12px; border-bottom: 1px solid var(--line-soft);
}
.modal-head h3 { font-size: 16px; margin: 0; }
.modal-close {
  width: 30px; height: 30px; flex: none; border: 0; border-radius: 8px;
  background: #f2f5fa; color: #6c7b93; font-size: 18px; line-height: 1; cursor: pointer;
}
.modal-close:hover { background: #e8edf7; color: var(--ink); }
.modal-body { padding: 18px 22px; overflow-y: auto; }
.modal-body .form-grid { margin-bottom: 0; }
.modal-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  padding: 14px 22px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap;
}
.modal-foot .form-status { margin-right: auto; }
.modal-message { margin: 0; color: #41506b; font-size: 13px; line-height: 1.85; word-break: break-word; white-space: pre-line; }
.modal-message strong { color: var(--ink); }

.detail-list { margin: 0; display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 9px 14px; font-size: 12.5px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.detail-list dd.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11.5px; }
.detail-notes {
  white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8;
  margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: #f7f9fd;
  color: #4d5b73; font-size: 12.5px; max-height: 220px; overflow-y: auto;
}

/* ---------- toast ---------- */
.toast-host {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: min(560px, calc(100vw - 32px)); pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 9px;
  max-width: 100%; padding: 10px 15px;
  border-radius: 10px; background: #23324f; color: #fff;
  box-shadow: 0 12px 34px rgba(20, 35, 66, 0.28);
  font-size: 12.5px; line-height: 1.65;
  animation: toast-in 0.18s ease;
}
.toast .toast-icon { flex: none; font-size: 15px; line-height: 1.4; }
.toast-message { overflow-wrap: anywhere; }
.toast.error { background: #b8463f; }
.toast.success { background: #1f7a52; }
.toast.warn { background: #a8701f; }
.toast.is-leaving { opacity: 0; transform: translateY(-6px); transition: opacity 0.25s ease, transform 0.25s ease; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============================================================================
   响应式：1280px 与 768px 都必须可用
   ========================================================================== */
@media (max-width: 1440px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-2 .panel { margin-bottom: 0; }
  .data-table .cell-truncate { max-width: 180px; }
}

@media (max-width: 900px) {
  /* 平板 / 768px：侧栏变为顶部横向导航 */
  .sidebar {
    position: static; width: auto; height: auto;
    padding: 13px 14px 8px; border-right: 0; border-bottom: 1px solid #e8edf5;
    overflow: visible;
  }
  .brand { padding: 0 2px 10px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 12px; font-size: 17px; }
  .brand strong { font-size: 15px; }
  .nav-label, .sidebar-foot { display: none; }
  .side-nav { flex-direction: row; overflow-x: auto; gap: 5px; padding-bottom: 4px; }
  .nav-item { height: 38px; padding: 0 12px; flex: none; white-space: nowrap; font-size: 13px; }
  .nav-item .layui-icon { font-size: 15px; }
  .main-area { margin-left: 0; padding: 20px 16px 15px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 21px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card { min-height: 104px; padding: 14px 13px; gap: 10px; }
  .metric-card strong { font-size: 22px; }
  .metric-card small { display: none; }
  .panel { padding: 17px 14px; border-radius: 14px; }
  .table-scroll, .table-scroll-lg { max-height: 420px; }
}

@media (max-width: 560px) {
  .topbar-caption { display: none; }
  .topbar h1 { margin-top: 0; }
  .user-badge { display: none; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 28px 22px 22px; }
  .toolbar .text-input-sm { width: 100%; }
  .panel-heading { flex-direction: column; align-items: stretch; }
  .modal-backdrop { padding: 10px; }
  .modal-dialog { max-height: calc(100vh - 20px); border-radius: 14px; }
  .detail-list { grid-template-columns: 1fr; gap: 2px 0; }
  .detail-list dt { margin-top: 8px; }
  .resume-banner { flex-direction: column; align-items: flex-start; }
}

/* 打印时隐藏后台导航（非核心需求，顺手支持） */
@media print {
  .sidebar, .topbar, .toast-host, .modal-backdrop { display: none !important; }
  .main-area { margin-left: 0; padding: 0; }
}

/* ---------- 支付管理 ---------- */
.pay-tabs {
  display: flex; gap: 6px; overflow-x: auto;
  margin: 0 0 18px; padding: 5px;
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid #fff; border-radius: 14px;
  box-shadow: var(--card-shadow);
}
.pay-tab {
  flex: none; height: 36px; padding: 0 16px;
  border: 0; border-radius: 10px; background: transparent;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pay-tab:hover { background: #f5f8ff; color: var(--ink-2); }
.pay-tab.is-active { background: #edf2ff; color: var(--blue); font-weight: 600; }
.pay-tab:focus-visible { outline: 2px solid #a9bcfb; outline-offset: 2px; }

.pay-pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; margin-top: 12px; flex-wrap: wrap;
}
.pay-pager .cell-sub { min-width: 96px; text-align: center; }

.pay-secret-box {
  margin: 0 0 12px; padding: 12px 14px;
  border: 1px dashed #bcd0f7; border-radius: 10px;
  background: #f5f8ff; color: #3e5bb5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px; word-break: break-all; line-height: 1.7;
}
.pay-modal-list { margin: 0; padding: 0; list-style: none; }
.pay-modal-list li {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12.5px;
}
.pay-modal-list li:last-child { border-bottom: 0; }
.pay-modal-list .label { color: var(--muted); flex: none; }
.pay-modal-list .value { color: var(--ink-2); text-align: right; word-break: break-all; }
.pay-subheading { margin-top: 18px; }

@media (max-width: 720px) {
  .pay-tabs { border-radius: 12px; }
  .pay-tab { padding: 0 12px; }
}

/* 支付配置里的文件选择框 */
#payConfigForm input[type="file"].text-input {
  height: auto;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.6;
}
#payConfigForm .setting-divider { margin-top: 6px; }

/* 支付配置：密钥在线粘贴输入框 */
#payConfigForm textarea.key-input {
  margin-top: 8px;
  min-height: 96px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
  word-break: break-all;
}

/* 「测试支付页」入口：与 tab 同视觉，但是链接 */
.pay-tabs .pay-tab--link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  margin-left: auto;
  color: #567cf6;
  border-color: transparent;
  background: transparent;
}
.pay-tabs .pay-tab--link:hover { background: #f2f5ff; }
