﻿/**
 * 婧愪竴鏁欒偛 - 绠＄悊鍚庡彴 UI 澧炲己灞? * Tabler 椋庢牸璁捐澧炲己锛氭洿绮捐嚧鐨勯槾褰便€佸井浜や簰鍔ㄧ敾銆佽仛鐒︽€佷紭鍖? * 鍙犲姞鍦?admin.css 涔嬩笂锛屼笉鐮村潖鐜版湁鏍峰紡
 */

/* ============================================================
   1. Enhanced Shadows & Elevation System
   ============================================================ */
:root {
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.15);
  --ring-primary: 0 0 0 3px rgba(79, 70, 229, 0.15);

  /* ===== kb_admin / 闈㈡澘閫氱敤鍙橀噺锛堟ˉ鎺?admin.css 鏃у彉閲忓悕锛?==== */
  --color-bg: #F9FAFB;
  --color-surface: #FFFFFF;
  --color-surface-2: #F3F4F6;
  --color-surface-hover: #F3F4F6;
  --bg-secondary: #F3F4F6;
  --color-border: #D1D5DB;
  --color-text: #111827;
  --color-muted: #9CA3AF;
  --text-muted: #9CA3AF;
  --bg-tertiary: #E5E7EB;
  --color-primary: #4F46E5;
  --color-primary-bg: #EEF2FF;
  --color-primary-alpha: rgba(79, 70, 229, 0.12);
  --color-warning: #F59E0B;
  --color-warning-bg: #FFFBEB;
  --color-error: #EF4444;
  --color-danger: #EF4444;
}

body.dark {
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.4);
  --shadow-2xl: 0 25px 50px -12px rgba(0,0,0,0.5);

  /* Bridge variables 鈥?dark mode overrides */
  --color-bg: #0F1117;
  --color-surface: #1A1D27;
  --color-surface-2: #232736;
  --color-surface-hover: #262A36;
  --bg-secondary: #232736;
  --color-border: #2D3148;
  --color-text: #F3F4F6;
  --color-muted: #6B7280;
  --text-muted: #6B7280;
  --bg-tertiary: #2D3148;
  --color-primary-bg: #312E81;
  --color-warning-bg: #451A03;
}

/* ============================================================
   2. Card Enhancements - Tabler Premium Feel
   ============================================================ */
.card {
  transition: box-shadow 0.2s ease, transform 0.15s ease;
  position: relative;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.card:active {
  transform: translateY(0);
}

/* KPI cards — accent top bar */
.kpi-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), #38BDF8);
}
.kpi-value {
  background: linear-gradient(135deg, var(--color-primary), #38BDF8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
    Dashboard Compact Layout 鈥?绱у噾鍧囧寑缃戞牸
   妗岄潰: KPI 4鍒?鈫?鍥捐〃 3鍒?鈫?琛ㄦ牸 2鍒?   骞虫澘: 2鍒?鈫?2鍒?鈫?鍫嗗彔
   鎵嬫満: 2鍒?鈫?鍫嗗彔 鈫?鍫嗗彔
   ============================================================ */
/* KPI 琛?鈥?姣斿師鏉ョ殑鏇寸揣鍑?*/
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dash-kpi-row .kpi-card {
  padding: 16px 20px;
}
.dash-kpi-row .kpi-value {
  font-size: 24px;
}
.dash-kpi-row .kpi-label {
  font-size: 12px;
}

/* 鍥捐〃琛?鈥?鑷€傚簲 */
.dash-charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

/* 琛ㄦ牸琛?鈥?鑷€傚簲 */
.dash-tables-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

/* 缁熶竴鍗＄墖 鈥?鍐呴儴绱у噾 */
.dash-card .card-header {
  padding: 10px 14px;
}
.dash-card .card-title {
  font-size: 13px;
}
.dash-card .card-body {
  padding: 10px 14px;
}
.dash-card canvas {
  max-height: 200px;
}
.dash-card .data-table {
  font-size: 12px;
}
.dash-card .data-table th,
.dash-card .data-table td {
  padding: 6px 8px;
}

/* ===== 鍝嶅簲寮? 骞虫澘 (鈮?024px) ===== */
@media (max-width: 1024px) {
  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .dash-kpi-row .kpi-card {
    padding: 12px 14px;
  }
  .dash-kpi-row .kpi-value {
    font-size: 20px;
  }

  .dash-charts-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .dash-tables-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

/* ===== 鍝嶅簲寮? 鎵嬫満 (鈮?40px) ===== */
@media (max-width: 640px) {
  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .dash-kpi-row .kpi-card {
    padding: 10px 12px;
  }
  .dash-kpi-row .kpi-value {
    font-size: 18px;
  }

  .dash-charts-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dash-tables-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .dash-card .card-header {
    padding: 8px 12px;
  }
  .dash-card .card-body {
    padding: 8px 12px;
  }
}

/* ============================================================
   4. Button Refinements
   ============================================================ */
.btn {
  transition: all 0.15s ease;
  position: relative;
  letter-spacing: 0.01em;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring-primary);
}

.btn-primary {
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.2);
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-card);
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-light);
}

