/* ═══ 杰作AI · 共享管理样式 ═══
 * 供 agent.html / 管理后台页面共用
 * 与 index.html <style> 块保持同步
 */

/* ---------- CSS 变量 ---------- */
:root,
[data-theme="light"] {
  --bg-primary: #f7f9fc;
  --bg-secondary: #eef2f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --text-primary: #172033;
  --text-secondary: #475467;
  --text-muted: #667085;
  --accent: #0369a1;
  --accent-hover: #075985;
  --accent-rgb: 3, 105, 161;
  --accent-light: rgba(3, 105, 161, 0.10);
  --success: #047857;
  --warning: #a84b0b;
  --info: #1d4ed8;
  --danger: #b42318;
  --gradient-brand: linear-gradient(135deg, #075985 0%, #0f766e 100%);
  --border-subtle: #dfe4ec;
  --border-hover: #b8c1ce;
  --border-control: #8893a5;
  --border: var(--border-subtle);
  --mobile-header-height: 64px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
}
[data-theme="dark"] {
  --bg-primary: #101827;
  --bg-secondary: #0b1220;
  --bg-card: #172033;
  --bg-card-hover: #202b3d;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent: #7dd3fc;
  --accent-hover: #bae6fd;
  --accent-rgb: 125, 211, 252;
  --accent-light: rgba(125, 211, 252, 0.13);
  --success: #6ee7b7;
  --warning: #fbbf24;
  --info: #93c5fd;
  --danger: #fca5a5;
  --gradient-brand: linear-gradient(135deg, #075985 0%, #0f766e 100%);
  --border-subtle: #2a364b;
  --border-hover: #40506a;
  --border-control: #64748b;
  --border: var(--border-subtle);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.24), 0 10px 30px rgba(0, 0, 0, 0.2);
}
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; background: var(--bg-secondary); }
body { font-family: system-ui, -apple-system, 'Segoe UI', 'Microsoft YaHei', 'Noto Sans SC', sans-serif; font-size: 16px; line-height: 1.6; color: var(--text-primary); background: var(--bg-secondary); transition: background 0.2s ease, color 0.2s ease; }
a { text-decoration: none; color: inherit; }
button { border: none; background: none; cursor: pointer; font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(var(--accent-rgb), 0.42); outline-offset: 2px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ui-icon, .nav-icon { width: 1.125rem; height: 1.125rem; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.skip-link { position: fixed; z-index: 10000; top: 0.75rem; left: 0.75rem; padding: 0.65rem 0.9rem; border-radius: 10px; background: var(--text-primary); color: var(--bg-card); font-weight: 700; transform: translateY(-160%); transition: transform 0.16s ease; }
.skip-link:focus { transform: translateY(0); }

/* ---------- 按钮 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 44px; padding: 10px 20px; border-radius: 10px; font-size: 0.875rem; font-weight: 600; transition: background-color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease; cursor: pointer; white-space: nowrap; position: relative; }
.btn:hover { box-shadow: 0 3px 10px rgba(16, 24, 40, 0.12); }
.btn:active { box-shadow: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.14); }
.btn-primary:hover { background: var(--accent-hover); }
[data-theme="dark"] .btn-primary { color: #082f49; }
.btn-secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--border-hover); }
.btn-secondary:hover { border-color: var(--accent); background: var(--accent-light); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.8125rem; border-radius: 9px; }
.btn-block { display: flex; width: 100%; }
.btn-outline { background: transparent; color: var(--text-primary); border: 1px solid var(--border-hover); }
.btn-outline:hover { border-color: var(--accent); background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { color: var(--accent); background: var(--accent-light); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.9); }
[data-theme="dark"] .btn-danger { color: #450a0a; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
[data-theme="dark"] .btn-success { color: #052e2b; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { filter: brightness(0.9); }
[data-theme="dark"] .btn-warning { color: #111827; }
.btn:disabled { cursor: not-allowed; opacity: 0.55; box-shadow: none; transform: none; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 4px 10px; border-radius: 99px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.badge-danger { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-primary { background: var(--accent-light); color: var(--accent); }
.badge-secondary { background: rgba(115, 115, 115, 0.15); color: var(--text-muted); }

/* ---------- 登录页面 ---------- */
.login-wrapper { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: var(--bg-secondary); background-image: radial-gradient(circle at 15% 10%, rgba(var(--accent-rgb), 0.10), transparent 32%), radial-gradient(circle at 85% 90%, rgba(4, 120, 87, 0.08), transparent 30%); }
.login-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 18px; padding: 2rem; width: 100%; max-width: 420px; text-align: left; box-shadow: 0 24px 70px rgba(16, 24, 40, 0.12); animation: fadeInUp 0.32s ease-out; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.login-logo { display: grid; place-items: center; width: 58px; height: 58px; margin: 0 auto 1rem; border: 1px solid var(--border-subtle); border-radius: 16px; background: var(--bg-primary); box-shadow: 0 8px 20px rgba(16, 24, 40, 0.08); }
.login-logo img { width: 40px; height: 40px; image-rendering: auto; }
.login-logo--lock .ui-icon { width: 28px; height: 28px; color: var(--accent); }
.login-title { font-size: 1.5rem; font-weight: 750; margin-bottom: 0.35rem; color: var(--text-primary); text-align: center; }
.login-subtitle { font-size: 0.875rem; color: var(--text-secondary); margin-bottom: 1.5rem; text-align: center; }
.login-error { color: var(--danger); font-size: 0.875rem; margin-top: 1rem; }
.password-field { position: relative; }
.password-field .form-input { padding-right: 4.25rem; }
.password-toggle { position: absolute; top: 50%; right: 0.35rem; min-width: 52px; min-height: 36px; padding: 0.25rem 0.5rem; border-radius: 8px; color: var(--accent); font-size: 0.8125rem; font-weight: 600; transform: translateY(-50%); }
.password-toggle:hover, .password-visibility:hover { background: var(--accent-light); }
.password-visibility { display: block; min-height: 40px; margin: -0.35rem 0 0.5rem auto; padding: 0.25rem 0.5rem; color: var(--accent); font-size: 0.8125rem; font-weight: 600; }
.login-secondary-action { margin-top: 0.5rem; }
.login-footer { position: fixed; right: 1rem; bottom: 0.75rem; left: 1rem; display: flex; align-items: center; justify-content: center; gap: 0.5rem; flex-wrap: wrap; color: var(--text-muted); font-size: 0.75rem; text-align: center; }
.login-footer a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 管理布局 ---------- */
.admin-layout { display: flex; min-height: 100vh; min-height: 100dvh; background: var(--bg-secondary); }
.sidebar { position: sticky; top: 0; width: 264px; height: 100vh; height: 100dvh; background: var(--bg-card); border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; flex-shrink: 0; box-shadow: 1px 0 0 rgba(16, 24, 40, 0.02); }
.sidebar-header { display: flex; align-items: center; gap: 0.75rem; min-height: 76px; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-subtle); }
.sidebar-logo { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08); }
.sidebar-brand-copy { min-width: 0; display: flex; flex-direction: column; }
.sidebar-brand-copy h2 { color: var(--text-primary); font-size: 1rem; font-weight: 750; line-height: 1.35; }
.sidebar-brand-copy span { color: var(--text-muted); font-size: 0.75rem; }
.sidebar-nav { flex: 1; min-height: 0; padding: 0.75rem; display: flex; flex-direction: column; gap: 0.8rem; overflow-y: auto; scrollbar-width: thin; }
.nav-group { display: flex; flex-direction: column; gap: 0.2rem; }
.nav-group-label { padding: 0 0.75rem 0.25rem; color: var(--text-muted); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; }
.nav-item { display: flex; width: 100%; min-height: 42px; align-items: center; gap: 0.7rem; padding: 0.6rem 0.75rem; border-radius: 10px; font-size: 0.875rem; font-weight: 550; color: var(--text-secondary); text-align: left; transition: background-color 0.16s ease, color 0.16s ease; text-decoration: none; }
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 700; }
.nav-item.active::before { content: ''; width: 3px; height: 20px; margin-left: -0.75rem; border-radius: 0 4px 4px 0; background: currentColor; }
.nav-item.active .nav-icon { margin-left: -0.5125rem; }
.nav-badge { min-width: 1.4rem; margin-left: auto; padding: 0.05rem 0.4rem; border-radius: 99px; background: rgba(180, 35, 24, 0.12); color: var(--danger); font-size: 0.6875rem; font-variant-numeric: tabular-nums; font-weight: 750; text-align: center; }
.sidebar-footer { padding: 0.85rem; border-top: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 0.65rem; }
.sidebar-user { display: flex; align-items: center; gap: 0.65rem; padding: 0.45rem; }
.sidebar-avatar { display: grid; place-items: center; width: 36px; height: 36px; flex: 0 0 auto; border-radius: 10px; background: var(--accent-light); color: var(--accent); font-size: 0.8125rem; font-weight: 750; }
.sidebar-user > div { min-width: 0; display: flex; flex-direction: column; }
.sidebar-user strong { overflow: hidden; color: var(--text-primary); font-size: 0.8125rem; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user span:not(.sidebar-avatar) { color: var(--text-muted); font-size: 0.6875rem; }
.sidebar-footer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.sidebar-action { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.45rem 0.55rem; border: 1px solid var(--border-subtle); border-radius: 9px; color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; }
.sidebar-action:hover { border-color: var(--border-hover); background: var(--bg-card-hover); color: var(--text-primary); }
.sidebar-action--danger:hover { border-color: rgba(180, 35, 24, 0.35); background: rgba(180, 35, 24, 0.08); color: var(--danger); }
.main-content { min-width: 0; flex: 1; padding: 0; background: var(--bg-secondary); }
.main-content:focus { outline: none; }
.top-bar { position: sticky; top: 0; z-index: 30; display: flex; min-height: 88px; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 2rem; padding-inline: max(2rem, calc((100% - 1600px) / 2 + 2rem)); border-bottom: 1px solid var(--border-subtle); background: var(--bg-card); background: color-mix(in srgb, var(--bg-card) 94%, transparent); box-shadow: 0 1px 3px rgba(16, 24, 40, 0.04); backdrop-filter: blur(12px); }
.page-heading { min-width: 0; }
.page-kicker { margin-bottom: 0.1rem; color: var(--accent); font-size: 0.6875rem; font-weight: 750; letter-spacing: 0.08em; }
.top-bar h1 { color: var(--text-primary); font-size: 1.25rem; font-weight: 750; line-height: 1.35; }
.page-description { max-width: 680px; margin-top: 0.15rem; color: var(--text-muted); font-size: 0.75rem; line-height: 1.45; }
.top-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.top-action-group { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.tab-panel { width: 100%; max-width: 1600px; margin: 0 auto; padding: 1.5rem 2rem 2.5rem; }
.mobile-menu-toggle, .mobile-nav-scrim { display: none; }

/* ---------- 统计卡片 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
/* ---------- 价格管理卡片（一行三张，窄屏降级） ---------- */
.prices-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.prices-grid .setting-card { margin-bottom: 0; }
.promotion-price-row { display: flex; align-items: baseline; gap: 0.75rem; margin-top: 0.35rem; }
.promotion-original-price { color: var(--text-muted); font-size: 0.9rem; text-decoration: line-through; }
.promotion-current-price { color: var(--accent); font-size: 1.4rem; font-weight: 700; }
.promotion-status { color: var(--success); font-size: 0.75rem; font-weight: 600; margin-top: 0.35rem; }
.promotion-toggle { display: flex; align-items: flex-start; gap: 0.65rem; cursor: pointer; }
.promotion-toggle input { margin-top: 0.2rem; }
.promotion-toggle span { display: flex; flex-direction: column; gap: 0.2rem; }
.promotion-toggle strong { color: var(--text-primary); font-size: 0.875rem; }
.promotion-toggle small { color: var(--text-muted); line-height: 1.45; }
@media (max-width: 1023px) { .prices-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 639px) { .prices-grid { grid-template-columns: 1fr; } }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 1.25rem; text-align: center; box-shadow: var(--shadow-card); }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.25rem; }
.stat-card .stat-label { font-size: 0.8125rem; color: var(--text-secondary); }
.stat-active { border-color: var(--success); }
.stat-active .stat-value { color: var(--success); }
.stat-inactive { border-color: var(--text-muted); }
.stat-expired { border-color: var(--danger); }
.stat-expired .stat-value { color: var(--danger); }
.stat-suspended { border-color: var(--warning); }
.stat-suspended .stat-value { color: var(--warning); }
.stat-revoked { border-color: var(--danger); }
.stat-revoked .stat-value { color: var(--danger); }
.stat-warn { border-color: var(--warning); }
.stat-warn .stat-value { color: var(--warning); }
.stat-tip { border-color: var(--accent); }
.stat-tip .stat-value { color: var(--accent); }
.stat-pending { border-color: var(--warning); }
.stat-pending .stat-value { color: var(--warning); }
@media (max-width: 1023px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 639px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.license-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin-bottom: 1rem; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-card); box-shadow: var(--shadow-card); }
.license-summary .stat-card { position: relative; min-width: 0; padding: 1rem 1.125rem; border: 0; border-right: 1px solid var(--border-subtle); border-radius: 0; background: transparent; box-shadow: none; text-align: left; }
.license-summary .stat-card:last-child { border-right: 0; }
.license-summary .stat-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.license-summary .stat-active::before { background: var(--success); }
.license-summary .stat-suspended::before { background: var(--warning); }
.license-summary .stat-revoked::before { background: var(--danger); }
.license-summary .stat-value { margin-bottom: 0.15rem; font-size: 1.5rem; }
.list-surface { overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-card); box-shadow: var(--shadow-card); }
.license-list-surface .filter-bar { margin: 0; padding: 1rem; border: 0; border-bottom: 1px solid var(--border-subtle); border-radius: 0; background: transparent; box-shadow: none; }
.license-list-surface > .inline-alert, .license-list-surface > .batch-bar { margin: 0.75rem 1rem 0; }
.license-list-surface .table-wrapper { margin: 0; border: 0; border-radius: 0; box-shadow: none; }
.license-list-surface .data-table { min-width: 1280px; }
.license-list-surface .data-table th, .license-list-surface .data-table td, .license-list-surface .badge { white-space: nowrap; }
.license-list-surface .pagination { margin: 0; border: 0; border-top: 1px solid var(--border-subtle); border-radius: 0; box-shadow: none; }
@media (max-width: 1023px) {
  .license-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .license-summary .stat-card { border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
  .license-summary .stat-card:nth-child(2n) { border-right: 0; }
  .license-summary .stat-card:nth-last-child(-n + 2) { border-bottom: 0; }
}
.section-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow-card); }
.section-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.75rem; }
.plan-distribution { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- 筛选栏 ---------- */
.filter-bar { display: flex; align-items: flex-end; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; padding: 1rem; border: 1px solid var(--border-subtle); background: var(--bg-card); border-radius: 14px; box-shadow: var(--shadow-card); }
.filter-input { flex: 1; min-width: 200px; }
.filter-select { width: auto; min-width: 120px; }
.filter-control { display: flex; min-width: 132px; flex: 0 1 auto; flex-direction: column; gap: 0.3rem; color: var(--text-secondary); font-size: 0.75rem; font-weight: 600; }
.filter-control--grow { min-width: 240px; flex: 1 1 280px; }
.filter-control .form-input { min-width: 0; }
.filter-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.filter-actions .btn { min-height: 44px; }
.page-section-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-section-intro h2 { color: var(--text-primary); font-size: 1rem; font-weight: 700; }
.page-section-intro p { max-width: 760px; margin-top: 0.2rem; color: var(--text-muted); font-size: 0.8125rem; }

/* ---------- 数据表格 ---------- */
.table-wrapper { position: relative; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; margin-bottom: 1rem; border: 1px solid var(--border-subtle); box-shadow: var(--shadow-card); border-radius: 14px; background: var(--bg-card); }
.table-wrapper:focus-visible { outline: 3px solid rgba(var(--accent-rgb), 0.38); outline-offset: 2px; }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-card); }
.data-table th { position: sticky; top: 0; z-index: 1; padding: 0.75rem 1rem; font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); background: var(--bg-card-hover); text-align: left; border-bottom: 1px solid var(--border-subtle); }
.data-table td { padding: 0.75rem 1rem; font-size: 0.875rem; color: var(--text-primary); border-bottom: 1px solid var(--border-subtle); transition: background 0.2s; }
.data-table tr:hover td { background: var(--accent-light); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table.table-sm th, .data-table.table-sm td { padding: 0.5rem 0.75rem; font-size: 0.8125rem; }
.selection-column { width: 44px; }
.cell-inline, .table-actions { display: flex; align-items: center; gap: 0.4rem; }
.cell-inline { min-width: max-content; }
.actions-cell { white-space: nowrap; }
.actions-cell > .btn + .btn { margin-left: 0.35rem; }
.table-actions { flex-wrap: wrap; }
.note-cell { max-width: 132px; }
.note-button { display: block; width: 100%; min-height: 36px; overflow: hidden; padding: 0.25rem 0.45rem; border-radius: 8px; color: var(--text-secondary); font-size: 0.75rem; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.note-button:hover { background: var(--accent-light); color: var(--accent); }
.empty-row td { min-height: 160px; padding: 2.5rem 1rem !important; color: var(--text-muted) !important; text-align: center; white-space: normal !important; }
.empty-state { display: flex; min-height: 180px; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; padding: 2rem; border: 1px dashed var(--border-hover); border-radius: 14px; background: var(--bg-card); color: var(--text-muted); text-align: center; }
.empty-state strong { color: var(--text-secondary); font-size: 0.9375rem; }
.inline-alert { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 0.75rem 0.9rem; border: 1px solid rgba(180, 35, 24, 0.28); border-radius: 10px; background: rgba(180, 35, 24, 0.07); color: var(--danger); font-size: 0.8125rem; }
.copy-button { display: inline-flex; min-width: 40px; min-height: 36px; align-items: center; justify-content: center; gap: 0.3rem; padding: 0.25rem 0.5rem; border: 1px solid var(--border-subtle); border-radius: 8px; color: var(--accent); font-size: 0.75rem; font-weight: 650; }
.copy-button:hover { border-color: var(--accent); background: var(--accent-light); }
.copy-button .ui-icon { width: 0.9rem; height: 0.9rem; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; flex-wrap: wrap; margin-top: 0.75rem; padding: 0.75rem 1rem; border: 1px solid var(--border-subtle); border-radius: 12px; background: var(--bg-card); box-shadow: var(--shadow-card); }
.pagination-summary, .pagination-controls, .pagination-size, .pagination-jump { display: flex; align-items: center; gap: 0.5rem; }
.pagination-controls { justify-content: flex-end; flex-wrap: wrap; }
.page-info, .pagination-current, .pagination-size, .pagination-jump { color: var(--text-secondary); font-size: 0.8125rem; }
.page-info strong, .pagination-current strong { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.pagination-current { display: inline-flex; min-height: 44px; align-items: center; gap: 0.25rem; padding: 0 0.25rem; white-space: nowrap; }
.pagination .pagination-select { width: 72px; min-height: 44px; padding: 0.45rem 1.65rem 0.45rem 0.6rem; font-size: 1rem; }
.pagination-jump { margin: 0; }
.pagination .pagination-input { width: 72px; min-height: 44px; padding: 0.45rem; font-size: 1rem; font-variant-numeric: tabular-nums; text-align: center; }
.pagination .pagination-input::-webkit-outer-spin-button, .pagination .pagination-input::-webkit-inner-spin-button { margin: 0; }
.pagination .btn-sm { min-height: 44px; }
.pagination--modal { box-shadow: none; }

/* ---------- 弹窗 ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(4px); animation: fadeIn 0.2s ease-out; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-dialog, .modal { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 18px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; margin: 1rem; box-shadow: 0 25px 80px rgba(0, 0, 0, 0.24); animation: slideUp 0.24s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.modal-lg { max-width: 700px; }
.modal-sm { max-width: 360px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-subtle); }
.modal-header h3 { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); }
.modal-close { display: inline-grid; min-width: 44px; min-height: 44px; place-items: center; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; line-height: 1; padding: 0.25rem; transition: background-color 0.16s ease, color 0.16s ease; border-radius: 9px; }
.modal-close:hover { color: var(--text-primary); background: var(--accent-light); }
.modal-body { padding: 1.5rem; }
.modal-footer { display: flex; justify-content: flex-end; gap: 0.75rem; padding: 1rem 1.5rem; border-top: 1px solid var(--border-subtle); }

/* ---------- 表单组 ---------- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.8125rem; font-weight: 650; color: var(--text-secondary); margin-bottom: 0.375rem; }
.form-input { width: 100%; min-height: 44px; padding: 0.65rem 0.8rem; border: 1px solid var(--border-control); border-radius: 10px; background: var(--bg-primary); color: var(--text-primary); font-size: max(0.875rem, 16px); outline: none; transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease; box-sizing: border-box; }
.form-input:focus { border-color: var(--accent); background: var(--bg-card); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12); }
.form-input::placeholder { color: var(--text-muted); opacity: 0.82; }
.form-input:disabled { opacity: 0.5; cursor: not-allowed; }
.form-row { display: flex; gap: 0.75rem; }
.flex-1 { flex: 1; }

/* ---------- 详情网格 ---------- */
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.detail-item { padding: 0.75rem; background: var(--bg-primary); border-radius: 12px; transition: background 0.2s; }
.detail-item:hover { background: var(--accent-light); }
.detail-label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; }
.detail-value { font-size: 0.875rem; color: var(--text-primary); word-break: break-all; }
.detail-actions { display: flex; gap: 0.5rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }

/* ---------- 操作日志 ---------- */
.activity-list { display: flex; flex-direction: column; gap: 0.5rem; }
.activity-item { display: flex; gap: 0.75rem; padding: 0.5rem 0.75rem; background: var(--bg-primary); border-radius: 12px; font-size: 0.8125rem; transition: all 0.2s; }
.activity-item:hover { background: var(--accent-light); transform: translateX(4px); }
.activity-time { color: var(--text-muted); white-space: nowrap; }
.activity-action { color: var(--accent); font-weight: 600; white-space: nowrap; }
.activity-detail { color: var(--text-secondary); flex: 1; word-break: break-all; }

/* ---------- 快速续期 ---------- */
.quick-renew-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------- 批量操作栏 ---------- */
.batch-bar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; padding: 0.75rem 1rem; background: var(--accent-light); border-radius: 16px; flex-wrap: wrap; border: 1px solid rgba(14, 165, 233, 0.2); }
.batch-bar .batch-info { font-size: 0.875rem; font-weight: 500; color: var(--accent); }

/* ---------- 设置卡片 ---------- */
.setting-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow-card); }
.setting-card .setting-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.setting-card .setting-label { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.setting-card .setting-desc { font-size: 0.8125rem; color: var(--text-secondary); margin-bottom: 0.75rem; }
.setting-card .setting-value { font-size: 1.5rem; font-weight: 700; color: var(--accent); }

/* ---------- 图表容器 ---------- */
.chart-container { position: relative; height: 260px; width: 100%; margin-bottom: 0; }
.chart-container-sm { position: relative; height: 220px; width: 100%; }
.chart-range { display: flex; align-items: center; gap: 0.5rem; }
.chart-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 1.25rem; margin-bottom: 1rem; box-shadow: var(--shadow-card); }
.chart-card .chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; flex-wrap: wrap; gap: 0.5rem; }
.chart-card .chart-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }

