﻿:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-alt: #f2f5f9;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d9e2ef;
  --accent: #165dff;
  --accent-strong: #0f46c9;
  --accent-soft: #eaf2ff;
  --warn: #d4380d;
  --topbar: #0f2554;
  --sidebar-bg: #f3f5f9;
  --shadow: 0 8px 24px rgba(15, 37, 84, 0.08);
  --shadow-soft: 0 4px 14px rgba(15, 37, 84, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.login-view {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #e8f5f1 0%, #f6f8fb 100%);
}

.login-view.active {
  display: grid;
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: white;
  box-shadow: var(--shadow);
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card p,
.login-card small {
  color: var(--muted);
}

.app-shell.locked {
  display: none;
}

button,
input,
select {
  font: inherit;
}

button,
.file-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: white;
  min-height: 38px;
  border-radius: 6px;
  padding: 8px 13px;
  cursor: pointer;
  transition: 0.16s ease;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

button:hover,
.file-button:hover {
  background: var(--accent-strong);
}

button.danger {
  border-color: var(--warn);
  background: transparent;
  color: var(--warn);
}

button.danger:hover {
  background: #fff0ed;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--text);
  border-radius: 6px;
  min-height: 38px;
  padding: 7px 10px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus {
  outline: 0;
  border-color: rgba(40, 120, 109, 0.48);
  box-shadow: 0 0 0 3px rgba(40, 120, 109, 0.12);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(251, 252, 251, 0.92);
  backdrop-filter: blur(10px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #4f9b8e);
  color: white;
  font-weight: 700;
}

.fzg-logo {
  position: relative;
  overflow: hidden;
  border: 2px solid #d10b13;
  border-radius: 50%;
  background: #fff;
  color: #d10b13;
  font-size: 18px;
  font-weight: 900;
  box-shadow: inset 0 -10px 0 rgba(209, 11, 19, 0.08);
}

.fzg-logo::before,
.fzg-logo::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  border: 3px solid #d10b13;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}

.fzg-logo::before {
  top: 7px;
  height: 13px;
}

.fzg-logo::after {
  top: 15px;
  height: 9px;
  left: 13px;
  right: 13px;
}

.brand h1,
.toolbar h2,
.panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
}

.brand p,
.toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.sync-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.sync-status span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--surface);
}

.sync-status strong {
  margin-left: 4px;
  color: var(--accent-strong);
}

.nav-tabs,
.sidebar-card {
  display: grid;
  gap: 8px;
}

.report-hidden,
.sync-hidden {
  display: none !important;
}

.nav-tab {
  border-color: transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.nav-tab.active,
.nav-tab:hover {
  border-color: var(--line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sidebar-card {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.sync-panel {
  display: grid;
  gap: 18px;
}

.sync-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.sync-guide article,
.sync-files div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
}

.sync-guide article {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 16px;
}

.sync-guide article > span {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 800;
}

.sync-guide h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.sync-guide p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.sync-guide code,
.sync-files span {
  font-family: "Consolas", "Monaco", monospace;
}

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

.sync-files div {
  display: grid;
  gap: 6px;
  padding: 14px;
}

.sync-files strong {
  color: var(--text);
}

.sync-files span {
  color: var(--accent-strong);
  overflow-wrap: anywhere;
}

#csvInput {
  display: none;
}

.content {
  min-width: 0;
  padding: 24px;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
  border: 1px solid rgba(220, 228, 223, 0.82);
  border-radius: 10px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
}

.filters {
  width: min(980px, 100%);
}

.date-shortcuts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.date-range {
  min-height: 32px;
  border-color: var(--line);
  background: white;
  color: var(--text);
  padding: 5px 11px;
}

.date-range.active,
.date-range:hover {
  border-color: var(--accent);
  background: #eef7f4;
  color: var(--accent-strong);
}

.shortcut-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--muted);
  font-size: 13px;
}

.shortcut-filter select {
  width: auto;
  min-width: 126px;
  min-height: 32px;
  padding: 5px 28px 5px 9px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.metrics article,
.panel,
.form-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 7px;
}

.metrics strong {
  font-size: 28px;
  line-height: 1.1;
}

.screen-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 18px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background:
    radial-gradient(circle at 94% 18%, rgba(40, 120, 109, 0.13), transparent 30%),
    linear-gradient(135deg, #ffffff 0%, #edf6f3 100%);
  box-shadow: var(--shadow);
}

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

.hero-period-metrics article {
  display: grid;
  gap: 7px;
  min-height: 136px;
  border: 1px solid rgba(40, 120, 109, 0.16);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.86);
}

.screen-total-card {
  display: grid;
  gap: 8px;
  align-content: center;
  border-radius: 8px;
  padding: 20px;
  background: #173f3a;
  color: white;
}

.screen-total-card span,
.screen-total-card small {
  color: rgba(255, 255, 255, 0.72);
}

.screen-total-card b,
.screen-metrics b,
.hero-period-metrics b {
  color: inherit;
  font-weight: 700;
}

.screen-total-card strong {
  font-size: 34px;
  line-height: 1.1;
}

