:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --line: #d8dee6;
  --soft: #edf1f5;
  --text: #1f252d;
  --muted: #667281;
  --primary: #1f7a8c;
  --primary-dark: #176676;
  --green: #197a45;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 12px 30px rgba(31, 42, 55, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
}

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

button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  min-height: 34px;
  border-radius: 6px;
  padding: 7px 12px;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

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

button.secondary {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

button.secondary:hover,
.mini:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #fbfefe;
}

button.secondary.danger {
  color: var(--red);
  border-color: rgba(185, 28, 28, .35);
}

button.secondary.danger:hover {
  color: var(--red);
  border-color: var(--red);
  background: #fff7f6;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  min-height: 34px;
  padding: 7px 10px;
  width: 100%;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 122, 140, .16), transparent 42%),
    linear-gradient(315deg, rgba(183, 121, 31, .12), transparent 44%),
    var(--bg);
}

.login-box {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  font-size: 24px;
  font-weight: 800;
}

.login-box p,
.login-tip {
  color: var(--muted);
}

.login-box label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
  color: var(--muted);
  font-size: 12px;
}

.login-box button {
  width: 100%;
  margin-top: 18px;
}

.error {
  margin-top: 10px;
  color: var(--red);
  min-height: 20px;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  transition: grid-template-columns .18s ease;
}

.app.sidebar-collapsed {
  grid-template-columns: 64px minmax(0, 1fr);
}

.sidebar {
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
}

.brand {
  padding: 6px 4px 14px 8px;
  border-bottom: 1px solid var(--soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-title {
  font-size: 19px;
  font-weight: 800;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-toggle {
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  border-color: var(--line);
  font-size: 22px;
  line-height: 1;
}

#sideNav {
  display: grid;
  gap: 4px;
  align-content: start;
}

.nav {
  border: 0;
  background: transparent;
  color: #303844;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  width: 100%;
  border-radius: 6px;
  padding: 0 12px;
  position: relative;
  white-space: nowrap;
}

.nav:hover {
  background: #eef2f5;
}

.nav.active {
  background: #e6f3f5;
  color: var(--primary);
  font-weight: 800;
}

.nav.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
}

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

.nav-group {
  display: grid;
  gap: 2px;
}

.nav-group-toggle {
  border: 0;
  background: transparent;
  min-height: 42px;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  color: #45505c;
  text-align: left;
  font-size: 14px;
  font-weight: 700;
  border-radius: 6px;
}

.nav-group-toggle:hover {
  background: #f0f3f5;
}

.nav-group-icon,
.nav-home-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 16px;
}

.nav-group-arrow {
  color: #8a97a3;
  transition: transform .15s ease;
}

.nav-group.open .nav-group-arrow {
  transform: rotate(90deg);
}

.nav-group-items {
  display: none;
  gap: 2px;
}

.nav-group.open .nav-group-items {
  display: grid;
}

.nav-group-items .nav {
  padding-left: 42px;
  font-size: 14px;
}

.app.sidebar-collapsed .brand-title,
.app.sidebar-collapsed .nav-home-label,
.app.sidebar-collapsed .nav-group-title,
.app.sidebar-collapsed .nav-group-arrow,
.app.sidebar-collapsed .nav-group-items,
.app.sidebar-collapsed .sidebar-foot > div,
.app.sidebar-collapsed .sidebar-foot button {
  display: none;
}

.app.sidebar-collapsed .brand {
  justify-content: center;
  padding-left: 4px;
}

.app.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.app.sidebar-collapsed .nav-home,
.app.sidebar-collapsed .nav-group-toggle {
  justify-content: center;
  grid-template-columns: 24px;
  padding: 0;
}

.app.sidebar-collapsed .nav-home {
  min-height: 42px;
}

.sidebar-foot {
  margin-top: auto;
  border-top: 1px solid var(--soft);
  padding: 14px 8px 0;
  color: var(--muted);
  display: grid;
  gap: 10px;
}

