:root {
  --color-primary: #007aff;
  --color-success: #4cd964;
  --color-warning: #f0ad4e;
  --color-error: #dd524d;
  --color-info: #5bc0de;
  --color-light: #f8f8f8;
  --color-dark: #333333;
  --color-border: #e5e7eb;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .08);
}

html[data-theme="dark"] {
  --color-primary: #60a5fa;
  --color-success: #34d399;
  --color-warning: #f59e0b;
  --color-error: #f87171;
  --color-info: #38bdf8;
  --color-light: #0f172a;
  --color-dark: #cbd5e1;
  --color-border: #293042;
  --shadow: 0 10px 30px rgba(0, 0, 0, .4);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--color-dark);
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, #0b1020 0%, #0f172a 100%);
  color: var(--color-dark);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 102;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .85), rgba(255, 255, 255, .65));
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .06);
}

html[data-theme="dark"] .app-header {
  background: linear-gradient(180deg, rgba(15, 23, 42, .85), rgba(15, 23, 42, .65));
}

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

.brand-logo {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border-radius: 8px;
  font-weight: 700;
}

.brand-name {
  font-weight: 700;
  letter-spacing: .5px;
  font-size: 18px;
}

.nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-item {
  color: #555;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  border-bottom: 2px solid transparent;
}

.nav-item:hover {
  background: var(--color-light);
}

.nav-item.is-active {
  color: var(--color-primary);
  background: #eef6ff;
  border-bottom-color: var(--color-primary);
}

html[data-theme="dark"] .nav-item.is-active {
  background: #0b1220;
}

html[data-theme="dark"] .nav-item {
  color: #cbd5e1;
  font-weight: 600;
}

html[data-theme="dark"] .nav-item:hover {
  background: #0b1220;
  color: #e2e8f0;
}

html[data-theme="dark"] .nav-item.is-active {
  color: #a7d0ff;
  border-bottom-color: #60a5fa;
  background: rgba(12, 19, 32, .6);
}

html[data-theme="dark"] .brand-name {
  color: #e2e8f0;
}

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

.tenant-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-right: 8px;
}

.user-menu {
  position: relative;
}

.avatar-btn {
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 12px;
  cursor: pointer;
}

.avatar-btn:hover {
  background: #f7f9fb;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, #3b82f6, #1d4ed8);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  border: 2px solid #fff;
}

.caret {
  color: #666;
  font-size: 12px;
}

.menu {
  position: absolute;
  right: 0;
  top: 100%;
  width: 220px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
  display: none;
  overflow: hidden;
  z-index: 1000;
}

html[data-theme="dark"] .menu {
  background: #0f172a;
}

.user-menu:hover .menu,
.user-menu:focus-within .menu,
.user-menu.open .menu {
  display: block;
}

.menu-header {
  padding: 10px 12px;
}

.menu-name {
  font-weight: 700;
  color: #333;
}

.menu-sub {
  margin-top: 6px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  color: #333;
  text-decoration: none;
}

.menu-item:hover {
  background: #f7f9fb;
}