.screen-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.screen-metrics article {
  display: grid;
  gap: 7px;
  min-height: 124px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.metric-card.today-card {
  border-color: #badfd2;
  background: linear-gradient(135deg, #f4fbf8 0%, #e1f3eb 100%);
}

.metric-card.yesterday-card {
  border-color: #bfd5ea;
  background: linear-gradient(135deg, #f6faff 0%, #e4f0fb 100%);
}

.metric-card.total-card {
  background: linear-gradient(135deg, #173f3a 0%, #24665d 100%);
}

.metric-card.last7-card {
  border-color: #d7dfc0;
  background: linear-gradient(135deg, #fbfcf5 0%, #eef4d9 100%);
}

.metric-card.previous7-card {
  border-color: #d8d2ea;
  background: linear-gradient(135deg, #faf8ff 0%, #ece7f7 100%);
}

.metric-card.current-month-card {
  border-color: #c6dfd9;
  background: linear-gradient(135deg, #f5fbfa 0%, #e2f1ee 100%);
}

.metric-card.previous-month-card {
  border-color: #d8d7cc;
  background: linear-gradient(135deg, #fcfbf6 0%, #eeeeE3 100%);
}

.metric-card.refund-card {
  border-color: #efc7c1;
  background: linear-gradient(135deg, #fff8f6 0%, #f9e5e1 100%);
}

.screen-metrics article:hover,
.panel:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 44px rgba(22, 48, 42, 0.11);
}

.screen-metrics span,
.screen-metrics small,
.hero-period-metrics span,
.hero-period-metrics small {
  color: var(--muted);
  font-size: 13px;
}

.screen-metrics strong,
.hero-period-metrics strong {
  font-size: 24px;
  line-height: 1.15;
}

.comparison-grid,
.ranking-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.ranking-stack {
  grid-template-columns: 1fr;
}

.comparison-panel {
  min-height: 190px;
}

.trend-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 4px 12px;
  background: #eef7f4;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.comparison-bars {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.comparison-bars > div {
  display: grid;
  gap: 8px;
}

.comparison-bars span {
  color: var(--muted);
  font-size: 13px;
}

.compare-track {
  height: 18px;
  border-radius: 999px;
  background: #e1ece8;
  overflow: hidden;
}

.compare-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.compare-track.muted i {
  background: #9fb2ab;
}

.ranking-table {
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0 2px;
}

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

.ranking-stack .panel {
  min-width: 0;
}

.ranking-table th,
.ranking-table td {
  padding-left: 14px;
  padding-right: 14px;
}

.ranking-grid .panel:first-child .table-wrap {
  padding-left: 8px;
  padding-right: 8px;
}

.rank-index {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef7f4;
  color: var(--accent-strong);
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.panel {
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

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

.panel-head input {
  max-width: 280px;
}

.orders-panel-head {
  align-items: flex-start;
  flex-wrap: wrap;
}

.orders-panel-head h3 {
  margin: 0 0 8px;
}

.orders-attention {
  display: grid;
  gap: 5px;
  max-width: 720px;
  border-left: 3px solid var(--accent);
  padding: 8px 10px;
  border-radius: 6px;
  background: #f4faf7;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
  white-space: normal;
}

.orders-attention strong {
  color: var(--accent-strong);
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.sub-tab {
  min-height: 34px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--muted);
  box-shadow: none;
}

.sub-tab.active,
.sub-tab:hover {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.user-section {
  display: none;
}

.user-section.active {
  display: block;
}

.users-table-wrap {
  max-width: 100%;
}

.users-table {
  min-width: 1080px;
  table-layout: fixed;
}

.users-table th,
.users-table td {
  padding: 10px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 130px;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  width: 110px;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  width: 90px;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  width: 110px;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  width: 220px;
}

.users-table th:nth-child(n+6):nth-child(-n+9),
.users-table td:nth-child(n+6):nth-child(-n+9) {
  width: 86px;
}

.users-table th:nth-child(10),
.users-table td:nth-child(10) {
  width: 70px;
}

.store-scope-cell {
  max-width: 220px;
}

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

.section-head h4 {
  margin: 0;
}

.role-layout {
  display: grid;
  gap: 16px;
  padding: 0 16px 16px;
}

.role-editor-card,
.roles-list-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.role-form {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.role-name-row {
  max-width: 420px;
}

.role-permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}

.permission-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.permission-groups legend {
  padding: 0 6px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
}

.permission-groups label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid #e6ece8;
  border-radius: 6px;
  padding: 7px 9px;
  background: white;
  color: var(--text);
}

.permission-groups input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.role-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 2px;
}

.roles-list-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.roles-list-head h4 {
  margin: 0;
}

.table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
  width: min(760px, 100%);
}

.table-tools label {
  min-width: 94px;
}

.table-tools button {
  min-height: 38px;
}

.table-tools button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
  table-layout: fixed;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #d9e3dd;
  white-space: nowrap;
  text-align: center;
}

th {
  position: relative;
  text-align: center;
  background: #f2f7f4;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  min-width: 122px;
  user-select: none;
  box-shadow: inset 0 -1px 0 #cbd9d2;
}

tbody tr {
  background: #ffffff;
  transition: background 0.14s ease;
}

tbody tr:nth-child(even) {
  background: #fbfdfb;
}

tbody tr:hover {
  background: #eef7f2;
}

tbody td {
  box-shadow: inset 0 -1px 0 rgba(19, 45, 35, 0.035);
}

th[data-sort-key] {
  cursor: pointer;
  padding-right: 26px;
}

th[data-sort-key]::after {
  content: "\2195";
  position: absolute;
  right: 10px;
  color: #9aaaa4;
  font-size: 12px;
}

th[data-sort-key].sorted::after {
  content: "\2191";
  color: var(--accent-strong);
}

th[data-sort-key].sorted[data-sort-dir="desc"]::after {
  content: "\2193";
}

td.numeric,
th.numeric {
  text-align: center;
}

td[rowspan] {
  vertical-align: middle;
  background: #f7fbf8;
  border-right: 1px solid #e2ebe5;
}

.product-item-cell {
  min-width: 280px;
  white-space: normal;
  line-height: 1.45;
  color: var(--text);
}

.store-craft-cell {
  min-width: 320px;
  max-width: 520px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-craft-cell .inline-input {
  min-width: 280px;
  white-space: nowrap;
}

.order-image-cell {
  width: 76px;
  min-width: 76px;
  text-align: center;
}

.order-image-cell img {
  display: block;
  width: 52px;
  height: 52px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf8;
}

.order-image-cell a {
  display: inline-block;
}

.image-preview-layer {
  position: fixed;
  z-index: 10000;
  display: none;
  width: 260px;
  height: 260px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 18px 45px rgba(24, 39, 34, 0.22);
  pointer-events: none;
}

.image-preview-layer.active {
  display: block;
}

.image-preview-layer img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: #f8faf8;
}

td.actions {
  display: flex;
  gap: 8px;
}

td.actions button {
  min-height: 32px;
  padding: 5px 9px;
}

.editable-table {
  min-width: 5200px;
  table-layout: auto;
}

.editable-table th {
  min-width: 132px;
}

#ordersTableGrid th,
#ordersTableGrid td {
  overflow: hidden;
  text-overflow: ellipsis;
}

#ordersTableGrid th:nth-child(1),
#ordersTableGrid td:nth-child(1) {
  min-width: 190px;
  width: 190px;
}

#ordersTableGrid th:nth-child(2),
#ordersTableGrid td:nth-child(2) {
  min-width: 96px;
  width: 96px;
}

#ordersTableGrid th:nth-child(3),
#ordersTableGrid td:nth-child(3) {
  min-width: 210px;
  width: 210px;
}

#ordersTableGrid th:nth-child(4),
#ordersTableGrid td:nth-child(4) {
  min-width: 88px;
  width: 88px;
}

#ordersTableGrid th:nth-child(5),
#ordersTableGrid td:nth-child(5) {
  min-width: 230px;
  width: 230px;
}

