/* ========== Design System Tokens ========== */
:root {
  /* iOS native palette, aligned with goods.html */
  --brand: #007AFF;
  --brand-hover: #006EDB;
  --brand-light: rgba(0,122,255,0.12);
  
  /* Spacing - 8pt Grid */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 40px;
  --space-8: 48px;
  
  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  
  /* Shadow - 2 layers */
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  
  /* Background & Surface */
  --bg: #F9F9FB;
  --surface: #FFFFFF;
  --row-alt: #F8F8FA;
  --row-hover: #F5F5F7;
  
  /* Border */
  --border: #E5E5EA;
  --border-hover: #D1D1D6;
  
  /* Text */
  --text: #1D1D1F;
  --text-head: #1D1D1F;
  --text-sec: #6E6E73;
  --text-tert: #86868B;
  
  /* Accent (兼容旧变量名) */
  --accent: var(--brand);
  --accent-hover: var(--brand-hover);
  --accent-bg: var(--brand-light);
  
  /* Status Colors */
  --status-ok: transparent;
  --status-ok-text: var(--text-sec);
  --status-warn: transparent;
  --status-warn-text: var(--text-sec);
  --status-err: transparent;
  --status-err-text: var(--text-sec);
  --status-info: transparent;
  --status-info-text: var(--text-sec);
  --status-partial: transparent;
  --status-partial-text: var(--text-sec);
  --danger: var(--text-sec);
  --success: var(--text-sec);
  --warning: var(--text-sec);
}

/* ========== Dark Theme ========== */
[data-theme="dark"] {
  --bg: #0A0A0B;
  --surface: #18181B;
  --row-alt: #27272A;
  --row-hover: #3F3F46;
  --border: #3F3F46;
  --border-hover: #52525B;
  
  --text: #FAFAFA;
  --text-head: #E4E4E7;
  --text-sec: #A1A1AA;
  --text-tert: #71717A;
  
  --brand-light: #1E3A5F;
  --accent-bg: var(--brand-light);
  
  --status-ok: transparent;
  --status-ok-text: var(--text-sec);
  --status-warn: transparent;
  --status-warn-text: var(--text-sec);
  --status-err: transparent;
  --status-err-text: var(--text-sec);
  --status-info: transparent;
  --status-info-text: var(--text-sec);
  --status-partial: transparent;
  --status-partial-text: var(--text-sec);
  --danger: var(--text-sec);
  --success: var(--text-sec);
  --warning: var(--text-sec);
  
  --shadow: 0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #52525B; }
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #71717A; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea,
.btn,
.badge,
.status-badge,
.sidebar-label,
.settings-label,
.settings-item label,
.data-table th,
.data-table td,
.detail-table th,
.detail-table td,
.small-table th,
.small-table td {
  white-space: nowrap;
}

/* ---- Shared Top Navigation ---- */
.top-nav {
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.top-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.top-links {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
}

.top-link {
  height: 28px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-sec);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface);
  white-space: nowrap;
}

.top-link:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.top-link.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

/* ---- Layout ---- */
.layout { display: flex; min-height: calc(100vh - 48px); }

.sidebar {
  width: 188px;
  flex-shrink: 0;
  background: var(--surface);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--border);
}

.sidebar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-label {
  font-size: 11px;
  color: var(--text-sec);
  font-weight: 600;
  margin-bottom: 2px;
}

.sidebar-btn { width: 100%; text-align: left; justify-content: flex-start; }
.sidebar-btn.nav-link { text-decoration: none; }
.sidebar-btn.nav-link.active {
  background: var(--brand);
  color: #fff;
}

