:root {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6eaf2;
  --line-strong: #d5dce9;
  --brand: #3457e0;
  --brand-2: #5b7cfa;
  --brand-soft: #eef2ff;
  --success: #0f9f6e;
  --success-soft: #e8f8f1;
  --warning: #d97706;
  --warning-soft: #fef4e6;
  --danger: #e5484d;
  --danger-soft: #feecec;
  --purple: #7c5cff;
  --purple-soft: #f1edff;
  --sidebar: #0a1120;
  --sidebar-2: #0f1a2f;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system,
    "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

svg {
  flex: none;
}

::selection {
  background: rgba(52, 87, 224, 0.16);
}

/* ---------------- 布局 ---------------- */

.app {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  background:
    radial-gradient(800px 400px at -20% -10%, rgba(91, 124, 250, 0.22), transparent 60%),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
  color: #c8d3e6;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 18px;
  z-index: 40;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 22px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #5b7cfa, #8fa6ff 55%, #3dd6c0);
  display: grid;
  place-items: center;
  color: #08101f;
  box-shadow: 0 8px 20px rgba(91, 124, 250, 0.35);
  flex: none;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 11px;
  color: #7f90ad;
  letter-spacing: 0.16em;
  margin-top: 2px;
}

.nav-section {
  font-size: 11px;
  color: #62718c;
  letter-spacing: 0.14em;
  padding: 16px 12px 8px;
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #aab8cf;
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background 0.16s ease, color 0.16s ease;
}

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

.nav-item.active {
  background: rgba(91, 124, 250, 0.16);
  color: #fff;
  box-shadow: inset 3px 0 0 #7f9bff;
}

.nav-item.active svg {
  color: #9db0ff;
}

.nav-item .nav-label {
  flex: 1;
}

.nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #43d9b3;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 12px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 11.5px;
  color: #6c7b95;
  line-height: 1.7;
}

.sidebar-foot strong {
  color: #9fb0cc;
  font-weight: 600;
}

.main {
  margin-left: 248px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  background: rgba(243, 245, 250, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(214, 221, 234, 0.7);
}

.topbar-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--ink-2);
}

.topbar-crumb {
  color: var(--muted-2);
  font-size: 12.5px;
}

.topbar-spacer {
  flex: 1;
}

.topbar-date {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12.5px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  position: relative;
  user-select: none;
}

.user-chip:hover {
  border-color: var(--line-strong);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #4759d6, #7c8ef8);
  flex: none;
}

.avatar.sm {
  width: 26px;
  height: 26px;
  font-size: 11px;
}

.user-meta {
  line-height: 1.2;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.user-role {
  font-size: 10.5px;
  color: var(--muted-2);
  margin-top: 2px;
}

.user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: none;
  z-index: 50;
}

.user-menu.open {
  display: block;
  animation: fadeIn 0.14s ease;
}

.user-menu-head {
  padding: 10px 10px 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 5px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}

.user-menu-item:hover {
  background: #f4f6fb;
}

.user-menu-item.danger {
  color: var(--danger);
}

.menu-toggle {
  display: none;
}

.content {
  padding: 24px 28px 56px;
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  flex: 1;
}

/* ---------------- 通用组件 ---------------- */

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.page-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #eef1f7;
}

.card-title {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 2px;
}

.card-body {
  padding: 20px;
}

.card-body.flush {
  padding: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.2;
}

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

