:root {
  --navy-950: #06132f;
  --navy-900: #0a1c42;
  --navy-800: #102a5c;
  --navy-700: #173c7a;
  --blue-700: #1450b8;
  --blue-600: #1f66dc;
  --blue-500: #2f7cf6;
  --blue-400: #5da0ff;
  --cyan-500: #16b8d8;
  --cyan-400: #37cdea;
  --sky-100: #eaf3ff;
  --sky-50: #f4f8ff;
  --slate-950: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --white: #ffffff;
  --green-600: #079455;
  --green-100: #dcfae6;
  --amber-600: #b54708;
  --amber-100: #fef0c7;
  --red-600: #d92d20;
  --red-100: #fee4e2;
  --purple-600: #7a5af8;
  --purple-100: #ebe9fe;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 8px 24px -8px rgba(15, 23, 42, 0.14);
  --shadow-lg: 0 24px 60px -20px rgba(7, 23, 57, 0.28);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 26px;
  --sidebar-w: 252px;
  --header-h: 72px;
  --font: "Inter", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--slate-800);
  background: var(--slate-50);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin-top: 0; }
::selection { background: rgba(47, 124, 246, .22); }

.icon { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; line-height: 1; transition: .18s ease;
  white-space: nowrap; background: var(--white); color: var(--slate-700);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--blue-600), var(--blue-500));
  color: #fff; box-shadow: 0 6px 14px rgba(31, 102, 220, .22);
}
.btn-primary:hover { box-shadow: 0 8px 20px rgba(31, 102, 220, .32); }
.btn-navy { background: var(--navy-900); color: #fff; }
.btn-outline { border-color: var(--slate-200); background: #fff; color: var(--slate-700); }
.btn-outline:hover { border-color: var(--blue-400); color: var(--blue-600); }
.btn-ghost { background: transparent; color: var(--slate-600); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-900); }
.btn-danger { background: var(--red-600); color: #fff; }
.btn-danger-ghost { background: var(--red-100); color: var(--red-600); }
.btn-success { background: var(--green-600); color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.btn-lg { height: 46px; padding: 0 22px; border-radius: 12px; font-size: 14.5px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 10px; }
.btn-block { width: 100%; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }
.badge.gray { background: var(--slate-100); color: var(--slate-600); }
.badge.blue { background: #e8f1ff; color: var(--blue-600); }
.badge.cyan { background: #e2f8fd; color: #0e8fa9; }
.badge.green { background: var(--green-100); color: var(--green-600); }
.badge.orange { background: var(--amber-100); color: var(--amber-600); }
.badge.red { background: var(--red-100); color: var(--red-600); }
.badge.purple { background: var(--purple-100); color: var(--purple-600); }
.badge.no-dot::before { display: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 650; color: var(--slate-600); }
.field > label .req { color: var(--red-600); margin-left: 2px; }
.field .hint { font-size: 11px; color: var(--slate-400); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--slate-200); background: #fff; border-radius: 10px;
  height: 40px; padding: 0 12px; font-size: 13.5px; color: var(--slate-800); outline: none;
  transition: .16s ease;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.65; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(47, 124, 246, .12); }
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; }
.input-group { display: flex; align-items: center; gap: 8px; }
.input-group .input { flex: 1; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--slate-600); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--blue-600); }
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--slate-300); border-radius: 99px; transition: .2s; }
.switch span::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--blue-600); }
.switch input:checked + span::after { transform: translateX(18px); }

