
:root {
  --primary: #1890ff;
  --primary-dark: #096dd9;
  --primary-light: #e6f7ff;
  --success: #52c41a;
  --warning: #faad14;
  --danger: #ff4d4f;
  --info: #13c2c2;
  --text-main: #262626;
  --text-secondary: #595959;
  --text-tertiary: #8c8c8c;
  --bg-page: #f0f2f5;
  --bg-card: #ffffff;
  --bg-hover: #fafafa;
  --bg-secondary: #fafafa;
  --border: #e8e8e8;
  --border-light: #f0f0f0;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-w: 220px;
  --header-h: 56px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  font-size: 14px;
  overflow: hidden;
  height: 100vh;
}

/* ============ 布局 ============ */
#app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #001529 0%, #002140 100%);
  color: rgba(255,255,255,0.65);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.25s ease;
  position: relative;
}

.sidebar-collapsed {
  width: 0;
  overflow: hidden;
  border: none;
}

.sidebar-title {
  white-space: nowrap;
  overflow: hidden;
}


.sidebar-external-toggle {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  margin-right: 8px;
}
.sidebar-external-toggle:hover {
  background: var(--bg-hover);
  color: var(--primary);
}


.sidebar-toggle {
  margin-left: auto;
  background: rgba(255,255,255,0.1);
  border: none;
  color: rgba(255,255,255,0.65);
  width: 28px;
  height: 28px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

.sidebar-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header .logo {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-group {
  margin-bottom: 4px;
}

.nav-group-title {
  padding: 10px 20px 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  cursor: pointer;
  gap: 10px;
  font-size: 14px;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}

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

.nav-item.active {
  background: var(--primary);
  color: #fff;
  border-left-color: #fff;
}

.nav-item .icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-item .badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
}

.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow);
  z-index: 10;
}

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

.topbar-spacer { flex: 1; }

.topbar-info {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-secondary);
}

.topbar-info .date {
  font-size: 13px;
}

.topbar-info .user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.topbar-info .user-clickable {
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 16px;
  background: #f0f7ff;
  color: #1f5c9e;
  border: 1px solid #d4e7f8;
  transition: all .15s;
  user-select: none;
}
.topbar-info .user-clickable:hover {
  background: #1890ff;
  color: #fff;
  border-color: #1890ff;
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

/* ============ 卡片 ============ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}

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

/* ============ 统计卡片 ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.blue { background: #e6f7ff; color: #1890ff; }
.stat-icon.green { background: #f6ffed; color: #52c41a; }
.stat-icon.orange { background: #fff7e6; color: #fa8c16; }
.stat-icon.red { background: #fff1f0; color: #ff4d4f; }
.stat-icon.purple { background: #f9f0ff; color: #722ed1; }
.stat-icon.cyan { background: #e6fffb; color: #13c2c2; }

.stat-info { flex: 1; }
.stat-label { font-size: 13px; color: var(--text-tertiary); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--text-main); }
.stat-sub { font-size: 12px; color: var(--text-tertiary); margin-top: 2px; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

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

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

.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.85; color: #fff; }

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

.btn-warning { background: var(--warning); border-color: var(--warning); color: #fff; }
.btn-warning:hover { opacity: 0.85; color: #fff; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 10px 24px; font-size: 15px; }
.btn-text { border: none; background: none; padding: 4px 8px; color: var(--primary); }
.btn-text:hover { background: var(--primary-light); }
.btn-text.danger { color: var(--danger); }
.btn-text.danger:hover { background: #fff1f0; }

/* ============ 表格 ============ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

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

table.data-table thead th {
  background: #fafafa;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
}

table.data-table tbody tr:hover { background: var(--bg-hover); }

table.data-table .text-right { text-align: right; }
table.data-table .text-center { text-align: center; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}
.tag-green { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-red { background: #fff1f0; color: #ff4d4f; border: 1px solid #ffa39e; }
.tag-blue { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.tag-orange { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.tag-gray { background: #fafafa; color: #8c8c8c; border: 1px solid #d9d9d9; }
.tag-success { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-warning { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.tag-danger { background: #fff1f0; color: #ff4d4f; border: 1px solid #ffa39e; }

/* ============ 表单 ============ */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-label .req { color: var(--danger); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color 0.15s;
  background: #fff;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(24,144,255,0.1);
}

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

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}


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

.toolbar .search-input {
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.toolbar .spacer { flex: 1; }


.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s;
}

.modal {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  width: 90%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s;
}