.btn-primary {
  background: linear-gradient(135deg, #3b5bdb, #4f6ef7);
  color: #fff;
  box-shadow: 0 6px 16px rgba(59, 91, 219, 0.22);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(59, 91, 219, 0.3);
}

.btn-secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.btn-secondary:hover:not(:disabled) {
  border-color: #b9c4d8;
  background: #fbfcff;
}

.btn-soft {
  background: var(--brand-soft);
  color: var(--brand);
}

.btn-soft:hover:not(:disabled) {
  background: #e3e9ff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  background: #f1f4fa;
  color: var(--ink-2);
}

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

.btn-danger:hover:not(:disabled) {
  background: #d43a3f;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-icon {
  padding: 7px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn:hover {
  background: #f1f4fa;
  color: var(--ink-2);
}

.icon-btn.danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #aab4c5;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: #7d93f5;
  box-shadow: 0 0 0 3px rgba(91, 124, 250, 0.14);
}

.input:disabled,
.select:disabled {
  background: #f7f9fc;
  color: var(--muted);
}

.textarea {
  resize: vertical;
  min-height: 72px;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' 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: 32px;
}

.search-box {
  position: relative;
  min-width: 210px;
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
}

.search-box .input {
  padding-left: 34px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.field-label em {
  color: var(--danger);
  font-style: normal;
  margin-left: 2px;
}

.field-hint {
  font-size: 11.5px;
  color: var(--muted-2);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 16px;
}

.span-2 {
  grid-column: span 2;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-spacer {
  flex: 1;
}

.toolbar .select {
  width: auto;
  min-width: 116px;
}

.toolbar .input {
  width: auto;
}

.tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  background: #e9edf5;
  border-radius: 11px;
}

.tab {
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  cursor: pointer;
  border: 0;
  background: transparent;
  transition: all 0.15s ease;
}

.tab:hover {
  color: var(--ink-2);
}

.tab.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.1);
}

/* ---------------- 表格 ---------------- */

.table-wrap {
  overflow-x: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  letter-spacing: 0.02em;
  background: #f8fafd;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data td {
  padding: 13px 16px;
  border-bottom: 1px solid #eff2f8;
  color: var(--ink-2);
  vertical-align: middle;
}

table.data tbody tr:last-child td {
  border-bottom: 0;
}

table.data tbody tr:hover {
  background: #fafbff;
}

table.data td.num,
table.data th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cell-main {
  font-weight: 600;
  color: var(--ink);
}

.cell-sub {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 2px;
}

.cell-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.cell-actions .btn {
  padding: 5px 9px;
  font-size: 12px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  flex-wrap: wrap;
}

.pager-btns {
  display: flex;
  gap: 6px;
}

.table-empty {
  padding: 42px 20px;
}

.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;
  line-height: 1.6;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.badge-green {
  background: var(--success-soft);
  color: var(--success);
}

.badge-blue {
  background: #eaf0ff;
  color: #3b5bdb;
}

.badge-amber {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-red {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-purple {
  background: var(--purple-soft);
  color: var(--purple);
}

.badge-gray {
  background: #eef1f6;
  color: #64748b;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  font-size: 10.5px;
  border-radius: 5px;
  background: #f1f4fa;
  color: var(--muted);
  font-weight: 600;
}

.chip.write {
  background: var(--success-soft);
  color: var(--success);
}

.chip.read {
  background: #eaf0ff;
  color: #3b5bdb;
}

.chip.none {
  background: #f1f3f7;
  color: #a3adbf;
}

/* ---------------- 仪表盘 ---------------- */

.greeting {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.greeting h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.greeting p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.capital-strip-sub {
  font-size: 11px;
  color: var(--muted-2);
}

.finance-overview {
  margin-bottom: 18px;
  overflow: hidden;
}

.finance-overview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px 0;
}

.finance-overview-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.finance-overview-body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr);
  gap: 24px;
  padding: 14px 20px 20px;
  align-items: start;
}

.finance-hero {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.finance-hero-label {
  font-size: 11.5px;
  color: var(--muted);
}

.finance-hero-value {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.finance-hero-sub {
  font-size: 11.5px;
  color: var(--muted-2);
}

.finance-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
}

.finance-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.finance-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
  padding-left: 24px;
  border-left: 1px solid var(--line);
}

.finance-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.finance-total-label {
  font-size: 11.5px;
  color: var(--muted);
}