.menu-item .mi {
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.menu-item.danger {
  color: #c2410c;
}

.menu-sep {
  height: 1px;
  background: #eef1f6;
  margin: 4px 0;
}

.btn {
  appearance: none;
  border: 1px solid var(--color-border);
  background: #fff;
  color: #333;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s ease;
  text-decoration: none;
  display: inline-block;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="dark"] .btn {
  background: #0b1220;
  color: var(--color-dark);
}

html[data-theme="dark"] .input {
  background: #0b1220;
  color: var(--color-dark);
  border-color: #293042;
}

html[data-theme="dark"] .input::placeholder {
  color: #64748b;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .06);
}

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

.btn.primary:hover {
  filter: brightness(1.05);
}

.btn.large {
  height: 44px;
  padding: 0 20px;
  font-size: 16px;
}

.btn.logout {
  border-color: #ffd8cc;
  background: #fff6f2;
  color: #c2410c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn.logout:hover {
  background: #ffeae3;
  box-shadow: 0 6px 16px rgba(255, 64, 0, .15);
}

.btn.logout .icon {
  margin-right: 0;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.container {
  /* max-width: 1200px;  */
  margin: 15px auto;
  padding: 0 20px;
}

.hero {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  background: radial-gradient(1000px 300px at 0% -10%, #eef6ff 10%, rgba(255, 255, 255, 0) 60%), #fff;
  background-blend-mode: soft-light;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .hero {
  background: #0f172a;
}

.hero-text h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.hero-text p {
  margin: 0;
  color: #666;
}

html[data-theme="dark"] .hero-text p {
  color: #94a3b8;
}

.hero-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .card {
  background: #0f172a;
}

html[data-theme="dark"] .flow-card {
  background: #0b1220;
  border-color: #293042;
  color: var(--color-dark);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
}

html[data-theme="dark"] .flow-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, .45);
}

.card-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.card-content {
  color: #666;
}

html[data-theme="dark"] .card-content {
  color: #94a3b8;
}

.card-content.muted {
  color: #888;
}

html[data-theme="dark"] .card-content.muted {
  color: #64748b;
}

.kpi {
  text-align: center;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-primary);
}

.kpi-desc {
  color: #888;
  font-size: 12px;
}

.panel {
  margin-top: 10px;
  background: radial-gradient(1000px 300px at 0% -10%, #eef6ff 10%, rgba(255, 255, 255, 0) 60%), #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .panel {
  background: #0f172a;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-border);
}

.panel-title {
  font-weight: 700;
}

.panel-body {
  padding: 10px;
}

html[data-theme="dark"] .panel-body {
  color: var(--color-dark);
}

.timeline {
  display: grid;
  gap: 10px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px dashed var(--color-border);
  border-radius: 10px;
}

.time {
  font-size: 12px;
  color: #888;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
}

.badge.info {
  background: #eef6ff;
  color: var(--color-primary);
}

.badge.success {
  background: #e8f7ee;
  color: #30a46c;
}

.badge.warning {
  background: #fff4e5;
  color: #b7791f;
}

.badge.error {
  background: #ffe9e6;
  color: #c2410c;
}

.app-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  color: #888;
}

html[data-theme="dark"] .app-footer {
  background: #0b1220;
  color: #94a3b8;
  border-top: 1px solid var(--color-border);
}

/* pagination */
.pagination,
ul.pagination {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  padding: 8px 0;
}

.pagination li {
  list-style: none;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  /*border-radius: 999px; */
  color: #555;
  text-decoration: none;
  background: #fff;
}

html[data-theme="dark"] .pagination a,
html[data-theme="dark"] .pagination span {
  background: #0f172a;
  color: var(--color-dark);
  border-color: var(--color-border);
}

.pagination a:hover {
  background: #eef6ff;
  color: var(--color-primary);
  border-color: #cfe4ff;
}

.pagination .current {
  background: #eef6ff;
  color: var(--color-primary);
  border-color: #cfe4ff;
}

/* flow */
.flow {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.flow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}

.flow-card {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  width: 180px;
  height: 110px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--color-dark);
  background: #fff;
}

.flow-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .08);
}

.flow-title {
  font-weight: 700;
  color: #5b21b6;
}

.flow-icon {
  font-size: 28px;
}

.flow-arrow {
  position: relative;
}

.flow-arrow.right {
  width: 56px;
  height: 0;
  border-top: 2px solid #9ca3af;
}

.flow-arrow.right::after {
  content: '';
  position: absolute;
  right: -2px;
  top: -5px;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #9ca3af;
}

.flow-arrow.down {
  width: 0;
  height: 40px;
  border-left: 2px solid #9ca3af;
}

.primary-table .layui-table tbody tr:nth-child(2n) {
  background: #f7f9fb;
}

.layui-table thead {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}

html[data-theme="dark"] .layui-table {
  background: #0f172a;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table thead {
  background: #0b1220;
}

