:root {
  --bg: #eef1f4;
  --panel: #ffffff;
  --panel-2: #f7f9fb;
  --ink: #1d2530;
  --muted: #67717f;
  --faint: #97a1ad;
  --line: #dfe5ea;
  --line-2: #edf0f3;
  --brand: #0e9f8d;
  --brand-strong: #0a7f71;
  --brand-soft: #e2f4f1;
  --amber: #d98b1f;
  --amber-soft: #fdf0dd;
  --red: #d04545;
  --red-soft: #fbe9e9;
  --green: #2e9e5b;
  --green-soft: #e5f5ea;
  --blue: #4f7dd9;
  --blue-soft: #e8eefb;
  --rose: #d9537a;
  --rose-soft: #fbeaf0;
  --sidebar: #14191f;
  --sidebar-ink: #c9d2da;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 30, 40, 0.05), 0 4px 16px rgba(20, 30, 40, 0.05);
  --shadow-lg: 0 12px 40px rgba(15, 25, 35, 0.18);
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, sans-serif;
}

body.dark {
  --bg: #10151a;
  --panel: #171e25;
  --panel-2: #1d262e;
  --ink: #e6ecf1;
  --muted: #9aa7b2;
  --faint: #6b7780;
  --line: #2a3540;
  --line-2: #232d36;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5);
}

body.dark .topbar {
  background: rgba(23, 30, 37, 0.92);
}

body.dark .card,
body.dark .list-item,
body.dark .doc-card,
body.dark .modal,
body.dark .drawer,
body.dark .login-card,
body.dark .lock-card {
  background: var(--panel);
  color: var(--ink);
}

body.dark .input,
body.dark .select,
body.dark .textarea {
  background: #12181f;
  border-color: var(--line);
  color: var(--ink);
}

body.dark .table th {
  background: var(--panel-2);
}

body.dark .table tbody tr:hover {
  background: #1a222a;
}

body.dark .bar-track {
  background: #232d36;
}

body.dark .seg {
  background: var(--panel);
}

body.dark .tabs {
  background: #1d262e;
}

body.dark .tab.active {
  background: var(--panel);
  color: var(--ink);
}

body.dark .chip {
  background: #232d36;
  color: var(--muted);
}

body.dark .boot-screen,
body.dark .login-screen {
  background: var(--bg);
}

body.dark .file-drop,
body.dark .import-result {
  background: #12181f;
}

body.dark .modal-backdrop,
body.dark .drawer-backdrop {
  background: rgba(0, 0, 0, 0.6);
}

body.dark .row-click:hover {
  background: #1a222a;
}

body.dark .brand-sub {
  color: #5f6c78;
}

* {
  box-sizing: border-box;
}

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

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

button {
  font-family: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 196px;
  flex: 0 0 196px;
  transition: width 0.18s ease, flex-basis 0.18s ease;
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 2px 10px 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 9px;
  background: linear-gradient(135deg, #16b3a0, #0a7f71);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark svg {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.brand-name {
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.brand-sub {
  color: #7e8c99;
  font-size: 12px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: #aeb9c4;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

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

.nav-item.active {
  background: rgba(14, 159, 141, 0.18);
  color: #4fe0cd;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 26px;
  padding: 8px 8px 2px;
  color: #71808d;
  font-size: 12px;
  width: 100%;
}

.foot-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #cdd8df;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.foot-btn:hover {
  background: rgba(79, 224, 205, 0.14);
  color: #fff;
  border-color: rgba(79, 224, 205, 0.35);
}

#logout-btn.foot-btn:hover {
  background: rgba(208, 69, 69, 0.16);
  color: #fff;
  border-color: rgba(208, 69, 69, 0.4);
}

.foot-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

body.sidebar-collapsed .foot-btn {
  width: 42px;
  height: 42px;
  padding: 0;
  justify-content: center;
}

body.sidebar-collapsed .foot-btn span:last-child {
  display: none;
}

body.sidebar-collapsed .sidebar {
  width: 64px;
  flex-basis: 64px;
}

body.sidebar-collapsed .brand {
  justify-content: center;
  padding: 6px 8px 14px;
}

body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .brand-sub {
  display: none;
}

body.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
}

body.sidebar-collapsed .nav-item span:last-child {
  display: none;
}

body.sidebar-collapsed .sidebar-foot {
  justify-content: center;
  padding-left: 4px;
  padding-right: 4px;
}

body.sidebar-collapsed .sidebar-foot > span {
  display: none;
}