.sidebar-foot button {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

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

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.top-actions input {
  width: 230px;
}

.content {
  padding: 22px;
  overflow: auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.message {
  /* 2026-10-15：改为固定在视口顶部。原来它在文档流里、位于内容区最上方，
     用户在列表第 3 屏点删除后提示出现在看不到的页面顶端，3.2 秒就消失，
     于是重复点击。现在任何滚动位置都可见，且可点击关闭。 */
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(560px, calc(100vw - 24px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #badbcc;
  background: #edf8f1;
  color: var(--green);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(16, 24, 40, .16);
  cursor: pointer;
}

.message.error {
  border-color: #f5c2c7;
  background: #fff0f0;
  color: var(--red);
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 15px;
  min-height: 102px;
}

.metric-wide {
  grid-column: span 2;
}

.metric .label {
  color: var(--muted);
  font-size: 12px;
}

.metric .value {
  margin-top: 9px;
  font-size: 24px;
  font-weight: 800;
}

.metric-no-value .value {
  display: none;
}

.metric .note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric .note b {
  color: var(--text);
}

.shop-stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(5, minmax(190px, 1fr));
  gap: 14px;
}

.shop-card {
  background: var(--panel);
  border: 1px solid var(--soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
  min-width: 0;
}

.shop-name {
  font-weight: 800;
  margin-bottom: 10px;
}

.shop-data {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.shop-data b {
  color: var(--text);
}

.finance-shop-stats {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 14px;
}

.finance-shop-card {
  overflow-x: auto;
}

.finance-period-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 1180px;
}

.finance-period-table th,
.finance-period-table td {
  border-bottom: 1px solid var(--soft);
  padding: 8px 6px;
  text-align: left;
  white-space: nowrap;
}

.finance-period-table th {
  color: var(--muted);
  font-weight: 700;
}

.finance-period-table tr:last-child td {
  border-bottom: 0;
}

.supplier-month-table {
  margin-top: 10px;
}

.promotion-expense-panel {
  margin-top: 14px;
}

.promotion-expense-head {
  align-items: center;
}

.promotion-expense-head h2 {
  margin: 0;
}

.promotion-expense-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

#promotionExpenseTable {
  min-width: 920px;
}

.split {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(330px, .8fr);
  gap: 14px;
}

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

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

.panel-head h2 {
  margin: 0;
  font-size: 15px;
}

.list-head {
  align-items: flex-start;
  flex-direction: column;
}

.filters {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 12px 18px;
  align-items: center;
}

.filters select,
.filters input {
  width: 100%;
}

.filter-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.filter-item.date-filter {
  grid-column: auto;
  /* 2026-10-15：原来是 max-content（按内容收缩），导致日期框比旁边的
     输入框短一截、右边留出空档。改成和其他筛选项一样的 1fr 撑满整格。 */
  grid-template-columns: 96px minmax(0, 1fr);
}

.filter-item label {
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

.date-range-control {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  /* 撑满整格，与普通筛选输入框同宽（原为 max-content，会短一截） */
  width: 100%;
  max-width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: max-content auto max-content;
  /* 两端对齐：开始日期靠左、结束日期靠右，中间留白；
     这样即使容器变宽也不会把日期文字截断 */
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  padding: 0 8px;
  white-space: nowrap;
  overflow-x: auto;
}

.date-range-control input {
  border: 0;
  min-height: 34px;
  padding: 0;
  background: transparent;
}

.date-range-control input:focus {
  outline: none;
}

.date-range-control span {
  color: var(--muted);
}

.date-picker {
  position: relative;
  min-width: max-content;
}

.date-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

.date-picker-display {
  width: max-content;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.form-date-control .date-picker-display {
  width: 100%;
}

.date-picker-display.empty {
  color: var(--muted);
}

.date-picker-display:focus-visible {
  outline: 2px solid rgba(22, 112, 133, .25);
  outline-offset: 2px;
}

.form-date-control {
  position: relative;
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 0 10px;
}

.form-date-control .date-native-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
}

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

.filters .filter-query,
.filters .filter-reset {
  min-width: 78px;
  justify-self: end;
}

.filters.top-filters {
  background: var(--panel);
  border: 1px solid var(--soft);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  padding: 14px 15px;
}

.security-panel {
  margin-bottom: 14px;
}

.security-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.switch-row {
  border: 1px solid var(--soft);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 700;
}

.security-form-grid {
  padding: 0 14px 14px;
}

.dashboard-orders {
  margin-top: 14px;
}

.task-list {
  padding: 14px;
  display: grid;
  gap: 10px;
}

.task {
  border: 1px solid var(--soft);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.task b {
  display: block;
}

.task span {
  color: var(--muted);
  font-size: 12px;
}

.task-link {
  border: 0;
  cursor: pointer;
}

.task-link:hover {
  background: #e6f3f5;
  color: var(--primary);
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f5;
  color: #344050;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.green {
  background: #e9f7ef;
  color: var(--green);
}

.badge.amber {
  background: #fff5df;
  color: var(--amber);
}

.badge.red {
  background: #fff0ee;
  color: var(--red);
}

.badge.teal {
  background: #e6f3f5;
  color: var(--primary);
}

.quick-grid {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quick-grid button {
  min-height: 70px;
  text-align: left;
  background: #fff;
  color: var(--text);
  border-color: var(--line);
  font-weight: 800;
}

.table-wrap {
  overflow: auto;
  position: relative;
}

.pagination {
  padding: 12px 14px;
  border-top: 1px solid var(--soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.page-size,
.page-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.page-size select {
  width: 96px;
}

.page-info,
.page-actions span,
.page-size span {
  color: var(--muted);
  font-size: 12px;
}

.code-countdown {
  min-height: 18px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

table {
  width: 100%;
  min-width: 850px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--soft);
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fafbfc;
  color: var(--muted);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 3;
}

th.filtered {
  color: var(--primary);
}

.select-column {
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  text-align: center;
}

.select-column input {
  width: auto;
  min-height: auto;
  padding: 0;
}

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.th-sort {
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.th-sort:hover {
  background: transparent;
  color: var(--primary);
}

.sort-mark {
  margin-left: 4px;
  color: var(--primary);
}

.header-filter-btn {
  min-width: 24px;
  min-height: 24px;
  padding: 0;
  border-color: var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
}

.header-filter-btn:hover,
.header-filter-btn.active {
  border-color: var(--primary);
  background: #e6f3f5;
  color: var(--primary);
}

.actions-sticky {
  position: sticky;
  right: 0;
  z-index: 4;
  background: #fff;
  box-shadow: -8px 0 14px rgba(31, 42, 55, .04);
}

th.actions-sticky {
  background: #fafbfc;
  z-index: 5;
}

.cell-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}

tr:hover td {
  background: #fcfdfe;
}

.strong {
  font-weight: 800;
}

.editable-order-no {
  cursor: pointer;
}

/* 订单号已从 <span> 改成 <button>（手机端 dblclick 不可用），
   这里把按钮默认样式复位成普通文字外观。 */
button.editable-order-no {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.editable-order-no:hover {
  text-decoration: underline;
}

.editable-product-code {
  cursor: pointer;
}

.editable-product-code:hover {
  text-decoration: underline;
}

.active-filters {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px dashed var(--soft);
  padding-top: 10px;
}

.active-filter-title {
  color: var(--muted);
  font-size: 12px;
}

.active-filter-tag,
.active-filter-clear {
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  border-color: #cde2e7;
  background: #edf8fa;
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
}

.active-filter-clear {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.header-filter-popover {
  position: fixed;
  z-index: 50;
  width: 268px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px;
}

.header-filter-title {
  font-weight: 800;
  margin-bottom: 10px;
}

.header-filter-body {
  display: grid;
  gap: 10px;
}

.header-filter-body label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.filter-checks {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.filter-checks label {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  color: var(--text);
}

.filter-checks input {
  width: auto;
  min-height: auto;
}

.header-filter-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(17, 24, 39, .28);
}

.table-settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 61;
  width: min(460px, 100vw);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 40px rgba(31, 42, 55, .16);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.drawer-head,
.drawer-actions {
  padding: 14px;
  border-bottom: 1px solid var(--soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.drawer-head h2 {
  margin: 0;
  font-size: 17px;
}

.drawer-actions {
  border-top: 1px solid var(--soft);
  border-bottom: 0;
  justify-content: flex-end;
}

.drawer-actions #resetTableSettings {
  margin-right: auto;
}

.table-field-groups {
  overflow: auto;
  padding: 12px 14px 18px;
}

.table-field-group {
  border: 1px solid var(--soft);
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.table-field-group h3 {
  margin: 0;
  padding: 10px 12px;
  background: #fafbfc;
  font-size: 13px;
}

.table-field-row {
  min-height: 44px;
  padding: 8px 10px;
  border-top: 1px solid var(--soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fff;
}

.table-field-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  cursor: pointer;
}

.table-field-row input {
  width: auto;
  min-height: auto;
}

.field-row-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.drag-handle,
.fixed-note {
  color: var(--muted);
  font-size: 12px;
}

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

.money-plus {
  color: var(--green);
  font-weight: 800;
}

.money-minus {
  color: var(--red);
  font-weight: 800;
}

.actions {
  display: flex;
  gap: 6px;
}

.mini,
.icon-btn {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.mini.danger {
  color: var(--red);
  border-color: rgba(185, 28, 28, .28);
}

.icon-btn {
  width: 34px;
  height: 34px;
  font-size: 20px;
  line-height: 1;
}

dialog {
  width: min(980px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .22);
  padding: 0;
}

dialog::backdrop {
  background: rgba(27, 34, 42, .36);
}

#editForm,
#passwordForm,
#forgotForm,
#userPasswordForm,
#promotionExpenseForm {
  padding: 0;
  margin: 0;
}

.dialog-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--soft);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.dialog-head h2 {
  margin: 0;
  font-size: 18px;
}

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

.form-grid {
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field.full {
  grid-column: 1 / -1;
}

.compact-textarea textarea {
  min-height: 42px;
  height: 42px;
}

.checkbox-field {
  align-self: end;
}

.checkbox-field input {
  width: auto;
  min-height: auto;
}

.permission-field {
  grid-column: 1 / -1;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
}

.permission-item {
  display: flex !important;
  align-items: center;
  gap: 7px;
  margin: 0 !important;
  color: var(--text) !important;
  font-weight: 500 !important;
}

.permission-item input {
  width: auto;
  min-height: auto;
}

.inline-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.inline-field button {
  white-space: nowrap;
}

.ghost-btn {
  margin-top: 8px !important;
}

.summary-blocks {
  margin-bottom: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 14px;
}

.summary-card table {
  min-width: 760px;
}

.table-wrap.compact th,
.table-wrap.compact td {
  padding: 9px 8px;
}

.dialog-actions {
  border-top: 1px solid var(--soft);
  padding: 14px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-message {
  min-height: 22px;
  padding: 0 18px 12px;
  color: var(--green);
}

.dialog-message.error {
  color: var(--red);
}

.account-editor-page {
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 88px;
}

.account-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.account-editor-head h2 {
  margin: 7px 0 5px;
  font-size: 24px;
}

.account-editor-head p,
.account-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.account-breadcrumb {
  color: var(--muted);
  font-size: 13px;
}

.account-tabs {
  display: flex;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
}

.account-tabs button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 2px 10px;
  min-height: 44px;
  white-space: nowrap;
}

.account-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 800;
}

.account-tab-panel {
  display: none;
}

.account-tab-panel.active {
  display: block;
}

.account-section-head {
  margin-bottom: 16px;
}

.account-section-head h3 {
  margin: 0;
  font-size: 17px;
}

.account-section-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.account-form-grid,
.device-policy-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 16px 20px;
  max-width: 920px;
}

.account-form-field {
  display: grid;
  gap: 7px;
}

.account-form-field label {
  color: #4d5965;
  font-size: 13px;
  font-weight: 700;
}

.account-form-field .field-help {
  color: var(--muted);
  font-size: 12px;
}

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

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

.permission-modules {
  display: grid;
  gap: 12px;
}

.permission-module {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.permission-module-head {
  min-height: 58px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fafcfd;
  border-bottom: 1px solid var(--soft);
}

.permission-module-head h4 {
  margin: 0;
  font-size: 15px;
}

.permission-module-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.permission-module-actions {
  display: flex;
  gap: 6px;
}

.permission-module-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.permission-matrix-wrap {
  overflow-x: auto;
}

.permission-matrix {
  width: 100%;
  min-width: 1080px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.permission-matrix th,
.permission-matrix td {
  padding: 0;
  border-right: 1px solid var(--soft);
  border-bottom: 1px solid var(--soft);
  vertical-align: top;
}

.permission-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 10px;
  background: #f4f7f8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.permission-matrix thead th:first-child,
.permission-matrix tbody th {
  width: 120px;
}

.permission-matrix tbody th {
  padding: 13px 10px;
  background: #fbfcfd;
  font-size: 13px;
  text-align: left;
}

.permission-choice {
  min-height: 42px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.permission-choice + .permission-choice {
  border-top: 1px solid var(--soft);
}

.permission-empty {
  display: block;
  padding: 13px 10px;
  color: #aab4bd;
  text-align: center;
}

.permission-choice input,
.shop-choice input,
.policy-toggle input {
  width: auto;
  min-height: auto;
}

.sensitive-tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  background: #fff1da;
  color: #a85c00;
  font-size: 11px;
  font-weight: 700;
}

.shop-permission-editor {
  max-width: 920px;
}

.shop-scope-all {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--soft);
}

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

.shop-choice,
.policy-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.account-subsection {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.account-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 12;
  margin-top: 26px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -8px 24px rgba(28, 44, 56, .08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-save-bar > span {
  color: var(--muted);
  font-size: 13px;
}

.account-save-bar > div {
  display: flex;
  gap: 8px;
}

@media (max-width: 1160px) {
  .metrics {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .shop-stats {
    grid-template-columns: repeat(2, minmax(190px, 1fr));
  }

  .finance-shop-stats {
    grid-template-columns: 1fr;
  }

  .split {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .permission-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

}

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

  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

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

  #sideNav {
    display: block;
  }

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

  .app.sidebar-collapsed .brand-title,
  .app.sidebar-collapsed .nav-home-label,
  .app.sidebar-collapsed .nav-group-title,
  .app.sidebar-collapsed .nav-group-arrow,
  .app.sidebar-collapsed .sidebar-foot > div,
  .app.sidebar-collapsed .sidebar-foot button {
    display: initial;
  }

  .app.sidebar-collapsed .nav-group-items {
    display: none;
  }

  .app.sidebar-collapsed .nav-group.open .nav-group-items {
    display: grid;
  }

  .app.sidebar-collapsed .nav-home,
  .app.sidebar-collapsed .nav-group-toggle {
    justify-content: initial;
    grid-template-columns: 24px minmax(0, 1fr) 16px;
    padding: 0 10px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .top-actions input,
  .filters input,
  .filters select {
    width: 100%;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .filter-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .filter-item.date-filter {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .filter-item label {
    text-align: left;
  }

  .date-range-control {
    grid-template-columns: max-content auto max-content;
  }

  .filters .filter-query,
  .filters .filter-reset,
  .filter-actions,
  .pagination,
  .page-size,
  .page-actions {
    width: 100%;
  }

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

  .filter-actions button {
    flex: 1;
  }

  .pagination {
    justify-content: flex-start;
  }

  .metrics,
  .shop-stats,
  .quick-grid,
  .form-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .metric-wide {
    grid-column: span 1;
  }

  .account-editor-head,
  .account-section-actions,
  .account-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .account-form-grid,
  .device-policy-editor,
  .shop-grid {
    grid-template-columns: 1fr;
  }

  .account-tabs {
    gap: 16px;
  }
}

/* 店铺销售统计：多选下拉 */
.multi-filter { position: relative; display: inline-block; }
.filter-multi-button {
  min-width: 160px; min-height: 36px; padding: 0 12px; border: 1px solid #cfd9e3;
  border-radius: 8px; background: #fff; color: #17212b; text-align: left; cursor: pointer; font-size: 13px;
}
.filter-multi-panel {
  position: absolute; z-index: 60; top: calc(100% + 4px); left: 0; min-width: 200px; max-height: 240px;
  overflow-y: auto; background: #fff; border: 1px solid #cfd9e3; border-radius: 8px;
  box-shadow: 0 12px 32px rgba(30, 45, 62, .14); padding: 6px;
}
.filter-multi-panel label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.filter-multi-panel label:hover { background: #f3f6f8; }

/* 日期快捷选择 */
.date-quick-row { display: flex; flex-wrap: wrap; gap: 6px; margin-left: 10px; }
.date-quick {
  min-height: 30px; padding: 0 10px; border: 1px solid #cfd9e3; border-radius: 8px;
  background: #fff; color: #167085; cursor: pointer; font-size: 12px;
}
.date-quick:hover { border-color: #167085; background: #f0f7f9; }

/* 合计行 */
.table-totals td { font-weight: 600; background: #f0f5f7; }

/* 宽弹窗 */
.wide-dialog { width: min(1100px, 94vw); max-width: 1100px; }
.wide-dialog .table-wrap { max-height: 60vh; overflow: auto; }

/* ===== 界面整体美化 ===== */
:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #dde4ec;
  --soft: #eef2f6;
  --text: #1c2733;
  --muted: #64748b;
  --primary: #147d93;
  --primary-dark: #0f6578;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 4px 16px rgba(16, 24, 40, .08);
}

body {
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease, color .15s ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 125, 147, .16);
}

button {
  min-height: 34px;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

/* 侧边栏 */
.sidebar {
  background: #f7f9fc;
  border-right: 1px solid var(--line);
  box-shadow: none;
}

.brand-title {
  color: var(--primary-dark);
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0;
}

.nav {
  color: #3d4c5c;
  border-radius: 7px;
  margin: 1px 8px;
}

.nav:hover {
  background: #e9eef3;
  color: var(--text);
}

.nav.active {
  background: linear-gradient(90deg, rgba(20, 125, 147, .16), rgba(20, 125, 147, .06));
  color: var(--primary-dark);
  font-weight: 600;
}

.nav.active::before {
  background: var(--primary);
}

.nav-group-items {
  background: transparent;
}

/* 顶栏与页面标题 */
.topbar {
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  font-size: 19px;
  letter-spacing: 0;
}

.topbar p {
  color: var(--muted);
}

.page {
  padding-top: 22px;
}

/* 指标卡片 */
.metrics {
  gap: 12px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}

.metric .value {
  color: var(--primary-dark);
  font-size: 24px;
  letter-spacing: 0;
}

.metric .label {
  color: var(--muted);
  font-weight: 500;
}

/* 面板 */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.panel-head {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.panel-head h2 {
  font-size: 15px;
  letter-spacing: 0;
}

/* 筛选区 */
.filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
  gap: 10px;
}

.filters select,
.filters input {
  border-radius: 6px;
}

.filter-item label {
  color: var(--muted);
  font-size: 12px;
}

/* 表格 */
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.table-wrap table {
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap thead th {
  background: #f4f7fa;
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.table-wrap tbody tr:nth-child(even) {
  background: #fafbfd;
}

.table-wrap tbody tr:hover {
  background: #f0f7f9;
}

.table-wrap td,
.table-wrap th {
  border-bottom: 1px solid #edf1f6;
}

.table-totals td {
  background: #f2f7f9;
}

/* 徽标 */
.badge {
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
}

/* 操作按钮 */
.actions button,
.mini {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}

/* 快捷入口 */
.quick-grid {
  gap: 10px;
}

.quick-grid button {
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

/* 账号编辑页 */
.account-editor-head {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  margin-bottom: 14px;
}

.account-tabs {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 6px;
  gap: 4px;
}

.account-tabs button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  border-radius: 6px;
}

.account-tabs button:hover {
  background: var(--soft);
  color: var(--text);
}

.account-tabs button.active {
  background: #e8f3f6;
  color: var(--primary-dark);
  font-weight: 600;
}

.account-tab-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
}

.account-section-head h3 {
  font-size: 15px;
  letter-spacing: 0;
}

.account-save-bar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

/* 弹窗 */
.dialog-mask .dialog {
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(16, 24, 40, .22);
}

/* 开关 */
.switch-row,
.policy-toggle {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfe;
}

.switch-row:hover,
.policy-toggle:hover {
  background: #f2f8fa;
  border-color: #b9d9e0;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: #c7d2dd;
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #a9b8c8;
  background-clip: content-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* ===== 移动端适配 ===== */
@media (max-width: 760px) {
  .app {
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: 1fr;
  }

  .app.sidebar-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .sidebar {
    width: 56px;
    padding: 12px 6px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .brand {
    justify-content: center;
    padding: 4px 0 10px;
    border-bottom: 1px solid var(--line);
  }

  .brand-title {
    font-size: 0;
  }

  .brand-title::before {
    content: "ERP";
    font-size: 14px;
    font-weight: 800;
    color: var(--primary-dark);
  }

  .sidebar-toggle {
    display: none;
  }

  #sideNav {
    display: grid;
    gap: 4px;
  }

  .nav,
  .nav-home,
  .nav-group-toggle {
    justify-content: center;
    min-height: 40px;
    padding: 0;
  }

  .nav-home-label,
  .nav-group-title,
  .nav-group-arrow {
    display: none;
  }

  .nav-group.open .nav-group-items {
    display: grid;
    position: fixed;
    left: 56px;
    top: 12px;
    width: 220px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(16, 24, 40, .16);
    z-index: 80;
  }

  .nav-group.open .nav-group-items .nav {
    justify-content: flex-start;
    padding: 0 10px;
  }

  .sidebar-foot {
    padding: 10px 0 0;
    justify-items: center;
  }

  .sidebar-foot > div,
  .sidebar-foot button {
    font-size: 0;
    width: 34px;
    min-width: 34px;
    padding: 0;
  }

  .main {
    min-width: 0;
  }

  .topbar {
    padding: 10px 12px;
  }

  .top-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .top-actions input {
    width: 100%;
  }

  .page {
    padding: 12px;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-item {
    width: 100%;
  }

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

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 900px;
  }

  .account-editor-head,
  .account-tabs,
  .account-tab-panel,
  .account-save-bar {
    border-radius: 8px;
  }

  .account-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

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

  .dialog-mask .dialog {
    width: min(94vw, 480px);
    max-height: 88vh;
    overflow-y: auto;
  }
}

/* ===== 移动端优化 (2026-08-16): 抽屉式导航 ===== */

/* 桌面端隐藏移动元素 */
.mobile-nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  border-radius: 8px;
  flex: none;
}

.mobile-nav-toggle:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: #fbfefe;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, .45);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}

@media (max-width: 760px) {
  /* 内容区占满全宽，侧栏改为抽屉 */
  .app,
  .app.sidebar-collapsed {
    display: block;
    min-height: 100dvh;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(276px, 84vw);
    padding: 14px 10px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 120;
    background: #fbfcfd;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(16, 24, 40, .18);
  }

  .app.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .app.mobile-nav-open .nav-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-toggle {
    display: none;
  }

  /* 抽屉内分组直接展开，不再使用悬浮菜单 */
  .nav-group.open .nav-group-items {
    position: static;
    width: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 2px 0 6px 10px;
    display: grid;
  }

  .nav-group.open .nav-group-items .nav {
    justify-content: flex-start;
    padding: 0 10px;
  }

  .nav,
  .nav-home,
  .nav-group-toggle {
    justify-content: flex-start;
    min-height: 42px;
    padding: 0 10px;
  }

  .nav-home-label,
  .nav-group-title,
  .nav-group-arrow {
    display: initial;
  }

  .brand {
    justify-content: space-between;
    padding: 4px 4px 12px 8px;
  }

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

  .brand-title::before {
    content: none;
  }

  .sidebar-foot {
    padding: 12px 4px 0;
    justify-items: stretch;
  }

  .sidebar-foot > div {
    font-size: 13px;
  }

  .sidebar-foot button {
    font-size: 13px;
    width: auto;
    min-width: 0;
    padding: 8px 12px;
  }

  /* 顶栏：汉堡 + 标题一行，操作按钮换行 */
  .topbar {
    padding: 10px 12px;
    min-height: 54px;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    flex-direction: row;
  }

  .topbar-title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .topbar p {
    font-size: 11px;
    margin-top: 2px;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .top-actions button,
  .top-actions .secondary {
    min-height: 40px;
    padding: 7px 14px;
  }

  .top-actions input {
    width: 100%;
  }

  /* 内容与页面 */
  .content {
    padding: 12px;
  }

  .page {
    padding: 10px;
  }

  /* 卡片与统计 */
  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-stats {
    grid-template-columns: 1fr;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  /* 表单与筛选 */
  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-item {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

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

  /* 弹窗：接近全宽 + 内部滚动 */
  dialog,
  dialog.wide-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    margin: 8px auto;
    max-height: calc(100dvh - 16px);
  }

  dialog .form-grid {
    max-height: 60dvh;
    overflow-y: auto;
  }

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

  .dialog-actions button {
    min-height: 42px;
  }

  /* 表格保持横向滚动 */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .table-wrap table {
    min-width: 900px;
  }

  /* 触控目标与输入优化（16px 防止 iOS 聚焦放大） */
  input,
  select,
  textarea {
    font-size: 16px;
  }

  button,
  .mini {
    min-height: 40px;
  }

  .actions button {
    min-height: 34px;
  }

  /* 账号编辑页 */
  .account-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .account-tab-panel {
    padding: 12px;
  }

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

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

  .shop-stats {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: 16px;
  }
}

/* ===== 界面优化 (2026-08-16): 加载状态/空状态/细节打磨 ===== */

/* 列表加载中：面板半透明 + 居中旋转指示器 */
.panel.loading {
  position: relative;
  pointer-events: none;
}

.panel.loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, .55);
  border-radius: inherit;
  z-index: 20;
}

.panel.loading::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 40%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border: 3px solid var(--line);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: dsh-spin .8s linear infinite;
  z-index: 21;
}

@keyframes dsh-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 空状态 */
.empty-cell {
  padding: 42px 12px !important;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--soft);
  position: relative;
}

.empty-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -8px 0 0 -8px;
  border: 2px solid #aab6c2;
  border-radius: 3px;
}

.empty-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 2px;
  margin: 8px 0 0 -10px;
  background: #aab6c2;
  border-radius: 1px;
}

/* 登录页品牌区增强 */
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-brand::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2090a5, #176676);
  flex: none;
  box-shadow: 0 4px 12px rgba(23, 102, 118, .28);
}

/* ===== 界面美化 (2026-08-16): 纯视觉优化，功能与布局不变 ===== */

/* 1. 调色板与基础排版精修 */
:root {
  --bg: #f2f5f9;
  --panel: #ffffff;
  --line: #dfe5ee;
  --soft: #edf1f7;
  --text: #1b2432;
  --muted: #68758a;
  --primary: #1e7f92;
  --primary-dark: #16687a;
  --primary-soft: #e8f4f6;
  --green: #1a8a4c;
  --amber: #b97a1e;
  --red: #c0392b;
  --shadow-sm: 0 1px 2px rgba(20, 30, 45, .05);
  --shadow: 0 1px 2px rgba(20, 30, 45, .04), 0 8px 24px rgba(20, 30, 45, .07);
  --radius: 10px;
  --radius-sm: 8px;
}

body {
  background:
    radial-gradient(1100px 520px at 88% -8%, rgba(31, 122, 140, .06), transparent 60%),
    radial-gradient(820px 480px at -8% 108%, rgba(183, 121, 31, .05), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  letter-spacing: .3px;
}

/* 2. 面板与卡片：更柔和的圆角与层次 */
.panel,
.filters.top-filters {
  border-color: rgba(219, 226, 236, .85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric,
.shop-card {
  border: 1px solid rgba(219, 226, 236, .85);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s ease, transform .18s ease;
}

.metric:hover,
.shop-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.panel-head {
  border-bottom-color: var(--soft);
}

.panel-head h2 {
  font-weight: 800;
}

.metric .value {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.shop-name {
  color: var(--text);
}

/* 3. 按钮：精致交互反馈（保持原有纯色主按钮，避免覆盖筛选控件按钮） */
button {
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, color .15s ease, transform .06s ease;
}

button:active {
  transform: translateY(1px);
}

button.secondary,
.mini {
  border-radius: var(--radius-sm);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(31, 122, 140, .28);
}

/* 导航图标（SVG）尺寸 */
.nav-group-icon svg,
.nav-home-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

/* 4. 输入控件：柔和聚焦光环 */
input,
select,
textarea {
  border-radius: var(--radius-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 122, 140, .13);
  outline: none;
}

/* 5. 侧边栏：更清爽 */
.sidebar {
  background: #ffffff;
  border-right-color: var(--line);
}

.brand {
  border-bottom-color: var(--soft);
}

.brand-title {
  color: var(--text);
}

.nav,
.nav-group-toggle {
  border-radius: var(--radius-sm);
  transition: background-color .12s ease, color .12s ease;
}

.nav:hover,
.nav-group-toggle:hover {
  background: var(--soft);
}

.nav.active {
  background: var(--primary-soft);
  box-shadow: inset 0 0 0 1px rgba(31, 122, 140, .10);
}

.nav-group-toggle {
  color: #33404f;
}

.nav-group-icon,
.nav-home-icon {
  color: var(--primary);
}

.sidebar-foot {
  border-top: 1px solid var(--soft);
}

/* 6. 顶栏：毛玻璃 + 精致分隔 */
.topbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom-color: var(--line);
}

.topbar h1 {
  color: var(--text);
}

/* 7. 表格：更清爽的表头与行 */
.table-wrap {
  border-radius: var(--radius);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.table-wrap thead th {
  background: #f6f8fb;
  color: #4b5a6e;
  font-size: 12px;
  letter-spacing: .4px;
  text-transform: none;
}

.table-wrap tbody tr:nth-child(even) {
  background: #f9fbfd;
}

.table-wrap tbody tr:hover {
  background: #eef6f8;
}

.table-wrap td,
.table-wrap th {
  border-bottom-color: #eef2f7;
}

/* 8. 徽标与任务卡片 */
.badge {
  font-weight: 700;
}

.badge.green {
  background: #e7f6ee;
}

.badge.amber {
  background: #fdf3e0;
}

.badge.red {
  background: #fdeeec;
}

.task {
  border-color: var(--soft);
  border-radius: var(--radius-sm);
  transition: box-shadow .15s ease, border-color .15s ease;
}

.task:hover {
  border-color: #cfe3e8;
  box-shadow: var(--shadow-sm);
}

/* 9. 弹窗 */
dialog {
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(20, 30, 45, .24);
}

.dialog-head {
  border-bottom-color: var(--soft);
}

.dialog-head h2 {
  font-weight: 800;
}

.dialog-actions {
  border-top: 1px solid var(--soft);
  padding-top: 14px;
}

/* 10. 分页 */
.pagination {
  border-top-color: var(--soft);
}

.page-info,
.page-actions span {
  font-variant-numeric: tabular-nums;
}

/* 11. 登录页：更精致的渐变背景与卡片 */
.login-view {
  background:
    radial-gradient(900px 520px at 12% 8%, rgba(31, 122, 140, .16), transparent 55%),
    radial-gradient(760px 560px at 92% 92%, rgba(183, 121, 31, .12), transparent 55%),
    linear-gradient(160deg, #f7fafc, #edf3f7);
}

.login-box {
  border-radius: 16px;
  border-color: rgba(219, 226, 236, .85);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px rgba(20, 30, 45, .14);
}

/* 12. 滚动条精修 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-thumb {
  background: #c6d1dd;
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: #a9b8c8;
}

/* 13. 汇总块与快捷入口微调 */
.summary-blocks {
  gap: 14px;
}

.quick-grid button {
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.quick-grid button:hover {
  box-shadow: var(--shadow-sm);
}

/* ==================== AI 助手（只读自然语言问数） ==================== */

.ai-hint {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
}

.ai-ask {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.ai-ask textarea {
  flex: 1;
  min-height: 52px;
  resize: vertical;
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.ai-ask button {
  flex: 0 0 auto;
  min-width: 84px;
  min-height: 40px;
}

.ai-meta {
  margin: 0 0 10px;
  font-size: 12px;
  min-height: 16px;
}

.ai-answer-box:empty {
  display: none;
}

.ai-answer {
  margin: 0 0 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.ai-error {
  margin: 0;
  color: var(--red);
  line-height: 1.7;
}

.ai-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.ai-table {
  min-width: 0 !important;
  font-size: 13px;
}

.ai-table th,
.ai-table td {
  padding: 6px 9px;
  white-space: nowrap;
}

.ai-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface, #fff);
}

.ai-sql {
  margin-bottom: 4px;
  font-size: 13px;
}

.ai-sql summary {
  cursor: pointer;
  color: var(--muted);
}

.ai-sql pre {
  margin: 8px 0 0;
  padding: 10px;
  background: #f5f7f9;
  border-radius: var(--radius-sm);
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 12px;
}

@media (max-width: 760px) {
  .ai-ask {
    flex-direction: column;
    align-items: stretch;
  }
  .ai-ask button {
    width: 100%;
  }
  .ai-table-wrap {
    max-height: 240px;
  }
}