html[data-theme="dark"] .layui-table td,
html[data-theme="dark"] .layui-table th {
  border-color: var(--color-border);
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table-total {
  background: #0b1220;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table-view {
  background: #0f172a;
}

html[data-theme="dark"] .layui-table-view,
html[data-theme="dark"] .layui-table-tool,
html[data-theme="dark"] .layui-table-page {
  border-color: var(--color-border);
}

html[data-theme="dark"] .layui-table-tool {
  background: #0b1220;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table-tool-self {
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table-tool .layui-btn {
  background: #0b1220;
  color: var(--color-dark);
  border-color: var(--color-border);
}

html[data-theme="dark"] .layui-table-tool .layui-btn:hover {
  background: #0b132b;
}

html[data-theme="dark"] .layui-table-view .layui-table-header {
  border-bottom: 1px solid var(--color-border);
}

html[data-theme="dark"] .layui-table-header {
  background: #0b1220;
}

html[data-theme="dark"] .layui-table-header .layui-table,
html[data-theme="dark"] .layui-table-body .layui-table {
  background: #0f172a;
}

html[data-theme="dark"] .layui-table-mend {
  background: #0b1220;
}

html[data-theme="dark"] .layui-inline {
  color: #ccc;
}

html[data-theme="dark"] .layui-table-tool .layui-inline {
  color: #ccc;
}

html[data-theme="dark"] .layui-form-checkbox[lay-skin=primary] {
  border: 1px solid var(--color-border);
  background: #0b1220;
}

html[data-theme="dark"] .layui-table-view .layui-form-checkbox[lay-skin=primary] i {
  background: #0b1220;
}

html[data-theme="dark"] .layui-form-checkbox[lay-skin=primary]>i {
  border: 1px solid var(--color-border);
  background: #0b1220;
}

html[data-theme="dark"] .layui-laypage select {
  border: 1px solid var(--color-border);
  background: #0b1220;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-laypage input {
  border: 1px solid var(--color-border);
  background: #0b1220;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-laypage button {
  border: 1px solid var(--color-border);
  background: #0b1220;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table-tool-panel {
  border: 1px solid var(--color-border);
  background: #0b1220;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-form-checkbox[lay-skin=primary]>div {
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table-tool-panel li:hover {
  background: #0f172a;
  color: var(--color-dark);
}

html[data-theme="dark"] .layui-table-fixed,
html[data-theme="dark"] .layui-table-fixed-l,
html[data-theme="dark"] .layui-table-fixed-r {
  background: #0f172a;
}

html[data-theme="dark"] .layui-table-fixed-r {
  border-left: 1px solid var(--color-border);
}

html[data-theme="dark"] .layui-table-fixed-l {
  border-right: 1px solid var(--color-border);
}

html[data-theme="dark"] .layui-table-hover {
  background: rgba(255, 255, 255, .04);
}

html[data-theme="dark"] .layui-table-view .layui-table-box .layui-table-body tr:nth-child(2n) {
  background: #0b132b;
}

html[data-theme="dark"] .layui-table-main::-webkit-scrollbar,
html[data-theme="dark"] .layui-table-body::-webkit-scrollbar,
html[data-theme="dark"] .layui-table-header::-webkit-scrollbar,
html[data-theme="dark"] .table-scroll::-webkit-scrollbar {
  height: 10px;
  width: 10px;
}

html[data-theme="dark"] .layui-table-main::-webkit-scrollbar-track,
html[data-theme="dark"] .layui-table-body::-webkit-scrollbar-track,
html[data-theme="dark"] .layui-table-header::-webkit-scrollbar-track,
html[data-theme="dark"] .table-scroll::-webkit-scrollbar-track {
  background: #0b132b;
  border-radius: 8px;
}

html[data-theme="dark"] .layui-table-main::-webkit-scrollbar-thumb,
html[data-theme="dark"] .layui-table-body::-webkit-scrollbar-thumb,
html[data-theme="dark"] .layui-table-header::-webkit-scrollbar-thumb,
html[data-theme="dark"] .table-scroll::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 8px;
  border: 1px solid #0f172a;
}

html[data-theme="dark"] .layui-table-main::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .layui-table-body::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .layui-table-header::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .table-scroll::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

html[data-theme="dark"] .layui-table-main::-webkit-scrollbar-button,
html[data-theme="dark"] .layui-table-body::-webkit-scrollbar-button,
html[data-theme="dark"] .layui-table-header::-webkit-scrollbar-button,
html[data-theme="dark"] .table-scroll::-webkit-scrollbar-button {
  display: none;
  height: 0;
}

html[data-theme="dark"] .layui-table-main::-webkit-scrollbar-corner,
html[data-theme="dark"] .layui-table-body::-webkit-scrollbar-corner,
html[data-theme="dark"] .layui-table-header::-webkit-scrollbar-corner,
html[data-theme="dark"] .table-scroll::-webkit-scrollbar-corner {
  background: #0b132b;
}

html[data-theme="dark"] .layui-table-main,
html[data-theme="dark"] .layui-table-body,
html[data-theme="dark"] .layui-table-header,
html[data-theme="dark"] .table-scroll {
  scrollbar-color: #334155 #0b132b;
}

.flow-arrow.down::after {
  content: '';
  position: absolute;
  left: -5px;
  bottom: -2px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #9ca3af;
}

/* improved aligned flow grid */
.flow-grid {
  display: grid;
  justify-content: center;
  align-items: center;
  grid-template-columns: repeat(5, 160px);
  grid-auto-rows: 100px;
  gap: 5px;
}
.flow-grid-3 {
  display: grid;
  justify-content: center;
  align-items: center;
  grid-template-columns: repeat(3, 160px);
  grid-auto-rows: 100px;
  gap: 5px;
}

.flow-grid .flow-card {
  width: 160px;
  height: 100px;
}

.flow-cell {
  width: 160px;
  height: 100px;
}

/* 修复后的水平箭头样式 */
.flow-arrow.h {
  justify-self: center;
  align-self: center;
  width: 64px;
  height: 2px;
  /* 直接用高度做线的粗细，替代border-top */
  background-color: #9ca3af;
  /* 线的颜色 */
  position: relative;
}

.flow-arrow.h::after {
  content: '';
  position: absolute;
  right: -8px;
  /* 箭头宽度是8px，让箭头接在线的右端 */
  top: 50%;
  /* 垂直居中 */
  transform: translateY(-50%);
  /* 抵消自身高度，实现精准居中 */
  width: 0;
  height: 0;
  /* 向右的箭头三角形（border-left对应向右的指向） */
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #9ca3af;
}

/* 垂直箭头样式（保持原有逻辑，若需调整可同理优化） */
.flow-arrow.v {
  justify-self: center;
  align-self: center;
  width: 2px;
  /* 用宽度做线的粗细，替代border-left */
  height: 60px;
  background-color: #9ca3af;
  /* 线的颜色 */
  position: relative;
}

.flow-arrow.v::after {
  content: '';
  position: absolute;
  left: 50%;
  /* 水平居中 */
  bottom: -8px;
  /* 箭头高度是8px，让箭头接在线的底端 */
  transform: translateX(-50%);
  /* 抵消自身宽度，实现精准居中 */
  width: 0;
  height: 0;
  /* 向下的箭头三角形（border-top对应向下的指向） */
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #9ca3af;
}

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

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

  .nav {
    gap: 8px;
  }
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .25);
  backdrop-filter: blur(2px);
  display: none;
  z-index: 900;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  /* 从8%改为50%，定位到垂直中点 */
  transform: translate(-50%, -50%);
  /* 同时水平+垂直偏移自身50%，实现真正居中 */
  width: min(1250px, 96vw);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .18);
  display: none;
  z-index: 1000;
  max-height: 90vh;
  /* 保留最大高度，防止内容溢出屏幕 */
  overflow-y: auto;
  /* 内容过长时可滚动 */
  /* 可选：添加最小边距，避免弹窗贴边（比如小屏幕） */
  margin: 0 auto;
  box-sizing: border-box;
  /* 确保边框不影响宽度计算 */
}