.sidebar-toggle-btn {
  width: 100%;
  height: 44px;
  color: #fff;
  border-radius: 10px;
  background: linear-gradient(135deg, #16b3a0, #0a7f71);
  border: 0;
  padding: 0 12px;
  display: inline-flex;
  gap: 8px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(10, 127, 113, 0.35);
}

.sidebar-toggle-btn:hover {
  color: #fff;
  background: linear-gradient(135deg, #1bc2ae, #0c8d7e);
}

.sidebar-toggle-btn svg {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.sidebar-logout-btn {
  width: 100%;
  height: 44px;
  color: #fff;
  border-radius: 10px;
  background: linear-gradient(135deg, #d04545, #a93232);
  border: 0;
  padding: 0 12px;
  display: inline-flex;
  gap: 8px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(169, 50, 50, 0.35);
}

.sidebar-logout-btn:hover {
  color: #fff;
  background: linear-gradient(135deg, #e05a5a, #b83a3a);
}

body.sidebar-collapsed .sidebar-toggle-btn,
body.sidebar-collapsed .sidebar-logout-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  border-radius: 10px;
}

body.sidebar-collapsed .sidebar-toggle-btn span:last-child,
body.sidebar-collapsed .sidebar-logout-btn span:last-child {
  display: none;
}

.foot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(46, 158, 91, 0.18);
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 26px;
}

.topbar-title {
  font-size: 17px;
  font-weight: 700;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-slogan {
  font-size: 16px;
  font-weight: 600;
  color: #0f5f56;
  margin-right: 24px;
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.45s ease;
}

.topbar-slogan-out {
  opacity: 0;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .topbar-slogan {
    background: linear-gradient(90deg, #16b3a0, #f2b134, #e05a6d, #4f7dd9, #16b3a0);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: welcome-shimmer 3s linear infinite;
  }
}

.confetti-zone {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 220px;
  z-index: 400;
  pointer-events: none;
  overflow: hidden;
}

.confetti-zone span {
  position: absolute;
  top: -14px;
  border-radius: 2px;
  opacity: 0;
  animation-name: confetti-zone-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes confetti-zone-fall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0.5; transform: translateY(230px) rotate(360deg); }
}

.content {
  padding: 22px 26px 40px;
  max-width: 1240px;
  width: 100%;
  margin: 0 auto;
}

.bottom-nav {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s;
}

.btn:hover {
  border-color: #c7d0d8;
  background: var(--panel-2);
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-strong);
  border-color: var(--brand-strong);
}

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

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

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

.btn-ghost:hover {
  background: var(--panel-2);
  color: var(--ink);
}

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

.icon-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

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

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

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn {
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.icon-btn:active {
  transform: scale(0.92);
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary:active {
  box-shadow: 0 2px 0 rgba(8, 105, 94, 0.35);
}

.nav-item {
  transition: background 0.15s, color 0.15s, transform 0.1s;
}

.nav-item:active {
  transform: scale(0.97);
}

.tab,
.seg {
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.tab:active,
.seg:active {
  transform: translateY(1px);
}

.card[data-action] {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.card[data-action]:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
}

.card[data-action]:active {
  transform: translateY(1px);
}

.row-click:hover {
  background: #f4f7f9;
}

.list-item {
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.list-item:hover {
  border-color: #c3cdd5;
  box-shadow: var(--shadow);
}

.list-item:active {
  transform: translateY(1px);
}

.doc-card {
  cursor: pointer;
}

.doc-card:hover {
  transform: translateY(-1px);
}

.input,
.select,
.textarea {
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #c3cdd5;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.nav-item:focus-visible,
.seg:focus-visible,
.tab:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 19px;
  font-weight: 700;
  margin: 0 0 3px;
}

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

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

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

.card-pad {
  padding: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-2);
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg {
  width: 15px;
  height: 15px;
  color: var(--brand);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-main-side {
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
  align-items: start;
}

.stat {
  padding: 15px 16px;
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  right: -22px;
  top: -22px;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--stat-soft, var(--brand-soft));
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-label svg {
  width: 14px;
  height: 14px;
}

.stat-value {
  font-size: 24px;
  font-weight: 800;
  margin-top: 6px;
  letter-spacing: 0;
}

.stat-note {
  color: var(--faint);
  font-size: 12px;
  margin-top: 4px;
}

.stat.green { --stat-soft: var(--green-soft); }
.stat.red { --stat-soft: var(--red-soft); }
.stat.amber { --stat-soft: var(--amber-soft); }
.stat.blue { --stat-soft: var(--blue-soft); }

.active-card {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 159, 141, 0.12);
}

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

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

.table th {
  text-align: left;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  white-space: nowrap;
}

.table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}

.table tbody tr:hover {
  background: #fafcfd;
}

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

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.table .actions {
  text-align: right;
  white-space: nowrap;
}

.row-click {
  cursor: pointer;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}

.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-teal { background: var(--brand-soft); color: var(--brand-strong); }
.badge-gray { background: #eef1f4; color: var(--muted); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }

.line-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.line-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--line-color, var(--brand));
  flex: 0 0 8px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  background: #e8ecf0;
  padding: 3px;
  border-radius: var(--radius);
}

.tab {
  padding: 6px 14px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(20, 30, 40, 0.12);
}

.seg-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.seg:hover {
  border-color: #c7d0d8;
  color: var(--ink);
}

.seg.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.seg .line-dot {
  width: 7px;
  height: 7px;
}

.more-nav-btn {
  height: 48px;
  justify-content: flex-start;
  padding: 0 14px;
}

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

.input, .select, .textarea {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}

.textarea {
  height: auto;
  min-height: 72px;
  padding: 8px 10px;
  resize: vertical;
}

.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 159, 141, 0.13);
}

.input-sm {
  height: 30px;
  font-size: 13px;
}

.search-input {
  width: 220px;
}

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

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

.field.full {
  grid-column: 1 / -1;
}

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

.field .hint {
  font-size: 11px;
  color: var(--faint);
  font-weight: 400;
}

.empty {
  padding: 46px 20px;
  text-align: center;
  color: var(--faint);
}

.empty svg {
  width: 34px;
  height: 34px;
  margin-bottom: 10px;
  opacity: 0.6;
}

.empty-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.empty-sub {
  font-size: 12px;
  margin-top: 4px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 90px;
  align-items: center;
  gap: 12px;
}

.bar-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  height: 10px;
  background: #eef1f4;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--bar-color, var(--brand));
  min-width: 2px;
  transition: width 0.3s;
}

.bar-value {
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.kv {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--line-2);
}

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

.kv-label {
  color: var(--muted);
}

.kv-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.kv-value.pos { color: var(--green); }
.kv-value.neg { color: var(--red); }

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.list-item + .list-item {
  margin-top: 8px;
}

.list-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 32px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.list-icon.warn { background: var(--amber-soft); color: var(--amber); }
.list-icon.danger { background: var(--red-soft); color: var(--red); }

.list-body {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.list-right {
  text-align: right;
  flex: 0 0 auto;
}

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

.doc-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.doc-card:hover {
  border-color: #c3cdd5;
  box-shadow: var(--shadow);
}

.doc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.doc-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
}

.doc-icon.contract { background: var(--brand-soft); color: var(--brand-strong); }
.doc-icon.invoice { background: var(--amber-soft); color: var(--amber); }
.doc-icon.customs { background: var(--rose-soft); color: var(--rose); }
.doc-icon.license { background: var(--blue-soft); color: var(--blue); }
.doc-icon.voucher { background: var(--green-soft); color: var(--green); }

.doc-icon svg {
  width: 18px;
  height: 18px;
}

.doc-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.doc-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.doc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.step-flow {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 4px;
}

.step {
  flex: 1;
  min-width: 56px;
  text-align: center;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin: 0 auto 6px;
  background: #eef1f4;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.step.done .step-dot {
  background: var(--brand);
  color: #fff;
}

.step.current .step-dot {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(14, 159, 141, 0.2);
}

.step-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.step.current .step-label {
  color: var(--brand-strong);
  font-weight: 700;
}

.chip {
  padding: 1px 7px;
  border-radius: 999px;
  background: #eef1f4;
  color: var(--muted);
  font-size: 11px;
}

.doc-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line-2);
  padding-top: 9px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 30, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4vh 14px 20px;
  z-index: 100;
  overflow-y: auto;
  animation: fade-in 0.15s ease;
}