.sidebar-badges {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.main-content {
  flex: 1;
  min-width: 0;
  background: var(--bg);
}

/* ---- Header ---- */
.header {
  background: var(--surface);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.header-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.header-subtitle {
  font-size: 12px;
  color: var(--text-sec);
  margin-left: 12px;
}

/* ---- Badge ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.badge-outline {
  background: transparent;
  color: var(--text-sec);
}

.badge-success {
  background: transparent;
  color: var(--text-sec);
}

.badge-danger {
  background: transparent;
  color: var(--text-sec);
}

.badge-warning {
  background: transparent;
  color: var(--text-sec);
}

/* ---- Stats ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 12px 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: none;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--border-hover);
}

.clickable-card {
  cursor: pointer;
}

.clickable-card:hover {
  border-color: var(--brand);
}

.clickable-card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.stat-card.stat-success .stat-value,
.stat-card.stat-danger .stat-value,
.stat-card.stat-warning .stat-value,
.stat-card.stat-info .stat-value { color: var(--text); }

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 11px;
  color: var(--text-tert);
  margin-top: 2px;
}

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px 10px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---- Form ---- */
.input-text, .input-select {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: #F5F5F7;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.input-text:focus, .input-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}

.input-text { min-width: 260px; }
.input-text::placeholder { color: var(--text-tert); }

/* ---- Button ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-hover);
}

.btn-primary:disabled {
  background: var(--border);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-outline {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-sec);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-sec);
}

.btn-ghost:hover {
  background: var(--row-alt);
  color: var(--text);
}

/* ---- Table ---- */
.table-wrapper {
  padding: 0 16px;
  max-height: calc(100vh - 214px);
  overflow: auto;
}

.data-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.data-table th {
  background: #F8F8FA;
  padding: 7px 9px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-tert);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0;
}

.data-table th.seq-col,
.data-table td.seq-cell {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  text-align: center;
  color: var(--text-tert);
  background: inherit;
  position: sticky;
  left: 0;
}

.data-table th.seq-col {
  z-index: 4;
  background: #F8F8FA;
}

.data-table td.seq-cell {
  z-index: 1;
  font-variant-numeric: tabular-nums;
  border-right: 1px solid var(--border);
}

.filter-row td {
  background: var(--surface);
  padding: 5px 8px;
  position: sticky;
  top: 31px;
  z-index: 2;
  border-bottom: 1px solid var(--border);
}

.col-filter {
  width: 100%;
  height: 24px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}

.col-filter:focus {
  border-color: var(--brand);
}

.data-table td {
  padding: 7px 9px;
  font-size: 12px;
  line-height: 1.35;
  vertical-align: middle;
  color: var(--text);
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* 状态列和修改时间列紧凑显示 */
.data-table td:nth-child(2),
.data-table td:nth-child(3) {
  white-space: nowrap;
  width: 1%;
  padding-right: 16px;
}

/* 时间列不换行 */
.data-table td:nth-child(8) {
  white-space: nowrap;
}

.data-table tbody tr:nth-child(even) { background: var(--row-alt); }
.data-table tbody tr:nth-child(odd) { background: var(--surface); }
.data-table tbody tr:hover { background: var(--row-hover); }
.data-table tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

.empty-row {
  text-align: center;
  color: var(--text-sec);
  padding: 40px 16px !important;
  cursor: default;
}

.remark-cell {
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* ---- Status Badge ---- */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--border);
}

.status-success,
.status-failed,
.status-pending,
.status-partial,
.status-running,
.status-error { background: transparent; color: var(--text-sec); }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
}

.page-btn {
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-sec);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: background 0.1s;
}

.page-btn:hover {
  background: var(--row-alt);
  color: var(--text);
}

.page-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-info {
  font-size: 12px;
  color: var(--text-sec);
  margin-right: var(--space-2);
}

/* ---- Panel Overlay ---- */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.panel-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  width: 400px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
}

.panel-card h3 {
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.panel-card .hint {
  font-size: 12px;
  color: var(--text-sec);
  margin-bottom: 14px;
  line-height: 1.6;
}

.panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  z-index: 200;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-hover);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-sec);
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}

.modal-close:hover {
  background: var(--row-alt);
  color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* ---- Detail ---- */
.detail-section { margin-bottom: 20px; }

.detail-section h4 {
  font-size: 12px;
  color: var(--text-sec);
  font-weight: 500;
  margin-bottom: 10px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 20px;
}

.detail-item { font-size: 13px; line-height: 1.6; }
.detail-item .label { color: var(--text-sec); }
.detail-item .value { font-weight: 500; color: var(--text); }

.detail-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
  border: 1px solid var(--border);
}

.detail-table th {
  background: var(--row-alt);
  padding: 8px 10px;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-head);
  border-bottom: 1px solid var(--border);
}

.detail-table td {
  padding: 8px 10px;
  color: var(--text);
}

.detail-table tbody tr:nth-child(even) { background: var(--row-alt); }
.detail-table tbody tr:hover { background: var(--row-hover); }

/* ---- Logs ---- */
.logs-section { padding: 14px 16px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.logs-table-wrapper {
  max-height: 300px;
  overflow: auto;
}

.small-table td, .small-table th {
  padding: 6px 8px;
  font-size: 12px;
}

.small-table tbody tr:nth-child(even) { background: var(--row-alt); }
.small-table tbody tr:hover { background: var(--row-hover); }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-sec); }

/* ---- Textarea ---- */
textarea.input-text {
  width: 100%;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 14px;
  }
  .sidebar-title { display: none; }
  .sidebar-section { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .sidebar-btn { width: auto; }
  .sidebar-badges { flex-direction: row; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); padding: 14px; }
  .toolbar { flex-direction: column; gap: 8px; align-items: stretch; padding: 0 14px 14px; }
  .toolbar-left, .toolbar-right { flex-wrap: wrap; }
  .header { flex-direction: column; gap: 8px; padding: 14px; }
  .table-wrapper { padding: 0 14px; }
  .modal-card { width: 95%; }
  .logs-section { padding: 16px 14px; }
  .pagination { padding: 14px; }
  .settings-drawer { width: 100% !important; }
  .tab-bar { flex-wrap: nowrap; overflow-x: auto; }
  .batch-actions-bar { left: 0; }
}

