/* 云创财务系统 · 样式参照 vue-vben-admin v5 默认主题（色值取自 vben 的 design tokens） */
:root {
  --font-family: -apple-system, blinkmacsystemfont, 'Segoe UI', roboto, 'Helvetica Neue', arial, 'Noto Sans',
    'PingFang SC', 'Microsoft YaHei', sans-serif;
  --background: 0 0% 100%;
  --background-deep: 216 20.11% 95.47%;
  --foreground: 210 6% 21%;
  --card: 0 0% 100%;
  --popover: 0 0% 100%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --primary: 212 100% 45%;
  --primary-foreground: 0 0% 98%;
  --destructive: 359.33 100% 65.1%;
  --success: 144 57% 58%;
  --warning: 42 84% 61%;
  --accent: 240 5% 96%;
  --accent-hover: 200 10% 90%;
  --border: 240 5.9% 90%;
  --input: 240 5.88% 90%;
  --input-placeholder: 217 10.6% 65%;
  --overlay: 0 0% 0% / 45%;
  --radius: 10px;
  --row-hover: 216 30% 97%;
  --group-bg: 212 100% 45% / 0.045;
  --card-shadow: 0 1px 2px rgb(16 24 40 / 4%);
  --party-yc: #2a78d6;
  --party-zg: #8a5cd6;
  --sidebar: 0 0% 100%;
  --header: 0 0% 100%;
  --shadow: 0 6px 16px 0 rgb(0 0 0 / 8%), 0 3px 6px -4px rgb(0 0 0 / 12%), 0 9px 28px 8px rgb(0 0 0 / 5%);

  /* 图表色（dataviz 参考调色板，已校验色盲区分度） */
  --series-1: #2a78d6;
  --series-1-soft: #86b6ef;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --chart-grid: #e8e8ec;
  --chart-axis: #c3c2b7;
  --chart-muted: #898781;
  --ref-line: #5f5e5a;
  --good: #0ca30c;
  --good-text: #006300;
  --critical: #d03b3b;
  --warning-mark: #fab219;
  --serious: #ec835a;
  color-scheme: light;
}

.dark {
  --row-hover: 216 6% 16%;
  --group-bg: 212 100% 60% / 0.07;
  --card-shadow: none;
  --party-yc: #3987e5;
  --party-zg: #a17ee6;
  --background: 222.34 10.43% 12.27%;
  --background-deep: 220 13.06% 9%;
  --foreground: 0 0% 95%;
  --card: 222.34 10.43% 12.27%;
  --popover: 0 0% 14.2%;
  --muted: 240 3.7% 15.9%;
  --muted-foreground: 240 5% 64.9%;
  --destructive: 359.21 68.47% 56.47%;
  --accent: 216 5% 19%;
  --accent-hover: 216 5% 24%;
  --border: 240 3.7% 22%;
  --input: 0 0% 100% / 10%;
  --input-placeholder: 218 11% 65%;
  --sidebar: 222.34 10.43% 12.27%;
  --header: 222.34 10.43% 12.27%;
  --shadow: 0 6px 16px 0 rgb(0 0 0 / 40%);
  --series-1: #3987e5;
  --series-1-soft: #1c5cab;
  --series-2: #d95926;
  --series-3: #199e70;
  --chart-grid: #2c2c2a;
  --chart-axis: #4a4a47;
  --chart-muted: #898781;
  --ref-line: #b4b2a9;
  --good-text: #0ca30c;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font-family);
  font-size: 14px;
  line-height: 1.5715;
  color: hsl(var(--foreground));
  background: hsl(var(--background-deep));
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a {
  color: hsl(var(--primary));
  text-decoration: none;
  cursor: pointer;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

svg.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  stroke: currentcolor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

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

.text-good {
  color: var(--good-text);
}

.text-bad {
  color: var(--critical);
}

.text-primary {
  color: hsl(var(--primary));
}

/* ---------------- 整体布局 ---------------- */

.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.sider {
  width: 224px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: hsl(var(--sidebar));
  border-right: 1px solid hsl(var(--border));
  transition: width 0.2s ease;
  z-index: 20;
}

.sider.collapsed {
  width: 60px;
}

.logo {
  height: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  color: hsl(var(--foreground));
}

.logo-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.sider.collapsed .logo-text,
.sider.collapsed .menu-text,
.sider.collapsed .menu-arrow {
  display: none;
}

.menu {
  flex: 1;
  overflow: hidden auto;
  padding: 4px 0 12px;
}

.menu-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin: 4px 8px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  color: hsl(var(--foreground) / 0.9);
  white-space: nowrap;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}

.menu-item:hover {
  background: hsl(var(--accent));
}

.menu-item.active {
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
}

.dark .menu-item.active {
  background: hsl(var(--primary) / 0.25);
  color: hsl(var(--primary-foreground));
}

.menu-item.parent-active {
  color: hsl(var(--primary));
}

.menu-arrow {
  margin-left: auto;
  transition: transform 0.2s;
}

.menu-group.open > .menu-item .menu-arrow {
  transform: rotate(180deg);
}

.menu-children {
  display: none;
}

.menu-group.open > .menu-children {
  display: block;
}

.menu-children .menu-item {
  padding-left: 38px;
}

.sider.collapsed .menu-children .menu-item {
  padding-left: 12px;
}

.sider.collapsed .menu-item {
  justify-content: center;
  padding: 0;
}

.sider-foot {
  padding: 8px;
  border-top: 1px solid hsl(var(--border));
}

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

.header {
  height: 50px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: hsl(var(--header));
  border-bottom: 1px solid hsl(var(--border));
}

.header-spacer {
  flex: 1;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: hsl(var(--foreground) / 0.8);
  cursor: pointer;
}

.icon-btn:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  color: hsl(var(--muted-foreground));
}

