:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff4ff;
  --primary-soft: #dbeafe;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #ebedf0;
  --border-strong: #dcdfe4;
  --text: #1a1d23;
  --text-2: #5b6470;
  --text-3: #8a929e;
  --success: #15a34a;
  --success-bg: #eaf7ef;
  --warning: #c2740a;
  --warning-bg: #fdf3e3;
  --danger: #dc2626;
  --danger-bg: #fdecec;
  --radius: 12px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 6px 24px rgba(16, 24, 40, 0.08);
  --sidebar-bg: #fbfcfe;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
}
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui,
    -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a {
  color: inherit;
  text-decoration: none;
}
h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: 0.2px;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease,
    transform 0.05s ease;
  white-space: nowrap;
}
.btn:hover {
  border-color: var(--text-3);
  background: var(--surface-2);
}
.btn:active {
  transform: translateY(1px);
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.btn-success {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.btn-success:hover {
  filter: brightness(0.96);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(0.96);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.btn-sm {
  height: 32px;
  padding: 0 13px;
  font-size: 13px;
}
.btn-block {
  width: 100%;
  height: 42px;
  font-size: 15px;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- 表单 ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}
.field > label {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
}
.req {
  color: var(--danger);
  margin-left: 2px;
}
.input {
  height: 40px;
  width: 100%;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea.input {
  height: auto;
  padding: 11px 13px;
  resize: vertical;
  line-height: 1.6;
}
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}
.input::placeholder {
  color: var(--text-3);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.form-grid .span2 {
  grid-column: 1 / -1;
}
.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
  margin-top: 2px;
}
.link {
  color: var(--primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.link:hover {
  text-decoration: underline;
}
.link.danger {
  color: var(--danger);
}
.muted {
  color: var(--text-3);
  font-weight: 400;
  font-size: 14px;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
  transition: box-shadow 0.18s ease;
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 {
  font-size: 15px;
}
.card > form,
.card > .detail-grid,
.card > .review-note,
.card > textarea,
.license {
  padding: 20px;
}

/* ---------- 登录/注册 ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #eef2f8 0%, #f4f5f7 55%);
  padding: 20px;
}
.auth-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-md);
  padding: 38px 34px 32px;
}
.auth-card::before {
  content: "";
  display: block;
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: var(--primary);
  margin: 0 auto 22px;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  text-align: center;
}
.auth-title {
  font-size: 20px;
  font-weight: 600;
}
.auth-sub {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: 1px;
}
.auth-form .field {
  margin-bottom: 18px;
}
.auth-foot {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-2);
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* ---------- 布局 ---------- */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: 58px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand-name {
  font-size: 16px;
  font-weight: 600;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.user-name {
  font-size: 14px;
  font-weight: 500;
}
.role-tag {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}
.body {
  flex: 1;
  display: flex;
}
.sidebar {
  width: 224px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  flex-shrink: 0;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item:hover {
  background: #eef1f5;
  color: var(--text);
}
.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.28);
}
.nav-item.active .nav-icon {
  opacity: 1;
}
.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
}
.content {
  flex: 1;
  padding: 26px 28px;
  min-width: 0;
}

/* ---------- 页面头 ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-head h1 {
  font-size: 21px;
  font-weight: 600;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- 统计卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 20px 20px 22px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
}
.stat-card:nth-child(2)::before {
  background: var(--warning);
}
.stat-card:nth-child(3)::before {
  background: var(--success);
}
.stat-card:nth-child(4)::before {
  background: var(--danger);
}
.stat-label {
  font-size: 13px;
  color: var(--text-2);
}
.stat-num {
  font-size: 30px;
  font-weight: 600;
  margin-top: 8px;
  letter-spacing: 0.5px;
}
.stat-num.warn {
  color: var(--warning);
}
.stat-num.ok {
  color: var(--success);
}
.stat-num.bad {
  color: var(--danger);
}

/* ---------- 表格 ---------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.table td {
  padding: 13px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.table tbody tr {
  transition: background 0.12s ease;
}
.table tbody tr:hover {
  background: var(--primary-light);
}
.row-actions {
  display: flex;
  gap: 14px;
}

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: #eef0f3;
  color: var(--text-2);
}
.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}
.badge-success {
  background: var(--success-bg);
  color: var(--success);
}
.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
}
.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

/* ---------- 详情 ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 32px;
}
.detail-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.detail-label {
  font-size: 12px;
  color: var(--text-3);
}
.detail-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-all;
}
.license {
  background: linear-gradient(180deg, var(--primary-light), #fff);
  border: 1px solid var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 15px;
  margin: 0 20px 20px;
}
.license b {
  color: var(--primary);
  letter-spacing: 0.5px;
}
.review-note {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
}
.card > textarea {
  margin: 0;
}

/* ---------- 筛选条 ---------- */
.filter-bar {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.chip {
  padding: 6px 15px;
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 20px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* ---------- 空态 ---------- */
.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}
.toast {
  background: #1f2329;
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.25s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
.toast-success {
  background: #15803d;
}
.toast-error {
  background: #b91c1c;
}

/* ---------- Modal ---------- */
#modal-root:empty {
  display: none;
}
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 20px;
  animation: mask-in 0.15s ease;
}
@keyframes mask-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal {
  background: #fff;
  border-radius: 14px;
  width: 380px;
  max-width: 100%;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.modal-title {
  padding: 20px 22px 0;
  font-size: 16px;
  font-weight: 600;
}
.modal-body {
  padding: 12px 22px 20px;
  color: var(--text-2);
  font-size: 14px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .sidebar {
    display: none;
  }
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 16px;
  }
}