#ordersTableGrid th:nth-child(6),
#ordersTableGrid td:nth-child(6),
#ordersTableGrid th:nth-child(7),
#ordersTableGrid td:nth-child(7) {
  min-width: 120px;
  width: 120px;
}

#ordersTableGrid th:nth-child(8),
#ordersTableGrid td:nth-child(8) {
  min-width: 160px;
  width: 160px;
}

#ordersTableGrid th:nth-child(12),
#ordersTableGrid td:nth-child(12),
#ordersTableGrid th:nth-child(13),
#ordersTableGrid td:nth-child(13) {
  min-width: 260px;
  width: 260px;
}

#ordersTableGrid th:nth-child(14),
#ordersTableGrid td:nth-child(14) {
  min-width: 150px;
  width: 150px;
}

.editable-table th.order-time-col,
.editable-table td.order-time-cell {
  min-width: 188px;
  width: 188px;
  white-space: nowrap;
}

.editable-table th:last-child,
.editable-table td:last-child {
  width: 88px;
  min-width: 88px;
}

.inline-new-row {
  background: #f4fbf8;
}

.inline-input {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  padding: 6px 4px;
  color: var(--text);
}

.inline-input:focus {
  outline: 2px solid rgba(40, 120, 109, 0.22);
  background: white;
}

.readonly-cell {
  color: var(--accent-strong);
  font-weight: 700;
  background: #f7fbf9;
}

.inline-input.numeric {
  text-align: right;
}

.account-health {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: linear-gradient(135deg, #ffffff, #f5faf7);
  box-shadow: var(--shadow-soft);
}

.account-health h3,
.account-health p {
  margin: 0;
}

.account-health p {
  color: var(--muted);
  margin-top: 6px;
}

.account-health-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  background: #f6f8f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-pill.online {
  border-color: rgba(40, 120, 109, 0.24);
  background: #e8f5f1;
  color: var(--accent-strong);
}

.status-pill.watch {
  border-color: rgba(178, 65, 50, 0.24);
  background: #fff3ef;
  color: var(--warn);
}

.management-table th,
.management-table td {
  min-width: 136px;
}

.management-table td:first-child,
.management-table th:first-child {
  min-width: 180px;
}

.aftersales-table th,
.aftersales-table td {
  min-width: 132px;
}

#shopsView > .shop-status-metrics,
#shopsView > .panel:not(.shop-console-panel) {
  display: none;
}

.shop-console-panel {
  border-radius: 4px;
  border: 1px solid #8a8f94;
  background: #f7f7f7;
  box-shadow: none;
}

.shop-console-toolbar {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  border-bottom: 1px solid #9da3a8;
  background: #f1f1f1;
  color: #222;
  font-size: 13px;
  overflow-x: auto;
}

.shop-console-toolbar button {
  min-height: 28px;
  border-radius: 0;
  padding: 4px 18px;
  border-color: #7668d7;
  background: #7366d9;
  box-shadow: none;
  white-space: nowrap;
}

.shop-console-toolbar label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 5px;
  color: #222;
  font-size: 13px;
  white-space: nowrap;
}

.shop-console-toolbar .inline-check {
  min-width: auto;
}

.shop-console-toolbar input,
.shop-console-toolbar select {
  width: auto;
  min-width: 82px;
  min-height: 28px;
  border-radius: 0;
  padding: 3px 6px;
  box-shadow: none;
}

.shop-console-toolbar input[type="checkbox"] {
  width: 14px;
  min-width: 14px;
  min-height: 14px;
  padding: 0;
}

.shop-console-toolbar #shopSearch {
  width: 120px;
  max-width: 180px;
}

.shop-console-toolbar #shopViewMode {
  margin-left: auto;
  min-width: 96px;
}

.shop-console-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid #c4c8cb;
  background: #fff;
  color: #445;
  font-size: 12px;
}

.shop-console-note span {
  color: #008a25;
  font-weight: 700;
}

.shop-table-wrap {
  max-height: calc(100vh - 210px);
}

.shop-console-table {
  min-width: 1320px;
  table-layout: fixed;
  border-collapse: collapse;
  background: white;
  font-size: 12px;
}

.shop-console-table th,
.shop-console-table td {
  min-width: 72px;
  padding: 4px 5px;
  border: 1px solid #b9b9b9;
  line-height: 1.25;
  white-space: nowrap;
  box-shadow: none;
}

.shop-console-table th {
  height: 24px;
  background: #edf3f7;
  color: #111;
  font-size: 12px;
  text-align: center;
}

.shop-console-table th:first-child,
.shop-console-table td:first-child {
  width: 52px;
  min-width: 52px;
  text-align: center;
}