.modal.modal-lg { max-width: 960px; }
.modal.modal-sm { max-width: 480px; }

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

.modal-title { font-size: 16px; font-weight: 600; }

.modal-close {
  cursor: pointer;
  font-size: 20px;
  color: var(--text-tertiary);
  background: none;
  border: none;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text-main); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }


.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .text { font-size: 14px; }
.empty-state .action { margin-top: 16px; }

/* ============ 单据 ============ */
.bill-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--primary);
}

.bill-no { font-size: 18px; font-weight: 700; color: var(--primary); }
.bill-date { color: var(--text-tertiary); font-size: 13px; }

.bill-items-table input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}

.bill-items-table input:focus { border-color: var(--primary); outline: none; }

.bill-summary {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  gap: 24px;
}

.bill-summary-item {
  text-align: right;
}
.bill-summary-item .label { font-size: 13px; color: var(--text-tertiary); }
.bill-summary-item .value { font-size: 20px; font-weight: 700; }
.bill-summary-item .value.total { color: var(--danger); font-size: 24px; }

/* ============ 通知 ============ */
.toast-container {
  position: fixed;
  top: 70px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  min-width: 280px;
  animation: slideInRight 0.2s;
  border-left: 4px solid var(--primary);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }


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

.tab {
  padding: 8px 20px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }


.progress-bar {
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s;
}


.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-tertiary { color: var(--text-tertiary); }
.font-bold { font-weight: 600; }
.font-lg { font-size: 16px; }
.font-sm { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.hide { display: none !important; }
.cursor-pointer { cursor: pointer; }


::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bfbfbf; }

.sidebar ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); }


.bill-workbench {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  overflow: hidden;
}

/* ---- 主体区域 ---- */
.bill-body {
  display: flex;
  flex: 1;
  min-height: 0;
}
.bill-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---- 顶部页签 ---- */
.bill-tabbar {
  background: #fff;
  border-bottom: 1px solid #e6ebf0;
  padding: 0 20px;
  flex-shrink: 0;
}
.bill-tab {
  display: inline-block;
  padding: 11px 28px;
  font-size: 15px;
  color: #4a5568;
  border: 1px solid #e6ebf0;
  border-bottom: none;
  border-radius: 5px 5px 0 0;
  background: #f7f9fb;
}
.bill-tab.active {
  background: #fff;
  color: #1890ff;
  border-color: #1890ff;
  font-weight: 600;
}


.bill-flow-wrap {
  flex: 1;
  overflow: auto;
  padding: 24px 24px 12px;
  background: #fff;
}


.bill-flow-wrap-inner {
  width: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 20px 0;
}