.card {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card-header { padding: 20px 22px; border-bottom: 1px solid var(--slate-100); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.card-header h3 { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -.2px; }
.card-header p { margin: 3px 0 0; font-size: 12px; color: var(--slate-500); }
.card-body { padding: 22px; }
.card-footer { padding: 14px 22px; border-top: 1px solid var(--slate-100); }

.table-wrap { width: 100%; overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  text-align: left; padding: 11px 14px; font-size: 11.5px; font-weight: 650; color: var(--slate-500);
  background: #f8fafc; border-bottom: 1px solid var(--slate-200); white-space: nowrap;
}
.data-table thead th:first-child { border-radius: 8px 0 0 8px; }
.data-table thead th:last-child { border-radius: 0 8px 8px 0; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid var(--slate-100); vertical-align: middle; color: var(--slate-700); }
.data-table tbody tr:hover { background: #fbfdff; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .strong { font-weight: 650; color: var(--slate-900); }
.data-table .muted { color: var(--slate-500); font-size: 12px; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #dfeeff, #c7ddff);
  color: var(--blue-700); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex: 0 0 auto; overflow: hidden;
}
.avatar.round { border-radius: 50%; }
.avatar.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 17px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.table-actions { display: flex; align-items: center; gap: 4px; }
.table-actions .btn { background: transparent; color: var(--slate-500); }
.table-actions .btn:hover { background: var(--sky-100); color: var(--blue-600); }
.table-actions .btn.danger:hover { background: var(--red-100); color: var(--red-600); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { height: 36px; font-size: 12.5px; width: auto; min-width: 140px; }
.toolbar .search { min-width: 220px; }
.toolbar-spacer { flex: 1; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--slate-200); }
.tab {
  border: 0; background: transparent; padding: 10px 16px; font-size: 13px; font-weight: 600;
  color: var(--slate-500); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.empty {
  padding: 48px 20px; text-align: center; color: var(--slate-500);
}
.empty .empty-icon { width: 56px; height: 56px; border-radius: 18px; background: var(--slate-100); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 14px; color: var(--slate-400); }
.empty h4 { margin: 0 0 6px; color: var(--slate-700); font-size: 14px; }
.empty p { margin: 0; font-size: 12px; }

.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-top: 1px solid var(--slate-100); font-size: 12px; color: var(--slate-500); }
.pager { display: flex; gap: 4px; }
.pager button { width: 30px; height: 30px; border: 1px solid var(--slate-200); background: #fff; border-radius: 8px; font-size: 12px; color: var(--slate-600); }
.pager button.active { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(6, 19, 47, .55);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 24px;
  opacity: 0; animation: fadeIn .18s forwards;
}
.modal {
  background: #fff; width: 100%; max-width: 620px; max-height: 90vh; border-radius: 20px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateY(12px) scale(.98);
  animation: modalIn .22s forwards;
}
.modal.wide { max-width: 920px; }
.modal.xwide { max-width: 1120px; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--slate-100); display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-header h3 { margin: 0; font-size: 17px; letter-spacing: -.3px; }
.modal-header p { margin: 4px 0 0; font-size: 12px; color: var(--slate-500); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--slate-100); display: flex; justify-content: flex-end; gap: 10px; }
.close-btn { width: 32px; height: 32px; border: 0; border-radius: 9px; background: var(--slate-100); color: var(--slate-500); display: inline-flex; align-items: center; justify-content: center; }
.close-btn:hover { background: var(--slate-200); color: var(--slate-800); }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes modalIn { to { transform: translateY(0) scale(1); } }

.toast-wrap { position: fixed; right: 22px; bottom: 24px; z-index: 2000; display: flex; flex-direction: column-reverse; gap: 10px; }
.toast {
  min-width: 280px; max-width: 420px; background: #fff; border: 1px solid var(--slate-200);
  border-left: 4px solid var(--blue-500); border-radius: 12px; padding: 13px 15px;
  box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start;
  animation: toastIn .25s ease; font-size: 13px; color: var(--slate-700);
}
.toast.success { border-left-color: var(--green-600); }
.toast.error { border-left-color: var(--red-600); }
.toast.warning { border-left-color: var(--amber-600); }
.toast .t-title { font-weight: 700; color: var(--slate-900); margin-bottom: 2px; }
.toast .t-close { margin-left: auto; border: 0; background: transparent; color: var(--slate-400); padding: 0; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.dark { border-color: var(--slate-200); border-top-color: var(--blue-600); }
.loading-block { padding: 60px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--slate-500); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, #f1f5f9 25%, #e8eef6 37%, #f1f5f9 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.progress { height: 7px; border-radius: 99px; background: var(--slate-100); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blue-500), var(--cyan-400)); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-lg); padding: 20px; position: relative; overflow: hidden; }
.stat-card .stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat-card .stat-label { font-size: 12px; color: var(--slate-500); font-weight: 550; }
.stat-card .stat-value { font-size: 28px; font-weight: 750; letter-spacing: -1px; color: var(--slate-900); line-height: 1; }
.stat-card .stat-value small { font-size: 13px; font-weight: 600; color: var(--slate-400); margin-left: 3px; }
.stat-card .stat-foot { margin-top: 9px; font-size: 11.5px; color: var(--slate-500); display: flex; align-items: center; gap: 5px; }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: var(--sky-100); color: var(--blue-600); }
.stat-icon.green { background: var(--green-100); color: var(--green-600); }
.stat-icon.orange { background: var(--amber-100); color: var(--amber-600); }
.stat-icon.purple { background: var(--purple-100); color: var(--purple-600); }

.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 11px; font-size: 12.5px; line-height: 1.6; }
.alert.info { background: var(--sky-100); color: #1d4ed8; }
.alert.warning { background: var(--amber-100); color: #93400b; }
.alert.error { background: var(--red-100); color: #b42318; }

.kv-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; column-gap: 26px; }
.kv-list .kv { padding: 11px 0; border-bottom: 1px dashed var(--slate-100); display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; }
.kv-list .kv:nth-child(even) { padding-left: 26px; border-left: 1px solid var(--slate-100); }
.kv-list .kv span:first-child { color: var(--slate-500); }
.kv-list .kv span:last-child { color: var(--slate-800); font-weight: 550; text-align: right; }

.desktop-only { display: initial; }
.mobile-only { display: none; }
.text-muted { color: var(--slate-500); }
.text-danger { color: var(--red-600); }
.text-success { color: var(--green-600); }
.text-blue { color: var(--blue-600); }
.fw-700 { font-weight: 700; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }

@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .kv-list { grid-template-columns: 1fr; }
  .kv-list .kv:nth-child(even) { padding-left: 0; border-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 15px; }
  .stat-card .stat-value { font-size: 23px; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 94vh; border-radius: 16px; }
  .modal-body { padding: 18px; }
  .desktop-only { display: none !important; }
  .mobile-only { display: initial; }
}