/* === 全民盘口管理控制台 === */
:root {
  --sidebar-w: 172px;
  --sidebar-collapsed: 72px;
  --primary: #1a56db;
  --primary-dark: #1341b0;
  --primary-light: #e8effd;
  --bg-main: #f1f3f6;
  --bg-card: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-card: 0 1px 2px rgba(0,0,0,.04), 0 1px 3px rgba(0,0,0,.06);
  --shadow-elevated: 0 4px 12px rgba(0,0,0,.07);
  --radius: 10px;
  --radius-sm: 6px;
  --green: #059669;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --accent: #1a56db;
  --orange: #f59e0b;
  --bg-secondary: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
}

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #0f172a;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width .25s ease;
  overflow: hidden;
}
.sidebar-header {
  padding: 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.05);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
}
.sidebar-logo {
  width: 34px;
  height: 34px;
  background: var(--primary);
  border-radius: 8px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex-shrink: 0;
}
.sidebar-title {
  color: #f1f5f9;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: .3px;
}
.sidebar-subtitle {
  font-size: 9.5px;
  color: #475569;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 6px;
}
.sidebar-nav::-webkit-scrollbar { width: 2px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); border-radius: 10px; }
.nav-section { margin-bottom: 2px; }
.nav-section-title {
  font-size: 9.5px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 8px 9px 3px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px !important;
  border-radius: 6px;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item:hover { background: rgba(255,255,255,.04); color: #cbd5e1; }
.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
}
.nav-item i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.sidebar-footer {
  padding: 10px 8px;
  border-top: 1px solid rgba(255,255,255,.05);
}
.sidebar-footer .nav-item { font-size: 12px; color: #475569; }

/* ===== Main ===== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0; /* 允许 flex 子项收缩，防止表格等内容撑破页面（table-wrap 内部滚动） */
}

/* ===== Top Bar ===== */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 10px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(8px);
}
.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.topbar-breadcrumb {
  font-size: 11px;
  color: var(--text-muted);
}
.topbar-breadcrumb span { color: var(--text-secondary); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-clock { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  padding: 3px 8px 3px 3px;
  border-radius: 6px;
  cursor: pointer;
}
.topbar-user:hover { background: var(--border-light); }
.topbar-avatar {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

/* ===== Content Area ===== */
.content { padding: 22px 28px; flex: 1; }
.page-section { min-width: 0; display: none; }
.page-section.active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.card-body { padding: 18px 20px; }
.card-body-sm { padding: 12px 20px; }

/* ===== Stat Cards ===== */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px 18px;
  transition: box-shadow .15s, transform .15s;
}
.stat-card:hover {
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}
.stat-card .stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  margin-bottom: 10px;
  color: var(--text-secondary);
  background: var(--border-light);
}
.stat-card .stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 3px;
}
.stat-card .stat-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.3px;
}
.stat-card .stat-change { font-size: 11px; margin-top: 3px; font-weight: 500; }
.stat-card .stat-change.up { color: var(--green); }
.stat-card .stat-change.down { color: var(--red); }

/* ===== Tables ===== */
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table-wrap th {
  background: #f8fafc;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 9px 14px;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.table-wrap td { padding: 9px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: #fafbfc; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: var(--green-bg); color: var(--green); }
.badge-warning { background: var(--amber-bg); color: var(--amber); }
.badge-danger { background: var(--red-bg); color: var(--red); }
.badge-info { background: var(--blue-bg); color: var(--blue); }
.badge-neutral { background: var(--border-light); color: var(--text-secondary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: all .12s;
  border: none;
  line-height: 1.4;
  white-space: nowrap;
}
.btn-sm { padding: 3px 9px; font-size: 11.5px; }
.btn-xs { padding: 2px 6px; font-size: 10px; border-radius: 4px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { background: var(--border-light); color: var(--text-primary); }

/* ===== Forms - Modern UI ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

/* ---- Inputs / Selects / Textareas ---- */
.input, .form-input, .form-select, .form-textarea {
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 9px 12px !important;
  width: 100%;
  font-size: 13px;
  background: #fff !important;
  transition: all .2s ease !important;
  outline: none !important;
  color: var(--text-primary);
  line-height: 1.5;
}
.form-input:hover, .form-select:hover, .form-textarea:hover {
  border-color: #cbd5e1;
}
.input:focus, .form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1), 0 1px 2px rgba(0,0,0,.04);
  background: #fff !important;
}
.form-input::placeholder, .form-textarea::placeholder {
  color: #cbd5e1;
  font-weight: 400;
}

/* ---- Select (enhanced dropdown) ---- */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
  cursor: pointer;
}
.form-select:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231a56db' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
}

/* ---- Textarea ---- */
.form-textarea { min-height: 72px; resize: vertical; line-height: 1.6; }