.breadcrumb .current {
  color: hsl(var(--foreground));
}

.user-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 8px;
  border-radius: 6px;
  cursor: pointer;
}

.user-trigger:hover {
  background: hsl(var(--accent));
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--primary));
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.dropdown {
  position: fixed;
  z-index: 1100;
  min-width: 200px;
  padding: 4px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: calc(100vw - 16px);
  overflow: auto;
  overscroll-behavior: contain;
}

.dropdown-head {
  padding: 8px 12px;
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: 4px;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.dropdown-item:hover,
.dropdown-item:focus-visible {
  background: hsl(var(--accent));
}

:is(button, a, [role='button'], .tbl-wrap):focus-visible {
  outline: 2px solid hsl(var(--primary));
  outline-offset: 2px;
}

/* 标签栏（chrome 风格） */
.tabbar {
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 8px;
  background: hsl(var(--background));
  border-bottom: 1px solid hsl(var(--border));
  overflow: auto hidden;
  scrollbar-width: none;
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  margin-right: 1px;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  color: hsl(var(--foreground) / 0.8);
}

.tab:not(.active)::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 9px;
  height: 14px;
  width: 1px;
  background: hsl(var(--border));
}

.tab:hover:not(.active) {
  background: hsl(var(--accent));
}

.tab.active {
  background: hsl(var(--background-deep));
  color: hsl(var(--primary));
}

.tab .tab-close {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
}

.tab .tab-close:hover {
  opacity: 1;
  background: hsl(var(--accent-hover));
}

.tab .tab-close svg {
  width: 12px;
  height: 12px;
}

.content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

/* ---------------- 卡片与页面 ---------------- */

.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  min-width: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
}

.card-sub {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  font-weight: 400;
}

.card-body {
  padding: 4px 16px 16px;
}

.page-head {
  padding: 16px 20px;
  margin-bottom: 16px;
}

.page-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.page-head p {
  margin: 4px 0 0;
  color: hsl(var(--muted-foreground));
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

.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, 2fr) minmax(0, 1fr);
}

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

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

/* ---------------- 按钮 ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 15px;
  border: 1px solid hsl(var(--input));
  border-radius: 6px;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.btn:hover {
  color: hsl(var(--primary));
  border-color: hsl(var(--primary));
}

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

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

.btn-primary:hover {
  background: hsl(var(--primary) / 0.85);
  border-color: hsl(var(--primary) / 0.85);
  color: #fff;
}

.btn-danger {
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive));
}

.btn-danger:hover {
  color: #fff;
  background: hsl(var(--destructive));
  border-color: hsl(var(--destructive));
}

.btn-icon {
  width: 32px;
  padding: 0;
}

.btn-sm {
  height: 24px;
  padding: 0 7px;
  font-size: 13px;
  border-radius: 4px;
}

.btn-link {
  border-color: transparent;
  background: transparent;
  color: hsl(var(--primary));
  padding: 0 4px;
  height: 24px;
}

.btn-link:hover {
  border-color: transparent;
  color: hsl(var(--primary) / 0.8);
}

.btn-link.danger {
  color: hsl(var(--destructive));
}

/* ---------------- 表单控件 ---------------- */

.input,
.select,
.textarea {
  width: 100%;
  height: 32px;
  padding: 4px 11px;
  border: 1px solid hsl(var(--input));
  border-radius: 6px;
  background: hsl(var(--background));
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  min-width: 0;
  max-width: 100%;
}

.dark .input,
.dark .select,
.dark .textarea {
  background-color: hsl(var(--background-deep) / 0.6);
}

.input::placeholder,
.textarea::placeholder {
  color: hsl(var(--input-placeholder));
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: hsl(var(--primary) / 0.7);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.12);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
  opacity: 1;
  cursor: not-allowed;
}

.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 18px;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23aeb7c5' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
}

.select option,
.select optgroup {
  color: hsl(var(--foreground));
  background-color: hsl(var(--popover));
  font: inherit;
  white-space: normal;
}

.select optgroup {
  font-weight: 600;
}

/* 单选浮层：与系统卡片、按钮共用配色与圆角，不依赖系统原生选项窗口。 */
.select-enhanced[aria-expanded='true'] {
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.1);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230073e6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 14 5-5 5 5'/%3E%3C/svg%3E");
}

.select-menu {
  --select-accent: var(--primary);
  position: fixed;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 5px;
  max-width: calc(100vw - 16px);
  max-height: 360px;
  color: hsl(var(--foreground));
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: 10px;
  box-shadow: 0 10px 32px hsl(220 35% 15% / 0.1), 0 2px 8px hsl(220 35% 15% / 0.05);
  font-size: 13px;
  line-height: 1.5;
}