.finance-total-value {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.finance-total-sub {
  font-size: 11px;
  color: var(--muted-2);
}

.finance-total-note {
  align-self: center;
  color: var(--muted-2);
  font-size: 12px;
}

.payables-card {
  margin-bottom: 18px;
}

.payables-sum {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.payables-overdue {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--danger);
}

.payables-list {
  display: flex;
  flex-direction: column;
  padding: 2px 20px 14px;
}

.payable-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.payable-item:first-child {
  border-top: none;
}

.payable-type {
  flex: none;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f1f4f9;
  color: var(--muted);
  font-size: 10.5px;
}

.payable-main {
  flex: 1;
  min-width: 0;
}

.payable-title {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.payable-sub {
  font-size: 11px;
  color: var(--muted-2);
}

.payable-side {
  flex: none;
  text-align: right;
}

.payable-amount {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.payable-due {
  font-size: 10.5px;
  color: var(--muted-2);
}

.payable-due.overdue {
  color: var(--danger);
  font-weight: 600;
}

@media (max-width: 1180px) {
  .finance-overview-body {
    grid-template-columns: minmax(220px, 1fr) minmax(0, 1.6fr);
  }
}

@media (max-width: 760px) {
  .finance-overview-body {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .finance-totals {
    padding-left: 0;
    border-left: none;
    border-top: 1px solid var(--line);
    padding-top: 14px;
  }
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kpi-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 550;
}

.kpi-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 10px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.kpi-value small {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 3px;
}

.kpi-foot {
  margin-top: 7px;
  font-size: 11.5px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi.accent-green .kpi-icon {
  background: var(--success-soft);
  color: var(--success);
}

.kpi.accent-amber .kpi-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.kpi.accent-purple .kpi-icon {
  background: var(--purple-soft);
  color: var(--purple);
}

.kpi.accent-rose .kpi-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.dashboard-grid.equal {
  grid-template-columns: 1fr 1fr;
}

.chart-body {
  padding: 12px 18px 18px;
}

.chart-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
}

.chart-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.chart-empty {
  height: 210px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  font-size: 12.5px;
}

.donut-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 0 4px;
}

.donut-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  width: 100%;
  margin-top: 12px;
  padding: 0 6px;
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: var(--muted);
}

.donut-legend-item b {
  color: var(--ink-2);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.schedule-list {
  display: flex;
  flex-direction: column;
}

.schedule-item {
  padding: 12px 20px;
  border-bottom: 1px solid #eff2f8;
}

.schedule-item:last-child {
  border-bottom: 0;
}

.schedule-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.schedule-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-meta {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 3px;
}

.progress {
  height: 5px;
  border-radius: 3px;
  background: #eef1f7;
  overflow: hidden;
  margin-top: 8px;
}

.progress > span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #5b7cfa, #3dd6c0);
  transition: width 0.5s ease;
}

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 550;
  cursor: pointer;
  transition: all 0.15s ease;
}

.quick-action:hover {
  border-color: #c6d0e2;
  background: #fbfcff;
  transform: translateY(-1px);
}

.quick-action svg {
  color: var(--brand);
}

/* ---------------- 空状态 ---------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 42px 20px;
  color: var(--muted);
}

.empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: #f3f6fc;
  color: #9aa7bf;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}

.empty-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.empty-desc {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 4px;
  max-width: 340px;
}

/* ---------------- 弹窗 ---------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

.modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
  animation: slideUp 0.2s ease;
}

.modal-lg {
  max-width: 780px;
}

.modal-xl {
  max-width: 940px;
}

.modal-sm {
  max-width: 430px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.modal-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.modal-body {
  padding: 6px 22px 20px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
}

.modal-foot .left {
  margin-right: auto;
}

.modal-note {
  background: #f6f8fc;
  border: 1px solid #e9eef7;
  padding: 11px 13px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

/* ---------------- 登录 ---------------- */

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: #fff;
}