/* ---------- 仪表盘信息架构 ---------- */
.dashboard-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.25rem; }
.dashboard-intro h3 { font-size: clamp(1.35rem, 2vw, 1.75rem); line-height: 1.25; margin-bottom: 0.35rem; }
.dashboard-intro p:not(.dashboard-eyebrow) { max-width: 720px; color: var(--text-secondary); font-size: 0.875rem; }
.dashboard-eyebrow { margin-bottom: 0.35rem; color: var(--accent); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.dashboard-refresh { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; color: var(--text-muted); font-size: 0.75rem; }
.dashboard-alert { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 0.875rem 1rem; border: 1px solid rgba(220, 38, 38, 0.3); border-radius: 12px; background: rgba(220, 38, 38, 0.08); color: var(--danger); font-size: 0.875rem; }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.metric-card { position: relative; min-width: 0; padding: 1.1rem 1.2rem; overflow: hidden; border: 1px solid var(--border-subtle); border-radius: 14px; background: var(--bg-card); box-shadow: var(--shadow-card); }
.metric-card::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--text-muted); opacity: 0.6; }
.metric-card--success::before { background: var(--success); opacity: 1; }
.metric-card--accent::before { background: var(--accent); opacity: 1; }
.metric-card--warning::before { background: var(--warning); opacity: 1; }
.metric-card--danger::before { background: var(--danger); opacity: 1; }
.metric-label { display: block; margin-bottom: 0.35rem; color: var(--text-secondary); font-size: 0.8125rem; font-weight: 600; }
.metric-value { display: block; min-width: 0; overflow: hidden; color: var(--text-primary); font-size: clamp(1.5rem, 2.6vw, 2rem); font-variant-numeric: tabular-nums; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.metric-meta { display: block; margin-top: 0.5rem; color: var(--text-muted); font-size: 0.75rem; line-height: 1.45; }
.metric-meta b { color: var(--text-secondary); font-variant-numeric: tabular-nums; font-weight: 600; }
.metric-links { display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.metric-links button { min-height: 32px; padding: 0.2rem 0.45rem; border-radius: 7px; color: var(--text-secondary); font-size: 0.75rem; }
.metric-links button:hover { background: var(--accent-light); color: var(--accent); }

.section-header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-header-row .section-title { margin-bottom: 0.15rem; }
.section-description, .chart-description { color: var(--text-muted); font-size: 0.75rem; line-height: 1.45; }
.segmented-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.dashboard-date-input { width: auto; min-width: 142px; }
.daily-metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin-top: 1rem; border: 1px solid var(--border-subtle); border-radius: 12px; overflow: hidden; background: var(--bg-primary); }
.daily-metric-grid > div { min-width: 0; padding: 0.875rem 1rem; border-right: 1px solid var(--border-subtle); }
.daily-metric-grid > div:last-child { border-right: 0; }
.daily-metric-grid span { display: block; color: var(--text-muted); font-size: 0.75rem; }
.daily-metric-grid strong { display: block; margin-top: 0.2rem; overflow: hidden; color: var(--text-primary); font-size: 1.125rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-chart-grid { display: grid; grid-template-columns: minmax(300px, 5fr) minmax(480px, 7fr); gap: 1rem; }
.dashboard-chart-grid .chart-card { min-width: 0; }
.chart-card .chart-header > div:first-child { min-width: 0; }
.chart-card .chart-title { margin: 0; }
.chart-description { margin-top: 0.2rem; }
.chart-caption { margin-top: 0.75rem; color: var(--text-muted); font-size: 0.75rem; line-height: 1.5; }
.dashboard-state { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem; padding: 1.5rem; border: 1px dashed var(--border-hover); border-radius: 12px; background: var(--bg-primary); color: var(--text-muted); text-align: center; font-size: 0.8125rem; }
.dashboard-state strong { color: var(--text-secondary); font-size: 0.9375rem; }
.dashboard-state--loading { position: relative; overflow: hidden; }
.dashboard-state--loading::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(var(--accent-rgb), 0.08) 50%, transparent 80%); transform: translateX(-100%); animation: dashboardShimmer 1.4s ease-in-out infinite; }
.dashboard-state--error { color: var(--danger); }
.inline-error { margin-top: 0.75rem; color: var(--danger); font-size: 0.8125rem; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
@keyframes dashboardShimmer { to { transform: translateX(100%); } }

@media (max-width: 1100px) {
  .dashboard-chart-grid { grid-template-columns: 1fr; }
  .daily-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .daily-metric-grid > div:nth-child(3) { border-right: 0; }
  .daily-metric-grid > div:nth-child(-n+3) { border-bottom: 1px solid var(--border-subtle); }
}

@media (max-width: 767px) {
  .dashboard-intro { align-items: flex-start; flex-direction: column; gap: 0.75rem; }
  .dashboard-refresh { width: 100%; justify-content: space-between; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
  .metric-card { padding: 1rem; }
  .metric-value { font-size: 1.4rem; }
  .metric-links button { min-height: 44px; }
  .section-header-row { align-items: flex-start; }
  .segmented-actions { width: 100%; }
  .dashboard-date-input { flex: 1 1 142px; }
  .chart-range { width: 100%; }
  .chart-range .btn { flex: 1; }
}

@media (max-width: 479px) {
  .metric-grid { grid-template-columns: 1fr; }
  .daily-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-metric-grid > div { border-right: 1px solid var(--border-subtle); border-bottom: 1px solid var(--border-subtle); }
  .daily-metric-grid > div:nth-child(2n) { border-right: 0; }
  .daily-metric-grid > div:nth-last-child(-n+2) { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-state--loading::after { animation: none; }
}

/* ---------- 额外工具类 ---------- */
.mono { font-family: 'Courier New', monospace; letter-spacing: 0.5px; }
[x-cloak] { display: none !important; }
.mt-1 { margin-top: 0.75rem; }
.mb-1 { margin-bottom: 0.75rem; }
.text-center { text-align: center; }

/* ---------- Toast 通知 ---------- */
.toast { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 12px; margin-bottom: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); font-size: 14px; animation: fadeIn 0.3s ease; }
.toast-success { background: var(--success, #10b981); color: #fff; }
.toast-error { background: var(--danger, #ef4444); color: #fff; }
.toast-warning { background: var(--warning, #f59e0b); color: #fff; }
.toast-info { background: var(--info, #3b82f6); color: #fff; }
[data-theme="dark"] .toast-success, [data-theme="dark"] .toast-error, [data-theme="dark"] .toast-warning, [data-theme="dark"] .toast-info { color: #0f172a; }
.toast-icon { font-size: 16px; }
.toast-message { flex: 1; }

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-10px); }
}

/* ---------- 确认步骤 ---------- */
.confirm-step { padding: 0.75rem; background: var(--bg-primary); border-radius: 12px; margin-bottom: 0.75rem; border-left: 3px solid var(--warning); }
.confirm-step .step-label { font-size: 0.8125rem; font-weight: 600; color: var(--warning); margin-bottom: 0.5rem; }

/* ---------- 响应式 ---------- */
@media (max-width: 767px) {
  .admin-layout { display: block; min-height: 100dvh; }
  .sidebar { position: sticky; top: 0; z-index: 900; width: 100%; height: auto; min-height: var(--mobile-header-height); display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 0.5rem; padding: 0.5rem 0.75rem; border-right: none; border-bottom: 1px solid var(--border-subtle); box-shadow: 0 3px 14px rgba(0, 0, 0, 0.08); }
  .sidebar-header { min-width: 0; min-height: 0; padding: 0; border: 0; background: transparent; }
  .sidebar-logo { width: 36px; height: 36px; }
  .sidebar-brand-copy h2 { overflow: hidden; color: var(--text-primary); font-size: 0.9375rem; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-brand-copy span { display: none; }
  .mobile-menu-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem; min-width: 44px; min-height: 44px; padding: 0.5rem; border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--bg-card-hover); color: var(--text-primary); font-size: 0.75rem; }
  .sidebar-nav { display: none; position: absolute; top: calc(100% + 1px); right: 0; left: 0; max-height: calc(100dvh - var(--mobile-header-height)); padding: 0.75rem; overflow-y: auto; border-bottom: 1px solid var(--border-subtle); background: var(--bg-card); box-shadow: 0 14px 28px rgba(0, 0, 0, 0.15); }
  .sidebar.is-mobile-open .sidebar-nav { display: flex; }
  .nav-item { min-height: 44px; padding: 0.7rem 0.875rem; }
  .sidebar-footer { min-width: 0; padding: 0; border: 0; }
  .sidebar-user { display: none; }
  .sidebar-footer-actions { display: flex; gap: 0.35rem; }
  .sidebar-action { min-width: 44px; min-height: 44px; padding: 0.5rem; }
  .sidebar-action span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .mobile-nav-scrim { display: block; position: fixed; z-index: 899; inset: var(--mobile-header-height) 0 0; width: 100%; border: 0; background: rgba(0, 0, 0, 0.32); cursor: default; }
  .top-bar { position: relative; align-items: flex-start; padding: 0.875rem 1rem; }
  .top-bar h1 { display: flex; align-items: center; }
  .top-actions { width: 100%; }
  .top-actions > span { display: flex; width: 100%; gap: 0.5rem; flex-wrap: wrap; }
  .top-actions > span .btn, .top-actions > .btn { flex: 1 1 140px; }
  .tab-panel { padding: 1rem; }
  .section-card, .chart-card, .setting-card { padding: 1rem; border-radius: 14px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 0.75rem; }
  .stat-card { min-width: 0; padding: 0.875rem 0.5rem; border-radius: 14px; }
  .license-summary { gap: 0; }
  .license-summary .stat-card { padding: 0.875rem 1rem; border-radius: 0; }
  .stat-value { overflow: hidden; font-size: 1.375rem; text-overflow: ellipsis; }
  .btn-sm { min-height: 44px; }
  .filter-bar { align-items: stretch; gap: 0.625rem; padding: 0.75rem; }
  .filter-control { min-width: 0; flex: 1 1 calc(50% - 0.3125rem); }
  .filter-control--grow { min-width: 0; flex: 1 1 100%; }
  .filter-actions { width: 100%; }
  .filter-actions .btn { flex: 1; }
  .filter-bar > .form-input, .filter-bar > .filter-input, .filter-bar > .filter-select { flex: 1 1 140px; min-width: 0; }
  .filter-control .form-input, .filter-control .filter-input, .filter-control .filter-select { width: 100%; min-width: 0; min-height: 44px; flex: 0 0 auto; }
  .filter-bar .btn { flex: 1 0 auto; }
  .batch-bar { padding: 0.75rem; }
  .batch-bar .batch-info { flex-basis: 100%; }
  .table-wrapper { margin-right: 0; border-radius: 12px; }
  .table-wrapper[role="region"]::before { content: '左右滑动查看完整表格'; position: sticky; left: 0; z-index: 2; display: block; width: max-content; margin: 0.5rem 0.75rem 0; padding: 0.2rem 0.5rem; border: 1px solid var(--border-subtle); border-radius: 999px; background: var(--bg-card); color: var(--text-muted); font-size: 0.6875rem; line-height: 1.5; pointer-events: none; }
  .data-table { min-width: 680px; }
  .data-table th, .data-table td { white-space: nowrap; }
  .data-table th { padding: 0.625rem 0.75rem; }
  .data-table td { padding: 0.625rem 0.75rem; }
  .actions-cell { min-width: 150px; }
  .copy-button, .note-button { min-height: 44px; }
  .pagination { justify-content: space-between; gap: 0.625rem; padding: 0.75rem; }
  .pagination-summary, .pagination-controls { width: 100%; justify-content: space-between; }
  .pagination-controls { justify-content: flex-start; }
  .pagination-jump { margin-left: auto; }
  .pagination-select, .pagination-input, .pagination-current { min-height: 44px; }
  .pagination .page-info { white-space: nowrap; }
  .modal-overlay { align-items: flex-end; }
  .modal-dialog, .modal { width: 100%; max-width: none; max-height: calc(100dvh - 0.5rem); margin: 0; border-width: 1px 0 0; border-radius: 20px 20px 0 0; }
  .modal-header { position: sticky; top: 0; z-index: 1; padding: 1rem; background: var(--bg-card); }
  .modal-body { padding: 1rem; overflow-x: auto; }
  .modal-body .data-table { min-width: 560px; }
  .modal-footer { position: sticky; bottom: 0; z-index: 1; padding: 0.75rem 1rem max(0.75rem, env(safe-area-inset-bottom)); background: var(--bg-card); }
  .modal-footer .btn { flex: 1; }
  .form-row { flex-direction: column; gap: 0; }
  .form-row .form-group { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-actions .btn { flex: 1; }
  .chart-container { height: 220px; }
  #toast-container { top: max(0.75rem, env(safe-area-inset-top)) !important; right: 0.75rem !important; left: 0.75rem !important; }
  .toast { width: 100%; }
  .login-wrapper, .reset-wrapper { min-height: 100dvh; align-items: flex-start; padding: max(1rem, env(safe-area-inset-top)) 1rem 1rem; }
  .login-card, .reset-card { margin-top: max(1.5rem, 10dvh); padding: 1.5rem; border-radius: 16px; }
  .login-logo { width: 54px; height: 54px; }
}

@media (max-width: 380px) {
  .mobile-menu-label { display: none; }
  .pagination { flex-wrap: wrap; justify-content: center; }
  .pagination-controls { justify-content: center; }
  .pagination-jump { width: 100%; margin-left: 0; justify-content: center; order: 3; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