.dark .select-menu {
  --select-accent: 212 100% 72%;
  box-shadow: 0 12px 36px rgb(0 0 0 / 32%), 0 2px 8px rgb(0 0 0 / 20%);
}

.dark .select-enhanced[aria-expanded='true'] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2375b7ff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 14 5-5 5 5'/%3E%3C/svg%3E");
}

.select-search {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 8px;
  margin: 3px 3px 6px;
  padding: 0 9px;
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  background: hsl(var(--muted) / 0.65);
  color: hsl(var(--muted-foreground));
}

.select-search:focus-within {
  border-color: hsl(var(--primary) / 0.6);
}

.select-search svg { flex-shrink: 0; width: 15px; height: 15px; }
.select-search-input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 0;
  border: 0;
  outline: none;
  color: hsl(var(--foreground));
  background: transparent;
  font: inherit;
}
.select-search-input::placeholder { color: hsl(var(--muted-foreground)); }
.select-options {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: hsl(var(--muted-foreground) / 0.25) transparent;
  outline: none;
}
.select-group {
  padding: 11px 10px 5px;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
  font-weight: 500;
}
.select-group:not(:first-child) {
  margin-top: 5px;
  border-top: 1px solid hsl(var(--border) / 0.65);
}
.select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 7px 10px;
  margin: 1px 0;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}
.select-option-label { min-width: 0; overflow-wrap: anywhere; }
.select-check { flex-shrink: 0; width: 16px; height: 16px; visibility: hidden; }
.select-option.is-active { background: hsl(var(--accent)); }
.select-option.is-selected { color: hsl(var(--select-accent)); background: hsl(var(--primary) / 0.09); font-weight: 500; }
.select-option.is-selected.is-active { background: hsl(var(--primary) / 0.14); }
.select-option.is-selected .select-check { visibility: visible; }
.select-option.is-disabled { opacity: 0.45; cursor: not-allowed; }
.select-empty { padding: 26px 12px; text-align: center; color: hsl(var(--muted-foreground)); }
@media (max-width: 768px) {
  .select-menu { font-size: 15px; border-radius: 12px; }
  .select-option { min-height: 44px; padding: 10px 12px; }
  .select-search-input { height: 40px; font-size: 16px; }
}

.select[multiple],
.select[size]:not([size='1']) {
  height: auto;
  background-image: none;
  padding-right: 11px;
}

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

.input.invalid,
.select.invalid {
  border-color: hsl(var(--destructive));
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: hsl(var(--primary));
}

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

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

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

.form-item {
  margin-bottom: 16px;
  min-width: 0;
}

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

