/* ========== 全局基础样式 ========== */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  font-size: 14px;
}
html, body, .flex.min-h-screen { height: 100%; }

/* ========== 侧边栏（参考图：深紫+分组） ========== */
.sidebar-bg {
  background: linear-gradient(180deg, #2e2070 0%, #1f164c 100%);
}
.sidebar-section {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.45);
  margin-top: 6px;
}
.menu-item {
  color: rgba(255,255,255,0.7);
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.menu-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.menu-item-active {
  background: rgba(99, 102, 241, 0.35);
  border-left-color: #a5b4fc;
  color: #fff !important;
  font-weight: 600;
}

/* ========== 卡片 ========== */
.card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  border: 1px solid #eef0f4;
}

/* ========== 按钮（参考图：蓝+浅灰） ========== */
.btn {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  line-height: 1.5;
  gap: 4px;
}
.btn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: #6366f1;
  color: #fff;
  border-color: #6366f1;
  box-shadow: 0 1px 2px rgba(99,102,241,0.25);
}
.btn-primary:hover {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}
.btn-ghost {
  background: #ffffff;
  color: #4b5563;
  border-color: transparent;
}
.btn-ghost:hover {
  background: #f3f4f6;
  color: #111827;
}
.btn-danger {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
}
.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}
.btn-warning {
  background: #f59e0b;
  color: #fff;
  border-color: #f59e0b;
}
.btn-warning:hover {
  background: #d97706;
  border-color: #d97706;
}
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 5px;
}

/* ========== 输入框 ========== */
.input {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
  background: #fff;
  line-height: 1.5;
  color: #111827;
  transition: all 0.15s;
  box-sizing: border-box;
}
.input::placeholder { color: #9ca3af; }
.input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
  background: #fff;
}
select.input {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 20 20' fill='%236b7280'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}

/* ========== 复选框（覆盖 Tailwind Preflight appearance:none 导致的不可见） ========== */
input[type="checkbox"] {
  -webkit-appearance: checkbox !important;
  appearance: checkbox !important;
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
  accent-color: #6366f1;
}
input[type="checkbox"].w-4.h-4 {
  width: 1rem !important;
  height: 1rem !important;
}
input[type="radio"] {
  -webkit-appearance: radio !important;
  appearance: radio !important;
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
  accent-color: #6366f1;
}

/* ========== 表格 ========== */
.table {
  width: 100%;
  font-size: 13px;
  border-collapse: separate;
  border-spacing: 0;
}
.table th {
  text-align: left;
  padding: 10px 12px;
  background: #f7f8fc;
  font-weight: 600;
  color: #4b5563;
  border-bottom: 1px solid #eef0f4;
  font-size: 12px;
}
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f4f5f8;
  color: #374151;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbff; }

/* ========== 徽章 ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-yellow{ background: #fef3c7; color: #92400e; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-gray  { background: #e5e7eb; color: #4b5563; }
.badge-purple{ background: #ede9fe; color: #5b21b6; }

/* ========== 页面级 Tab（参考图：白底+细下划线激活） ========== */
.page-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  padding: 10px 16px !important;
}
.page-tab {
  border: 0;
  background: transparent;
  padding: 8px 16px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  border-radius: 4px;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  font-weight: 500;
}
.page-tab:hover { color: #4f46e5; }
.page-tab-active {
  color: #4f46e5 !important;
  border-bottom-color: #6366f1;
  background: rgba(99,102,241,0.04);
}

/* 旧 Tab 类兼容（保留防止遗漏） */
.tab-active {
  color: #4f46e5 !important;
  border-bottom: 2px solid #6366f1;
}
.secret-tab, .account-tab {
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  padding: 10px 20px;
  cursor: pointer;
  background: transparent;
  border-top: 0;
  border-left: 0;
  border-right: 0;
}
.secret-tab:hover, .account-tab:hover { color: #4f46e5; }

/* ========== Toast ========== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 18px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  z-index: 9999;
  animation: slideIn 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-width: 360px;
}
.toast-success { background: #10b981; }
.toast-error   { background: #ef4444; }
.toast-info    { background: #3b82f6; }
.toast-warning { background: #f59e0b; }
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ========== 加载 Spinner ========== */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #e5e7eb;
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== 间距辅助 ========== */
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }

/* ========== 登录页专用 ========== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #9333ea 100%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 14px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(31, 22, 76, 0.25);
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
  color: #111827;
}
.login-sub { font-size: 13px; color: #6b7280; margin-bottom: 24px; }
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-size: 12px;
  color: #4b5563;
  margin-bottom: 6px;
  font-weight: 500;
}
.login-field .input { width: 100%; padding: 10px 12px; font-size: 14px; }
.login-btn {
  width: 100%;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
}
.login-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
  color: #9ca3af;
}
.login-msg {
  margin-top: 14px;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 6px;
  display: none;
}
.login-msg.err   { background:#fee2e2; color:#991b1b; display:block; }
.login-msg.ok    { background:#d1fae5; color:#065f46; display:block; }

/* ========== 操作列链接按钮颜色 ========== */
table .text-blue-600   { color: #2563eb !important; }
table .text-indigo-600 { color: #4f46e5 !important; }
table .text-green-600  { color: #059669 !important; }
table .text-red-600    { color: #dc2626 !important; }

/* ========== 滚动条（侧边栏） ========== */
aside ::-webkit-scrollbar { width: 6px; height: 6px; }
aside ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