.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 640px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.18s ease;
  margin-bottom: 20px;
}

.modal-wrap {
  width: 100%;
  max-width: 640px;
}

.modal.wide {
  max-width: 820px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-2);
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding: 16px 18px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--line-2);
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 30, 0.35);
  z-index: 90;
  animation: fade-in 0.15s ease;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 94vw);
  background: #fff;
  z-index: 91;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slide-in 0.2s ease;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-2);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

.section + .section {
  margin-top: 22px;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.toast-wrap {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.toast {
  background: #1d2530;
  color: #fff;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.2s ease;
  max-width: 90vw;
}

.toast.error {
  background: var(--red);
}

.toast.success {
  background: var(--green);
}

.summary-card {
  padding: 14px 16px;
}

.summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.summary-name {
  font-size: 13px;
  font-weight: 700;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  padding: 3px 0;
}

.summary-row b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.lock-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.lock-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.lock-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.lock-icon svg {
  width: 22px;
  height: 22px;
}

.lock-card h2 {
  margin: 0 0 4px;
  font-size: 17px;
}

.lock-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.lock-card .input {
  width: 100%;
  text-align: center;
  font-size: 18px;
  letter-spacing: 4px;
}

.lock-card .btn {
  width: 100%;
  margin-top: 12px;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(20, 30, 40, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 30, 40, 0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 36px 32px 30px;
  text-align: center;
  animation: rise 0.22s ease;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #16b3a0, #0a7f71);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(10, 127, 113, 0.22);
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-logo svg {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.login-card h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.login-title-line {
  display: block;
}

.login-title-line:first-child {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}

.login-title-line:last-child {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}

.login-welcome {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 24px;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 7px;
}

.login-input {
  position: relative;
}

.login-input svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--faint);
  pointer-events: none;
}

.login-input .input {
  width: 100%;
  padding-left: 36px;
  height: 44px;
  border-radius: 10px;
  font-size: 14px;
}

.login-btn {
  width: 100%;
  height: 44px;
  margin-top: 4px;
  font-size: 15px;
  border-radius: 10px;
}

.login-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
  animation: login-spin 0.7s linear infinite;
}

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

.login-error {
  color: var(--red);
  font-size: 12px;
  min-height: 16px;
  margin-top: 6px;
  text-align: left;
}

.celebrate-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  animation: fade-in 0.2s ease;
}

.welcome-simple {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: welcome-simple-in 0.45s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.welcome-simple-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  font-family: "楷体", "KaiTi", "STKaiti", "华文楷体", "Microsoft YaHei", serif;
  letter-spacing: 2px;
}

.welcome-simple-slogan {
  font-size: 30px;
  font-weight: 800;
  color: #0f5f56;
  letter-spacing: 1px;
  text-shadow: 0 2px 14px rgba(255, 255, 255, 0.9);
}

.welcome-banner {
  margin: 0 0 14px;
  font-size: 24px;
  font-weight: 800;
  color: #0f5f56;
  letter-spacing: 1px;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .welcome-banner {
    background: linear-gradient(90deg, #16b3a0, #f2b134, #e05a6d, #4f7dd9, #16b3a0);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: welcome-shimmer 3s linear infinite;
  }
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .welcome-simple-slogan {
    background: linear-gradient(90deg, #16b3a0, #f2b134, #e05a6d, #4f7dd9, #16b3a0);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: none;
    animation: welcome-shimmer 3s linear infinite;
  }
}

@keyframes welcome-shimmer {
  to { background-position: 200% center; }
}

.confetti-piece {
  position: absolute;
  top: -24px;
  border-radius: 2px;
  opacity: 0;
  animation-name: confetti-fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.celebrate-overlay.out {
  opacity: 0;
  transition: opacity 0.35s ease;
}

@keyframes welcome-simple-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0.4; }
}

.login-foot {
  color: var(--faint);
  font-size: 12px;
  margin-top: 18px;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.boot-logo {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #16b3a0, #0a7f71);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(10, 127, 113, 0.25);
  animation: boot-pulse 1.2s ease-in-out infinite;
}

.boot-logo svg {
  width: 26px;
  height: 26px;
}

.boot-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.boot-sub {
  font-size: 12px;
  color: var(--muted);
}

@keyframes boot-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 9px;
}

.brand-avatar {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 64px;
  border: 1px solid var(--line);
}

.brand-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-avatar svg {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.import-result {
  max-height: 260px;
  overflow-y: auto;
  font-size: 12px;
  margin-top: 10px;
  background: var(--panel-2);
  border-radius: var(--radius);
  padding: 10px;
  white-space: pre-wrap;
}

.file-drop {
  border: 1.5px dashed #c3cdd5;
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  background: #fbfcfd;
}

.file-drop:hover {
  border-color: var(--brand);
  color: var(--brand-strong);
}

.alert {
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
}

.alert-amber {
  background: var(--amber-soft);
  color: #8a5a12;
}

.alert-teal {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

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

.spacer {
  flex: 1;
}

.mono {
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.pos { color: var(--green); }
.neg { color: var(--red); }
.warn { color: var(--amber); }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in {
  from { transform: translateX(40px); opacity: 0.6; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-main-side {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  .topbar {
    padding: 10px 14px;
  }

  .content {
    padding: 16px 14px 90px;
  }

  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 50;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }

  .bottom-nav .nav-item {
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    padding: 5px 10px;
    color: var(--muted);
  }

  .bottom-nav .nav-item.active {
    color: var(--brand-strong);
    background: transparent;
  }

  .bottom-nav .nav-item svg {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 640px) {
  .grid-4, .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;
  }

  .search-input {
    width: 100%;
  }

  .bar-row {
    grid-template-columns: 74px minmax(0, 1fr) 78px;
    gap: 8px;
  }

  .modal-backdrop {
    padding: 12px 8px;
    align-items: flex-start;
  }

  .stat-value {
    font-size: 21px;
  }
}