.form-item.span-all {
  grid-column: 1 / -1;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.form-label .req {
  color: hsl(var(--destructive));
  margin-right: 4px;
}

.form-help {
  margin-top: 4px;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

.form-err {
  margin-top: 4px;
  font-size: 12px;
  color: hsl(var(--destructive));
}

.form-section {
  grid-column: 1 / -1;
  margin: 4px 0 12px;
  padding-bottom: 6px;
  font-weight: 600;
  border-bottom: 1px dashed hsl(var(--border));
}

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

.search-form .sf-item.sf-hidden {
  display: none;
}

.sf-toggle {
  height: 32px;
  gap: 2px;
}

.search-form .sf-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-form .sf-item > label {
  width: 64px;
  flex-shrink: 0;
  text-align: right;
  color: hsl(var(--foreground) / 0.85);
}

.search-form .sf-actions {
  grid-column: -2 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

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

.segmented {
  display: inline-flex;
  padding: 2px;
  gap: 2px;
  border-radius: 6px;
  background: hsl(var(--accent));
}

.segmented button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: hsl(var(--foreground) / 0.7);
  cursor: pointer;
}

.segmented button:hover {
  color: hsl(var(--foreground));
}

.segmented button.active {
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  box-shadow: 0 1px 2px rgb(0 0 0 / 8%), 0 1px 4px -1px rgb(0 0 0 / 6%);
}

/* ---------------- 标签 ---------------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 7px;
  font-size: 12px;
  line-height: 20px;
  border-radius: 4px;
  border: 1px solid #d9d9d9;
  background: #fafafa;
  color: rgb(0 0 0 / 88%);
  white-space: nowrap;
}

.tag svg.icon {
  width: 12px;
  height: 12px;
}

.tag-blue {
  color: #0958d9;
  background: #e6f4ff;
  border-color: #91caff;
}

.tag-green {
  color: #389e0d;
  background: #f6ffed;
  border-color: #b7eb8f;
}

.tag-orange {
  color: #d46b08;
  background: #fff7e6;
  border-color: #ffd591;
}

.tag-red {
  color: #cf1322;
  background: #fff1f0;
  border-color: #ffa39e;
}

.tag-purple {
  color: #531dab;
  background: #f9f0ff;
  border-color: #d3adf7;
}

.tag-cyan {
  color: #08979c;
  background: #e6fffb;
  border-color: #87e8de;
}

.dark .tag {
  background: hsl(var(--accent));
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}

.dark .tag-blue {
  color: #65a9f3;
  background: #111a2c;
  border-color: #15325b;
}

.dark .tag-green {
  color: #8fd460;
  background: #162312;
  border-color: #274916;
}

.dark .tag-orange {
  color: #f3b765;
  background: #2b1d11;
  border-color: #593815;
}

.dark .tag-red {
  color: #f37370;
  background: #2a1215;
  border-color: #58181c;
}

.dark .tag-purple {
  color: #ab7ae0;
  background: #1a1325;
  border-color: #3e2069;
}

.dark .tag-cyan {
  color: #58d1c9;
  background: #112123;
  border-color: #144848;
}

/* ---------------- 卡片头部 / 统计条 ---------------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 16px 12px;
  flex-wrap: wrap;
}

.toolbar-left {
  min-width: 0;
}

.toolbar-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.toolbar-sub {
  margin-top: 2px;
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
}

.toolbar-actions {
  flex-wrap: wrap;
}

.summary-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: hsl(var(--muted-foreground));
  font-size: 13px;
}

.summary-chips b {
  color: hsl(var(--foreground));
  font-weight: 600;
  margin-left: 4px;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin: 0 16px 14px;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  background: hsl(var(--background-deep) / 0.45);
  overflow: hidden;
}

.ss-item {
  padding: 10px 14px;
  min-width: 0;
  border-left: 1px solid hsl(var(--border));
}

.ss-item:first-child {
  border-left: 0;
}

.ss-label {
  font-size: 12.5px;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-value {
  margin-top: 2px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.ss-sub {
  margin-top: 1px;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-warn {
  color: #b07a00;
}

.dark .text-warn {
  color: var(--warning-mark);
}

/* ---------------- 左侧导航 + 右侧表格 ---------------- */

.split {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  border-top: 1px solid hsl(var(--border));
}

.split-main {
  min-width: 0;
  padding: 12px 16px 0;
}

.split-main > .alert {
  margin-bottom: 12px;
}

.table-pad {
  padding: 0 16px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 10px 8px 16px;
  border-right: 1px solid hsl(var(--border));
  background: hsl(var(--background-deep) / 0.35);
  min-width: 0;
}

.nav-title {
  padding: 2px 10px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: hsl(var(--muted-foreground));
}

.nav-group {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: hsl(var(--muted-foreground));
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: hsl(var(--foreground) / 0.9);
}

.nav-item.lv-2 {
  padding-left: 18px;
}

.nav-item:hover {
  background: hsl(var(--accent));
}

.nav-item.active {
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  font-weight: 500;
}

.dark .nav-item.active {
  background: hsl(var(--primary) / 0.22);
  color: hsl(var(--foreground));
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: hsl(var(--primary));
}

.nav-item.is-empty {
  color: hsl(var(--muted-foreground) / 0.8);
}

.nav-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-amt {
  font-size: 12.5px;
  color: hsl(var(--foreground) / 0.75);
}

.nav-item.active .nav-amt {
  color: inherit;
}

.nav-item.is-empty .nav-amt {
  color: hsl(var(--muted-foreground) / 0.7);
}

.nav-bar {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 5px;
  border-radius: 2px;
  background: hsl(var(--border) / 0.7);
  overflow: hidden;
}

.nav-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--series-1);
  opacity: 0.75;
}

.nav-sub {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  margin-top: 2px;
  font-size: 11.5px;
  color: hsl(var(--muted-foreground));
}

.party-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
}

.party-dot.yc {
  background: var(--party-yc);
}

.party-dot.zg {
  background: var(--party-zg);
}