.login-brand {
  position: relative;
  background:
    radial-gradient(900px 600px at 10% 0%, rgba(91, 124, 250, 0.32), transparent 55%),
    radial-gradient(700px 500px at 90% 100%, rgba(61, 214, 192, 0.16), transparent 55%),
    linear-gradient(160deg, #0a1120 20%, #101d36 70%, #0c1628);
  color: #fff;
  padding: 54px 58px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.login-brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 60% 40%, #000 0%, transparent 75%);
  pointer-events: none;
}

.login-brand > * {
  position: relative;
  z-index: 1;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-logo .brand-mark {
  width: 42px;
  height: 42px;
}

.login-logo-name {
  font-size: 18px;
  font-weight: 700;
}

.login-logo-sub {
  font-size: 11px;
  color: #8194b4;
  letter-spacing: 0.18em;
  margin-top: 3px;
}

.login-hero h1 {
  font-size: 40px;
  line-height: 1.2;
  letter-spacing: -0.04em;
  font-weight: 700;
  max-width: 520px;
}

.login-hero h1 span {
  background: linear-gradient(100deg, #9fb2ff, #57dfc4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-hero p {
  margin-top: 18px;
  color: #90a1be;
  font-size: 14px;
  max-width: 470px;
  line-height: 1.8;
}

.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 34px;
  max-width: 520px;
}

.login-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12.5px;
  color: #c3d0e5;
}

.login-feature svg {
  color: #7f9bff;
}

.login-foot {
  font-size: 11.5px;
  color: #63748f;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 372px;
}

.login-card h2 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-card .login-desc {
  color: var(--muted);
  font-size: 13px;
  margin-top: 7px;
  margin-bottom: 28px;
}

.login-card .field {
  margin-bottom: 16px;
}

.login-card .input {
  padding: 11px 13px;
}

.login-error {
  background: var(--danger-soft);
  color: #c22d33;
  border: 1px solid #fbd5d7;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 12.5px;
  margin-bottom: 14px;
  display: none;
}

.login-error.show {
  display: block;
  animation: fadeIn 0.15s ease;
}

.login-btn {
  width: 100%;
  padding: 12px;
  margin-top: 6px;
  font-size: 14px;
}

.login-hint {
  margin-top: 24px;
  padding: 11px 13px;
  border-radius: 10px;
  background: #f6f8fc;
  border: 1px dashed #dde4f0;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.7;
}

.login-hint code {
  background: #eef2fb;
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--ink-2);
  font-family: "SFMono-Regular", Consolas, monospace;
}

/* ---------------- 导入 / 文档 ---------------- */

.dropzone {
  border: 1.5px dashed #cfd8e8;
  border-radius: 12px;
  padding: 26px 18px;
  text-align: center;
  background: #fafbfe;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: #8aa1f6;
  background: #f3f6ff;
}

.dropzone-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  margin: 0 auto 9px;
}

.dropzone-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

.dropzone-desc {
  font-size: 11.5px;
  color: var(--muted-2);
  margin-top: 4px;
}

.parse-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: #334dbb;
  font-size: 12px;
  margin: 14px 0;
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mapping-table th,
.mapping-table td {
  padding: 8px 9px;
  border-bottom: 1px solid #eef1f7;
  text-align: left;
}

.mapping-table th {
  background: #f8fafd;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
}

.mapping-table .select {
  padding: 6px 9px;
  font-size: 12px;
}