.btn-danger {
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
  transform: translateY(-1px);
}

/* ============================================================
   5. Form Control Enhancements
   ============================================================ */
.form-control {
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: var(--ring-primary);
}

.form-control:hover:not(:focus):not(:disabled) {
  border-color: var(--border-hover);
}

/* ============================================================
   6. Table Enhancements
   ============================================================ */
.data-table th {
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 12px 16px;
}

.data-table td {
  padding: 14px 16px;
}

.data-table tr {
  transition: background 0.1s ease;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ============================================================
   7. Badge / Tag Pill Enhancements
   ============================================================ */
.badge, .tag {
  transition: all 0.15s ease;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ============================================================
   8. Modal Refinements
   ============================================================ */
.modal-content {
  box-shadow: var(--shadow-2xl);
}

.modal-overlay {
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.4);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ============================================================
   9. Toast Refinements
   ============================================================ */
.toast {
  border-left: 3px solid transparent;
  padding: 12px 16px 12px 14px;
}

.toast-success {
  border-left-color: var(--color-success);
}

.toast-error {
  border-left-color: var(--color-danger);
}

.toast-info {
  border-left-color: var(--color-info);
}

.toast-warning {
  border-left-color: var(--color-warning);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   10. Pagination Refinements
   ============================================================ */
.page-btn {
  transition: all 0.15s ease;
  font-weight: 500;
}

.page-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.page-btn.active {
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

body.dark .page-btn:hover {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

/* ============================================================
   11. Tab Enhancements
   ============================================================ */
.tab-item {
  position: relative;
  transition: all 0.15s ease;
}

.tab-item::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
  transition: width 0.2s ease;
}

.tab-item.active::after {
  width: 60%;
}

/* ============================================================
   12. Login Page Enhancements
   ============================================================ */
.login-container {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 40%, #1a1a2e 100%);
  position: relative;
}

.login-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(79, 70, 229, 0.06) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(129, 140, 248, 0.04) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: rgba(30, 30, 50, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  animation: loginSlideUp 0.4s ease;
}

@keyframes loginSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.dark .login-card {
  background: rgba(26, 29, 39, 0.98);
  border-color: rgba(255, 255, 255, 0.05);
}

.login-card h2::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), #818cf8);
  border-radius: 2px;
  margin: 10px auto 0;
}

/* ============================================================
   13. Loading Overlay Enhancement
   ============================================================ */
#loading-overlay {
  background: rgba(15, 23, 42, 0.7);
}

.spinner {
  width: 36px;
  height: 36px;
  border-width: 3px;
  border-color: rgba(255, 255, 255, 0.1);
  border-top-color: var(--color-primary);
}

/* ============================================================
   14. Skeleton Enhancement
   ============================================================ */
.skeleton {
  border-radius: 8px;
}

/* ============================================================
   15. Scrollbar Refinement
   ============================================================ */
::-webkit-scrollbar-thumb {
  border-radius: 4px;
}

body.dark ::-webkit-scrollbar-thumb {
  background: #3D4160;
}

/* ============================================================
   16. Empty State Enhancement
   ============================================================ */
.empty-state {
  padding: 64px 24px;
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 16px;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ============================================================
   17. Panel Transition Enhancement
   ============================================================ */
.panel.active,
.panel:not(.hidden) {
  animation: panelFadeIn 0.25s ease;
}

@keyframes panelFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   18. Quick Action Buttons Enhancement
   ============================================================ */
.quick-actions .btn {
  gap: 4px;
}

.quick-actions .btn i {
  font-size: 14px;
}

/* ============================================================
   19. Table Action Buttons
   ============================================================ */
td .btn-sm {
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

tr:hover td .btn-sm {
  opacity: 1;
}

/* ============================================================
   19b. Card Key Grid 鈥?Desktop
   ============================================================ */

/* Tab bar 鈥?used by activity pages, AI panel, etc. */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary, #F3F4F6);
  border-radius: 10px;
  width: fit-content;
}

.tab-btn {
  padding: 8px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary, #6B7280);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.tab-btn:hover {
  color: var(--text-primary, #111827);
  background: var(--bg-hover, rgba(0,0,0,0.05));
}

.tab-btn.tab-active {
  color: var(--color-primary, #4F46E5);
  background: var(--bg-card, #fff);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.card-key-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  padding: 16px;
}

.card-key-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--color-surface, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
}

.card-key-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.card-key-item-selected {
  border-color: var(--color-primary, #4F46E5);
  box-shadow: 2px 2px 0 var(--color-primary, #4F46E5);
  background: var(--color-primary-bg, #EEF2FF);
}

.card-key-item-disabled {
  opacity: 0.5;
}

.card-key-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 22px; /* room for checkbox */
  flex-wrap: wrap;
}

.card-key-code {
  font-family: var(--font-mono, 'Fira Code', 'Cascadia Code', monospace);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  word-break: break-all;
  line-height: 1.4;
}

.card-key-user {
  font-size: 13px;
  color: var(--text-secondary, #6B7280);
}

.card-key-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-tertiary, #9CA3AF);
}

.card-key-dist {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-key-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary, #4F46E5);
  white-space: nowrap;
}

.card-key-actions {
  display: flex;
  gap: 4px;
  border-top: 1px solid var(--color-border, #D1D5DB);
  padding-top: 8px;
  margin-top: 2px;
}

.card-key-checkbox {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  cursor: pointer;
}

.card-key-checkbox .checkbox-box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  background: var(--bg-card, #fff);
  transition: all 0.15s ease;
}

.card-key-checkbox .checkbox-box.checked {
  background: var(--color-primary, #4F46E5);
  border-color: var(--color-primary, #4F46E5);
  color: #fff;
}

/* Card list toolbar */
.card-list-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border, #D1D5DB);
}

.card-list-toolbar .toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.card-list-toolbar .toolbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.card-list-toolbar .toolbar-select {
  width: auto;
  min-width: 110px;
  height: 36px;
  font-size: 13px;
}

.card-list-toolbar .toolbar-search {
  width: 200px;
  max-width: 100%;
  height: 36px;
  font-size: 13px;
}

.card-list-toolbar .selection-info {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary, #4F46E5);
  white-space: nowrap;
}

/* ============================================================
   20. Responsive Refinements
   ============================================================ */
@media (max-width: 768px) {
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .quick-actions {
    width: 100%;
    display: flex;
    gap: 6px;
  }

  .quick-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .modal-content {
    max-height: 85vh;
  }
}

@media (max-width: 640px) {
  .kpi-card::after {
    height: 2px;
  }

  .kpi-value {
    font-size: 24px;
  }
}

/* ============================================================
   22. Focus Visible for Accessibility
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================================
   23. Dark Mode Contrast Tweaks
   ============================================================ */
body.dark .card {
  border-color: rgba(255, 255, 255, 0.06);
}

body.dark .data-table th {
  background: rgba(255, 255, 255, 0.02);
}

/* ============================================================
   24. Selection Color
   ============================================================ */
::selection {
  background: rgba(79, 70, 229, 0.15);
  color: var(--text-primary);
}

/* 鎸夐挳閫氱敤杩囨浮 */
.btn, button {
  transition: transform 0.1s ease, opacity 0.1s ease, filter 0.1s ease !important;
}
.btn:active, button:active {
  transform: scale(0.96) !important;
  filter: brightness(0.9) !important;
}
.btn:hover, button:hover {
  filter: brightness(1.05);
  cursor: pointer;
}

/* 锟斤拷锟斤拷锟斤拷锟斤拷 */
.modal-overlay.modal-show { animation: modalFadeIn 0.2s ease; }
.modal-overlay.modal-hide { animation: modalFadeOut 0.2s ease; }
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* 锟角憋拷锟斤拷图锟斤拷锟斤拷小锟斤拷锟斤拷 */
.dashboard-charts .card { max-width: 450px; }
.dashboard-charts canvas { max-height: 200px !important; }

/* 锟角憋拷锟斤拷图锟斤拷锟斤拷锟斤拷 */
.dashboard-charts { max-width: 900px; }
.dashboard-charts .card { max-width: 450px; }
#content-trend-chart-wrapper { max-width: 600px; }
#content-trend-chart-wrapper canvas { max-height: 200px !important; }
#trend-chart, #pie-chart { max-height: 200px !important; }

/* ============================================================
   MOBILE RESPONSIVE OVERRIDES (< 768px)
   ============================================================ */

/* Mobile Header Bar */
#mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--sidebar-bg, #1A1A2E);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  z-index: 1001;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mobile-menu-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  transition: background 0.15s;
}

.mobile-menu-btn:hover,
.mobile-menu-btn:active {
  background: rgba(255,255,255,0.1);
}

.mobile-header-title {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.5px;
}

/* Main content offset for mobile header */
@media (max-width: 768px) {
  #mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 16px !important;
    padding-top: 68px !important;
    min-height: 100vh;
    box-sizing: border-box;
  }

  /* Mobile panels */
  .panel {
    padding: 12px !important;
    border-radius: 12px !important;
  }

  .panel-header {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: flex-start !important;
    margin-bottom: 12px !important;
    padding-bottom: 12px !important;
  }

  .panel-header .panel-title {
    font-size: 17px !important;
  }

  .panel-body {
    padding: 0 !important;
  }

  .kpi-value {
    font-size: 20px !important;
  }

  .kpi-label {
    font-size: 11px !important;
  }

  /* Stats grid (used in dashboard) */
  .stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }

  .stat-card {
    padding: 12px !important;
    border-radius: 10px !important;
  }

  .stat-num {
    font-size: 18px !important;
  }

  /* Data tables: horizontal scroll wrapper */
  .card-table-wrap,
  .article-table-container,
  [id$="table-container"],
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Buttons: larger touch targets */
  .btn {
    min-height: 40px !important;
    min-width: 40px !important;
    padding: 8px 14px !important;
    font-size: 13px !important;
    border-radius: 8px !important;
  }

  .btn-sm {
    min-height: 34px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
  }

  .btn-lg {
    min-height: 48px !important;
    font-size: 15px !important;
  }

  /* Action bar */
  .action-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .action-bar > * {
    width: 100% !important;
  }

  /* Filter / search bar */
  .panel-toolbar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
  }

  /* Filter / search bar: 鎸夐挳鎹㈣ + 澧炲ぇ闂磋窛 + 瑙︽懜楂樺害 */
  .toolbar-left,
  .toolbar-right {
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: center !important;
  }

  .toolbar-left input,
  .toolbar-left select {
    flex: 1 !important;
    min-width: 100% !important;
    height: 44px !important;
    font-size: 15px !important;
  }

  /* 鎸夐挳鏈€灏忚Е鎽搁珮搴?44px锛堢Щ鍔ㄧ鏍囧噯锛?*/
  .toolbar-left .btn,
  .toolbar-right .btn,
  .card-header .btn {
    min-height: 44px !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    white-space: normal !important;
    flex-shrink: 1 !important;
    word-break: keep-all;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Cards */
  .card {
    border-radius: 12px !important;
    padding: 16px !important;
    margin-bottom: 14px !important;
  }

  .card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
  }

  .card-title {
    font-size: 15px !important;
  }

  /* Batch bar */
  .batch-bar {
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 10px !important;
    border-radius: 10px !important;
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap !important;
    gap: 6px !important;
    justify-content: center !important;
    padding: 12px 0 !important;
  }

  .pagination button {
    min-width: 40px !important;
    min-height: 40px !important;
    font-size: 13px !important;
  }

  /* Modal 鈥?绉诲姩绔簳閮ㄥ脊鍑猴紙闈炲叏灞忓紑灞忓紡锛?*/
  .modal-overlay,
  #modal-overlay,
  [id*="modal-overlay"] {
    position: fixed !important;
    inset: 0 !important;
    z-index: 9999 !important;
    display: flex !important;
    align-items: flex-end !important;
    justify-content: center !important;
    background: rgba(0,0,0,0.4) !important;
  }

  .modal-overlay.active {
    display: flex !important;
    align-items: flex-end !important;
  }

  /* 搴曢儴寮瑰嚭鍗＄墖 */
  .modal-content {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 88vh !important;
    margin: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    overflow-y: auto !important;
    box-sizing: border-box !important;
    animation: apModalSlideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1) !important;
  }

  @keyframes apModalSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  .modal-dialog {
    background: var(--bg-primary) !important;
    border-radius: 20px 20px 0 0 !important;
    padding: 20px !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .modal-header {
    padding-bottom: 12px !important;
    margin-bottom: 16px !important;
  }

  .modal-title {
    font-size: 17px !important;
  }

  .modal-close {
    font-size: 22px !important;
    padding: 8px !important;
    min-width: 40px !important;
    min-height: 40px !important;
  }

  .modal-footer {
    flex-direction: column !important;
    gap: 10px !important;
    margin-top: 16px !important;
  }

  .modal-footer .btn {
    width: 100% !important;
  }

  /* Form groups */
  .form-group {
    margin-bottom: 14px !important;
  }

  .form-group label {
    font-size: 13px !important;
    margin-bottom: 6px !important;
  }

  .form-control {
    height: 44px !important;
    font-size: 14px !important;
    padding: 8px 12px !important;
    border-radius: 8px !important;
  }

  textarea.form-control {
    height: auto !important;
    min-height: 80px !important;
  }

  select.form-control {
    height: 44px !important;
  }

  .form-row {
    flex-direction: column !important;
    gap: 12px !important;
  }

  /* Tabs */
  .tab-item {
    padding: 10px 12px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  .dist-tabs {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap !important;
    padding-bottom: 4px !important;
  }

  /* Search inputs */
  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="password"],
  select {
    height: 42px !important;
    font-size: 14px !important;
  }

  /* Badge */
  .badge {
    font-size: 11px !important;
    padding: 3px 8px !important;
    border-radius: 6px !important;
  }

  /* Toast */
  .toast-container {
    top: 60px !important;
    left: 12px !important;
    right: 12px !important;
  }

  .toast {
    border-radius: 10px !important;
    font-size: 13px !important;
  }

  /* File/Media grid */
  .file-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
    gap: 8px !important;
  }

  /* Login page */
  .login-container {
    padding: 20px !important;
  }

  .login-card {
    padding: 24px !important;
    border-radius: 16px !important;
    margin-top: 60px !important;
  }

  .login-card h2 {
    font-size: 22px !important;
  }

  /* Notification panel */
  .notif-item {
    padding: 12px !important;
    border-radius: 10px !important;
    margin-bottom: 8px !important;
  }

  /* Dashboard quick actions */
  .quick-actions {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  .quick-action-btn {
    padding: 14px !important;
    border-radius: 12px !important;
    font-size: 12px !important;
  }

  .quick-action-btn i {
    font-size: 20px !important;
  }

  /* AI usage panel */
  .ai-stats-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
  }

  /* Tags */
  .tag {
    font-size: 11px !important;
    padding: 2px 8px !important;
    border-radius: 6px !important;
  }

  /* Chart containers */
  .chart-container {
    height: 200px !important;
  }

  canvas {
    max-height: 180px !important;
  }

  /* Card key grid 鈥?compact mobile layout */
  .card-key-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 8px !important;
    padding: 8px !important;
  }

  .card-key-item {
    padding: 8px !important;
    gap: 3px !important;
    border-radius: 8px !important;
  }

  .card-key-top {
    padding-left: 0 !important;
    gap: 3px !important;
  }

  .card-key-code {
    font-size: 10px !important;
  }

  .card-key-user {
    font-size: 11px !important;
  }

  .card-key-meta {
    font-size: 10px !important;
  }

  .card-key-price {
    font-size: 11px !important;
  }

  .card-key-actions {
    gap: 2px !important;
    border-top: none !important;
    padding-top: 2px !important;
    margin-top: 0 !important;
  }

  .card-key-checkbox {
    top: 4px !important;
    left: 4px !important;
  }

  /* btn-xs 鈥?compact touch target for card actions */
  .btn-xs {
    min-height: 28px !important;
    min-width: 28px !important;
    padding: 2px 6px !important;
    font-size: 11px !important;
    border-radius: 5px !important;
  }
}

/* Ultra small screens */
@media (max-width: 480px) {
  .main-content {
    padding: 12px !important;
    padding-top: 60px !important;
  }

  .panel {
    padding: 10px !important;
  }

  .kpi-grid {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .card {
    padding: 12px !important;
  }

  .modal-dialog {
    border-radius: 16px 16px 0 0 !important;
    padding: 16px !important;
  }

  /* Card key 鈥?single column on ultra-small */
  .card-key-grid {
    grid-template-columns: 1fr !important;
  }
}


/* 鍖哄潡 */
.section-block {
  margin-top: 12px;
  border-radius: var(--radius-lg, 12px);
  background: var(--bg-card, #fff);
  border: 1px solid var(--border-color, #e5e7eb);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-secondary, #f8f9fa);
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.section-header:hover {
  background: var(--bg-hover, #f3f4f6);
}
.section-header-fixed {
  cursor: default;
}
.section-header-fixed:hover {
  background: var(--bg-secondary, #f8f9fa);
}
.section-title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary, #111827);
}
.section-toggle {
  font-size: 12px;
  color: var(--text-tertiary, #9ca3af);
}
.section-body {
  padding: 16px 20px;
}

/* 绛涢€夊伐鍏锋爮 */
.card-filter-bar {
  margin-bottom: 16px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.filter-search {
  width: 220px;
  height: 36px;
  font-size: 13px;
}
.filter-select {
  width: auto;
  min-width: 100px;
  height: 36px;
  font-size: 13px;
  padding: 4px 12px;
  line-height: 1.4;
}
.filter-selection-info {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-primary, #4f46e5);
  white-space: nowrap;
  margin-left: 8px;
}
.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

/* 琛ㄦ牸瀹瑰櫒 */
.card-table-wrap {
  overflow-x: auto;
  margin: 0 -4px;
}
.card-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 13px;
}
.card-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
}
.card-table th {
  padding: 10px 8px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  background: var(--bg-secondary, #f8f9fa);
  border-bottom: 2px solid var(--border-color, #e5e7eb);
  white-space: nowrap;
}
.card-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-color, #e5e7eb);
  vertical-align: middle;
}
.card-table tbody tr:hover {
  background: var(--bg-hover, #f3f4f6);
}
.table-row-selected {
  background: var(--color-primary-light, #eef2ff) !important;
}
.table-row-disabled {
  opacity: 0.45;
}
.card-key-code {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  word-break: break-all;
}
.card-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary, #4f46e5);
}

@media (max-width: 768px) {
  .filter-row {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-search, .filter-select {
    width: 100%;
  }
  .filter-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .section-body {
    padding: 12px;
  }
  .card-table-wrap {
    margin: 0 -12px;
  }
}

/* ============================================================
   40. 鍗″瘑绫诲瀷閫夋嫨鑺墖锛堝崱瀵嗙鐞?+ 鍗″瘑鍟嗕汉鍏辩敤锛?   ============================================================ */

.card-type-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.card-type-chip {
  flex: 1;
  min-width: 100px;
  padding: 12px 10px;
  border-radius: 12px;
  border: 2px solid var(--border-color, #e0e0e0);
  background: var(--bg-secondary, #f8f9fa);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  user-select: none;
  position: relative;
}

.card-type-chip:hover {
  border-color: var(--color-primary, #4f46e5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79,70,229,0.15);
}

.card-type-chip.selected {
  border-color: var(--color-primary, #4f46e5);
  background: rgba(79,70,229,0.08);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}

.card-type-chip.selected::after {
  content: "鉁?;
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 14px;
}

.card-type-chip .chip-name {
  display: block;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary, #1d1d1f);
  margin-bottom: 4px;
}

.card-type-chip.selected .chip-name {
  color: var(--color-primary, #4f46e5);
}

.card-type-chip .chip-info {
  display: block;
  font-size: 11px;
  color: var(--text-secondary, #86868b);
  margin-bottom: 6px;
}

.card-type-chip .chip-price {
  display: inline-block;
  font-weight: 700;
  font-size: 15px;
  color: var(--color-danger, #ef4444);
  background: rgba(239,68,68,0.08);
  padding: 2px 10px;
  border-radius: 20px;
}

.card-type-chip.selected .chip-price {
  background: var(--color-primary, #4f46e5);
  color: #fff;
}

/* ============================================================
   鍏ㄥ眬澧炲己: 琛ㄦ牸鏂戦┈绾?+ 鍗＄墖闂磋窛 + 绌虹姸鎬?+ 鎸夐挳hover
   ============================================================ */
.data-table tbody tr:nth-child(even) { background: rgba(0,0,0,.02); }
body.dark .data-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }
.data-table tbody tr:hover { background: var(--bg-hover, rgba(0,0,0,.04)); }
.data-table td { vertical-align: middle; }
.data-table th { font-weight: 600; font-size: 11px; text-transform: none; letter-spacing: 0; }

/* 鍗＄墖闂磋窛缁熶竴 */
.card, .section-block { margin-bottom: 14px; }
.panel-body > .card:last-child { margin-bottom: 0; }

/* 绌虹姸鎬?*/
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-secondary); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state .empty-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty-state .empty-desc { font-size: 13px; }

/* 鎸夐挳hover骞虫粦杩囨浮 */
.btn { transition: all .12s ease; }
.btn:active { transform: scale(.97); }

/* 寰界珷缁熶竴 */
.badge { padding: 2px 8px; font-size: 11px; border-radius: 10px; font-weight: 500; }
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-neutral { background: var(--bg-hover); color: var(--text-secondary); }
body.dark .badge-success { background: #064e3b; color: #6ee7b7; }
body.dark .badge-danger { background: #7f1d1d; color: #fca5a5; }
body.dark .badge-warning { background: #78350f; color: #fcd34d; }
body.dark .badge-info { background: #1e3a5f; color: #93c5fd; }

/* 鍒嗛〉缁熶竴 */
.pagination-bar, .pagination { display: flex; align-items: center; gap: 4px; padding: 12px 0; }
.pagination-info { font-size: 12px; color: var(--text-tertiary); margin-right: 8px; }

/* KPI鍗＄墖闂磋窛锛堣鐩?admin.css 鏇村ぇ鐨?gap锛?*/
.kpi-grid { gap: 14px; }

/* 鍒嗗尯鍧?section-block) 涓庡崱鐗囪瑙夌粺涓€ */
.section-block {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border-color);
}
.section-title { font-size: 14px; font-weight: 600; }
.section-toggle { font-size: 12px; color: var(--text-tertiary); }
.section-body { padding: 14px 20px; }

/* ============================================================
   瑙嗚澧炲己: 渚ц竟鏍?+ 椤甸潰鏍囬 + 鍔ㄧ敾
   ============================================================ */

/* 渚ц竟鏍忔椿璺冩€?*/
.sidebar-menu-item.active {
  background: linear-gradient(90deg, rgba(79,70,229,.35), rgba(79,70,229,.08)) !important;
  border-left-color: #818cf8 !important;
}

/* 椤甸潰鏍囬缁熶竴 */
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.panel-header h2 { font-size: 20px; font-weight: 700; }

/* 绠＄悊椤垫爣棰樻爮 */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

/* 绛涢€夎 */
.filter-row, .card-filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 0;
}
.filter-row input[type="text"] {
  padding: 6px 10px; border: 1px solid var(--border-color);
  border-radius: 6px; font-size: 12px; background: var(--bg-card);
  color: var(--text-primary); width: 200px;
}

/* 娣″叆鍔ㄧ敾 */
@keyframes fadeUp { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.panel-body { animation: fadeUp .2s ease; }
.kpi-card { animation: fadeUp .25s ease both; }
.kpi-card:nth-child(1) { animation-delay: 0s; }
.kpi-card:nth-child(2) { animation-delay: .05s; }
.kpi-card:nth-child(3) { animation-delay: .1s; }
.kpi-card:nth-child(4) { animation-delay: .15s; }
.kpi-card:nth-child(5) { animation-delay: .2s; }
.kpi-card:nth-child(6) { animation-delay: .25s; }

/* ============================================================
   鍏ㄥ眬: 琛ㄦ牸妯粴wrapper + 璇箟鍒楀
   ============================================================ */
.card-table-wrap,
.article-table-container,
[id$=table-container],
[id$=table],
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.col-id     { width: 50px; text-align: center; }
.col-date   { width: 130px; font-size: 12px; white-space: nowrap; }
.col-status { width: 80px; text-align: center; }
.col-count  { width: 70px; text-align: right; }
.col-icon   { width: 50px; text-align: center; font-size: 18px; }
.col-actions { width: 100px; white-space: nowrap; text-align: center; }
.col-user   { min-width: 120px; }

/* Sub-tab navigation */
.card-tabs { border-bottom: 1px solid var(--border-color); }
.tab-btn { padding: 8px 16px; border: none; background: transparent; color: var(--text-secondary); font-size: 13px; font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; transition: all .15s; }
.tab-btn:hover { color: var(--text-primary); background: var(--bg-hover); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ============================================================
   20. 表格「操作」列固定右侧（2026-09-24）
   背景：.card-table 写死 min-width:1100px，容器通常只有 ~940px，
   横向滚动时最后一列（重置密码等）会跑到屏幕外 → 按钮根本看不见。
   给需要常驻操作列的表格加 .card-table--fixed-actions，把最后一列吸附在右侧。
   ============================================================ */
.card-table--fixed-actions {
  min-width: 0;
}
.card-table--fixed-actions th:last-child,
.card-table--fixed-actions td:last-child {
  position: sticky;
  right: 0;
  background: var(--bg-card, #fff);
  box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.25);
}
.card-table--fixed-actions thead th:last-child {
  background: var(--bg-secondary, #f8f9fa);
  z-index: 3;
}
.card-table--fixed-actions tbody tr:hover td:last-child {
  background: var(--bg-hover, #f3f4f6);
}