.modal.open,
.modal-backdrop.open {
  display: block;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
}

.modal-title {
  font-weight: 700;
}

.modal-body {
  padding: 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}

.form-grid {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
}

.form-grid .thead,
.form-grid .row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.form-grid .thead {
  background: #f7f9fb;
  font-weight: 600;
}

.form-grid .cell {
  padding: 8px 10px;
  border-top: 1px solid #eef1f6;
}

.form-grid .cell.label {
  color: #666;
}

.input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 0 8px;
}

/* receipt 结算单样式 */
.receipt {
  background: transparent;
  padding: 16px;
  border-radius: 0;
}

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

.receipt .receipt-title {
  text-align: center;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.3;
  margin: 0 0 10px;
}

.receipt .receipt-sub {
  text-align: center;
  font-weight: 700;
  margin-bottom: 8px;
}

.receipt .in-time {
  font-size: 12px;
  color: #555;
}

.receipt-grid {
  border: 1px solid #000;
  /* border-radius: 6px;  */
  overflow: visible;
  margin-bottom: 16px;
}

.receipt-grid .row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 0.8fr 1.2fr 0.8fr 1.2fr 0.8fr 1.2fr;
}

.receipt-grid .cell {
  padding: 6px 8px;
  border-top: 1px solid #000;
  border-right: 1px solid #000;
  background: #fff;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.receipt-grid .row:first-child .cell {
  border-top: none;
}