.bill-flow-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.bill-node {
  width: 140px;
  padding: 20px 12px 18px;
  border-radius: 12px;
  background: #fff;
  border: 1.5px solid #d9dde3;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}
.bill-node:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.16);
  border-color: #1890ff;
}
.bill-node-icon { font-size: 48px; line-height: 1.15; }
.bill-node-label {
  font-size: 17px;
  margin-top: 10px;
  color: #2c3e50;
  font-weight: 600;
  letter-spacing: .5px;
}
.bill-node-red { border-color: #f0a9a5; background: #fff8f7; }
.bill-node-red .bill-node-icon { color: #d94b3f; }
.bill-node-green { border-color: #9ed4b4; background: #f5fdf7; }
.bill-node-green .bill-node-icon { color: #2f9e5e; }
.bill-node-blue { border-color: #a3c9ec; background: #f5faff; }
.bill-node-blue .bill-node-icon { color: #2b7fc4; }
.bill-node-purple { border-color: #c3a9e0; background: #fbf7ff; }
.bill-node-purple .bill-node-icon { color: #8250b8; }
.bill-node-teal { border-color: #8fd0d6; background: #f4fdfd; }
.bill-node-teal .bill-node-icon { color: #2a9ba3; }
.bill-node-orange { border-color: #f3c891; background: #fffaf0; border-style: dashed; }
.bill-node-orange .bill-node-icon { color: #d98f2b; }
.bill-arrow {
  font-size: 34px;
  color: #b8c2cd;
  user-select: none;
  text-align: center;
  line-height: 1;
  padding: 0 8px;
}

/* ---- 底部基础资料（紧凑单行） ---- */
.home-base {
  background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fa 100%);
  border-top: 1px solid #dbe1e8;
  padding: 10px 24px 12px;
  flex-shrink: 0;
}
.home-base-title {
  font-size: 15px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 8px;
  letter-spacing: .5px;
}
.home-base-items {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: nowrap;
}
.home-base-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  padding: 6px 10px 6px 6px;
  flex: 1 1 0;
  min-width: 0;
  background: #fff;
  border: 1px solid #e3e8ee;
  border-radius: 9px;
  transition: all .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.home-base-item:hover {
  transform: translateY(-3px);
  border-color: #1890ff;
  box-shadow: 0 8px 20px rgba(24,144,255,0.18);
}
.home-base-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  flex-shrink: 0;
  transition: transform .18s;
}
.home-base-item:hover .home-base-icon { transform: scale(1.08); }
.home-base-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
}
.home-base-label {
  font-size: 13.5px;
  font-weight: 600;
  color: #2c3e50;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-base-desc {
  font-size: 11px;
  color: #8c97a3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   单据页面
   ========================================================================== */

/* ---- 单据容器 ---- */
.bill-doc {
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  margin: 12px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 150px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}


.bill-doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fbfdff 0%, #f5f9fd 100%);
}

.bill-doc-head-compact {
  justify-content: flex-end;
  padding: 10px 20px;
  background: #fafcfe;
}
.bill-doc-head-compact .bill-doc-meta {
  display: flex;
  align-items: center;
  gap: 18px;
}
.bill-doc-head-compact .bill-meta-row {
  margin-bottom: 0;
}
.bill-doc-meta { text-align: right; font-size: 13px; }
.bill-meta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 5px;
}
.bill-meta-label { color: var(--text-secondary); }
.bill-meta-value {
  font-weight: 700;
  color: #1890ff;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
}
.bill-date {
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  padding: 3px 8px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-main);
  background: #fff;
}
.bill-date:focus { outline: none; border-color: #1890ff; }


.bill-doc-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.bill-radio-group { display: flex; gap: 16px; }
.bill-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-main);
  user-select: none;
}
.bill-radio input { display: none; }
.bill-radio-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid #bfbfbf;
  display: inline-block;
  position: relative;
  transition: all .15s;
}
.bill-radio input:checked + .bill-radio-dot {
  border-color: #1890ff;
  background: #1890ff;
  box-shadow: inset 0 0 0 2.5px #fff;
}
.bill-field { display: flex; align-items: center; gap: 6px; }
.bill-field-label { font-size: 14px; color: var(--text-secondary); white-space: nowrap; }
.bill-field-hint { font-size: 12px; white-space: nowrap; }
.bill-select {
  border: 1px solid #d9d9d9;
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
  color: var(--text-main);
}
.bill-select:focus { outline: none; border-color: #1890ff; }
.bill-select-wide { width: 190px; }

/* ---- 明细表格 ---- */
.bill-table-wrap {
  flex: 1;
  overflow: auto;
  border-bottom: 1px solid var(--border);
  min-height: 260px;
}
.bill-items-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
.bill-items-table thead th {
  background: #f0f6fc;
  color: #1a4d80;
  font-weight: 600;
  padding: 9px 8px;
  border: 1px solid #cfd9e3;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}
.bill-items-table tbody td {
  border: 1px solid #e2e8ee;
  padding: 3px 5px;
  height: 34px;
  vertical-align: middle;
}
.bill-items-table tbody tr:nth-child(even) { background: #fcfdfe; }
.bill-items-table tbody tr:hover { background: #eef6fd; }
.bill-idx {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 12px;
  width: 40px;
  background: #fafbfc;
}
.bill-cell-name { width: 26%; }
.bill-cell-unit { width: 70px; }
.bill-cell-cat { width: 100px; }
.bill-cell-qty { width: 80px; }
.bill-cell-price { width: 90px; }
.bill-cell-amt {
  width: 100px;
  text-align: right;
  font-weight: 600;
  color: #c0392b;
  white-space: nowrap;
  background: #fffdf7;
}
.bill-cell-remark { width: 120px; }
.bill-cell-op { width: 36px; text-align: center; }
.bill-inp {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 5px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-main);
  border-radius: 2px;
}
.bill-inp:hover { border-color: #d9d9d9; }
.bill-inp:focus {
  outline: none;
  border-color: #1890ff;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(24,144,255,.12);
}
.bill-inp-name { font-weight: 600; }
.bill-inp-num { text-align: right; }
.bill-inp-amt {
  width: 130px;
  text-align: right;
  font-weight: 600;
  border-color: #d9d9d9;
}
.bill-inp-unit { text-align: center; }
.bill-row-del {
  border: none;
  background: transparent;
  color: #bfbfbf;
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 0 4px;
  border-radius: 3px;
}
.bill-row-del:hover { color: #ff4d4f; background: #fff1f0; }
.bill-blank-row:hover { background: #f0f7ff !important; }
.bill-blank-hint {
  color: #bfbfbf;
  font-size: 12px;
  text-align: left;
  padding-left: 8px !important;
  cursor: pointer;
  height: 30px !important;
}
.bill-blank-hint:hover { color: #1890ff; }
.bill-total-row td {
  background: #eef4fb;
  font-weight: 700;
  border: 1px solid #cfd9e3;
  padding: 8px;
  font-size: 13px;
}
.bill-total-row .bill-cell-amt { background: #eef4fb; color: #c0392b; }


.bill-note {
  padding: 12px 20px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--border);
}
.bill-note-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 9px;
}
.bill-note-row:last-child { margin-bottom: 0; }
.bill-note-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.bill-note .bill-inp { border-color: #d9d9d9; background: #fff; }


.bill-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 20px;
  background: linear-gradient(180deg, #fbfcfd 0%, #f2f6fa 100%);
  border-radius: 0 0 4px 4px;
  gap: 12px;
  flex-wrap: wrap;
}
.bill-actions-left, .bill-actions-right { display: flex; gap: 10px; align-items: center; }

/* ---- 商品选择弹窗 ---- */
.bill-picker { width: 100%; }
.bill-picker-list {
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.bill-picker-item {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background .12s;
}
.bill-picker-item:hover { background: var(--primary-light); }
.bill-picker-name { font-size: 14px; font-weight: 600; color: var(--text-main); }
.bill-picker-meta { font-size: 12px; color: var(--text-tertiary); margin-top: 3px; }


a.text-primary { text-decoration: none; }
a.text-primary:hover { text-decoration: underline; }

/* ---- modal-lg ---- */
.modal-lg { width: 800px !important; max-width: 92vw; }


.perm-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px 16px;
}
.perm-group-title {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-tertiary);
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  margin-top: 4px;
}
.perm-group-title:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.perm-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
  user-select: none;
}
.perm-check:hover { background: var(--primary-light); }
.perm-check input { width: 15px; height: 15px; cursor: pointer; accent-color: #1890ff; }
.perm-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.perm-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary-dark);
  margin: 2px;
}
.perm-tag.off { background: #f5f5f5; color: #bfbfbf; }

/* ---- 余额明细弹窗 ---- */
.stmt-balance {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #fff7e6, #fff1d6);
  border: 1px solid #ffd591;
  border-radius: 6px;
  margin-bottom: 14px;
}
.stmt-balance .lbl { font-size: 13px; color: var(--text-secondary); }
.stmt-balance .val { font-size: 24px; font-weight: 700; color: var(--danger); }

/* ---- 分类明细 ---- */
.cat-detail-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background .12s;
}
.cat-detail-item:hover { background: var(--primary-light); }
.cat-detail-item .nm { font-weight: 600; }
.cat-detail-item .amt { color: var(--success); font-weight: 700; }

/* ==================== 登录界面 ==================== */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  background: linear-gradient(135deg, #e8f2fd 0%, #f5f9fd 45%, #eaf4ff 100%);
  padding: 24px;
  overflow-y: auto;
  box-sizing: border-box;
}
.login-card {
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(24, 144, 255, .13);
  padding: 40px 36px 30px;
  text-align: center;
  margin: auto;
}
.login-logo {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1890ff, #0a66c2);
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 6px 18px rgba(24, 144, 255, .3);
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #1a4d80;
  letter-spacing: 1px;
}
.login-subtitle {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 5px;
  margin-bottom: 24px;
}
.login-warning {
  background: #fff7e6;
  border: 1px solid #ffd591;
  color: #ad6800;
  font-size: 12px;
  line-height: 1.7;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 18px;
  text-align: left;
}
.login-form { text-align: left; }
.login-error {
  display: none;
  margin-bottom: 12px;
  padding: 8px 10px;
  background: #fff1f0;
  border: 1px solid #ffa39e;
  border-radius: 6px;
  color: #ff4d4f;
  font-size: 13px;
  line-height: 1.5;
}
.login-field input.login-input-error {
  border-color: #ff4d4f;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(255, 77, 79, .1);
}
.login-field { margin-bottom: 15px; }
.login-field label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.login-field input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #d9d9d9;
  border-radius: 7px;
  font-size: 14px;
  outline: none;
  transition: all .15s;
  background: #fff;
}
.login-field input:focus {
  border-color: #1890ff;
  box-shadow: 0 0 0 3px rgba(24, 144, 255, .12);
}
.login-btn {
  width: 100%;
  height: 42px;
  margin-top: 8px;
  background: #1890ff;
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 4px;
  cursor: pointer;
  transition: all .15s;
}
.login-btn:hover { background: #0a66c2; }
.login-btn:active { transform: translateY(1px); }

@media (max-width: 480px) {
  .login-page { padding: 16px; }
  .login-card { padding: 30px 24px 24px; border-radius: 12px; }
  .login-logo { width: 54px; height: 54px; font-size: 28px; border-radius: 14px; }
  .login-title { font-size: 20px; }
  .login-subtitle { margin-bottom: 20px; }
}
@media (max-height: 620px) {
  .login-page { align-items: flex-start; }
  .login-card { margin: auto; padding: 26px 30px 24px; }
  .login-logo { width: 50px; height: 50px; font-size: 26px; margin-bottom: 12px; }
  .login-title { font-size: 19px; }
  .login-subtitle { margin-bottom: 16px; }
  .login-field { margin-bottom: 11px; }
  .login-field input { height: 36px; }
  .login-btn { height: 38px; }
}

/* ==================== 表格排序 ==================== */
.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sortable:hover { color: var(--primary); }
.sort-icon {
  display: inline-block;
  margin-left: 3px;
  font-size: 10px;
  color: #c0c4cc;
  vertical-align: middle;
}
.sortable.active { color: var(--primary); font-weight: 700; }
.sortable.active .sort-icon { color: var(--primary); }


.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.switch-label input { cursor: pointer; margin: 0; }


.account-card {
  cursor: pointer;
  transition: all .15s;
}
.account-card:hover {
  box-shadow: 0 6px 18px rgba(24, 144, 255, .16);
  transform: translateY(-2px);
}
.account-card .stat-label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.account-hint {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 4px;
}


.skeleton-wrap { padding: 12px; }
.skeleton-line {
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.2s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-line.short { width: 60%; }
.skeleton-line.long { width: 100%; }

/* ==================== 分页组件 ==================== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
  gap: 8px;
}
.pagination-info {
  font-size: 13px;
  color: var(--text-tertiary);
}
.pagination-btns {
  display: flex;
  gap: 4px;
  align-items: center;
}
.pagination-btns .btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination-dots {
  padding: 0 8px;
  color: var(--text-tertiary);
  font-size: 13px;
}


.dash-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dash-stat {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dash-stat-label {
  font-size: 12px;
  color: var(--text-tertiary);
}
.dash-stat-value {
  font-size: 22px;
  font-weight: 700;
}
.dash-stat-value.text-success { color: var(--success); }
.dash-stat-value.text-danger { color: var(--danger); }
.dash-stat-value.text-primary { color: var(--primary); }


.dash-quick-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dash-quick-btn {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
.dash-quick-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.dash-quick-btn .icon { font-size: 20px; }
.dash-quick-btn.sale { border-color: #ffa39e; background: #fff8f7; color: #d94b3f; }
.dash-quick-btn.sale:hover { background: #ff4d4f; color: #fff; border-color: #ff4d4f; }
.dash-quick-btn.retail { border-color: #d3adf7; background: #f9f0ff; color: #722ed1; }
.dash-quick-btn.retail:hover { background: #722ed1; color: #fff; border-color: #722ed1; }
.dash-quick-btn.pur { border-color: #9ed4b4; background: #f5fdf7; color: #2f9e5e; }
.dash-quick-btn.pur:hover { background: #52c41a; color: #fff; border-color: #52c41a; }
.dash-quick-btn.receipt { border-color: #a3c9ec; background: #f5faff; color: #2b7fc4; }
.dash-quick-btn.receipt:hover { background: #1890ff; color: #fff; border-color: #1890ff; }
.dash-quick-btn.payment { border-color: #f3c891; background: #fffaf0; color: #d98f2b; }
.dash-quick-btn.payment:hover { background: #faad14; color: #fff; border-color: #faad14; }


.dash-todo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.dash-todo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
}
.dash-todo-item:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.dash-todo-item.alert { background: #fff1f0; border: 1px solid #ffa39e; }
.dash-todo-item.alert:hover { border-color: var(--danger); }
.dash-todo-item.warn { background: #fff7e6; border: 1px solid #ffd591; }
.dash-todo-item.warn:hover { border-color: var(--warning); }
.dash-todo-item.ok { background: #f6ffed; border: 1px solid #b7eb8f; }
.dash-todo-item .todo-icon { font-size: 20px; flex-shrink: 0; }
.dash-todo-item .todo-text { flex: 1; }
.dash-todo-item .todo-amount { font-weight: 700; font-size: 16px; }
.dash-todo-item.alert .todo-amount { color: var(--danger); }
.dash-todo-item.warn .todo-amount { color: var(--warning); }

/* ==================== 首页整体填充 ==================== */
.dashboard-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100vh - var(--header-h) - 40px);
  min-height: 560px;
}
.dashboard-page > * { margin-bottom: 0 !important; }
.dashboard-page .dash-overview,
.dashboard-page .dash-charts { flex: 0 0 auto; }
.dashboard-page .dash-quick-actions {
  flex: 1 1 104px;
  min-height: 100px;
  max-height: 150px;
  gap: 14px;
}
.dashboard-page .dash-todo {
  flex: 0 1 80px;
  min-height: 76px;
  max-height: 84px;
  gap: 16px;
}
.dashboard-page .home-base {
  flex: 1 1 128px;
  min-height: 120px;
  max-height: 180px;
  padding: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: transparent;
  border-top: none;
}
.dashboard-page .home-base-title {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 7px;
  padding-left: 2px;
}
.dashboard-page .home-base-items {
  gap: 10px;
}
.dashboard-page .home-base-item {
  padding: 12px 14px;
  gap: 10px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.dashboard-page .home-base-item:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.dashboard-page .home-base-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 23px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.16);
}
.dashboard-page .home-base-label {
  font-size: 14.5px;
  font-weight: 600;
}
.dashboard-page .home-base-desc {
  font-size: 12px;
}
@media (max-width: 1280px) {
  .dashboard-page .home-base-icon {
    width: 36px;
    height: 36px;
    font-size: 19px;
  }
  .dashboard-page .home-base-item {
    padding: 8px 10px;
    gap: 8px;
  }
  .dashboard-page .home-base-label { font-size: 13px; }
}


.dash-quick-btn {
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  padding: 18px 20px;
  min-width: 150px;
  border-radius: 14px;
  text-align: left;
}
.dash-quick-btn .icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  line-height: 1;
  background: rgba(255,255,255,0.78);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06), inset 0 0 0 1px rgba(255,255,255,0.6);
  flex-shrink: 0;
}
.quick-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  text-align: left;
}
.quick-label {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
}
.quick-sub {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.62;
  white-space: nowrap;
}


.dash-todo-item {
  height: auto;
  padding: 8px 18px;
  gap: 12px;
  border-radius: 12px;
}

.dashboard-page .dash-todo-item.alert,
.dashboard-page .dash-todo-item.ok,
.dashboard-page .dash-todo-item.warn {
  background: #fff;
  border: 1px solid var(--border);
}
.dashboard-page .dash-todo-item.alert:hover { border-color: var(--danger); }
.dashboard-page .dash-todo-item.ok:hover { border-color: var(--success); }
.dashboard-page .dash-todo-item.warn:hover { border-color: var(--warning); }
.dash-todo-item .todo-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  background: rgba(255,255,255,0.75);
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  flex-shrink: 0;
}
.dash-todo-item .todo-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.todo-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.dash-todo-item .todo-amount {
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.todo-desc {
  font-size: 10.5px;
  opacity: 0.6;
}
.todo-arrow {
  margin-left: auto;
  font-size: 19px;
  line-height: 1;
  opacity: 0.22;
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .dashboard-page { height: auto; min-height: 0; }
  .dashboard-page .dash-quick-actions,
  .dashboard-page .dash-todo { max-height: none; }
  .dash-quick-btn { min-width: calc(33.333% - 10px); }
}

@media (max-height: 800px) and (min-width: 1101px) {
  .dashboard-page { height: auto; min-height: 0; }
}

@media (max-width: 768px) {
  .dash-todo { grid-template-columns: 1fr; }
  .dash-quick-btn { min-width: calc(50% - 7px); }
}


.bill-flow-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.bill-flow-mini-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
}
.bill-flow-mini-node:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.bill-flow-mini-node .icon { font-size: 24px; }
.bill-flow-mini-node .label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.bill-flow-mini-arrow { color: var(--text-tertiary); font-size: 20px; }


.dash-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.dash-chart-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.dash-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.dash-chart-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}
.dash-chart-hint {
  font-size: 12px;
  color: var(--text-tertiary);
}


.asset-body {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 0;
}
.asset-ring-wrap {
  flex-shrink: 0;
  width: 150px;
  height: 150px;
}
.asset-ring-wrap svg { display: block; }
.asset-ring-center {
  font-size: 10px;
  fill: var(--text-tertiary);
  text-anchor: middle;
}
.asset-ring-total {
  font-size: 13px;
  font-weight: 700;
  fill: var(--text-main);
  text-anchor: middle;
}
.asset-legend {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.asset-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
}
.asset-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.asset-legend-label {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-legend-value {
  font-weight: 600;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.asset-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.asset-total-label {
  font-size: 12px;
  color: var(--text-tertiary);
}
.asset-total-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}


.cash-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cash-chart {
  width: 100%;
  height: auto;
  display: block;
}
.cash-chart .grid-line {
  stroke: var(--border-light);
  stroke-width: 1;
}
.cash-chart .axis-text {
  font-size: 10px;
  fill: var(--text-tertiary);
}
.cash-chart .axis-text-y { text-anchor: end; }
.cash-chart .axis-text-x { text-anchor: middle; }
.cash-chart .line-income {
  fill: none;
  stroke: #ff7a45;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cash-chart .line-expense {
  fill: none;
  stroke: #36cfc9;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.cash-chart .point-income { fill: #fff; stroke: #ff7a45; stroke-width: 2; }
.cash-chart .point-expense { fill: #fff; stroke: #36cfc9; stroke-width: 2; }
.cash-legend {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  flex-wrap: wrap;
}
.cash-legend-item { display: flex; align-items: center; gap: 6px; }
.cash-legend-line {
  width: 16px;
  height: 0;
  border-top: 2px solid;
  border-radius: 2px;
}
.cash-legend-line.income { border-color: #ff7a45; }
.cash-legend-line.expense { border-color: #36cfc9; }
.cash-legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.cash-summary {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap;
}
.cash-summary-item .lbl {
  font-size: 12px;
  color: var(--text-tertiary);
  display: block;
}
.cash-summary-item .val {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cash-summary-item .val.income { color: #ff7a45; }
.cash-summary-item .val.expense { color: #13c2c2; }
.cash-summary-item .val.net { color: var(--text-main); }

.chart-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  color: var(--text-tertiary);
  font-size: 13px;
}


.cash-chart-wrap {
  position: relative;
}
.cash-chart-wrap .cash-hover-zone {
  fill: transparent;
  cursor: crosshair;
}
.cash-chart-wrap .cash-pt {
  cursor: pointer;
  transition: r 0.15s;
}
.cash-chart-wrap .cash-pt.active {
  r: 6;
}
.cash-tooltip {
  display: none;
  position: absolute;
  z-index: 10;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.cash-tooltip .tt-date {
  font-weight: 700;
  margin-bottom: 3px;
  font-size: 11px;
  color: rgba(255,255,255,0.7);
}
.cash-tooltip .tt-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.cash-tooltip .tt-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .dash-charts { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .asset-body { flex-direction: column; align-items: stretch; }
  .asset-ring-wrap { align-self: center; }
}

/* ==================== 打印优化 ==================== */
@media print {
  .sidebar, .topbar, .toolbar, .toast-container, .home-base { display: none !important; }
  .content-area { padding: 0 !important; overflow: visible !important; }
  body { overflow: visible !important; height: auto !important; }
  #app { display: block !important; height: auto !important; }
  .card { box-shadow: none !important; border: 1px solid #999 !important; page-break-inside: avoid; }
}


.sidebar-collapsed {
  width: 56px;
  overflow: visible;
}
.sidebar-collapsed .sidebar-header {
  padding: 0;
  justify-content: center;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .nav-group-title,
.sidebar-collapsed .nav-item > span:last-child {
  display: none;
}
.sidebar-collapsed .sidebar-nav { overflow-x: hidden; }
.sidebar-collapsed .nav-group {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 0;
  gap: 0;
}
.sidebar-collapsed .nav-item .icon {
  width: auto;
  font-size: 18px;
}

/* ==================== 报表图表 ==================== */
.rc-chart-wrap {
  width: 100%;
  padding: 4px 0 0;
}
.rc-chart {
  width: 100%;
  max-width: 980px;
  height: auto;
  display: block;
  margin: 0 auto;
}
.rc-chart .grid-line { stroke: var(--border-light); stroke-width: 1; }
.rc-chart .rc-zero { stroke: var(--border); stroke-width: 1.2; }
.rc-chart .axis-text { font-size: 10px; fill: var(--text-tertiary); }
.rc-chart .axis-text-y { text-anchor: end; }
.rc-chart .axis-text-x { text-anchor: middle; }
.rc-chart .rc-value {
  font-size: 10px;
  fill: var(--text-secondary);
  text-anchor: middle;
  font-variant-numeric: tabular-nums;
}
.rc-chart .rc-bar { transition: opacity .15s; }
.rc-chart .rc-bar:hover { opacity: .82; }

.rc-hbars { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 8px; }
.rc-hbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.rc-hbar-rank {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rc-hbar-row:nth-child(-n+3) .rc-hbar-rank {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}
.rc-hbar-label {
  width: 150px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}
.rc-hbar-track {
  flex: 1;
  height: 10px;
  background: var(--bg-page);
  border-radius: 6px;
  overflow: hidden;
}
.rc-hbar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width .3s ease;
}
.rc-hbar-value {
  width: 110px;
  flex-shrink: 0;
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 640px) {
  .rc-hbar-label { width: 90px; }
  .rc-hbar-value { width: 84px; }
}

/* ==================== 单据校验错误反馈 ==================== */
.bill-items-table tr.row-error td { background: #fff1f0 !important; }
.bill-items-table tr.row-error .bill-inp { border-color: var(--danger) !important; }
.bill-table-wrap.bill-error {
  outline: 2px solid var(--danger);
  outline-offset: -2px;
  animation: bill-shake .35s ease;
}
@keyframes bill-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* ==================== 小屏/平板基础适配 ==================== */
@media (max-width: 900px) {
  .sidebar,
  .sidebar:not(.sidebar-collapsed) {
    width: 56px;
  }
  .sidebar .sidebar-header {
    padding: 0;
    justify-content: center;
    gap: 0;
  }
  .sidebar .sidebar-title,
  .sidebar .nav-group-title,
  .sidebar .nav-item > span:last-child {
    display: none;
  }
  .sidebar .nav-item {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
  }
  .sidebar .nav-item .icon { width: auto; font-size: 18px; }
  .sidebar .nav-group {
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
  }
  .content-area { padding: 12px; }
  .topbar { padding: 0 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .topbar-info .date { display: none; }
  .stat-grid { grid-template-columns: 1fr; }
  .toolbar { gap: 6px; }
  .modal { width: 96vw !important; max-width: 96vw !important; }
}


.report-card-link {
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.report-card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.report-link-hint {
  font-size: 11px;
  color: var(--primary);
  font-weight: 400;
  margin-left: 4px;
  white-space: nowrap;
}


.retail-settle-account {
  width: 160px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 8px;
  font-size: 13px;
  background: #fff;
}

/* ==================== 独立零售收银窗口 ==================== */body.standalone-retail {
  overflow: hidden;
  background: var(--bg-page);
}
body.standalone-retail #app {
  display: block;
  height: 100vh;
}
body.standalone-retail .content-area {
  height: 100vh;
  padding: 0;
  overflow: hidden;
}
body.standalone-retail .retail-wrap {
  height: 100vh;
}
body.standalone-retail .toast-container {
  top: 12px;
  right: 12px;
}

/* ==================== 只打印弹窗（单据/对账单） ==================== */
@media print {
  @page { size: A4; margin: 12mm; }
  .bill-actions, .tabs { display: none !important; }
  body.print-modal #app { display: none !important; }
  body.print-modal .modal-overlay {
    position: static !important;
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
    overflow: visible !important;
    z-index: auto !important;
  }
  body.print-modal .modal {
    max-width: none !important;
    width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  body.print-modal .modal-header,
  body.print-modal .modal-footer,
  body.print-modal .modal-close { display: none !important; }
  body.print-modal .modal-body {
    padding: 0 4mm !important;
    overflow: visible !important;
    max-height: none !important;
    width: 100% !important;
  }
  body.print-modal .bill-header { flex-wrap: wrap; gap: 8px 20px; }
  body.print-modal .bill-summary {
    flex-wrap: wrap !important;
    justify-content: flex-end;
    gap: 8px 22px !important;
    border-top: 1px solid #999;
    padding-top: 8px;
  }
  body.print-modal .bill-summary-item { min-width: 92px; }
  body.print-modal .table-wrap { overflow: visible !important; }
  body.print-modal .data-table {
    width: 100% !important;
    table-layout: fixed;
    font-size: 11px;
  }
  body.print-modal .data-table th,
  body.print-modal .data-table td {
    padding: 4px 3px !important;
    border-color: #999 !important;
    word-break: break-all;
  }
  body.print-modal .bill-no { font-size: 18px !important; }
}