.shop-console-table th:nth-child(2),
.shop-console-table td:nth-child(2) {
  width: 160px;
  min-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-console-table tbody tr:first-child {
  background: #0c84d8;
  color: white;
}

.shop-console-table tbody tr:first-child .shop-status,
.shop-console-table tbody tr:first-child .shop-actions button,
.shop-console-table tbody tr:first-child .shop-score-tag {
  color: white;
}

.shop-console-table tbody tr:hover {
  background: #e7f4ff;
}

.shop-console-table tfoot td {
  font-weight: 700;
  background: #fbfbfb;
}

.shop-status {
    color: #000000;
    font-weight: 400;
  }
  
.shop-status.offline {
    color: #000000;
  }

.shop-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.shop-actions button {
  min-height: auto;
  border: 0;
  padding: 0;
  background: transparent;
  color: #001eff;
  box-shadow: none;
  font-size: 12px;
}

.shop-score {
  margin-right: 5px;
}

.shop-score-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  border-radius: 2px;
  background: #dbeafe;
  color: #1677ff;
  font-size: 11px;
  font-weight: 700;
}

.shop-score-tag.high {
  background: #d9fbe7;
  color: #0aae55;
}

.shop-score-tag.low {
  background: #ffe8df;
  color: #d24b2a;
}

.modal-dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: white;
  box-shadow: var(--shadow);
}

.modal-dialog::backdrop {
  background: rgba(25, 38, 34, 0.28);
}

.dialog-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dialog-head h3,
.dialog-hint {
  margin: 0;
}

.dialog-hint {
  color: var(--muted);
  line-height: 1.55;
  font-size: 13px;
}

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

.resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  z-index: 1;
  width: 7px;
  height: 100%;
  cursor: col-resize;
}

.resize-handle::after {
  content: "";
  position: absolute;
  top: 25%;
  right: 3px;
  width: 1px;
  height: 50%;
  background: var(--line);
}

th[data-product-sort],
th[data-factory-sort] {
  cursor: pointer;
  padding-right: 26px;
}

th[data-product-sort]::after,
th[data-factory-sort]::after {
  content: "\2195";
  position: absolute;
  right: 10px;
  color: #9aaaa4;
  font-size: 12px;
}

th[data-product-sort].sorted::after,
th[data-factory-sort].sorted::after {
  content: "\2191";
  color: var(--accent-strong);
}

th[data-product-sort].sorted[data-sort-dir="desc"]::after,
th[data-factory-sort].sorted[data-sort-dir="desc"]::after {
  content: "\2193";
}

.form-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  padding: 16px;
}

.user-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.user-form label:has(input[type="checkbox"]) {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-form input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.user-store-picker {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.user-permission-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(260px, 1fr);
  gap: 12px;
}

.user-permission-grid fieldset {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.user-permission-grid legend {
  padding: 0 6px;
  font-weight: 700;
  color: var(--text);
}

.user-permission-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  margin: 0;
}

.user-store-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.user-store-picker-head div {
  display: flex;
  gap: 8px;
}

.user-store-picker-head button {
  min-height: 28px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
}

.user-store-picker #userStoreSearch {
  min-height: 34px;
}

.user-store-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.user-store-option {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.user-store-option:hover {
  border-color: rgba(22, 93, 255, 0.32);
  background: #eef5ff;
}

.user-store-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-store-empty {
  grid-column: 1 / -1;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.computed-panel {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8faf8;
}

.computed-panel article {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: white;
}

.computed-panel span {
  color: var(--muted);
  font-size: 13px;
}

.computed-panel strong {
  font-size: 20px;
  line-height: 1.1;
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 8px;
}

.form-actions button {
  width: 100%;
}

.smart-login-actions {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 0.7fr) minmax(140px, 0.6fr);
  gap: 10px;
  align-items: center;
  margin: 4px 0 10px;
}

.smart-login-actions button {
  min-height: 38px;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px;
}

.daily-cards {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.daily-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  overflow: hidden;
}

.daily-card summary {
  display: grid;
  grid-template-columns: 140px 90px repeat(4, minmax(110px, 1fr));
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}

.daily-card summary::-webkit-details-marker {
  display: none;
}

.daily-card summary::after {
  content: "灞曞紑鍘傚鍒嗗竷";
  justify-self: end;
  color: var(--accent-strong);
  font-size: 13px;
}

.daily-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: #f7faf8;
}

.daily-card[open] summary::after {
  content: "鏀惰捣";
}

.daily-date {
  font-weight: 700;
  font-size: 16px;
}

.daily-platform {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 54px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  background: white;
  color: var(--accent-strong);
  font-weight: 600;
}

.daily-card-body {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.daily-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
}

.daily-kpis article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 11px;
}

.daily-kpis span,
.daily-factories {
  color: var(--muted);
  font-size: 13px;
}

.daily-kpis strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.daily-section-title {
  margin: 4px 0 0;
  font-size: 15px;
}

.share-chart {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.share-row {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfb;
}

.share-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.share-head strong {
  font-size: 16px;
}

.share-head span {
  color: var(--muted);
  font-size: 13px;
}

.share-bar {
  display: grid;
  grid-template-columns: 90px minmax(120px, 1fr) 70px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.share-bar span {
  color: var(--muted);
}

.share-track {
  height: 12px;
  border-radius: 999px;
  background: #e6ece8;
  overflow: hidden;
}

.share-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #62a392);
}

.share-bar b {
  text-align: right;
  font-weight: 600;
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .sidebar-card {
    margin-top: 0;
    grid-template-columns: repeat(4, 1fr);
  }

  .toolbar,
  .dashboard-grid,
  .screen-hero,
  .comparison-grid,
  .ranking-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .filters,
  .metrics,
  .screen-metrics,
  .hero-period-metrics,
  .sync-guide,
  .sync-files,
  .form-panel,
  .computed-panel,
  .daily-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .role-permission-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content,
  .sidebar {
    padding: 16px;
  }

  .nav-tabs,
  .sidebar-card,
  .filters,
  .metrics,
  .screen-metrics,
  .hero-period-metrics,
  .sync-guide,
  .sync-files,
  .form-panel,
  .computed-panel,
  .daily-kpis,
  .daily-card summary {
    grid-template-columns: 1fr;
  }

  .metrics strong {
    font-size: 23px;
  }

  .permission-groups {
    grid-template-columns: 1fr;
  }

  .role-actions {
    justify-content: stretch;
  }

  .role-actions button {
    flex: 1;
  }

  .screen-total-card strong {
    font-size: 28px;
  }

  .share-head,
  .share-bar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .share-bar b {
    text-align: left;
  }
}

/* ERP standard blue-white-gray refresh */
.app-shell {
  grid-template-columns: 248px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid #d8e0ec;
  box-shadow: inset -1px 0 0 rgba(15, 37, 84, 0.03);
}

.brand {
  padding: 10px 8px 14px;
  border-bottom: 1px solid #d8e0ec;
}

.brand h1 {
  color: #0f2554;
  font-weight: 800;
}

.brand p {
  color: #718096;
}

.nav-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #344054;
  box-shadow: none;
  justify-content: flex-start;
  min-height: 38px;
}