.receipt-grid .cell:nth-child(8n) {
  border-right: none;
}

.receipt-grid .label {
  font-weight: 600;
  background: #f0f0f0;
  justify-content: flex-end;
  text-align: right;
}

.receipt-grid .label.required::before {
  content: '*';
  margin-right: 4px;
  color: #c2410c;
}

.receipt-grid .label.em {
  color: #c00;
}

.receipt-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.receipt .input {
  height: 28px;
  border: none !important;
  outline: none;
  background: transparent;
  border-radius: 0;
  padding: 0 6px;
  box-shadow: none;
  flex: 1;
}

.receipt input[type="text"],
.receipt input[type="number"],
.receipt input[type="datetime-local"],
.receipt textarea,
.receipt select {
  border: none !important;
  background: transparent;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.receipt input::-ms-clear {
  display: none;
}

.receipt input::-webkit-inner-spin-button,
.receipt input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.receipt input[type="number"] {
  -moz-appearance: textfield;
}

.receipt input[type="datetime-local"] {
  flex: 0 0 auto;
  width: 140px;
}

/* 网格合并类 */
.span-2 {
  grid-column: span 2;
}

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

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

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

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

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

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

/* 模糊搜索下拉 */
.suggest {
  position: relative;
  width: 100%;
}

.suggest-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1100;
  background: #fff;
  border: 1px solid var(--color-border);
  border-top: none;
  max-height: 180px;
  overflow: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
  border-radius: 0 0 8px 8px;
}

.suggest-item {
  padding: 8px 10px;
  cursor: pointer;
}

.suggest-item:hover {
  background: #f7f9fb;
}