.acct {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cat-chip {
  display: inline-block;
  padding: 0 7px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 20px;
  background: hsl(var(--accent));
  color: hsl(var(--foreground) / 0.8);
}

.status-cell {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.tbl-box {
  min-width: 0;
}

.tbl-wrap {
  overflow: auto;
  border: 1px solid hsl(var(--border));
  border-radius: 8px;
  overscroll-behavior: contain;
}

.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 40px;
  padding: 0 12px;
  background: hsl(var(--muted));
  color: hsl(var(--foreground) / 0.78);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid hsl(var(--border));
}

.dark .tbl th {
  background: hsl(var(--accent));
}

.tbl th.sortable {
  cursor: pointer;
  user-select: none;
}

.tbl th.sortable:hover {
  color: hsl(var(--foreground));
}

.tbl th .sort-mark {
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.35;
}

.tbl th.sorted {
  color: hsl(var(--primary));
}

.tbl th.sorted .sort-mark {
  opacity: 1;
}

.tbl td {
  height: 42px;
  padding: 0 12px;
  border-bottom: 1px solid hsl(var(--border) / 0.8);
  white-space: nowrap;
  background: hsl(var(--card));
}

.tbl tbody tr:hover td {
  background: hsl(var(--row-hover));
}

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

.tbl .right {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tbl .center {
  text-align: center;
}

.tbl td.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tbl td.ellipsis .cell-clip {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tbl .sticky-left,
.tbl .sticky-right {
  position: sticky;
  z-index: 1;
}

.tbl th.sticky-left,
.tbl th.sticky-right {
  z-index: 3;
}

.tbl .sticky-right {
  right: 0;
  box-shadow: -8px 0 8px -8px rgb(0 0 0 / 14%);
}

.tbl .sticky-left.edge {
  box-shadow: 8px 0 8px -8px rgb(0 0 0 / 14%);
}

.dark .tbl .sticky-right {
  box-shadow: -8px 0 8px -8px rgb(0 0 0 / 50%);
}

.dark .tbl .sticky-left.edge {
  box-shadow: 8px 0 8px -8px rgb(0 0 0 / 50%);
}

.tbl tr.group-row td {
  height: 36px;
  background: linear-gradient(hsl(var(--group-bg)), hsl(var(--group-bg))), hsl(var(--card));
  border-top: 1px solid hsl(var(--border));
  font-weight: 600;
  font-size: 12.5px;
  color: hsl(var(--foreground) / 0.85);
}

.tbl tbody tr.group-row:first-child td {
  border-top: 0;
}

.tbl tr.group-row:hover td {
  background: linear-gradient(hsl(var(--group-bg)), hsl(var(--group-bg))), hsl(var(--card));
}

.tbl tr.group-row .group-label b {
  font-size: 13px;
  color: hsl(var(--foreground));
}

.tbl tr.group-row .group-label .muted {
  font-weight: 400;
}

.tbl tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  height: 40px;
  font-weight: 600;
  background: hsl(var(--muted));
  border-top: 1px solid hsl(var(--border));
  border-bottom: 0;
}

.dark .tbl tfoot td {
  background: hsl(var(--accent));
}

.tbl tfoot td.sticky-left,
.tbl tfoot td.sticky-right {
  z-index: 3;
}

.tbl tr.voided td {
  color: hsl(var(--muted-foreground));
}

.tbl tr.voided td:not(.sticky-right) {
  text-decoration: line-through;
}

.tbl tr.voided .tag {
  text-decoration: none;
}

.tbl .wrap {
  white-space: normal;
  min-width: 160px;
  max-width: 320px;
}

.tbl-empty {
  height: 160px !important;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.tbl-empty-state {
  position: sticky;
  left: 0;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: hsl(var(--muted-foreground));
}

.tbl-empty svg.icon,
.tbl-empty-state svg.icon {
  width: 28px;
  height: 28px;
  stroke-width: 1.5;
  opacity: 0.6;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  padding: 12px 0 16px;
  color: hsl(var(--muted-foreground));
  flex-wrap: wrap;
}

.pager-total {
  margin-right: 8px;
}

.pager button {
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.pager button:hover:not(:disabled) {
  background: hsl(var(--accent));
}

.pager button.active {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
  font-weight: 600;
}

.pager button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.pager .select {
  width: auto;
  margin-left: 6px;
}

.split-main .pager,
.table-pad .pager {
  padding-bottom: 14px;
}

.table-pad > .tbl-box > .tbl-wrap:last-child,
.split-main > .tbl-box > .tbl-wrap:last-child {
  margin-bottom: 16px;
}

.inline-select {
  height: 26px;
  padding: 0 24px 0 8px;
  font-size: 12.5px;
  width: auto;
  background-position: right 6px center;
}

.dropdown-foot {
  margin-top: 4px;
  padding: 4px 4px 0;
  border-top: 1px solid hsl(var(--border));
}

.col-menu {
  width: 200px;
  min-width: 0;
  max-height: 70vh;
  overflow: auto;
}

.col-menu .dropdown-item {
  display: flex;
  padding: 5px 10px;
}

/* 科目汇总表 */
.pivot-note {
  margin: -4px 16px 10px;
  font-size: 12.5px;
}

.card > .tbl-box {
  padding: 0 16px 16px;
}

.tbl.pivot td,
.tbl.pivot th {
  padding: 0 10px;
}

.tbl.pivot td.heat {
  background: linear-gradient(hsl(var(--primary) / var(--heat)), hsl(var(--primary) / var(--heat))), hsl(var(--card));
}

.dark .tbl.pivot td.heat {
  background: linear-gradient(hsl(var(--primary) / calc(var(--heat) * 1.8)), hsl(var(--primary) / calc(var(--heat) * 1.8))), hsl(var(--card));
}

.tbl.pivot tbody tr:not(.group-row):hover td:not(.heat) {
  background: hsl(var(--card));
}

.tbl.pivot tbody tr:not(.group-row):hover td {
  box-shadow: inset 0 1px 0 hsl(var(--primary) / 0.35), inset 0 -1px 0 hsl(var(--primary) / 0.35);
}

.tbl.pivot td.clickable {
  cursor: pointer;
}

.tbl.pivot td.clickable:hover {
  outline: 2px solid hsl(var(--primary) / 0.6);
  outline-offset: -2px;
}

.tbl.pivot td.zero {
  color: hsl(var(--muted-foreground) / 0.6);
}

.tbl.pivot .total-col {
  font-weight: 600;
  border-left: 1px solid hsl(var(--border));
}

.tbl.pivot tr.dim .pivot-name {
  color: hsl(var(--muted-foreground));
}

.tbl.pivot td.sticky-left .pivot-name {
  padding-left: 12px;
}

/* ---------------- 抽屉 / 弹窗 / 消息 ---------------- */

.mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: hsl(var(--overlay));
  animation: fade-in 0.2s;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  max-width: 100vw;
  background: hsl(var(--card));
  box-shadow: var(--shadow);
  animation: slide-in 0.25s ease;
}

.drawer-head,
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  flex-shrink: 0;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 16px;
  font-weight: 600;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.drawer-foot,
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid hsl(var(--border));
  flex-shrink: 0;
  flex-wrap: wrap;
}

.modal {
  position: fixed;
  top: 12vh;
  left: 50%;
  z-index: 1001;
  max-width: calc(100vw - 32px);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  transform: translateX(-50%);
  background: hsl(var(--card));
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: zoom-in 0.2s;
}

.modal-body {
  padding: 20px;
  overflow: auto;
  min-height: 0;
}

body.overlay-open {
  overflow: hidden;
}

body.overlay-open .content {
  overflow: hidden;
}

.drawer-body,
.modal-body,
.content,
.tbl-wrap,
.menu {
  -webkit-overflow-scrolling: touch;
}

.messages {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 2000;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 24px);
}

.message {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: hsl(var(--popover));
  border-radius: 8px;
  box-shadow: var(--shadow);
  animation: drop-in 0.2s;
  max-width: 560px;
  width: fit-content;
  overflow-wrap: anywhere;
}

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

.message.error svg {
  color: var(--critical);
}

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

.message.info svg {
  color: hsl(var(--primary));
}

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

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

@keyframes zoom-in {
  from {
    transform: translateX(-50%) scale(0.96);
    opacity: 0;
  }
}

@keyframes drop-in {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
}

/* ---------------- 看板 ---------------- */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
}