.nav-tab.active,
.nav-tab:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.content {
  padding: 0 22px 24px;
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  margin: 0 -22px 20px;
  padding: 14px 22px;
  border: 0;
  border-radius: 0;
  background: var(--topbar);
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 37, 84, 0.16);
}

.toolbar h2 {
  color: #fff;
  font-size: 20px;
}

.toolbar p,
.toolbar label,
.toolbar .shortcut-filter {
  color: rgba(255, 255, 255, 0.72);
}

.toolbar select,
.toolbar input,
.toolbar .date-range {
  border-color: rgba(255, 255, 255, 0.18);
  background: #fff;
  color: var(--text);
}

.toolbar .date-range.active,
.toolbar .date-range:hover {
  border-color: #8ab2ff;
  background: #eaf2ff;
  color: var(--accent);
}

button,
.file-button {
  border-color: var(--accent);
  background: var(--accent);
  border-radius: 6px;
  box-shadow: none;
}

button:hover,
.file-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

button.danger {
  border-color: #ffccc7;
  background: #fff;
  color: var(--warn);
}

input,
select {
  border-color: #d9e2ef;
  border-radius: 6px;
}

input:focus,
select:focus {
  border-color: rgba(22, 93, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.12);
}

.metrics article,
.panel,
.form-panel,
.screen-hero,
.comparison-panel,
.computed-panel article,
.roles-list-card,
.role-editor-card {
  border-color: #d9e2ef;
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.metrics article {
  border-top: 3px solid var(--accent);
}

.metrics strong,
.screen-metrics strong,
.hero-period-metrics strong,
.computed-panel strong {
  color: var(--accent);
}

.panel-head,
.roles-list-head {
  background: #f7f9fc;
  border-bottom-color: #d9e2ef;
}

table {
  background: #fff;
}

th {
  background: #eef3fa;
  color: #4b5563;
  border-bottom-color: #cbd7e8;
  box-shadow: inset 0 -1px 0 #cbd7e8;
}

td {
  border-bottom-color: #e5ebf3;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

tbody tr:hover {
  background: #eef5ff;
}

.sub-tab.active,
.sub-tab:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.modal-dialog .dialog-card,
dialog {
  border: 1px solid #b8d4ff;
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(15, 37, 84, 0.18);
}

.dialog-head {
  border-bottom: 1px solid #d9e8ff;
  background: #f3f8ff;
}

.shop-console-table th {
  background: #eaf2ff;
  color: #1f2937;
}

.shop-console-table tbody tr:first-child {
  background: #165dff;
}

/* FineBI/FanRuan trial shell */
html.light {
  --primary: #165DFF;
  --sidebar-bg: #ffffff;
  --header-bg: #165DFF;
  --page-bg: #F5F7FA;
  --card-bg: #FFFFFF;
  --text-main: #1D2129;
  --text-second: #6B7785;
  --border: #E5E6EB;
  --chart-up: #00B42A;
  --chart-down: #F53F3F;
  --bg: var(--page-bg);
  --surface: var(--card-bg);
  --surface-alt: #F7F8FA;
  --text: var(--text-main);
  --muted: var(--text-second);
  --line: var(--border);
  --accent: var(--primary);
  --accent-strong: #0F46C9;
  --accent-soft: rgba(22, 93, 255, 0.1);
  --topbar: var(--header-bg);
  --shadow: 0 6px 18px rgba(29, 33, 41, 0.08);
  --shadow-soft: 0 2px 8px rgba(29, 33, 41, 0.06);
}

html.dark {
  --primary: #2979FF;
  --sidebar-bg: #1F2937;
  --header-bg: #111827;
  --page-bg: #111827;
  --card-bg: #1F2937;
  --text-main: #F2F2F2;
  --text-second: #9CA3AF;
  --border: #374151;
  --chart-up: #22C55E;
  --chart-down: #F87171;
  --bg: var(--page-bg);
  --surface: var(--card-bg);
  --surface-alt: #243244;
  --text: var(--text-main);
  --muted: var(--text-second);
  --line: var(--border);
  --accent: var(--primary);
  --accent-strong: #60A5FA;
  --accent-soft: rgba(41, 121, 255, 0.16);
  --topbar: var(--header-bg);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.22);
}

html.star {
  --primary: #00C6FF;
  --sidebar-bg: #0F172A;
  --header-bg: #0F172A;
  --page-bg: #0B1120;
  --card-bg: rgba(30, 41, 59, 0.72);
  --text-main: #E5F7FF;
  --text-second: #93A4B8;
  --border: rgba(148, 163, 184, 0.28);
  --chart-up: #22C55E;
  --chart-down: #FB7185;
  --bg: var(--page-bg);
  --surface: var(--card-bg);
  --surface-alt: rgba(15, 23, 42, 0.84);
  --text: var(--text-main);
  --muted: var(--text-second);
  --line: var(--border);
  --accent: var(--primary);
  --accent-strong: #67E8F9;
  --accent-soft: rgba(0, 198, 255, 0.14);
  --topbar: var(--header-bg);
  --shadow: 0 12px 34px rgba(0, 198, 255, 0.08);
  --shadow-soft: 0 6px 18px rgba(0, 198, 255, 0.08);
}

html.tech {
  --primary: #0088FF;
  --sidebar-bg: #15294B;
  --header-bg: #15294B;
  --page-bg: #0E1A33;
  --card-bg: #192C4E;
  --text-main: #EAF3FF;
  --text-second: #9DB1D1;
  --border: #29466F;
  --chart-up: #00D68F;
  --chart-down: #FF5C7A;
  --bg: var(--page-bg);
  --surface: var(--card-bg);
  --surface-alt: #1C355F;
  --text: var(--text-main);
  --muted: var(--text-second);
  --line: var(--border);
  --accent: var(--primary);
  --accent-strong: #47B2FF;
  --accent-soft: rgba(0, 136, 255, 0.16);
  --topbar: var(--header-bg);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
  --shadow-soft: 0 5px 16px rgba(0, 0, 0, 0.18);
}

.app-shell.refined-ui {
  display: block;
  min-height: 100vh;
  background: var(--page-bg);
}

.app-shell.refined-ui .toolbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 80;
  height: 60px;
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(420px, auto);
  align-items: center;
  gap: 18px;
  margin: 0;
  padding: 0 20px;
  border: 0;
  border-radius: 0;
  background: var(--header-bg);
  color: #fff;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.18);
}