/* theme toggle (illustrated) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  margin-right: 8px;
}

.theme-toggle input {
  display: none;
}

.theme-toggle label {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 30px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--color-border);
  cursor: pointer;
}

.theme-toggle label .bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #8ec5ff 0%, #eaf6ff 100%);
  transition: all .3s ease;
}

.theme-toggle label .sun {
  position: absolute;
  left: 8px;
  top: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff8dd 0%, #ffd54f 100%);
  box-shadow: 0 0 12px rgba(255, 200, 0, .6);
  transition: transform .3s ease, opacity .3s ease;
}

.theme-toggle label .moon {
  position: absolute;
  right: 8px;
  top: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fafafa 0%, #cbd5e1 100%);
  box-shadow: inset -6px 0 0 #b0c4de;
  opacity: 0;
  transform: translateY(6px) scale(.8);
  transition: transform .3s ease, opacity .3s ease;
}

.theme-toggle label .stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .3s ease;
}

.theme-toggle label .stars::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 8px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 12px 6px #fff, 24px 12px #fff, 30px 4px #fff, 40px 10px #fff, 50px 6px #fff;
}

.theme-toggle label .cloud {
  position: absolute;
  left: 32px;
  bottom: 6px;
  width: 14px;
  height: 10px;
  background: #fff;
  border-radius: 999px;
  box-shadow: -12px 2px #fff, 12px 2px #fff;
  opacity: .8;
  transition: opacity .3s ease;
}

.theme-toggle input:checked+label .bg {
  background: linear-gradient(180deg, #0b132b 0%, #1f2937 100%);
}

.theme-toggle input:checked+label .sun {
  opacity: .25;
  transform: translateY(10px) scale(.7);
}

.theme-toggle input:checked+label .moon {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.theme-toggle input:checked+label .stars {
  opacity: 1;
}

.theme-toggle input:checked+label .cloud {
  opacity: .1;
}

/* 打印样式 */
@media print {
  @page {
    size: A4 landscape;
    margin: 5mm;
    /* 强制页面仅一页（核心修复1） */
    page-break-after: avoid;
    page-break-before: avoid;
  }

  /* 清除body/html的所有默认边距和溢出（核心修复2） */
  html,
  body {
    background: #fff;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  /* 隐藏无关元素 */
  .app-header,
  .app-footer,
  .panel,
  .modal-actions,
  .modal-backdrop {
    display: none !important;
  }

  /* 重置modal样式，强制适应页面（核心修复3） */
  .modal {
    position: static;
    transform: none;
    width: 100% !important;
    /* 强制宽度100%，避免自适应溢出 */
    max-width: 100% !important;
    border: none;
    box-shadow: none;
    max-height: none;
    overflow: visible;
    margin: 0 !important;
    /* 清除margin避免溢出 */
    padding: 0 !important;
    /* 清除padding避免溢出 */
  }

  /* 收据样式优化 */
  .receipt {
    padding: 0 !important;
    font-size: 12px;
    width: 100% !important;
    /* 强制收据宽度适配页面 */
    margin: 0 !important;
    /* 清除margin */
  }

  .receipt .receipt-toolbar {
    display: none !important;
  }

  .receipt .receipt-title {
    font-size: 14px;
    margin-bottom: 4px;
  }

  .receipt-actions,
  .receipt-space {
    display: none !important;
  }

  .receipt-grid {
    page-break-inside: avoid;
    width: 100% !important;
    /* 表格宽度强制适配 */
  }

  .receipt-grid .cell {
    border-color: #000;
    padding: 3px 4px;
    min-height: 24px;
    box-sizing: border-box;
    /* 确保内边距不溢出 */
  }

  .receipt input[type="datetime-local"] {
    width: 120px;
    box-sizing: border-box;
    /* 输入框尺寸计算正确 */
  }

  /* 隐藏所有按钮 */
  .btn {
    display: none !important;
  }

  /* 核心修复4：强制所有元素不触发分页 */
  * {
    page-break-after: avoid !important;
    page-break-before: avoid !important;
    page-break-inside: avoid !important;
  }

  /* 打印时隐藏编号列、复选框列和操作列，只显示序号列 */

  /* 隐藏编号列 - 使用多种选择器确保生效 */
  .layui-table td[data-field="编号"],
  .layui-table th[data-field="编号"],
  table td[data-field="编号"],
  table th[data-field="编号"],
  [data-field="编号"] {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* 隐藏复选框列 */
  .layui-table td[data-key$="-checkbox"],
  .layui-table th[data-key$="-checkbox"],
  table td[data-key$="-checkbox"],
  table th[data-key$="-checkbox"],
  [data-key$="-checkbox"] {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* 隐藏操作列（最后一列通常是操作列）*/
  .layui-table-fixed-r,
  td[data-field="操作"],
  th[data-field="操作"] {
    display: none !important;
    visibility: hidden !important;
  }

  /* 确保序号列显示 */
  .layui-table td[data-key$="-numbers"],
  .layui-table th[data-key$="-numbers"],
  table td[data-key$="-numbers"],
  table th[data-key$="-numbers"],
  [data-key$="-numbers"] {
    display: table-cell !important;
    visibility: visible !important;
  }

  /* 确保表格和 panel 在打印时显示 */
  body.full-mode .panel,
  body.full-mode .panel-body,
  body.full-mode .full-list {
    display: block !important;
  }

  body.full-mode .primary-table,
  body.full-mode .app-header,
  body.full-mode .app-footer {
    display: none !important;
  }
}

/* 隐藏默认取消/关闭按钮（保留业务按钮） */
#buyCancel {
  display: none;
}

/* 推荐信息样式 */
.recommendation {
  margin: 16px 0;
  padding: 12px 16px;
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  border-radius: 10px;
  text-align: center;
}

html[data-theme="dark"] .recommendation {
  background: linear-gradient(180deg, #0c4a6e 0%, #0369a1 100%);
  border-color: #0ea5e9;
}

.recommendation p {
  margin: 0 0 12px 0;
  font-weight: 500;
  color: #0369a1;
}

html[data-theme="dark"] .recommendation p {
  color: #7dd3fc;
}

.download-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px !important;
  font-size: 14px;
  font-weight: 600;
}

.feature-list {
  padding-left: 20px;
}

.feature-list li {
  margin-bottom: 8px;
  line-height: 1.5;
}

.install-steps {
  padding-left: 20px;
}

.install-steps li {
  margin-bottom: 10px;
  line-height: 1.6;
}

.download-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
}

@media (max-width: 768px) {
  .download-section {
    flex-direction: column;
    align-items: stretch;
  }
  
  .download-action {
    order: -1; /* 将下载按钮移到最前面 */
  }
}