.period-picker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.period-picker .select {
  width: 150px;
}

.stat {
  padding: 16px 20px;
}

.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: hsl(var(--muted-foreground));
}

.stat-value {
  margin: 6px 0 2px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.stat-deltas {
  display: flex;
  gap: 16px;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 600;
}

.delta svg.icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.5;
}

.delta.good {
  color: var(--good-text);
}

.delta.bad {
  color: var(--critical);
}

.delta.flat {
  color: hsl(var(--muted-foreground));
}

.stat-foot > span {
  white-space: nowrap;
}

.stat-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid hsl(var(--border));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
}

.chart {
  position: relative;
  width: 100%;
}

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

.chart text {
  font-family: var(--font-family);
}

.chart-tip {
  position: absolute;
  z-index: 10;
  min-width: 140px;
  padding: 8px 10px;
  background: hsl(var(--popover));
  border: 1px solid hsl(var(--border));
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}

.chart-tip .tip-title {
  margin-bottom: 4px;
  color: hsl(var(--muted-foreground));
}

.chart-tip .tip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 20px;
}

.chart-tip .tip-row b {
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  padding-left: 12px;
}

.chart-tip .key {
  width: 10px;
  height: 2px;
  border-radius: 1px;
}

.chart-tip .key.box {
  height: 8px;
  border-radius: 2px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

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

.legend i {
  display: inline-block;
  width: 12px;
  height: 2px;
  border-radius: 1px;
}

.legend i.dash {
  height: 0;
  border-top: 2px dashed var(--ref-line);
  border-radius: 0;
  background: none;
}

.legend i.box {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.anomaly-list {
  display: flex;
  flex-direction: column;
  max-height: 330px;
  overflow: auto;
  padding-right: 4px;
}

.anomaly {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid hsl(var(--border));
}

.anomaly:last-child {
  border-bottom: 0;
}

.anomaly .a-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.anomaly .a-icon.danger {
  color: var(--critical);
  background: color-mix(in srgb, var(--critical) 12%, transparent);
}

.anomaly .a-icon.warning {
  color: #b07a00;
  background: color-mix(in srgb, var(--warning-mark) 18%, transparent);
}

.dark .anomaly .a-icon.warning {
  color: var(--warning-mark);
}

.anomaly .a-icon.info {
  color: hsl(var(--primary));
  background: hsl(var(--primary) / 0.1);
}

.anomaly .a-title {
  font-weight: 500;
}

.anomaly .a-detail {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

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

.kv dt {
  color: hsl(var(--muted-foreground));
}

.kv dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.split-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.split-card {
  padding: 12px 14px;
  border-radius: 6px;
  background: hsl(var(--accent));
}

.split-card .v {
  font-size: 20px;
  font-weight: 600;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

.split-card .s {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
}

/* ---------------- 结算明细 ---------------- */

.calc-lines {
  display: flex;
  flex-direction: column;
}

.calc-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 0;
  border-bottom: 1px dashed hsl(var(--border));
}

.calc-line .l {
  color: hsl(var(--foreground) / 0.85);
}

.calc-line .l small {
  display: block;
  color: hsl(var(--muted-foreground));
  font-size: 12px;
}

.calc-line .v {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.calc-line.indent .l {
  padding-left: 16px;
}

.calc-line.total {
  border-bottom: 0;
  border-top: 1px solid hsl(var(--border));
  margin-top: 4px;
  padding-top: 10px;
  font-weight: 600;
  font-size: 15px;
}

.tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid hsl(var(--border));
  margin-bottom: 16px;
}

.tabs button {
  position: relative;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: hsl(var(--foreground) / 0.75);
  cursor: pointer;
}

.tabs button:hover {
  color: hsl(var(--primary));
}

.tabs button.active {
  color: hsl(var(--primary));
  font-weight: 500;
}

.tabs button.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: hsl(var(--primary));
}

.alert {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid #91caff;
  background: #e6f4ff;
  color: rgb(0 0 0 / 85%);
}

.alert svg.icon {
  margin-top: 3px;
  color: #1677ff;
}

.alert.slim {
  padding: 7px 12px;
  font-size: 12.5px;
  align-items: center;
}

.alert.slim svg.icon {
  margin-top: 0;
}

.alert.warn {
  border-color: #ffe58f;
  background: #fffbe6;
}

.alert.warn svg.icon {
  color: #faad14;
}

.dark .alert {
  background: #111a2c;
  border-color: #15325b;
  color: hsl(var(--foreground));
}

.dark .alert.warn {
  background: #2b2111;
  border-color: #594214;
}

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

.login {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  background: hsl(var(--background));
}

.login-side {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: hsl(var(--background-deep));
}

.login-side::before {
  content: '';
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--primary) / 0.18), transparent 65%);
  top: 10%;
  left: 20%;
}

