*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif; background: #f0f2f5; color: rgba(0,0,0,0.85); min-height: 100vh; font-size: 14px; line-height: 1.5715; }
a { color: #1890ff; text-decoration: none; }
a:hover { color: #40a9ff; }
input, select, textarea { background: #fff; color: rgba(0,0,0,0.85); border: 1px solid #d9d9d9; border-radius: 2px; padding: 4px 11px; font-size: 14px; outline: none; transition: all 0.3s; height: 32px; box-sizing: border-box; }
textarea { height: auto; padding: 8px 11px; line-height: 1.6; }
input:hover, select:hover { border-color: #40a9ff; }
input:focus, select:focus { border-color: #40a9ff; box-shadow: 0 0 0 2px rgba(24,144,255,0.2); }
input::placeholder { color: #bfbfbf; }
button { cursor: pointer; border: none; border-radius: 2px; padding: 4px 15px; font-size: 14px; height: 32px; transition: all 0.3s; line-height: 1.5715; }
.btn-primary { background: #1890ff; color: #fff; box-shadow: 0 2px 0 rgba(0,0,0,0.045); }
.btn-primary:hover { background: #40a9ff; }
.btn-danger { background: #ff4d4f; color: #fff; }
.btn-danger:hover { background: #ff7875; }
.btn-default { background: #fff; color: rgba(0,0,0,0.85); border: 1px solid #d9d9d9; }
.btn-default:hover { color: #40a9ff; border-color: #40a9ff; }

#login-page { display: none; align-items: center; justify-content: center; min-height: 100vh; background: #f0f2f5; }
.login-box { background: #fff; border-radius: 2px; padding: 32px 40px 40px; width: 368px; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02), 0 2px 4px 0 rgba(0,0,0,0.02); }
.login-box h2 { margin-bottom: 40px; font-size: 28px; color: rgba(0,0,0,0.85); font-weight: 500; text-align: center; }
.login-box label { display: block; font-size: 14px; color: rgba(0,0,0,0.85); margin-bottom: 8px; }
.login-box label:not(:first-of-type) { margin-top: 24px; }
.login-box input { width: 100%; height: 40px; font-size: 14px; }
.login-box button { width: 100%; height: 40px; margin-top: 24px; font-size: 16px; }
.login-error { color: #ff4d4f; font-size: 14px; margin-top: 12px; text-align: center; }

#app { display: none; min-height: 100vh; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 200px; background: #001529; flex-shrink: 0; overflow-y: auto; }
.sidebar h3 { color: #fff; font-size: 18px; font-weight: 500; padding: 16px 24px; margin: 0; background: rgba(255,255,255,0.08); letter-spacing: 1px; display: flex; align-items: center; }
.sidebar nav { padding: 4px 0; }
.sidebar nav a { display: flex; align-items: center; padding: 12px 24px; font-size: 14px; color: rgba(255,255,255,0.65); transition: all 0.3s; position: relative; }
.nav-icon { width: 18px; height: 18px; margin-right: 10px; fill: currentColor; flex-shrink: 0; opacity: 0.85; }
.logo-icon { width: 20px; height: 20px; fill: #fff; margin-right: 8px; vertical-align: middle; }
.sidebar nav a:hover { color: #fff; }
.sidebar nav a.active { color: #fff; background: #1890ff; }
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.top-bar { display: flex; align-items: center; justify-content: flex-end; background: #fff; box-shadow: 0 1px 4px rgba(0,21,41,0.08); padding: 0 24px; height: 48px; gap: 16px; flex-shrink: 0; z-index: 10; }
.top-bar span { font-size: 14px; color: rgba(0,0,0,0.65); }
.menu-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 40px; cursor: pointer; font-size: 20px; color: rgba(0,0,0,0.65); border: none; background: transparent; }
.menu-toggle:hover { color: #1890ff; }
.content { flex: 1; padding: 24px; overflow: auto; }
.page { display: none; }
.page.active { display: block; }
.page-header-actions h2 { font-size: 20px; color: rgba(0,0,0,0.85); font-weight: normal; margin: 0; line-height: 32px; }
.page-header-actions { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: 2px; padding: 20px 24px; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02), 0 2px 4px 0 rgba(0,0,0,0.02); }
.stat-card .lbl { font-size: 14px; color: rgba(0,0,0,0.45); margin-bottom: 4px; }
.stat-card .num { font-size: 24px; color: rgba(0,0,0,0.85); }

.card { background: #fff; border-radius: 2px; box-shadow: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02), 0 2px 4px 0 rgba(0,0,0,0.02); }
.card-body { padding: 24px; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { width: 200px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { background: #fafafa; }
th { padding: 16px; text-align: left; color: rgba(0,0,0,0.85); font-weight: normal; border-bottom: 1px solid #f0f0f0; white-space: nowrap; }
td { padding: 16px; border-bottom: 1px solid #f0f0f0; color: rgba(0,0,0,0.65); }
tr:hover td { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }
.table-mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 13px; color: rgba(0,0,0,0.85); }
.table-actions { display: inline-flex; gap: 8px; white-space: nowrap; }
.table-actions button { height: 28px; padding: 0 12px; font-size: 13px; line-height: 26px; }
.badge { display: inline-block; padding: 0 8px; height: 22px; line-height: 22px; border-radius: 2px; font-size: 12px; white-space: nowrap; }
.badge-green { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.badge-yellow { background: #fffbe6; color: #d48806; border: 1px solid #ffe58f; }
.badge-red { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }
.badge-blue { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.badge-purple { background: #f9f0ff; color: #722ed1; border: 1px solid #d3adf7; }
.badge-cyan { background: #e6fffb; color: #13c2c2; border: 1px solid #87e8de; }
.badge-gray { background: #fafafa; color: #8c8c8c; border: 1px solid #d9d9d9; }

.pagination { display: flex; gap: 8px; align-items: center; padding: 16px 0; justify-content: flex-end; }
.pagination button { min-width: 32px; }
.pagination span { color: rgba(0,0,0,0.65); font-size: 14px; margin: 0 8px; }

.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 2px; width: 520px; max-width: 90vw; box-shadow: 0 3px 6px -4px rgba(0,0,0,0.12), 0 6px 16px 0 rgba(0,0,0,0.08), 0 9px 28px 8px rgba(0,0,0,0.05); }
.modal h3 { padding: 16px 24px; margin: 0; color: rgba(0,0,0,0.85); font-size: 16px; font-weight: normal; border-bottom: 1px solid #f0f0f0; }
.modal-body { padding: 24px; }
.modal label { display: block; font-size: 14px; color: rgba(0,0,0,0.85); margin-bottom: 8px; }
.modal label .required { color: #ff4d4f; }
.addr-display { font-size: 13px; color: rgba(0,0,0,0.45); margin-bottom: 16px; word-break: break-all; font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; }
.modal label:not(:first-child) { margin-top: 16px; }
.modal input[type="text"], .modal input[type="password"], .modal input[type="number"], .modal select { width: 100%; height: 40px; font-size: 14px; }
.modal textarea { width: 100%; font-size: 14px; }
.modal select { padding: 0 11px; }
.modal .modal-footer { padding: 10px 16px; border-top: 1px solid #f0f0f0; display: flex; gap: 8px; justify-content: flex-end; }

.alert { padding: 8px 15px; border-radius: 2px; font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; }
.alert-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.alert-error { background: #fff2f0; color: #ff4d4f; border: 1px solid #ffccc7; }

td.empty { text-align: center; padding: 32px !important; color: rgba(0,0,0,0.25); }

/* 表格容器 - 始终可横向滚动 */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 响应式布局 */
@media (max-width: 1400px) {
  th, td { padding: 12px 10px; }
}

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  th, td { padding: 10px 8px; }
  .sidebar { width: 180px; }
}

@media (max-width: 992px) {
  .sidebar { 
    position: fixed;
    top: 0;
    left: -220px;
    width: 220px;
    height: 100vh;
    z-index: 100;
    transition: left 0.3s ease;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay.open { display: block; }
  .content { padding: 16px; }
  th, td { padding: 10px 6px; font-size: 13px; }
  
  /* 显示菜单按钮 */
  .menu-toggle { display: flex !important; }
  .top-bar { justify-content: space-between; }
}

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card .num { font-size: 20px; }
  .content { padding: 12px; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { width: 100%; }
  .page-header-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-header-actions h2 { font-size: 18px; }
  
  /* 表格 - 固定最小宽度，允许滚动 */
  table { min-width: 800px; font-size: 13px; }
  th, td { padding: 10px 8px; white-space: nowrap; }
  .table-mono { font-size: 12px; word-break: keep-all; }
  
  .pagination { flex-wrap: wrap; justify-content: center; padding: 12px 0; gap: 6px; }
  .pagination button { min-width: 40px; padding: 4px 10px; font-size: 13px; }
  .pagination span { font-size: 13px; }
  
  .modal { width: 95vw; max-height: 90vh; overflow-y: auto; }
  .modal h3 { padding: 12px 16px; font-size: 15px; }
  .modal-body { padding: 16px; }
  
  .login-box { width: 90vw; max-width: 360px; padding: 24px; }
  .login-box h2 { font-size: 22px; margin-bottom: 24px; }

  .top-bar { padding: 0 12px; }
}

@media (max-width: 480px) {
  .content { padding: 8px; }
  .card-body { padding: 12px; }
  table { min-width: 700px; font-size: 12px; }
  th, td { padding: 8px 6px; }
  .table-mono { font-size: 11px; }
  .badge { padding: 0 6px; font-size: 11px; }
  .table-actions button { padding: 0 8px; font-size: 12px; }
  
  .pagination { 
    gap: 6px; 
    flex-wrap: wrap; 
    justify-content: center; 
    padding: 12px 8px; 
  }
  .pagination button { 
    min-width: 56px; 
    padding: 6px 10px; 
    font-size: 13px; 
    white-space: nowrap;
  }
  .pagination span { 
    font-size: 12px; 
    white-space: nowrap; 
    width: 100%; 
    text-align: center; 
    order: -1; 
    margin-bottom: 8px;
  }
}

/* 移动端侧边栏遮罩 */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* 表格滚动提示 */
.table-scroll-hint {
  display: none;
  text-align: center;
  padding: 8px 12px;
  color: rgba(0,0,0,0.45);
  font-size: 12px;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 2px;
  margin-bottom: 12px;
}
@media (max-width: 992px) {
  .table-scroll-hint { display: block; }
}