.toolbar-left,
.toolbar-title,
.toolbar-brand-mini {
  display: flex;
  align-items: center;
  min-width: 0;
}

.toolbar-left {
  gap: 12px;
}

.toolbar-title {
  display: block;
}

.toolbar-title h2 {
  color: #fff;
  font-size: 17px;
  line-height: 1.2;
}

.toolbar-title p {
  max-width: 520px;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toolbar-brand-mini {
  gap: 8px;
  color: #fff;
  white-space: nowrap;
}

.brand-dot,
.user-avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 800;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.icon-button:hover {
  border-color: rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.2);
}

.notify-button {
  position: relative;
  color: #ff4d4f;
  font-size: 12px;
}

.app-shell.refined-ui .sidebar {
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  z-index: 70;
  width: 220px;
  padding: 14px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--sidebar-bg);
  box-shadow: none;
  transition: width 0.3s ease, transform 0.3s ease, opacity 0.3s ease;
}

.app-shell.refined-ui .content {
  min-height: 100vh;
  margin-left: 220px;
  padding: 80px 20px 24px;
  background: var(--page-bg);
  transition: margin-left 0.3s ease;
}

.app-shell.sidebar-collapsed .sidebar {
  width: 64px;
}

.app-shell.sidebar-collapsed .sidebar:hover {
  width: 220px;
  box-shadow: 12px 0 28px rgba(15, 23, 42, 0.16);
}

.app-shell.sidebar-collapsed .content {
  margin-left: 64px;
}

.app-shell.sidebar-hidden .sidebar {
  width: 0;
  padding-right: 0;
  padding-left: 0;
  opacity: 0;
  transform: translateX(-12px);
  pointer-events: none;
}

.app-shell.sidebar-hidden .content {
  margin-left: 0;
}

.app-shell.refined-ui .brand {
  min-height: 56px;
  padding: 6px 6px 14px;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .brand h1,
.app-shell.sidebar-collapsed .brand p,
.app-shell.sidebar-collapsed .sidebar-card,
.app-shell.sidebar-collapsed .nav-tab {
  white-space: nowrap;
}

.app-shell.sidebar-collapsed .brand > div:last-child,
.app-shell.sidebar-collapsed .sidebar-card,
.app-shell.sidebar-collapsed .nav-tab {
  opacity: 0;
}

.app-shell.sidebar-collapsed .sidebar:hover .brand > div:last-child,
.app-shell.sidebar-collapsed .sidebar:hover .sidebar-card,
.app-shell.sidebar-collapsed .sidebar:hover .nav-tab {
  opacity: 1;
}

.app-shell.refined-ui .nav-tabs {
  gap: 4px;
  margin-top: 12px;
}

.app-shell.refined-ui .nav-tab {
  position: relative;
  min-height: 38px;
  padding: 8px 12px 8px 18px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-second);
  box-shadow: none;
  text-align: left;
}

.app-shell.refined-ui .nav-tab::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: transparent;
}

.app-shell.refined-ui .nav-tab.active {
  background: var(--accent-soft);
  color: var(--primary);
  font-weight: 700;
}

.app-shell.refined-ui .nav-tab.active::before {
  background: var(--primary);
}

.app-shell.refined-ui .nav-tab:hover {
  background: var(--accent-soft);
  color: var(--primary);
}

.app-shell.refined-ui .metrics article,
.app-shell.refined-ui .panel,
.app-shell.refined-ui .form-panel,
.app-shell.refined-ui .screen-hero,
.app-shell.refined-ui .comparison-panel,
.app-shell.refined-ui .computed-panel article {
  border-color: var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
}

.app-shell.refined-ui .metrics strong,
.app-shell.refined-ui .screen-metrics strong,
.app-shell.refined-ui .hero-period-metrics strong {
  color: var(--primary);
}

.app-shell.refined-ui th {
  background: color-mix(in srgb, var(--card-bg) 82%, var(--primary) 10%);
  color: var(--text-second);
  border-bottom-color: var(--border);
}

.app-shell.refined-ui td {
  border-bottom-color: var(--border);
}

.app-shell.refined-ui tbody tr {
  background: var(--card-bg);
}

.app-shell.refined-ui tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--card-bg) 92%, var(--page-bg) 8%);
}

.app-shell.refined-ui tbody tr:hover {
  background: var(--accent-soft);
}

.app-shell.refined-ui input,
.app-shell.refined-ui select {
  border-color: var(--border);
  background: var(--card-bg);
  color: var(--text-main);
}

.app-shell.refined-ui .toolbar input,
.app-shell.refined-ui .toolbar select,
.app-shell.refined-ui .toolbar .date-range {
  min-height: 32px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: #1D2129;
}

.app-shell.refined-ui .filters {
  width: auto;
}

