/* ========== 全局重置与基础样式 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #ff6b35;
  --primary-dark: #e85a26;
  --primary-light: #fff0ea;
  --bg: #f5f6f8;
  --white: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border: #e8e8e8;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #1890ff;
  --sidebar-bg: #2a2d3a;
  --sidebar-text: #c9ccd5;
  --sidebar-active: #ff6b35;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: none;
  outline: none;
  border-radius: var(--radius);
  transition: all 0.2s;
}

input, textarea, select {
  font-family: inherit;
  font-size: 14px;
  outline: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  width: 100%;
  transition: border-color 0.2s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-weight: 500;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-default {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-default:hover { border-color: var(--primary); color: var(--primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { opacity: 0.9; }

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-sm {
  padding: 4px 12px;
  font-size: 12px;
}

.btn-link {
  background: none;
  color: var(--primary);
  padding: 4px 8px;
}
.btn-link:hover { text-decoration: underline; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 布局 ========== */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-logo {
  padding: 20px;
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo .logo-icon {
  color: var(--primary);
  margin-right: 6px;
}

.sidebar-menu {
  flex: 1;
  padding: 12px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  cursor: pointer;
  color: var(--sidebar-text);
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

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

.menu-item.active {
  background: rgba(255, 107, 53, 0.15);
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
}

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

.sidebar-footer .user-info {
  color: #fff;
  margin-bottom: 8px;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 56px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
}

.content {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
}

/* ========== 卡片 ========== */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

/* ========== 表格 ========== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #fafafa;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

tr:hover {
  background: #fafafa;
}

/* ========== 标签/徽章 ========== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}

.tag-success { background: #f6ffed; color: var(--success); border: 1px solid #b7eb8f; }
.tag-warning { background: #fffbe6; color: var(--warning); border: 1px solid #ffe58f; }
.tag-danger { background: #fff1f0; color: var(--danger); border: 1px solid #ffa39e; }
.tag-info { background: #e6f7ff; color: var(--info); border: 1px solid #91d5ff; }
.tag-default { background: #fafafa; color: var(--text-muted); border: 1px solid var(--border); }
.tag-primary { background: var(--primary-light); color: var(--primary); border: 1px solid #ffc9b3; }

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-row {
  display: flex;
  gap: 16px;
}

.form-row .form-group {
  flex: 1;
}

/* ========== 模态框 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  cursor: pointer;
  font-size: 20px;
  color: var(--text-muted);
  background: none;
  padding: 0;
  line-height: 1;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ========== Toast 提示 ========== */
.toast-container {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 10px 20px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: toastIn 0.3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--info); }
.toast-warning { background: var(--warning); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 空状态 ========== */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ========== 工具类 ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