/* ---- Date & Time Inputs ---- */
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="month"],
input[type="week"] {
  appearance: none;
  -webkit-appearance: none;
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 7px 9px !important;
  width: 100%;
  font-size: 13px !important;
  font-family: inherit;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E") no-repeat right 10px center;
  background-size: 16px;
  padding-right: 36px;
  transition: all .2s ease !important;
  outline: none !important;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 38px;
}
input[type="date"]:hover,
input[type="datetime-local"]:hover,
input[type="time"]:hover,
input[type="month"]:hover {
  border-color: #cbd5e1;
}
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
input[type="month"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1), 0 1px 2px rgba(0,0,0,.04);
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 20px;
  height: 20px;
  margin-left: -20px;
  cursor: pointer;
}

/* ---- Search Input ---- */
input[type="search"] {
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 8px 12px 8px 36px;
  width: 100%;
  font-size: 13px !important;
  font-family: inherit;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat left 12px center;
  background-size: 16px;
  transition: all .2s ease !important;
  outline: none !important;
  color: var(--text-primary);
}
input[type="search"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}

/* ---- Number Input ---- */
input[type="number"] {
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 7px 9px !important;
  width: 100%;
  font-size: 13px;
  font-family: inherit;
  transition: all .2s ease !important;
  outline: none !important;
  color: var(--text-primary);
  -moz-appearance: textfield;
}
input[type="number"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---- Input Group (icon + input) ---- */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group .input-icon {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}
.input-group .form-input,
.input-group input[type="date"],
.input-group input[type="datetime-local"],
.input-group input[type="search"],
.input-group input[type="number"] {
  padding-left: 36px;
}

/* ---- Filter Bar (upgraded) ---- */
.filter-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  border-radius: 10px;
}
.filter-bar .form-input,
.filter-bar .form-select,
.filter-bar input[type="date"],
.filter-bar input[type="datetime-local"] {
  width: auto;
  min-width: 140px;
  padding: 6px 10px;
  font-size: 12px;
  background: #fff !important;
}

/* ---- Checkbox & Radio ---- */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 4px;
  outline: none !important;
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
  flex-shrink: 0;
  background: #fff !important;
  margin: 0;
}
input[type="checkbox"]:hover {
  border-color: var(--primary);
}
input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 50%;
  outline: none !important;
  cursor: pointer;
  transition: all .15s ease;
  position: relative;
  flex-shrink: 0;
  background: #fff !important;
  margin: 0;
}
input[type="radio"]:hover {
  border-color: var(--primary);
}
input[type="radio"]:checked {
  border-color: var(--primary);
  border-width: 5px;
}
input[type="radio"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

/* ---- Toggle Switch ---- */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.toggle-track {
  width: 38px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 11px;
  transition: all .2s ease !important;
  position: relative;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff !important;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.toggle-switch input { display: none; }
.toggle-switch input:checked + .toggle-track {
  background: var(--primary);
}
.toggle-switch input:checked + .toggle-track::after {
  transform: translateX(16px);
}

/* ---- Color Input ---- */
input[type="color"] {
  width: 42px;
  height: 38px;
  border: 1.5px solid var(--border) !important;
  border-radius: 8px !important;
  padding: 2px;
  cursor: pointer;
  background: #fff !important;
  outline: none;
}
input[type="color"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.1);
}

/* ---- Range Slider ---- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e2e8f0;
  outline: none !important;
  transition: background .2s;
  margin: 6px 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(26,86,219,.3);
  transition: transform .15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

/* ---- Disabled state ---- */
.form-input:disabled,
.form-select:disabled,
.form-textarea:disabled,
input[type="date"]:disabled,
input[type="datetime-local"]:disabled,
input[type="number"]:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: .7;
}

/* ---- Readonly state ---- */
.form-input[readonly],
input[type="date"][readonly],
input[type="datetime-local"][readonly] {
  background: #f8fafc;
  cursor: default;
}

/* ---- Error state ---- */
.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220,38,38,.08);
}
.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220,38,38,.12);
}

/* ---- Small variant for compact layouts ---- */
.form-input-sm, .form-select-sm {
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 6px;
}

/* ---- File Input ---- */
input[type="file"] {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 0;
}
input[type="file"]::file-selector-button {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  margin-right: 10px;
}
input[type="file"]::file-selector-button:hover {
  background: var(--border-light);
  border-color: #cbd5e1;
}

