:root {
  --sidebar-bg: #1e2532;
  --sidebar-width: 220px;
  --primary: #52c41a;
  --primary-dark: #389e0d;
  --header-height: 56px;
  --bg: #f0f2f5;
  --card: #fff;
  --text: #333;
  --border: #e8e8e8;
  --supplier-primary: #4f6ef7;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: #b8c0cc;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  overflow-y: auto;
}
.sidebar.supplier-theme { --primary: var(--supplier-primary); }
.sidebar .brand {
  padding: 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand small {
  display: block;
  font-size: 11px;
  color: #8892a0;
  margin-top: 4px;
  font-weight: 400;
}
.nav-group { padding: 4px 0; }
.nav-group-title {
  padding: 10px 20px;
  font-size: 12px;
  color: #8892a0;
  cursor: pointer;
  user-select: none;
}
.nav-group-title:hover { color: #fff; }
.nav-group.open .nav-group-title { color: #fff; }
.nav-sub { display: none; padding-bottom: 4px; }
.nav-group.open .nav-sub { display: block; }
.nav-sub-item { padding-left: 36px !important; font-size: 12px; }
.nav-top { border-left: 3px solid transparent; }
.nav-icon { margin-right: 8px; opacity: 0.6; font-size: 11px; }
.nav-item {
  display: block;
  padding: 10px 20px;
  color: #b8c0cc;
  text-decoration: none;
  font-size: 13px;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active {
  background: rgba(82, 196, 26, 0.15);
  color: var(--primary);
  border-left-color: var(--primary);
}
.sidebar.supplier-theme .nav-item.active {
  background: rgba(79, 110, 247, 0.15);
  color: var(--supplier-primary);
  border-left-color: var(--supplier-primary);
}

.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
}
.topbar {
  height: var(--header-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .breadcrumb { font-size: 14px; color: #666; }
.topbar .user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.topbar .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #95de64);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
}
.supplier-theme .topbar .avatar {
  background: linear-gradient(135deg, var(--supplier-primary), #818cf8);
}

.content { padding: 20px 24px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.stat-card .label { font-size: 13px; color: #888; }
.stat-card .value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.stat-card .value.green { color: var(--primary); }
.stat-card .value.blue { color: #1890ff; }
.stat-card .value.orange { color: #fa8c16; }
.stat-card .trend { font-size: 12px; color: #52c41a; margin-top: 4px; }

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-header h2 { font-size: 16px; font-weight: 600; }

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.9; }
.btn-primary { background: var(--primary); color: #fff; }
.supplier-theme .btn-primary { background: var(--supplier-primary); }
.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: #666;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}
.filter-bar input, .filter-bar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  min-width: 140px;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}
th { background: #fafafa; color: #666; font-weight: 600; }
tr:hover td { background: #fafafa; }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.tag-green { background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f; }
.tag-orange { background: #fff7e6; color: #fa8c16; border: 1px solid #ffd591; }
.tag-blue { background: #e6f7ff; color: #1890ff; border: 1px solid #91d5ff; }
.tag-tax8 { background: #e8f5e9; color: #2e7d32; }
.tag-tax13 { background: #fff3e0; color: #e65100; }
.link { color: var(--primary); cursor: pointer; text-decoration: none; }
.supplier-theme .link { color: var(--supplier-primary); }

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  font-size: 13px;
  color: #666;
}

.tax-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.tax-box {
  padding: 20px;
  border-radius: 12px;
  border: 2px solid;
}
.tax-box.rate8 { border-color: #81c784; background: #f1f8e9; }
.tax-box.rate13 { border-color: #ffb74d; background: #fff8e1; }
.tax-box h3 { font-size: 14px; margin-bottom: 12px; }
.tax-box .row { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.tax-box .big { font-size: 22px; font-weight: 700; margin-top: 8px; }

.chart-placeholder {
  height: 220px;
  background: linear-gradient(180deg, #f9f9f9, #fff);
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  padding: 20px;
  gap: 12px;
}
.chart-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--primary), #95de64);
  border-radius: 4px 4px 0 0;
  min-height: 20px;
}
.supplier-theme .chart-bar {
  background: linear-gradient(180deg, var(--supplier-primary), #818cf8);
}

.demo-ribbon {
  position: fixed;
  top: 12px;
  right: 12px;
  background: #ff4d4f;
  color: #fff;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  z-index: 999;
}

.welcome-banner {
  background: linear-gradient(135deg, #f6ffed, #e8f5e9);
  border: 1px solid #b7eb8f;
  border-radius: 12px;
  padding: 48px 32px;
  font-size: 28px;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
}
.summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  padding: 12px 16px;
  background: #fafafa;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}
.summary-item .lbl { color: #888; margin-right: 6px; }
.summary-item strong { font-size: 15px; color: #333; }
.balance-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.balance-card {
  border-radius: 12px;
  padding: 24px;
}
.balance-card.green { background: #f6ffed; border: 1px solid #b7eb8f; }
.balance-card.orange { background: #fff7e6; border: 1px solid #ffd591; }
.balance-card .lbl { font-size: 14px; color: #666; margin-bottom: 8px; }
.balance-card .val { font-size: 32px; font-weight: 700; }
.balance-card .val.small { font-size: 20px; }
.row-highlight td { background: #f6ffed !important; }
.page-num {
  display: inline-block;
  min-width: 28px;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.page-num.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.page-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
}
.date-range {
  min-width: 220px !important;
  background: #fff;
}
.empty-data {
  text-align: center;
  padding: 48px;
  color: #999;
}
.bigscreen-embed-wrap {
  margin: -20px -24px;
  min-height: calc(100vh - var(--header-height));
  overflow: hidden;
}
body.bigscreen-mode .bigscreen-embed-wrap,
body.supplier-bigscreen-mode .bigscreen-embed-wrap {
  margin: 0 !important;
  overflow-x: hidden;
}
.bigscreen-embed-wrap .bigscreen {
  min-height: 100%;
  transform-origin: top left;
}
.toggle-switch {
  display: inline-block;
  width: 40px;
  height: 22px;
  background: #ccc;
  border-radius: 11px;
  position: relative;
}
.toggle-switch.on { background: var(--primary); }
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
}
.toggle-switch.on::after { left: 20px; }