.login-brand {
  position: absolute;
  top: 24px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
}

.login-illus {
  position: relative;
  width: min(520px, 80%);
}

.login-slogan {
  position: relative;
  margin-top: 28px;
  text-align: center;
}

.login-slogan h2 {
  margin: 0 0 8px;
  font-size: 24px;
}

.login-slogan p {
  margin: 0;
  color: hsl(var(--muted-foreground));
}

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

.login-form {
  width: 100%;
  max-width: 380px;
}

.login-form h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 700;
}

.login-form .sub {
  margin: 0 0 28px;
  color: hsl(var(--muted-foreground));
}

.login-form .input {
  height: 40px;
}

.login-form .btn {
  width: 100%;
  height: 40px;
  font-size: 15px;
}

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

  .login-panel {
    width: 100%;
    min-width: 0;
  }
}

.empty {
  padding: 32px 0;
  text-align: center;
  color: hsl(var(--muted-foreground));
}

.loading-dim {
  opacity: 0.5;
  transition: opacity 0.2s;
}

/* ---------------- 页面容器 ---------------- */

.page {
  min-width: 0;
}

.nav-mask {
  display: none;
}

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

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

/* ---------------- 手机 / 窄屏 ---------------- */

@media (max-width: 768px) {
  .app,
  .main {
    width: 100%;
  }

  .sider {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
    z-index: 1200;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    max-width: calc(100vw - 48px);
    visibility: hidden;
  }

  .sider.collapsed {
    width: 240px;
  }

  .sider.collapsed .logo-text,
  .sider.collapsed .menu-text,
  .sider.collapsed .menu-arrow {
    display: initial;
  }

  .sider.collapsed .menu-item {
    justify-content: flex-start;
    padding: 0 12px;
  }

  .sider.collapsed .menu-children .menu-item {
    padding-left: 38px;
  }

  body.nav-open .sider {
    transform: none;
    visibility: visible;
  }

  body.nav-open .content {
    overflow: hidden;
  }

  .menu-item {
    height: 46px;
  }

  .header {
    height: calc(56px + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) max(6px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px));
  }

  .header > .icon-btn,
  .user-trigger {
    flex-shrink: 0;
  }

  .header .breadcrumb {
    min-width: 0;
    margin-left: 2px;
    white-space: nowrap;
    overflow: hidden;
  }

  .header .breadcrumb .current {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .user-trigger {
    gap: 4px;
    padding: 0 4px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .btn,
  .btn-sm,
  .btn-link,
  .segmented button,
  .pager button {
    min-height: 42px;
    height: auto;
  }

  .btn-icon {
    min-width: 42px;
  }

  .input,
  .select,
  .textarea,
  .inline-select,
  .textarea.group-msg {
    min-height: 44px;
    font-size: 16px;
  }

  .input,
  .select {
    height: 44px;
  }

  .textarea {
    line-height: 1.6;
  }

  .checkbox {
    min-height: 42px;
  }

  .checkbox input {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .dropdown-item,
  .col-menu .dropdown-item {
    min-height: 44px;
    padding: 10px 12px;
  }

  body.nav-open .nav-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1150;
    background: hsl(var(--overlay));
  }

  .tabbar,
  .user-name,
  .header .breadcrumb > :not(.current),
  .header [title='全屏'] {
    display: none;
  }

  .content {
    padding: 10px max(10px, env(safe-area-inset-right, 0px)) max(14px, env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  }

  .stack {
    gap: 10px;
  }

  .grid {
    gap: 10px;
  }

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

  .grid-2,
  .grid-3,
  .grid-main-side,
  .split-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .search-form {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .search-form .sf-actions {
    grid-column: auto;
    flex-wrap: wrap;
  }

  .search-form .sf-item {
    grid-column: 1 / -1 !important;
  }

  .search-form .sf-item > :not(label) {
    min-width: 0;
  }

  .toolbar {
    padding: 12px 12px 10px;
  }

  .toolbar-actions {
    max-width: 100%;
    gap: 8px;
  }

  .toolbar-actions .btn:not(.btn-icon) {
    padding-right: 10px;
    padding-left: 10px;
  }

  .card-header {
    flex-wrap: wrap;
    padding: 12px;
  }

  .card-body,
  .page-head {
    padding-right: 12px;
    padding-left: 12px;
  }

  .card-title,
  .toolbar-title,
  .alert,
  .form-help,
  .order-no-bar,
  .kv dd {
    overflow-wrap: anywhere;
  }

  .toolbar-sub {
    display: none;
  }

  .stat-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 12px 12px;
  }

  .ss-item {
    border-left: 0;
    border-top: 1px solid hsl(var(--border));
  }

  .ss-item:nth-child(-n + 2) {
    border-top: 0;
  }

  .ss-item:nth-child(even) {
    border-left: 1px solid hsl(var(--border));
  }

  .ss-value {
    font-size: 17px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

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

  .side-nav {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid hsl(var(--border));
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .side-nav .nav-title,
  .side-nav .nav-group,
  .side-nav .nav-bar,
  .side-nav .nav-sub {
    display: none;
  }

  .nav-item,
  .nav-item.lv-2 {
    width: auto;
    flex: none;
    display: inline-flex;
    gap: 6px;
    padding: 5px 10px;
    border: 1px solid hsl(var(--border));
    border-radius: 16px;
    min-height: 40px;
  }

  .nav-item.active::before {
    display: none;
  }

  .nav-item.is-empty {
    display: none;
  }

  .split-main,
  .table-pad {
    padding: 10px 12px 0;
  }

  .card > .tbl-box {
    padding: 0 12px 12px;
  }

  .tbl-wrap {
    max-height: none !important;
    max-width: 100%;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
  }

  .tbl-box::before {
    content: '左右滑动查看完整表格';
    display: block;
    padding: 0 0 6px;
    color: hsl(var(--muted-foreground));
    font-size: 12px;
  }

  .tbl td {
    height: 48px;
  }

  .tbl .btn-link {
    padding-right: 8px;
    padding-left: 8px;
  }

  /* 手机上不固定列，整张表左右滑动 */
  .tbl .sticky-left,
  .tbl .sticky-right {
    position: static;
    box-shadow: none !important;
  }

  .tbl th {
    position: static;
  }

  .tbl tfoot td {
    position: static;
  }

  .stat {
    padding: 12px 14px;
  }

  .stat-value {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .stat-deltas,
  .stat-foot {
    flex-wrap: wrap;
    gap: 6px;
  }

  .stat-foot .chart {
    display: none;
  }

  .filter-bar {
    padding: 10px 12px;
  }

  .filter-bar > .segmented,
  .segmented {
    max-width: 100%;
    flex-wrap: wrap;
  }

  .period-picker {
    min-width: 0;
    max-width: 100%;
  }

  .period-picker .select {
    width: 150px;
  }

  .drawer {
    width: 100vw !important;
    height: 100vh;
    height: 100dvh;
    bottom: auto;
  }

  .drawer-head,
  .modal-head {
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    overflow-wrap: anywhere;
  }

  .drawer-head {
    padding-top: max(8px, env(safe-area-inset-top, 0px));
  }

  .drawer-head > .icon-btn,
  .modal-head > .icon-btn {
    flex-shrink: 0;
  }

  .drawer-body,
  .modal-body {
    padding: 16px 12px;
    overscroll-behavior-y: contain;
  }

  .drawer-foot,
  .modal-foot {
    padding: 10px 12px max(10px, env(safe-area-inset-bottom, 0px));
  }

  .drawer-foot > .btn,
  .modal-foot > .btn {
    flex: 1 0 auto;
  }

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

  .form-item.span-2 {
    grid-column: auto;
  }

  .modal {
    top: max(12px, env(safe-area-inset-top, 0px));
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  .pager {
    justify-content: center;
    gap: 6px;
  }

  .pager button {
    min-width: 40px;
  }

  .pager-total {
    flex-basis: 100%;
    text-align: center;
  }

  .tabs {
    overflow-x: auto;
    gap: 20px;
  }

  .tabs button {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .order-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    overflow-wrap: anywhere;
  }

  .login-panel {
    padding: max(32px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(32px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  }

  .login-form h1 {
    font-size: 26px;
  }

  .login-form .input,
  .login-form .btn {
    height: 46px;
  }

  .messages {
    top: max(12px, env(safe-area-inset-top, 0px));
  }
}

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

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

  .ss-item:nth-child(n) {
    border-left: 0;
    border-top: 1px solid hsl(var(--border));
  }

  .ss-item:first-child {
    border-top: 0;
  }

  .header [title='刷新'] {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------------- 订单编号 / 群消息 ---------------- */

.order-no {
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.order-no-bar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  background: hsl(var(--primary) / 0.06);
  border: 1px solid hsl(var(--primary) / 0.18);
  font-size: 13px;
}

.order-no-big {
  font-size: 17px;
  font-weight: 600;
  color: hsl(var(--primary));
  letter-spacing: 0.02em;
}

.dark .order-no-big {
  color: hsl(var(--foreground));
}

.textarea.group-msg {
  min-height: 280px;
  font-size: 13px;
  line-height: 1.7;
  background: hsl(var(--background-deep) / 0.5);
  resize: vertical;
}

.drawer-foot > .btn:first-child:not(:last-child) {
  margin-right: auto;
}