.app-shell.refined-ui .date-shortcuts {
  justify-content: flex-end;
  gap: 7px;
}

.app-shell.refined-ui .shortcut-filter {
  color: rgba(255, 255, 255, 0.76);
}

.app-shell.refined-ui .sidebar-card {
  border-color: var(--border);
  background: color-mix(in srgb, var(--sidebar-bg) 90%, var(--primary) 6%);
}

html.dark .fzg-logo,
html.star .fzg-logo,
html.tech .fzg-logo {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}

@media (max-width: 1180px) {
  .app-shell.refined-ui .toolbar {
    grid-template-columns: auto minmax(160px, 1fr);
    height: auto;
    min-height: 60px;
    padding: 10px 14px;
  }

  .app-shell.refined-ui .filters {
    grid-column: 1 / -1;
    width: 100%;
  }

  .app-shell.refined-ui .content {
    padding-top: 118px;
  }

  .app-shell.refined-ui .sidebar {
    top: 104px;
  }
}

/* Store management final layout: match the rest of the ERP dashboard instead of
   the cramped reference-table mockup. */
#shopsView.view.active {
  display: grid;
  gap: 18px;
}

#shopsView.view:not(.active) {
  display: none;
}

#shopsView > .shop-status-metrics {
  display: grid;
}

.shop-console-panel {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
}

.shop-console-toolbar {
  display: grid;
  grid-template-columns: 112px 88px 96px minmax(220px, 1.3fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) 96px minmax(120px, 0.7fr);
  align-items: end;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 3%, var(--card-bg)), var(--card-bg));
  color: var(--text-main);
  font-size: 13px;
  overflow-x: visible;
}

.shop-console-toolbar #addShopButton,
.shop-console-toolbar #refreshShopsButton,
.shop-console-toolbar #shopGroupManage {
  width: 100%;
  padding-inline: 10px;
}

.shop-console-toolbar button {
  min-height: 32px;
  border-radius: 6px;
  padding: 6px 12px;
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: none;
  white-space: nowrap;
}

.shop-console-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--text-second);
  font-size: 12px;
  white-space: normal;
}

.shop-console-toolbar .inline-check {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  justify-content: center;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
}

.shop-console-toolbar input,
.shop-console-toolbar select,
.shop-console-toolbar #shopSearch,
.shop-console-toolbar #shopViewMode {
  width: 100%;
  min-width: 120px;
  min-height: 32px;
  border-radius: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-main);
}

.shop-console-toolbar #shopViewMode {
  margin-left: 0;
}

.shop-console-toolbar input#shopSearch {
  width: 160px;
  max-width: 180px;
  min-width: 120px;
}

.shop-console-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--primary) 5%, var(--card-bg));
  color: var(--text-second);
  font-size: 12px;
}

.shop-cards-wrap {
  padding: 14px 16px 18px;
  overflow-x: auto;
}

.shop-card-header,
.shop-data-card {
  display: grid;
  grid-template-columns: 58px minmax(180px, 1.5fr) 90px minmax(110px, 1fr) repeat(9, minmax(96px, 1fr));
  align-items: center;
  gap: 0;
  min-width: 1320px;
}

.shop-card-header {
  padding: 0 12px 8px;
  color: var(--text-second);
  font-size: 12px;
  font-weight: 700;
}

.shop-data-card {
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.shop-data-card > * {
  padding-right: 10px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shop-status.relogin-shop {
    border: 0;
    color: #000000;
    font-weight: 400;
    cursor: pointer;
    text-decoration: underline;
  }

.shop-card-total {
  display: grid;
  grid-template-columns: minmax(420px, 2.5fr) repeat(6, minmax(110px, 1fr));
  gap: 12px;
  min-width: 1040px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 7%, var(--card-bg));
  color: var(--text-main);
}

/* Rebuilt shop management: compact Douyin login/list workbench. */
#shopsView.view.active {
  display: block;
}

#shopsView .shop-console-panel {
  min-height: calc(100vh - 112px);
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

#shopsView .shop-console-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #d8dee8;
  background: #f6f9fe;
  overflow-x: auto;
}

#shopsView .shop-console-toolbar button {
  min-width: 92px;
  min-height: 32px;
  border-radius: 4px;
  background: #165dff;
  border-color: #165dff;
}

#shopsView .shop-login-inline-status {
  display: none;
  margin: 0 14px 12px;
  padding: 10px 12px;
  border: 1px solid #b9d3ff;
  border-radius: 6px;
  background: #eef5ff;
  color: #174ea6;
  font-weight: 700;
}

#shopsView .shop-login-inline-status:not(:empty) {
  display: block;
}

#shopsView .shop-console-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: #344054;
}

#shopsView .shop-console-toolbar input,
#shopsView .shop-console-toolbar select {
  min-width: 112px;
  min-height: 30px;
  border-radius: 4px;
  background: #fff;
}

#shopsView .shop-table-wrap {
  padding: 14px;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

#shopsView .shop-table-wrap {
  max-height: none;
  overflow: auto;
}

#shopsView .shop-console-table {
  width: 100%;
  min-width: 980px;
  table-layout: fixed;
  border-collapse: collapse;
  background: #ffffff;
  font-size: 12px;
  color: #000000;
}

#shopsView .shop-console-table th,
#shopsView .shop-console-table td {
  height: 34px;
  padding: 5px 7px;
  border: 1px solid #cfd6e2;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #000000;
}

#shopsView .shop-console-table th {
  background: #eef4ff;
  color: #000000;
  font-weight: 700;
}

#shopsView .shop-console-table .shop-status,
#shopsView .shop-console-table .shop-score-tag,
#shopsView .shop-console-table button {
  color: #000000;
}

#shopsView .shop-console-table tbody tr {
  cursor: pointer;
}

#shopsView .shop-console-table tbody tr:nth-child(odd) td {
  background: #ffffff;
}

#shopsView .shop-console-table tbody tr:nth-child(even) td {
  background: #f4f7fb;
}

#shopsView .shop-console-table tbody tr:hover td {
  background: #e8f1ff;
}