/* ========== 设置按钮 (齿轮图标) ========== */
.settings-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}
.settings-btn:hover {
  opacity: 1;
  background: var(--row-alt);
}
.settings-btn svg {
  width: 18px;
  height: 18px;
  fill: var(--text-sec);
}

/* ========== 设置抽屉 ========== */
.settings-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 299;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.settings-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 300;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}
.settings-drawer.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-header h3 {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}
.settings-close {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  font-size: 18px;
  color: var(--text-sec);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.settings-close:hover {
  background: var(--row-alt);
  color: var(--text);
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.settings-section {
  border-bottom: 1px solid var(--border);
}
.settings-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  background: var(--row-alt);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  user-select: none;
}
.settings-section-header:hover {
  background: var(--row-hover);
}
.settings-section-header::after {
  content: '▼';
  font-size: 10px;
  color: var(--text-sec);
  transition: transform 0.2s;
}
.settings-section.collapsed .settings-section-header::after {
  transform: rotate(-90deg);
}
.settings-section.collapsed .settings-section-content {
  display: none;
}
.settings-section-content {
  padding: 12px 20px;
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}
.settings-row-label {
  font-size: 13px;
  color: var(--text);
}
.settings-row-desc {
  font-size: 11px;
  color: var(--text-sec);
  margin-top: 2px;
}

/* 开关按钮 */
.toggle-switch {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border);
  border-radius: 11px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-switch.on {
  background: var(--accent);
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.on::after {
  transform: translateX(18px);
}

/* 下拉选择 */
.settings-select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.settings-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* 颜色选择器 */
.color-picker-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.color-picker {
  width: 32px;
  height: 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  padding: 0;
}
.color-picker::-webkit-color-swatch-wrapper { padding: 2px; }
.color-picker::-webkit-color-swatch { border-radius: 2px; border: none; }

/* 设置底部按钮 */
.settings-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-footer .btn {
  width: 100%;
}

/* ========== Tab 系统 ========== */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--row-alt);
  flex-wrap: wrap;
}
.tab-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sec);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.tab-item:hover {
  background: var(--surface);
  color: var(--text);
}
.tab-item.active {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--accent);
}
.tab-item.dragging {
  opacity: 0.5;
  border-style: dashed;
}
.tab-item-name {
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab-item-menu {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  opacity: 0.5;
  border-radius: 2px;
}
.tab-item:hover .tab-item-menu { opacity: 1; }
.tab-item-menu:hover { background: var(--row-hover); }
.tab-add-btn {
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 14px;
  color: var(--text-sec);
  background: transparent;
  border: 1px dashed var(--border);
  cursor: pointer;
}
.tab-add-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Tab 右键菜单 */
.tab-context-menu {
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 400;
  min-width: 120px;
  padding: 4px 0;
}
.tab-context-menu-item {
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.tab-context-menu-item:hover {
  background: var(--row-alt);
}
.tab-context-menu-item.danger {
  color: var(--danger);
}

/* ========== 列可见性设置 ========== */
.column-checkboxes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 12px;
}
.column-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}
.column-checkbox input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ========== 列宽调整 ========== */
.col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: col-resize;
  background: transparent;
}
.col-resize-handle:hover,
.col-resize-handle.active {
  background: var(--accent);
  opacity: 0.3;
}
.data-table th {
  position: relative;
}

/* ========== 新订单高亮动画 ========== */
@keyframes order-flash {
  0%, 100% { background: inherit; }
  25%, 75% { background: var(--row-hover); }
}
.row-new {
  animation: order-flash 2s ease;
}
.row-new-flash {
  animation: order-flash 2s ease;
}

/* ========== 批量操作 ========== */
.batch-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.batch-actions-bar {
  position: fixed;
  bottom: 0;
  left: 188px;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 100;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.1);
}
.batch-count {
  font-size: 13px;
  color: var(--text-sec);
}
.batch-count strong {
  color: var(--accent);
  font-weight: 600;
}
.batch-actions-bar .btn {
  padding: 6px 16px;
}

/* ========== 快捷操作按钮组 ========== */
.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.quick-actions .btn {
  flex: 1;
  min-width: 100px;
}

/* ========== 内联编辑 (Tab 重命名) ========== */
.tab-item-name-input {
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  width: 80px;
  outline: none;
}

/* ========== 声音预览按钮 ========== */
.sound-preview {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: all 0.15s ease;
}
.sound-preview:hover {
  background: var(--row-alt);
  border-color: var(--brand);
}

/* ========== 音量滑块 ========== */
#sound-volume-slider {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
#sound-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--brand);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s ease;
}
#sound-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}
#sound-volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--brand);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ========== Header 需要相对定位以放置设置按钮 ========== */
.header {
  position: relative;
}