/* ===== Filter Bar (responsive) ===== */
@media (max-width: 768px) {
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
  }
  .filter-bar .form-input,
  .filter-bar .form-select,
  .filter-bar input[type="date"],
  .filter-bar input[type="datetime-local"] {
    width: 100%;
    min-width: unset;
  }
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(2px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  animation: modalIn .15s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  width: 26px; height: 26px; border-radius: 5px; border: none;
  background: transparent; cursor: pointer; display: flex;
  align-items: center; justify-content: center; color: var(--text-muted); transition: all .12s;
}
.modal-close:hover { background: var(--border-light); color: var(--text-primary); }
.modal-body { padding: 18px 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ===== Spinner ===== */
.spinner {
  border: 2.5px solid var(--border-light);
  border-top: 2.5px solid var(--primary);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 36px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 32px; margin-bottom: 10px; opacity: .35; }
.empty-state p { font-size: 13px; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar-title, .sidebar-subtitle, .nav-section-title, .nav-item span { display: none; }
  .main { margin-left: var(--sidebar-collapsed); }
  .content { padding: 14px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .form-input, .filter-bar .form-select { width: 100%; }
  .topbar { padding: 8px 14px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-title { font-size: 18px; font-weight: 700; }
.page-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ===== Config Rows ===== */
.config-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.config-row:last-child { border-bottom: none; }
.config-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.config-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* ===== 小屏适配（PWA 手机端） ===== */
@media (max-width: 768px) {
  .topbar-right { gap: 6px; }
  .topbar-clock { display: none; }
  .topbar-breadcrumb { display: none; }
  #admin-name { display: none; }
  /* 按钮只保留图标，隐藏文字 */
  #btn-desktop-push { font-size: 0 !important; padding: 2px 8px !important; }
  #btn-desktop-push i { font-size: 14px !important; }
  #btn-voice-alert { font-size: 0 !important; padding: 2px 8px !important; }
  #btn-voice-alert i { font-size: 14px !important; }
  .topbar-right .btn-outline { font-size: 0 !important; padding: 2px 8px !important; }
  .topbar-right .btn-outline i { font-size: 14px !important; }
  .topbar-avatar { width: 26px !important; height: 26px !important; font-size: 12px !important; }
  #logout-btn { padding: 2px 6px !important; }
  .sidebar-header { padding: 10px 8px !important; }
  .sidebar-logo { margin: 0 auto !important; }
}
@media (max-width: 480px) {
  .content { padding: 10px !important; }
  .topbar { padding: 6px 10px !important; }
}


/* ===== 2026-08-23 升级：深色模式 + 移动端适配 ===== */
html.dark {
  --bg-main: #0b1220;
  --bg-card: #141d30;
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #5b6b83;
  --border: #24344d;
  --border-light: #1d2a42;
  --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.45);
  --shadow-elevated: 0 4px 12px rgba(0,0,0,.5);
  --primary-light: rgba(26,86,219,.18);
  --accent: #60a5fa;
  --orange: #fbbf24;
  --bg-secondary: #1a2438;
  --card-bg: #141d30;
  --text: #e2e8f0;
  --green-bg: rgba(5,150,105,.12);
  --red-bg: rgba(220,38,38,.12);
  --amber-bg: rgba(217,119,6,.12);
  --blue-bg: rgba(37,99,235,.12);
}
html.dark .topbar { background: rgba(20,29,48,.92); }
html.dark .sidebar { background: #0a1120; }
html.dark input, html.dark select, html.dark textarea { background: #0f1830; color: var(--text-primary); border-color: var(--border); }
html.dark .input, html.dark .form-input, html.dark .form-select, html.dark .form-textarea {
  background: #0f1830 !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}
html.dark .input:focus, html.dark .form-input:focus, html.dark .form-select:focus, html.dark .form-textarea:focus {
  background: #0f1830 !important;
  border-color: var(--primary) !important;
}
html.dark .form-input::placeholder, html.dark .form-textarea::placeholder,
html.dark input::placeholder, html.dark textarea::placeholder { color: #5b6b83; }
html.dark select option { background: #141d30; color: #e2e8f0; }
html.dark .table-wrap table th { background: #101a30; }
html.dark .stat-card { background: var(--bg-card); }
html.dark .nav-item:hover, html.dark .topbar-user:hover { background: rgba(255,255,255,.05); }

#btn-sidebar-toggle {
  display: none; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; background: transparent;
  color: var(--text-secondary); border-radius: 6px; cursor: pointer; font-size: 15px;
}
#btn-sidebar-toggle:hover { background: var(--border-light); }
#btn-dark-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary);
  border-radius: 6px; cursor: pointer; font-size: 14px;
}
#btn-dark-toggle:hover { border-color: var(--primary); color: var(--primary); }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 99; }
.sidebar-backdrop.show { display: block; }

@media (max-width: 900px) {
  /* 抽屉模式显示完整导航文字（2026-08-23 修复：768px 折叠规则误隐藏按钮名称） */
  .sidebar-title, .sidebar-subtitle, .nav-section-title { display: block; }
  .nav-item span { display: inline; }
  .sidebar-header { padding: 12px 14px !important; }
  .sidebar-logo { margin: 0 !important; }
  .sidebar { transform: translateX(-100%); width: 192px; transition: transform .28s ease; }
  .sidebar.open { transform: translateX(0); box-shadow: 6px 0 28px rgba(0,0,0,.35); }
  .main { margin-left: 0 !important; }
  .topbar { padding: 8px 14px; }
  #btn-sidebar-toggle { display: inline-flex; }
  .topbar-breadcrumb { display: none; }
  .topbar-clock { display: none; }
  .topbar-right { gap: 8px; }
  .content { padding: 12px; }
}

/* 阶段2：仪表盘待办横幅深色适配 */
html.dark #dash-todo > div { background: linear-gradient(135deg, rgba(220,38,38,.14), rgba(217,119,6,.10)) !important; }
html.dark #dash-todo { border-color: rgba(220,38,38,.25); }
