* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #3370ff;
  --primary-hover: #1f57e7;
  --bg-main: #f5f6f7;
  --bg-sidebar: #1e222d;
  --card-bg: #ffffff;
  --text-main: #1f2329;
  --text-muted: #646a73;
  --border-color: #dee0e3;
  --success: #00b578;
  --warning: #ff8800;
  --danger: #f54a45;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
}

.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
  width: 250px;
  background-color: var(--bg-sidebar);
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand-box {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
  font-size: 26px;
  color: #3370ff;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-sub {
  font-size: 12px;
  color: #8f959e;
  margin-top: 2px;
}

.side-menu {
  flex: 1;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #b5bac5;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s ease;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.menu-item.active {
  background: #3370ff;
  color: #fff;
  font-weight: 600;
}

.menu-item.highlight {
  margin-top: 14px;
  border: 1px dashed rgba(51, 112, 255, 0.6);
  color: #79a5ff;
}

.menu-item.highlight:hover {
  background: rgba(51, 112, 255, 0.15);
  color: #fff;
}

.mini-icon {
  font-size: 11px;
  margin-left: 4px;
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sys-badge {
  font-size: 12px;
  color: #00d68f;
  background: rgba(0, 214, 143, 0.12);
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.version-text {
  font-size: 11px;
  color: #717784;
}

/* 主内容区 */
.main-content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #1f2329;
}

.header-date {
  font-size: 13px;
  color: #8f959e;
  margin-left: 12px;
}

.btn-primary {
  background: #3370ff;
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s ease;
}

.btn-primary:hover {
  background: #1f57e7;
}

/* 指标卡片 Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  gap: 14px;
}

.metric-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.bg-blue { background: #eef4fe; color: #3370ff; }
.bg-green { background: #e8faf1; color: #00b578; }
.bg-yellow { background: #fff7eb; color: #ff8800; }
.bg-red { background: #feeceb; color: #f54a45; }
.bg-purple { background: #f3effe; color: #722ed1; }

.metric-label {
  font-size: 13px;
  color: #8f959e;
  margin-bottom: 4px;
}

.metric-num {
  font-size: 24px;
  font-weight: 700;
  color: #1f2329;
}

.text-success { color: #00b578 !important; }
.text-warning { color: #ff8800 !important; }
.text-danger { color: #f54a45 !important; }

/* 表格区 */
.table-section {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.04);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #646a73;
}

.input-date, .select-status {
  padding: 7px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}

.btn-default {
  background: #fff;
  border: 1px solid var(--border-color);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #1f2329;
}

.btn-default:hover {
  background: #f8f9fa;
}

.btn-success {
  background: #00b578;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-success:hover {
  background: #009d68;
}

.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.data-table th {
  background: #f7f8fa;
  color: #646a73;
  padding: 12px 14px;
  font-weight: 600;
  border-bottom: 1px solid #eaebec;
}

.data-table td {
  padding: 14px;
  border-bottom: 1px solid #f2f3f5;
  color: #1f2329;
}

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

.loading-td {
  text-align: center;
  padding: 40px !important;
  color: #8f959e;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #3370ff;
  color: #fff;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.tag-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.tag-normal {
  background: #eef4fe;
  color: #3370ff;
  border: 1px solid rgba(51, 112, 255, 0.3);
}

.btn-shot-preview {
  background: #f0f4ff;
  border: 1px solid rgba(51, 112, 255, 0.3);
  color: #3370ff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
}

.btn-shot-preview:hover {
  background: #3370ff;
  color: #fff;
  border-color: #3370ff;
}

.btn-table-edit-user {
  background: transparent;
  border: none;
  color: #8f959e;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 13px;
  transition: all 0.2s;
  margin-left: 4px;
}

.user-cell:hover .btn-table-edit-user {
  color: #3370ff;
  background: #f0f4ff;
}

.btn-table-edit-user:hover {
  color: #1f57e7 !important;
  background: #deebff !important;
}

.tag-late, .tag-early {
  background: #feeceb;
  color: #f54a45;
  border: 1px solid rgba(245, 74, 69, 0.3);
}

.tag-inrange {
  color: #00b578;
}

.tag-outrange {
  color: #f54a45;
}

/* 弹窗样式 */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: #fff;
  width: 100%;
  max-width: 500px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid #eaebec;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #8f959e;
}

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 13px;
  color: #646a73;
  font-weight: 500;
}

.modal-ipt {
  padding: 9px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 13px;
}

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

.modal-footer {
  padding: 14px 22px;
  background: #f7f8fa;
  border-top: 1px solid #eaebec;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.btn-cancel {
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.btn-save {
  padding: 8px 20px;
  background: #3370ff;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* Toast */
.admin-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e222d;
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 1000;
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}
