/* bank-user admin — refined UI */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary:        #6366f1;
  --primary-hover:  #4f46e5;
  --primary-light:  #eef2ff;
  --danger:         #ef4444;
  --danger-light:   #fef2f2;
  --success:        #10b981;
  --border:         #e5e7eb;
  --border-focus:   #6366f1;
  --bg:             #f5f6fa;
  --bg-white:       #ffffff;
  --text:           #111827;
  --text-secondary: #6b7280;
  --sidebar-bg:     #0f172a;
  --sidebar-hover:  rgba(255,255,255,.07);
  --sidebar-active: #6366f1;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg:      0 20px 48px rgba(0,0,0,.14), 0 8px 16px rgba(0,0,0,.06);
  --radius:         0.5rem;
  --radius-sm:      0.375rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 0.9rem;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── page layout ─────────────────────────────── */

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-narrow  { max-width: 42rem; }
.page-medium  { max-width: 52rem; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  position: relative;
  padding: 1.125rem 1.25rem 1.125rem 1.5rem;
  background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
  border: 1px solid #eef0f3;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(99, 102, 241, 0.06);
  overflow: hidden;
}
/* 左侧彩色装饰条 */
.page-header::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #6366f1 0%, #8b5cf6 100%);
}
/* 右上角柔和光斑 */
.page-header::after {
  content: '';
  position: absolute;
  top: -40%;
  right: -10%;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.10) 0%, rgba(139, 92, 246, 0) 70%);
  pointer-events: none;
}

