/* ==========================================================================
   综合信息汇总平台 · 基础样式（设计令牌 / 组件）
   零依赖，兼容 PC 与移动端主流浏览器
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --brand: #3b6ef6;
  --brand-dark: #2a55d4;
  --brand-light: #eef3ff;
  --brand-2: #7c5cff;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f9;

  --text: #0f172a;
  --text-2: #475467;
  --text-3: #8a94a6;
  --text-inv: #ffffff;

  --border: #e6e9f0;
  --border-strong: #d3d9e4;

  --success: #12b76a;
  --success-bg: #e9f9f1;
  --warn: #f79009;
  --warn-bg: #fef6e7;
  --danger: #f04438;
  --danger-bg: #fdecea;
  --info: #2e90fa;
  --info-bg: #eaf4ff;
  --purple: #7c5cff;
  --purple-bg: #f1edff;

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 8px;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 2px 8px rgba(16, 24, 40, 0.06);
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.14);

  --header-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans CN", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --brand: #6b93ff;
  --brand-dark: #4a76ef;
  --brand-light: #1b2643;
  --brand-2: #9b83ff;

  --bg: #0d1117;
  --surface: #151b26;
  --surface-2: #1a2130;
  --surface-3: #202836;

  --text: #eef2f9;
  --text-2: #a9b4c7;
  --text-3: #77839a;
  --text-inv: #0d1117;

  --border: #232c3b;
  --border-strong: #313c4e;

  --success: #38d996;
  --success-bg: #10291f;
  --warn: #f7b955;
  --warn-bg: #2c2113;
  --danger: #ff7b72;
  --danger-bg: #2f1715;
  --info: #6cb1ff;
  --info-bg: #132538;
  --purple: #a78bfa;
  --purple-bg: #1e1a33;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, p, figure {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: rgba(59, 110, 246, 0.2);
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 9px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-3);
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* ============================ 布局工具 ============================ */

.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.row {
  display: flex;
  align-items: center;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wrap {
  flex-wrap: wrap;
}
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.muted { color: var(--text-2); }
.muted-2 { color: var(--text-3); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ============================ 按钮 ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.16s ease;
  user-select: none;
}

.btn:hover {
  border-color: var(--border-strong);
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #4f7cff 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(59, 110, 246, 0.28);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(59, 110, 246, 0.34);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-3);
  color: var(--text);
  border-color: transparent;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
}
.btn-danger:hover {
  background: #d92d20;
  border-color: transparent;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn-danger-ghost:hover {
  background: var(--danger-bg);
  border-color: transparent;
}

.btn-sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: var(--radius-xs);
}

.btn-lg {
  height: 46px;
  padding: 0 24px;
  font-size: 15px;
  border-radius: 12px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ============================ 表单 ============================ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}
.field > label .req {
  color: var(--danger);
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.textarea {
  height: auto;
  min-height: 92px;
  padding: 10px 12px;
  line-height: 1.6;
  resize: vertical;
}

.input::placeholder,
.textarea::placeholder {
  color: var(--text-3);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, 0.14);
}

.input:disabled,
.select:disabled {
  background: var(--surface-3);
  color: var(--text-3);
  cursor: not-allowed;
}

.select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.input-sm {
  height: 34px;
  font-size: 13px;
}

.field-hint {
  font-size: 12px;
  color: var(--text-3);
}

.field-error {
  font-size: 12px;
  color: var(--danger);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-2);
  user-select: none;
}
.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
}

.switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex: none;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.switch span {
  position: absolute;
  inset: 0;
  background: var(--border-strong);
  border-radius: 24px;
  transition: 0.2s;
  cursor: pointer;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
.switch input:checked + span {
  background: var(--brand);
}
.switch input:checked + span::before {
  transform: translateX(18px);
}

/* ============================ 卡片 / 面板 ============================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
}

.card-pad {
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

/* ============================ 徽章 / 标签 ============================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--text-2);
}

.badge-brand { background: var(--brand-light); color: var(--brand); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  border: 1px solid transparent;
}

.tag-click {
  cursor: pointer;
  transition: all 0.14s;
}
.tag-click:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-light);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
}
.chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 3px 10px rgba(59, 110, 246, 0.3);
}

/* ============================ 表格 ============================ */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  padding: 11px 14px;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr {
  transition: background 0.12s;
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table tbody tr:last-child td {
  border-bottom: none;
}

.table .col-actions {
  text-align: right;
  white-space: nowrap;
}

/* ============================ 分页 ============================ */

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 4px;
}

.pager-info {
  font-size: 13px;
  color: var(--text-3);
}

.pager-list {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager-btn {
  min-width: 34px;
  height: 34px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.14s;
}
.pager-btn:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}
.pager-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.pager-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pager-dots {
  color: var(--text-3);
  padding: 0 2px;
}

/* ============================ 弹窗 ============================ */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 900;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}
.modal-mask.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 48px);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s;
  overflow: hidden;
}
.modal-mask.open .modal {
  transform: none;
}

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 980px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* ============================ 轻提示 ============================ */

.toast-host {
  position: fixed;
  top: 78px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 40px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: toastIn 0.24s ease;
  max-width: 100%;
}
.toast.hide {
  animation: toastOut 0.2s ease forwards;
}
.toast-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #fff;
  flex: none;
}
.toast-success .toast-icon { background: var(--success); }
.toast-error .toast-icon { background: var(--danger); }
.toast-info .toast-icon { background: var(--brand); }
.toast-warn .toast-icon { background: var(--warn); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ============================ 空态 / 加载 ============================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 20px;
  color: var(--text-3);
  text-align: center;
}
.empty-icon {
  font-size: 40px;
  opacity: 0.55;
  line-height: 1;
}
.empty-title {
  font-size: 14.5px;
  color: var(--text-2);
  font-weight: 500;
}
.empty-desc {
  font-size: 13px;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border-strong);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 60px 20px;
  color: var(--text-3);
  font-size: 13.5px;
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ============================ 分段控件 ============================ */

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-3);
  border-radius: 9px;
  gap: 2px;
}
.segmented button {
  height: 28px;
  padding: 0 12px;
  border: none;
  background: transparent;
  border-radius: 7px;
  color: var(--text-3);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.14s;
  white-space: nowrap;
}
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* ============================ 头像 ============================ */

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  flex: none;
  overflow: hidden;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 19px;
}

/* ============================ 通用工具类 ============================ */

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.vdivider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

.text-success { color: var(--success); }
.text-warn { color: var(--warn); }
.text-danger { color: var(--danger); }
.text-brand { color: var(--brand); }

@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .toast-host { top: 72px; }
  .modal { max-width: 100%; }
  .modal-foot { padding: 14px 16px; }
  .modal-head { padding: 15px 16px; }
  .modal-body { padding: 16px; }
}