.preview-scroll {
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.import-result {
  text-align: center;
  padding: 22px 10px;
}

.import-result .result-num {
  font-size: 36px;
  font-weight: 700;
  color: var(--success);
  letter-spacing: -0.04em;
}

.failed-list {
  margin-top: 14px;
  text-align: left;
  max-height: 170px;
  overflow: auto;
  border: 1px solid #f6d7d9;
  background: #fff8f8;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  color: #b7383d;
  line-height: 1.8;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.doc-card {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px;
  background: #fff;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}

.doc-card:hover {
  border-color: #cbd5e7;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
  transform: translateY(-2px);
}

.doc-top {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.doc-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  flex: none;
}

.doc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

.doc-meta {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.doc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f0f3f9;
  justify-content: flex-end;
}

.doc-actions .btn {
  height: 30px;
}

.doc-preview-image {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 70vh;
  padding: 12px;
  background: #f6f8fb;
  border-radius: 12px;
  overflow: auto;
}

.doc-preview-image img {
  max-width: 100%;
  max-height: 68vh;
  border-radius: 8px;
  object-fit: contain;
}

.doc-preview-frame {
  width: 100%;
  height: 70vh;
  border: 0;
  border-radius: 12px;
  background: #fff;
}

.doc-preview-text {
  margin: 0;
  padding: 16px;
  max-height: 68vh;
  overflow: auto;
  background: #f6f8fb;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}

.deletion-snapshot {
  margin: 0;
  padding: 14px 16px;
  max-height: 50vh;
  overflow: auto;
  background: #f6f8fb;
  border: 1px solid #eef1f7;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-gallery {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-gallery-stage {
  flex: 1;
  min-width: 0;
  height: 56vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f6f8fb;
  border-radius: 12px;
  overflow: hidden;
}

.doc-gallery-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-nav {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: all 0.15s ease;
}

.gallery-nav:hover:not(:disabled) {
  background: var(--brand-soft);
  border-color: #c7d2f8;
  color: var(--brand);
}

.gallery-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.doc-gallery-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.doc-gallery-bar > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-gallery-count {
  color: var(--ink-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex: none;
}

.doc-gallery-thumbs {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-bottom: 4px;
  overflow-x: auto;
}

.doc-gallery-thumb {
  flex: none;
  width: 64px;
  height: 52px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f6f8fb;
  cursor: pointer;
  overflow: hidden;
}

.doc-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.doc-gallery-thumb.active {
  border-color: var(--brand);
}

.upload-file-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.upload-file-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 8px 6px 12px;
  background: #f7f9fc;
  border-bottom: 1px solid #eef1f7;
  font-size: 12px;
  color: var(--muted);
}

.upload-file-list {
  max-height: 168px;
  overflow-y: auto;
}

.upload-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 12.5px;
}

.upload-file + .upload-file {
  border-top: 1px solid #f2f5fa;
}

.upload-file-name {
  flex: 1;
  min-width: 0;
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-file-size {
  flex: none;
  color: var(--muted-2);
  font-size: 11.5px;
}

.upload-file-remove {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 6px;
}

.upload-file-remove:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.doc-drop {
  margin-bottom: 16px;
}

/* ---------------- 权限 ---------------- */

.perm-matrix {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.perm-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #eff2f8;
}

.perm-row:last-child {
  border-bottom: 0;
}

.perm-name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.perm-select {
  width: 112px;
  padding: 7px 28px 7px 10px;
  font-size: 12px;
}

.demo-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 16px;
  border-radius: 12px;
  background: linear-gradient(100deg, #eef3ff, #f7f9ff);
  border: 1px solid #dce5fb;
  color: #34509e;
  font-size: 12.5px;
  margin-bottom: 16px;
  line-height: 1.65;
}

.demo-banner svg {
  margin-top: 1px;
  color: #5b7cfa;
}

.perm-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ---------------- 提示 ---------------- */

.toast-root {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 240px;
  max-width: 380px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
  font-size: 12.5px;
  color: var(--ink-2);
  animation: toastIn 0.22s ease;
  pointer-events: auto;
}

.toast.leaving {
  animation: toastOut 0.2s ease forwards;
}

.toast svg {
  margin-top: 1px;
}

.toast-success svg {
  color: var(--success);
}

.toast-error svg {
  color: var(--danger);
}

.toast-warning svg {
  color: var(--warning);
}

.loading-block {
  padding: 70px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  gap: 10px;
  font-size: 13px;
}

.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid #dbe2f0;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

.skeleton {
  background: linear-gradient(90deg, #eef1f7 25%, #f6f8fc 37%, #eef1f7 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mini-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
}

.mini-stat-label {
  font-size: 11.5px;
  color: var(--muted);
}

.mini-stat-value {
  font-size: 19px;
  font-weight: 700;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.mini-stat-value small {
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 500;
}

.temp-password {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 11px;
  background: #f4f7ff;
  border: 1px dashed #b9c8f5;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 17px;
  font-weight: 700;
  color: #2e46a8;
  letter-spacing: 0.06em;
  margin: 14px 0;
}

@media (max-width: 1380px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .sidebar {
    width: 220px;
  }
  .main {
    margin-left: 220px;
  }
  .content {
    padding: 20px 20px 48px;
  }
  .topbar {
    padding: 0 20px;
  }
  .dashboard-grid,
  .dashboard-grid.equal {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    width: 248px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  .menu-toggle {
    display: inline-grid;
  }
  .topbar-date {
    display: none;
  }
  .login-page {
    grid-template-columns: 1fr;
  }
  .login-brand {
    display: none;
  }
  .login-panel {
    min-height: 100vh;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 560px) {
  .content {
    padding: 16px 14px 40px;
  }
  .topbar {
    padding: 0 14px;
    height: 62px;
  }
  .page-title {
    font-size: 20px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .user-meta {
    display: none;
  }
  .card-head,
  .card-body {
    padding-left: 15px;
    padding-right: 15px;
  }
  .modal {
    max-height: 94vh;
  }
  .modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }
  .modal-head,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .login-panel {
    padding: 26px;
  }
}

/* ---------------- 动画 ---------------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateX(20px);
  }
}

@keyframes growBar {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

.chart-bar {
  transform-origin: bottom;
  animation: growBar 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.dash-refreshed .chart-bar {
  animation: none;
}

@keyframes drawLine {
  to {
    stroke-dashoffset: 0;
  }
}