.page-title {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  position: relative;
  z-index: 1;
}
/* 可选：标题前的图标徽章 <i class="page-title-icon fa fa-..."></i> */
.page-title-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
/* 可选：标题下方副标题 */
.page-subtitle {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-secondary);
  letter-spacing: 0;
}
.page-title-block {
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

/* ── buttons ─────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.8375rem;
  font-weight: 500;
  line-height: 1.25rem;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(99,102,241,.35);
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(99,102,241,.4);
}

.btn-outline {
  background: var(--bg-white);
  color: var(--text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover:not(:disabled) {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 0.25rem 0.5rem;
  box-shadow: none;
}
.btn-danger:hover:not(:disabled) { color: #b91c1c; text-decoration: underline; }

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-success {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
  box-shadow: 0 1px 3px rgba(16,185,129,.35);
}
.btn-success:hover:not(:disabled) {
  background: #059669;
  border-color: #059669;
  box-shadow: 0 2px 8px rgba(16,185,129,.4);
}

.btn-warning {
  background: #f97316;
  color: #fff;
  border-color: #f97316;
  box-shadow: 0 1px 3px rgba(249,115,22,.35);
}
.btn-warning:hover:not(:disabled) {
  background: #ea6c0a;
  border-color: #ea6c0a;
  box-shadow: 0 2px 8px rgba(249,115,22,.4);
}

.btn-link {
  color: var(--primary);
  border: none;
  background: none;
  padding: 0.25rem 0.5rem;
  font-size: 0.8375rem;
  box-shadow: none;
}
.btn-link:hover { text-decoration: underline; }

/* ── card ────────────────────────────────────── */

.card {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* ── form ────────────────────────────────────── */

.form-stack { display: flex; flex-direction: column; gap: 1.1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.label {
  font-size: 0.8375rem;
  font-weight: 500;
  color: #374151;
}

.input,
select.input {
  width: 100%;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  background: var(--bg-white);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.input:focus,
select.input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

.input::placeholder { color: #9ca3af; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.form-hint {
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.4;
}
.form-hint code {
  padding: 0 0.3em;
  background: #eef2ff;
  border-radius: 3px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
}

.form-tip {
  background: #f6f9ff;
  border: 1px solid #d6e4ff;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.5;
}
.form-tip-title { font-weight: 600; margin-bottom: 0.3rem; color: #1e40af; }
.form-tip-list { margin: 0; padding-left: 1.2rem; }
.form-tip-list li { margin: 0.15rem 0; }
.form-tip-list code,
.form-tip-table code {
  padding: 0 0.3em;
  background: #eaf1ff;
  border-radius: 3px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.85em;
}
.form-tip-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.35rem;
  font-size: 0.8rem;
}
.form-tip-table th,
.form-tip-table td {
  border: 1px solid #d6e4ff;
  padding: 0.3rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.form-tip-table th { background: #eaf1ff; font-weight: 500; }

/* ── filter bar ──────────────────────────────── */

.filter-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  align-items: end;
}

.filter-bar-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 768px) {
  .filter-bar, .filter-bar-5 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .filter-bar, .filter-bar-5 { grid-template-columns: 1fr; }
}

.filter-actions {
  display: flex;
  gap: 0.5rem;
}

.filter-actions .btn { flex: 1; }

/* ── table ───────────────────────────────────── */

.table-wrap {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8375rem;
}

.data-table thead tr {
  border-bottom: 2px solid var(--border);
}

.data-table th {
  text-align: left;
  padding: 0.8rem 1rem;
  background: #fafafa;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.data-table td {
  padding: 0.85rem 1rem;
  border-top: 1px solid #f1f3f5;
  vertical-align: middle;
  color: var(--text);
}

.data-table tbody tr {
  transition: background 0.1s;
}

.data-table tbody tr:hover { background: #fafbff; }

.cell-sub { font-size: 0.75rem; color: #9ca3af; margin-top: 0.2rem; }

.cell-truncate {
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-actions { white-space: nowrap; }

.text-center { text-align: center; }
.text-muted   { color: var(--text-secondary); }

/* ── picker ──────────────────────────────────── */

.picker-box {
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  background: #f9fafb;
  transition: border-color 0.15s;
}
.picker-box:hover { border-color: #a5b4fc; }

.picker-summary { font-size: 0.8375rem; color: var(--text-secondary); margin-bottom: 0.6rem; }
.picker-summary strong { color: var(--text); font-weight: 600; }

/* ── modal ───────────────────────────────────── */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  z-index: 40;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.open { display: flex; }
.modal.modal-nested { z-index: 50; }

.modal-panel {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 56rem;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modal-in .18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal-panel-form { max-width: 40rem; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.modal-close {
  border: none;
  background: none;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  transition: background 0.1s, color 0.1s;
}
.modal-close:hover { background: #f3f4f6; color: var(--text); }

.modal-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  background: #fafafa;
}

.modal-body {
  overflow: auto;
  flex: 1;
}

.modal-body-form {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

/* ── detail rows ─────────────────────────────── */

.detail-row {
  display: flex;
  gap: 0.75rem;
  padding: 0.45rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f3f5;
}
.detail-row:last-child { border-bottom: none; }

.detail-label {
  width: 9rem;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.detail-value {
  flex: 1;
  word-break: break-all;
  font-weight: 500;
}

.code-block {
  margin: 0;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ── detail sections / money cards / stat chips (shared) ─────── */

.detail-section { margin-bottom: 1.25rem; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #6366f1;
  margin: 0 0 0.625rem;
  padding-left: 0.5rem;
  border-left: 3px solid #6366f1;
  letter-spacing: 0.5px;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem 1rem;
  background: #f9fafb;
  border: 1px solid #eef0f3;
  border-radius: 8px;
  padding: 0.875rem 1rem;
}
.detail-grid .detail-row {
  border-bottom: none;
  padding: 0.375rem 0;
  display: flex;
  align-items: center;
}
.detail-grid .detail-label {
  width: 6.5rem;
  font-size: 0.8125rem;
  color: #6b7280;
}
.detail-grid .detail-value {
  flex: 1;
  font-weight: 500;
  color: #111827;
  word-break: break-all;
}
.detail-grid .detail-row.full { grid-column: 1 / -1; }

/* 金额高亮卡片 */
.money-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}
.money-cards.cols-1 { grid-template-columns: 1fr; }
.money-cards.cols-3 { grid-template-columns: repeat(3, 1fr); }
.money-cards.cols-4 { grid-template-columns: repeat(4, 1fr); }
.money-card {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border-radius: 10px;
  padding: 0.875rem 1rem;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}
.money-card-amber {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}
.money-card-emerald {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}
.money-card-slate {
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  box-shadow: 0 4px 12px rgba(100, 116, 139, 0.25);
}
.money-card-label {
  font-size: 0.75rem;
  opacity: 0.9;
  margin-bottom: 0.25rem;
  letter-spacing: 0.5px;
}
.money-card-value {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  letter-spacing: 0.5px;
  line-height: 1.2;
}
.money-card-value .currency {
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.85;
  margin-right: 2px;
}
.money-card-sub {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-top: 0.25rem;
}

/* 统计 chip */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.625rem;
}
.stat-row.cols-2 { grid-template-columns: repeat(2, 1fr); }
.stat-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.stat-chip {
  text-align: center;
  padding: 0.625rem 0.5rem;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid #eef0f3;
}
.stat-chip-value {
  font-size: 1.125rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}
.stat-chip-label {
  font-size: 0.75rem;
  color: #6b7280;
  margin-top: 0.125rem;
}
.stat-chip-sub {
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 0.125rem;
}
.stat-chip.is-pending  .stat-chip-value { color: #f59e0b; }
.stat-chip.is-success  .stat-chip-value { color: #10b981; }
.stat-chip.is-failed   .stat-chip-value { color: #ef4444; }
.stat-chip.is-primary  .stat-chip-value { color: #6366f1; }

/* ── 金额内联样式（表格单元格里突出展示） ─────── */
.amount {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: 'SFMono-Regular', Consolas, Menlo, monospace;
  font-weight: 700;
  font-size: 0.95rem;
  color: #4f46e5;
  letter-spacing: 0.2px;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 6px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 1px solid rgba(99, 102, 241, 0.15);
}
.amount .amount-cur {
  font-size: 0.75rem;
  font-weight: 600;
  opacity: 0.7;
  margin-right: 1px;
}
.amount.amount-emerald {
  color: #047857;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%);
  border-color: rgba(16, 185, 129, 0.18);
}
.amount.amount-amber {
  color: #b45309;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.10) 0%, rgba(239, 68, 68, 0.08) 100%);
  border-color: rgba(245, 158, 11, 0.22);
}
.amount.amount-slate {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}
.amount.amount-zero {
  color: #94a3b8;
  background: #f8fafc;
  border-color: #eef2f7;
  font-weight: 600;
}

/* ── badge ───────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-running { background: #dbeafe; color: #1d4ed8; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-failed  { background: #fee2e2; color: #991b1b; }
.badge-default { background: #f3f4f6; color: #374151; }

/* ── pagination ──────────────────────────────── */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8375rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.pagination-actions { display: flex; gap: 0.5rem; align-items: center; }
.pagination-jump {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.pagination-jump-input {
  width: 4rem;
  padding: 0.3rem 0.45rem;
  text-align: center;
  font-size: 0.8375rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-white);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pagination-jump-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ── toast ───────────────────────────────────── */

#globalToast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
  max-width: 22rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
  color: #fff;
  display: none;
  animation: toast-in .2s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

#globalToast.show        { display: block; }
#globalToast.toast-success { background: #059669; }
#globalToast.toast-info    { background: #1e293b; }

/* ── error overlay ───────────────────────────── */

#errorOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

#errorOverlay.show { display: flex; }

.error-dialog {
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 22rem;
  padding: 1.75rem 1.5rem 1.5rem;
  text-align: center;
  animation: modal-in .18s ease;
}

.error-dialog-icon {
  width: 2.75rem;
  height: 2.75rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--danger-light);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
}

.error-dialog-title {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.error-dialog-msg {
  margin: 0 0 1.5rem;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--text-secondary);
  word-break: break-word;
}

.error-dialog .btn { min-width: 5rem; }

/* ── app shell ───────────────────────────────── */

body.shell-body {
  overflow: hidden;
  height: 100vh;
}

.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-sidebar {
  width: 14rem;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.04);
}

.app-sidebar-brand {
  padding: 1.35rem 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-bottom: 1px solid rgba(255,255,255,.07);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-sidebar-brand::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px rgba(99,102,241,.8);
}

.app-sidebar-nav {
  flex: 1;
  padding: 0.85rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  overflow-y: auto;
}

.app-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 0.875rem;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.app-sidebar-item i { font-size: 0.9rem; width: 1rem; text-align: center; flex-shrink: 0; }

.app-sidebar-item:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.app-sidebar-item.active {
  background: var(--sidebar-active);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99,102,241,.4);
}

/* 可折叠分组：辅助工具 / 超级管理员 */
.app-sidebar-group {
  margin-top: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(255,255,255,.06);
}

.app-sidebar-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.55rem 0.9rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.app-sidebar-group-toggle:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.app-sidebar-group-toggle i:first-child {
  font-size: 0.9rem;
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}

.app-sidebar-group-toggle .caret {
  margin-left: auto;
  font-size: 0.7rem;
  color: #64748b;
  transition: transform 0.15s;
}

.app-sidebar-group.open .app-sidebar-group-toggle .caret {
  transform: rotate(90deg);
}

.app-sidebar-group-items {
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0.15rem 0 0.2rem 0.9rem;
  padding-left: 0.55rem;
  border-left: 1px solid rgba(255,255,255,.08);
}

.app-sidebar-group.open .app-sidebar-group-items {
  display: flex;
}

.app-sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.07);
  font-size: 0.75rem;
  color: #64748b;
}

.app-sidebar-footer a {
  color: #94a3b8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.app-sidebar-footer .sidebar-user {
  color: #cbd5e1;
  font-weight: 500;
  margin: 0 0 0.5rem 0;
}

.app-sidebar-footer .sidebar-actions {
  margin-bottom: 0.75rem;
}

.app-sidebar-footer .sidebar-actions a {
  color: #cbd5e1;
  text-decoration: none;
  cursor: pointer;
}

.app-sidebar-footer .sidebar-actions a:hover {
  color: #fff;
  text-decoration: underline;
}

.app-sidebar-footer .sidebar-sep {
  margin: 0 0.4rem;
  color: #475569;
}

.app-main {
  flex: 1;
  min-width: 0;
  background: var(--bg);
}

.app-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: var(--bg);
}

/* ── embed mode ──────────────────────────────── */

html.embed body { background: var(--bg); }

html.embed .hide-in-embed { display: none !important; }

html.embed .page {
  max-width: none;
  padding: 1.5rem 1.75rem;
}

/* ── utils ───────────────────────────────────── */

.mt-4    { margin-top: 1rem; }
.hidden  { display: none !important; }

/* ── dashboard ───────────────────────────────── */

.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.dash-grid-3 { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1024px) {
  .dash-grid   { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .dash-grid, .dash-grid-3 { grid-template-columns: 1fr; }
}

.stat-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: box-shadow 0.15s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-label {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
}

.stat-card-sub {
  font-size: 0.775rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.stat-card-icon {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.stat-card--primary .stat-card-value { color: var(--primary); }
.stat-card--success .stat-card-value { color: var(--success); }
.stat-card--warning .stat-card-value { color: #f59e0b; }
.stat-card--danger  .stat-card-value { color: var(--danger); }

.dash-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 1.5rem 0 0.75rem;
}

/* ── 日期范围选择器（与数据看板一致的样式） ───────── */
.range-picker {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: nowrap;
}
.range-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.range-input-icon {
  position: absolute;
  left: .65rem;
  color: #94a3b8;
  font-size: .8rem;
  pointer-events: none;
}
.range-input.input {
  width: 15rem;
  padding-left: 2rem;
  padding-right: 1.85rem;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: .5rem;
  transition: border-color .15s, box-shadow .15s;
}
.range-input.input:hover,
.range-input.input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
  outline: none;
}
.range-input-clear {
  position: absolute;
  right: .5rem;
  background: transparent;
  border: 0;
  color: #cbd5e1;
  cursor: pointer;
  font-size: .9rem;
  padding: 0;
  line-height: 1;
  transition: color .15s;
}
.range-input-clear:hover { color: #ef4444; }
.flatpickr-calendar {
  box-shadow: 0 10px 32px rgba(15,23,42,.15), 0 2px 8px rgba(15,23,42,.06) !important;
  border-radius: .75rem !important;
  border: 1px solid var(--border) !important;
}

/* ── 美化的下拉框（带左侧图标 + 右侧自定义 caret） ─────── */
.select-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
}
.select-wrap-icon {
  position: absolute;
  left: .7rem;
  color: #94a3b8;
  font-size: .8rem;
  pointer-events: none;
  transition: color .15s;
}
.select-wrap-caret {
  position: absolute;
  right: .75rem;
  color: #94a3b8;
  font-size: .9rem;
  pointer-events: none;
  transition: color .15s, transform .15s;
}
.select-pretty {
  width: 100%;
  padding-left: 2rem !important;
  padding-right: 2rem !important;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: .5rem;
  font-weight: 500;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: none;
  transition: border-color .15s, box-shadow .15s;
}
.select-pretty:hover {
  border-color: #cbd5e1;
}
.select-pretty:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
  outline: none;
}
.select-wrap:hover .select-wrap-icon,
.select-wrap:hover .select-wrap-caret,
.select-wrap:focus-within .select-wrap-icon,
.select-wrap:focus-within .select-wrap-caret {
  color: #6366f1;
}