#shopsView .shop-console-table tbody tr.selected td {
  background: #dbeafe;
}

#shopsView .shop-console-table tbody tr.selected td:first-child {
  box-shadow: inset 3px 0 0 #165dff;
}

.shop-login-dialog {
  width: min(720px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  border-radius: 6px;
  border: 1px solid #b8c2d6;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 22px 52px rgba(15, 23, 42, 0.18);
}

.shop-login-dialog .dialog-card {
  min-height: 360px;
  max-height: calc(100vh - 24px);
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.shop-login-dialog .dialog-head {
  min-height: 42px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #d8dde7;
  background: #f4f7fb;
}

.shop-login-dialog .dialog-head h3 {
  color: #111827;
  font-size: 15px;
  font-weight: 700;
}

.shop-login-dialog #closeShopLoginDialog {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  background: #d34b4b;
  color: #ffffff;
  font-size: 18px;
  line-height: 20px;
  cursor: pointer;
}

.shop-login-panel {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
  background: #f8fafc;
  color: #475467;
}

.shop-login-status-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-height: 108px;
  padding: 20px;
  border: 1px solid #d8e2f3;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.shop-login-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #165dff;
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
}

.shop-login-panel[data-status="success"] .shop-login-icon {
  background: #00a650;
}

.shop-login-panel[data-status="error"] .shop-login-icon {
  background: #d34b4b;
}

.shop-login-status-card strong {
  color: #111827;
  font-size: 20px;
}

.shop-login-status-card p {
  margin: 0;
  line-height: 1.8;
}

.shop-login-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.shop-login-steps span {
  position: relative;
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #d8e2f3;
  border-radius: 6px;
  background: #ffffff;
  color: #667085;
  font-weight: 700;
}

.shop-login-panel[data-status="starting"] .shop-login-steps span[data-step="helper"],
.shop-login-panel[data-status="login"] .shop-login-steps span[data-step="helper"],
.shop-login-panel[data-status="login"] .shop-login-steps span[data-step="login"],
.shop-login-panel[data-status="saving"] .shop-login-steps span,
.shop-login-panel[data-status="success"] .shop-login-steps span {
  border-color: #165dff;
  background: #eaf2ff;
  color: #165dff;
}

.shop-login-panel[data-status="success"] .shop-login-steps span {
  border-color: #94d6af;
  background: #eefaf3;
  color: #00873b;
}

.shop-login-panel[data-status="error"] .shop-login-steps span {
  border-color: #f0bbbb;
  background: #fff3f3;
  color: #b42318;
}

.shop-login-result {
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 10px;
}

.shop-login-result[hidden] {
  display: none;
}

.shop-login-result div {
  display: grid;
  gap: 6px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid #d8e2f3;
  border-radius: 8px;
  background: #ffffff;
}

.shop-login-result span {
  color: #667085;
  font-size: 12px;
}

.shop-login-result strong {
  color: #0f172a;
  font-size: 17px;
}

.shop-login-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.shop-login-actions button {
  min-width: 140px;
  min-height: 36px;
  border-radius: 6px;
  background: #165dff;
  border-color: #165dff;
  color: #ffffff;
}

.shop-login-actions #finishShopLoginHelper {
  background: #00a650;
  border-color: #00a650;
}

.shop-delete-inline,
.shop-open-inline {
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid #c7ccd5;
  border-radius: 4px;
  background: #ffffff;
  color: #165dff;
  cursor: pointer;
}

.shop-delete-inline {
  color: #d14343;
  border-color: #f0bbbb;
}

@media (max-width: 1180px) {
  .shop-login-dialog {
    width: min(760px, calc(100vw - 20px));
  }

  .shop-login-dialog .dialog-card {
    max-height: calc(100vh - 20px);
  }

  .shop-console-toolbar {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .orders-table-tools,
  .aftersales-tools {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}
.app-shell.locked,
.app-shell.refined-ui.locked {
  display: none !important;
}

.orders-column-panel {
  position: fixed;
  z-index: 9999;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: min(330px, calc(100vw - 24px));
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
  margin-top: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.16);
  color: var(--text-main);
}

.orders-column-panel.compact {
  transform: translateY(4px);
}

.orders-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px;
}

.orders-head-grid {
  align-items: stretch;
  gap: 14px;
}

.orders-title-block {
  display: grid;
  gap: 8px;
  min-width: 180px;
}

.orders-table-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  width: 100%;
}

#ordersFactoryFilter {
  max-width: 128px;
}

#ordersPageSize {
  width: 72px;
}

#ordersPageInfo {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 4px;
  color: var(--text-second);
  white-space: nowrap;
}

#ordersPrevPage,
#ordersNextPage {
  min-width: 72px;
}

#searchOrders {
  width: min(260px, 100%);
}

.orders-table-tools label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-second);
}

.orders-table-tools label:has(#ordersPageSize) {
  min-width: 72px;
  width: 72px;
}

.orders-sync-progress {
  display: grid;
  gap: 5px;
  min-width: 220px;
  font-size: 12px;
  color: var(--text-second);
}

.orders-sync-progress div {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 70%, var(--card-bg));
}

.orders-sync-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.25s ease;
}

.aftersales-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) repeat(5, minmax(118px, 0.8fr)) minmax(82px, auto) auto minmax(86px, auto) auto minmax(96px, auto);
  align-items: end;
  gap: 10px;
  width: 100%;
}

.aftersales-tools label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-second);
}

.order-status-tab {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-main);
  padding: 7px 12px;
}

.order-status-tab.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, var(--card-bg));
  color: var(--primary);
  font-weight: 700;
}

.orders-column-panel label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
}

.orders-column-panel input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
  flex: 0 0 auto;
}

.orders-column-panel-section {
  display: grid;
  gap: 6px;
  padding: 7px;
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--primary) 4%, var(--card-bg));
}

.orders-column-panel-section strong {
  font-size: 11px;
  color: var(--text-second);
}

.orders-column-panel-section div {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  gap: 6px 8px;
  align-items: center;
}

