/* ===== 全局重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 主色系 - 链动小铺风格蓝色 */
  --primary: #165dff;
  --primary-dark: #0e42d2;
  --primary-light: #e8f0ff;
  --primary-lighter: #f2f7ff;

  --success: #00b42a;
  --success-light: #e8ffea;
  --danger: #f53f3f;
  --danger-light: #ffece8;
  --warning: #ff7d00;
  --warning-light: #fff7e8;
  --info: #165dff;

  --bg: #f5f7fa;
  --bg-soft: #fbfcfe;
  --s50: #f7f8fa;
  --s100: #f2f3f5;
  --s200: #e5e6eb;
  --s300: #c9cdd4;
  --s400: #86909c;
  --s500: #4e5969;
  --s600: #4e5969;
  --s700: #272e3b;
  --s800: #1d2129;
  --s900: #17171a;

  --sidebar-w: 232px;
  --header-h: 56px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-xs: 0 1px 2px rgba(0,0,0,.03);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
  --shadow: 0 2px 8px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.08);

  /* 向后兼容别名 */
  --gray-200: var(--s200);
  --gray-400: var(--s400);
  --gray-500: var(--s500);
  --gray-600: var(--s600);
  --gray-700: var(--s700);
}

html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 14px;
  color: var(--s800);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5715;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; font-size: 14px; outline: none; }

/* ===== 登录/注册页 ===== */
.auth-page {
  display: flex;
  min-height: 100vh;
  background: #fff;
}
.auth-left {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 460px;
  background: #fff;
}
.auth-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 32px 48px;
}
.auth-brand-logo {
  width: 36px; height: 36px; border-radius: var(--radius-md);
  background: linear-gradient(135deg, #165dff, #4080ff);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
}
.auth-brand-name { font-size: 18px; font-weight: 600; color: var(--s900); }
.auth-center {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 48px;
}
.auth-card {
  width: 100%; max-width: 420px;
  background: #fff;
}
.auth-card .auth-header {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 28px;
}
.auth-card h1 {
  font-size: 26px; color: var(--s900); font-weight: 600; margin: 0;
}
.auth-card .auth-tag {
  font-size: 12px; color: var(--s500);
  padding: 2px 8px; background: var(--s100); border-radius: var(--radius-sm);
}
.auth-tabs { display: flex; gap: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--s100); }
.auth-tab {
  position: relative; padding-bottom: 10px;
  font-size: 15px; color: var(--s500); cursor: pointer; transition: color .2s;
}
.auth-tab.active { color: var(--primary); font-weight: 500; }
.auth-tab.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--primary); border-radius: 2px 2px 0 0;
}
.auth-card .form-group { margin-bottom: 20px; }
.auth-card .form-group label { font-size: 13px; color: var(--s700); margin-bottom: 8px; }
.auth-card .input-with-icon {
  position: relative;
}
.auth-card .input-with-icon .input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--s400); font-size: 16px; pointer-events: none;
}
.auth-card .input-with-icon .form-control {
  padding-left: 38px; height: 44px; border-radius: var(--radius-md);
  border-color: var(--s200); background: #fff;
}
.auth-card .input-with-icon .form-control:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,93,255,.1);
}
.auth-card .btn-primary {
  height: 46px; font-size: 15px; font-weight: 500; border-radius: var(--radius-md);
  background: linear-gradient(135deg, #165dff, #4080ff);
  box-shadow: 0 4px 12px rgba(22,93,255,.25);
}
.auth-card .btn-primary:hover {
  background: linear-gradient(135deg, #1456e5, #3975f5);
  box-shadow: 0 6px 16px rgba(22,93,255,.35);
}
.auth-card .auth-extra {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px; font-size: 13px; color: var(--s500);
}
.auth-card .auth-extra a { cursor: pointer; }
.auth-card .auth-extra a:hover { color: var(--primary-dark); }
.auth-card .auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 24px 0 16px; color: var(--s400); font-size: 12px;
}
.auth-card .auth-divider::before,
.auth-card .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--s100);
}
.auth-card .demo-hint {
  margin-top: 20px; padding: 14px 16px; background: var(--primary-light); border-radius: var(--radius-md);
  font-size: 12px; color: var(--primary-dark); line-height: 1.9; border: 1px solid rgba(22,93,255,.12);
}
.auth-card .demo-hint b { color: var(--primary-dark); }
.auth-card .switch-link { text-align: center; margin-top: 18px; font-size: 13px; color: var(--s400); }
.auth-card .switch-link a { cursor: pointer; font-weight: 500; }
.auth-footer {
  padding: 24px 48px;
  text-align: center; font-size: 12px; color: var(--s400);
}
.auth-right {
  width: 50%; min-width: 460px;
  background: linear-gradient(160deg, #165dff 0%, #0e42d2 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.auth-right::before {
  content: ''; position: absolute; top: -20%; right: -10%; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,.12) 0%, transparent 60%);
  border-radius: 50%;
}
.auth-hero {
  position: relative; z-index: 1; text-align: center; color: #fff; padding: 40px;
  max-width: 520px;
}
.auth-hero h2 {
  font-size: 32px; font-weight: 600; margin-bottom: 12px; letter-spacing: .5px;
}
.auth-hero p {
  font-size: 15px; color: rgba(255,255,255,.75); margin-bottom: 40px;
}
.auth-hero-illustration {
  width: 320px; height: 260px; margin: 0 auto;
}
@media (max-width: 960px) {
  .auth-right { display: none; }
  .auth-left { min-width: auto; width: 100%; }
}

/* ===== 表单组件 ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; color: var(--s700); font-size: 13px; }
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 0 12px; height: 36px; border: 1px solid var(--s200); border-radius: var(--radius-md);
  transition: all .2s; background: #fff; color: var(--s800);
}
.form-control:hover { border-color: var(--s300); }
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,93,255,.1); }
.form-control:disabled { background: var(--s50); color: var(--s400); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 70px; height: auto; padding: 8px 12px; }
select.form-control { cursor: pointer; }
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 0 16px; height: 36px; border-radius: var(--radius-md); font-size: 14px; font-weight: 400;
  transition: all .2s; white-space: nowrap; border: 1px solid transparent; line-height: 1;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 2px 8px rgba(22,93,255,.3); }
.btn-primary:active { background: #0e42d2; transform: scale(.98); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #009a26; box-shadow: 0 2px 8px rgba(0,180,42,.3); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #d9363e; box-shadow: 0 2px 8px rgba(245,63,63,.3); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #e6690a; }
.btn-outline { background: #fff; border: 1px solid var(--s200); color: var(--s600); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-lighter); }
.btn-ghost { background: transparent; color: var(--s500); padding: 0 10px; height: auto; }
.btn-ghost:hover { background: var(--s100); color: var(--s700); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ===== 主布局 ===== */
.layout { display: flex; height: 100vh; overflow: hidden; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  background: #1d2129;
  color: #c9cdd4;
  display: flex; flex-direction: column; flex-shrink: 0; transition: width .2s;
  position: relative; z-index: 10;
}
.sidebar-header {
  padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px; height: var(--header-h);
}
.sidebar-header .logo {
  width: 32px; height: 32px; background: linear-gradient(135deg, #165dff, #4080ff); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.sidebar-header .title { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .2px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }
.nav-group-title {
  padding: 14px 20px 6px; font-size: 11px; color: #4e5969;
  letter-spacing: .5px; font-weight: 600; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 0 20px; cursor: pointer;
  font-size: 14px; color: #c9cdd4; transition: all .2s;
  height: 40px; margin: 1px 8px; border-radius: var(--radius-md);
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active {
  background: var(--primary); color: #fff;
  font-weight: 500; box-shadow: 0 2px 8px rgba(22,93,255,.3);
}
.nav-item .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }

/* 顶栏 */
.main-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.topbar {
  height: var(--header-h); background: #fff; border-bottom: 1px solid var(--s200);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0;
  box-shadow: var(--shadow-xs);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left .page-title { font-size: 16px; font-weight: 600; color: var(--s900); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right .store-badge {
  background: var(--primary-light); color: var(--primary-dark); padding: 4px 12px;
  border-radius: var(--radius); font-size: 12px; font-weight: 500;
}

/* 用户菜单下拉 */
.user-menu-wrapper { position: relative; }
.user-menu { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-md); transition: all .2s; }
.user-menu:hover { background: var(--s50); }
.user-menu .avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; font-weight: 600;
}
.user-menu .uname { font-size: 13px; color: var(--s700); font-weight: 500; }
.user-menu .urole { font-size: 11px; color: var(--s400); }
.user-dropdown {
  position: absolute; top: calc(100% + 4px); right: 0; width: 200px;
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  border: 1px solid var(--s200); overflow: hidden; z-index: 100;
  display: none;
}
.user-dropdown.show { display: block; }
.user-dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px; cursor: pointer;
  font-size: 13px; color: var(--s700); transition: all .15s;
}
.user-dropdown-item:hover { background: var(--primary-lighter); color: var(--primary); }
.user-dropdown-item .di-icon { font-size: 14px; width: 16px; text-align: center; }
.user-dropdown-divider { height: 1px; background: var(--s100); }

/* 内容区 */
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }
.content::-webkit-scrollbar { width: 6px; }
.content::-webkit-scrollbar-thumb { background: var(--s200); border-radius: 3px; }
.content::-webkit-scrollbar-thumb:hover { background: var(--s300); }

/* ===== 通用组件 ===== */
.card { background: #fff; border-radius: var(--radius-lg); border: 1px solid var(--s200); box-shadow: var(--shadow-sm); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--s100); display: flex; align-items: center; justify-content: space-between; }
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--s800); }
.card-body { padding: 20px; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h2 { font-size: 18px; font-weight: 600; color: var(--s900); }
.page-header .actions { display: flex; gap: 8px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  background: var(--s50); padding: 10px 16px; text-align: left; font-weight: 600;
  color: var(--s500); border-bottom: 1px solid var(--s200); white-space: nowrap;
  font-size: 13px;
}
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--s100); color: var(--s700); }
.data-table tr:hover td { background: var(--s50); }
.data-table .empty-row td { text-align: center; color: var(--s400); padding: 40px; }

/* 徽章 */
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius); font-size: 12px; font-weight: 400; line-height: 1.5; }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--primary-light); color: var(--primary-dark); }
.badge-gray { background: var(--s100); color: var(--s500); }

/* 工作台欢迎横幅 */
.db-banner {
  background: linear-gradient(135deg, #165dff 0%, #4080ff 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  color: #fff;
}
.db-banner::before {
  content: ''; position: absolute; top: -40px; right: -40px; width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,.15) 0%, transparent 60%); border-radius: 50%;
}
.db-banner::after {
  content: ''; position: absolute; bottom: -60px; left: 10%; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,255,255,.08) 0%, transparent 60%); border-radius: 50%;
}
.db-banner .db-banner-content { position: relative; z-index: 1; }
.db-banner .db-banner-title { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.db-banner .db-banner-subtitle { font-size: 13px; color: rgba(255,255,255,.75); }

/* 兼容旧欢迎横幅 */
.welcome-banner {
  background: linear-gradient(135deg, #e8f0ff 0%, #f2f7ff 100%);
  border: 1px solid rgba(22,93,255,.08);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.welcome-banner::after {
  content: '';
  position: absolute; top: -20px; right: -20px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(22,93,255,.06) 0%, transparent 70%);
  border-radius: 50%;
}
.welcome-banner .wb-content { position: relative; z-index: 1; }
.welcome-banner .wb-title { font-size: 20px; font-weight: 600; color: var(--s900); margin-bottom: 4px; }
.welcome-banner .wb-subtitle { font-size: 13px; color: var(--s500); }
.welcome-banner .wb-icon {
  width: 64px; height: 64px; background: rgba(22,93,255,.08); border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center; font-size: 32px;
}

/* 工作台指标总览 */
.db-metrics {
  background: linear-gradient(135deg, #165dff 0%, #4080ff 100%);
  border-radius: var(--radius-lg);
  padding: 28px 0;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: relative; overflow: hidden;
}
.db-metrics::before {
  content: ''; position: absolute; top: -60px; right: -60px; width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,.12) 0%, transparent 60%); border-radius: 50%;
}
.db-metric-item { text-align: center; color: #fff; position: relative; z-index: 1; flex: 1; }
.db-metric-item:not(:last-child) { border-right: 1px solid rgba(255,255,255,.15); }
.db-metric-item .value { font-size: 32px; font-weight: 700; margin-bottom: 6px; }
.db-metric-item .label { font-size: 13px; color: rgba(255,255,255,.8); }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--s200); border-radius: var(--radius-lg);
  padding: 20px; position: relative; overflow: hidden; transition: all .2s;
  box-shadow: var(--shadow-sm);
}
.stat-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.stat-card .stat-label { font-size: 13px; color: var(--s500); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--s900); letter-spacing: -0.5px; }
.stat-card .stat-icon-box {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  margin-bottom: 12px;
}
.stat-card .stat-icon-box.bg-blue { background: var(--primary-light); }
.stat-card .stat-icon-box.bg-green { background: var(--success-light); }
.stat-card .stat-icon-box.bg-orange { background: var(--warning-light); }
.stat-card .stat-icon-box.bg-purple { background: #f5e8ff; }
.stat-card .stat-trend { font-size: 12px; margin-top: 6px; color: var(--s400); }

/* 兼容旧 stat-icon */
.stat-card .stat-icon { position: absolute; top: 16px; right: 16px; font-size: 28px; opacity: .12; }

/* 工作台分栏 */
.db-section-title { font-size: 16px; font-weight: 600; color: var(--s900); margin-bottom: 14px; }
.db-main-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.db-quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.db-quick-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 16px 8px; border: 1px solid var(--s200); border-radius: var(--radius-md);
  cursor: pointer; transition: all .2s; background: #fff;
}
.db-quick-item:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-2px); }
.db-quick-item .icon { width: 36px; height: 36px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 18px; background: var(--primary-light); }
.db-quick-item .label { font-size: 12px; color: var(--s600); }
.db-reminder-list { display: flex; flex-direction: column; gap: 10px; }
.db-reminder-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border-radius: var(--radius-md); background: var(--s50); }
.db-reminder-item .icon { font-size: 16px; margin-top: 1px; }
.db-reminder-item .content { flex: 1; }
.db-reminder-item .title { font-size: 13px; color: var(--s800); font-weight: 500; }
.db-reminder-item .desc { font-size: 12px; color: var(--s500); margin-top: 2px; }
.db-notice-list { display: flex; flex-direction: column; gap: 8px; }
.db-notice-item { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--s600); }
.db-notice-item .tag { flex-shrink: 0; padding: 1px 6px; border-radius: var(--radius-sm); background: var(--primary-light); color: var(--primary-dark); font-size: 11px; }
@media (max-width: 960px) {
  .db-main-grid { grid-template-columns: 1fr; }
  .db-metrics { flex-wrap: wrap; gap: 16px 0; padding: 20px 0; }
  .db-metric-item { min-width: 120px; border-right: none !important; }
}

/* 模态框 */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 520px; max-width: 95vw; max-height: 90vh; display: flex; flex-direction: column; }
.modal.modal-lg { width: 820px; }
.modal.modal-xl { width: 1020px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--s100); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-header h3 { font-size: 16px; font-weight: 600; color: var(--s900); }
.modal-header .close-btn { background: none; font-size: 20px; color: var(--s400); padding: 4px; line-height: 1; border-radius: var(--radius); }
.modal-header .close-btn:hover { color: var(--s600); background: var(--s100); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--s100); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* Toast */
#toast-container { position: fixed; top: 70px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 10px 16px;
  display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 260px;
  border: 1px solid var(--s200); animation: slideIn .2s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* 搜索栏 */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.search-bar .form-control { width: auto; min-width: 180px; }
.search-bar .spacer { flex: 1; }

/* 过滤栏 - 链动小铺风格 */
.filter-bar {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--s200);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: var(--shadow-xs);
}
.filter-bar .filter-item { display: flex; align-items: center; gap: 6px; }
.filter-bar .filter-item label { font-size: 13px; color: var(--s500); white-space: nowrap; }
.filter-bar .form-control { width: auto; min-width: 160px; height: 34px; }
.filter-bar .spacer { flex: 1; }

/* 标签页 */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--s200); margin-bottom: 16px; }
.tab { padding: 8px 16px; cursor: pointer; font-size: 14px; color: var(--s500); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all .2s; font-weight: 500; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* 段控制标签页 (Segment Tabs) */
.segment-tabs {
  display: inline-flex;
  background: var(--s100);
  border-radius: var(--radius-md);
  padding: 3px;
  margin-bottom: 16px;
}
.segment-tabs .seg-tab {
  padding: 6px 16px; cursor: pointer; font-size: 13px; color: var(--s500);
  border-radius: var(--radius); transition: all .2s; font-weight: 500; border: none; background: transparent;
}
.segment-tabs .seg-tab:hover { color: var(--s700); }
.segment-tabs .seg-tab.active {
  background: #fff; color: var(--primary); font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.segment-tabs .seg-tab .count {
  display: inline-block; background: var(--s200); color: var(--s600);
  border-radius: 10px; padding: 0 6px; font-size: 11px; margin-left: 4px; line-height: 16px; height: 16px;
}
.segment-tabs .seg-tab.active .count { background: var(--primary-light); color: var(--primary-dark); }

/* 空状态 */
.empty-state { text-align: center; padding: 48px 24px; color: var(--s400); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: .2; }
.empty-state .text { font-size: 14px; }

/* 收银台特殊样式 */
.pos-layout { display: flex; gap: 16px; height: calc(100vh - var(--header-h) - 56px); }
.pos-left { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.pos-right { width: 380px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.pos-search-card { flex-shrink: 0; }
.pos-products { flex: 1; overflow-y: auto; }
.pos-cart { flex: 1; overflow-y: auto; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.product-card {
  background: #fff; border: 1px solid var(--s200); border-radius: var(--radius-md); padding: 10px;
  cursor: pointer; transition: all .2s; display: flex; gap: 10px; align-items: flex-start;
}
.product-card:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.product-avatar {
  width: 48px; height: 48px; border-radius: var(--radius-md); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; font-weight: 600; overflow: hidden;
}
.product-avatar img { width: 100%; height: 100%; object-fit: cover; }
.product-info { flex: 1; min-width: 0; }
.product-card .pname { font-size: 13px; font-weight: 600; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--s800); }
.product-card .pspec { font-size: 11px; color: var(--s400); margin-bottom: 4px; }
.product-card .pprice { font-size: 15px; font-weight: 700; color: var(--danger); }
.product-card .pstock { font-size: 11px; color: var(--s400); margin-top: 2px; }

.cart-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--s100); }
.cart-item .ci-info { flex: 1; min-width: 0; }
.cart-item .ci-name { font-size: 13px; font-weight: 600; color: var(--s800); }
.cart-item .ci-spec { font-size: 11px; color: var(--s400); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cart-item .ci-price-unit { color: var(--s600); }
.cart-item .ci-price-unit.changed { color: var(--danger); font-weight: 600; }
.cart-item .ci-original-price { text-decoration: line-through; color: var(--s300); }
.cart-item .ci-spec .btn-ghost { font-size: 11px; padding: 0 4px; height: 18px; }
.cart-item .ci-price { font-size: 13px; color: var(--danger); font-weight: 600; white-space: nowrap; }
.qty-control { display: flex; align-items: center; gap: 4px; }
.qty-control button { width: 24px; height: 24px; border-radius: var(--radius); background: var(--s100); font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.qty-control button:hover { background: var(--s200); }
.qty-control .qty-val { width: 36px; text-align: center; font-size: 13px; font-weight: 600; color: var(--s800); border: none; outline: none; }

.cart-summary { background: var(--s50); border-radius: var(--radius-md); padding: 12px; }
.cart-summary .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; color: var(--s600); }
.cart-summary .row.total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--s200); margin-top: 6px; padding-top: 8px; color: var(--danger); }

/* 开关 */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
  position: absolute; cursor: pointer; inset: 0; background: var(--s300);
  border-radius: 22px; transition: all .2s;
}
.switch-slider::before {
  content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: all .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(18px); }

/* 权限矩阵 */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.perm-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  border: 1px solid var(--s200); border-radius: var(--radius-md); font-size: 13px; cursor: pointer;
  transition: all .15s; color: var(--s700);
}
.perm-item:hover { background: var(--s50); border-color: var(--s300); }
.perm-item input { margin: 0; accent-color: var(--primary); }

/* 图片上传区域 */
.img-upload-area { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.img-preview {
  width: 80px; height: 80px; border: 1px solid var(--s200); border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--s50);
}
.img-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.img-preview .img-placeholder { font-size: 11px; color: var(--s400); text-align: center; padding: 4px; }
.img-clear-btn {
  background: var(--danger-light); color: var(--danger); border: none; padding: 4px 10px;
  border-radius: var(--radius); font-size: 12px; cursor: pointer; font-weight: 500; transition: all .15s;
}
.img-clear-btn:hover { background: var(--danger); color: #fff; }

/* 响应式 - 平板 */
@media (max-width: 1024px) {
  :root { --sidebar-w: 56px; }
  .sidebar-header .title { display: none; }
  .nav-item span:not(.icon) { display: none; }
  .nav-group-title { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .pos-right { width: 320px; }
  .user-menu .uname, .user-menu .urole { display: none; }
}
@media (max-width: 768px) {
  .pos-layout { flex-direction: column; height: auto; }
  .pos-right { width: 100%; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 12px; }
  .topbar-right .store-badge { display: none; }
  .welcome-banner .wb-icon { display: none; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .filter-bar .filter-item { width: 100%; }
  .filter-bar .form-control { width: 100%; }
}

/* 打印 */
@media print {
  .sidebar, .topbar, .pos-right, .search-bar, .page-header .actions { display: none !important; }
  .content { padding: 0; }
}

/* 小票预览 */
.receipt-preview {
  width: 58mm; margin: 0 auto; background: #fff; padding: 8px;
  font-family: 'Courier New', monospace; font-size: 12px; color: #000;
  border: 1px dashed var(--s300);
}
.receipt-preview .r-center { text-align: center; }
.receipt-preview .r-bold { font-weight: bold; }
.receipt-preview .r-row { display: flex; justify-content: space-between; }
.receipt-preview table { width: 100%; border-collapse: collapse; }
.receipt-preview td { padding: 1px 0; }
.receipt-preview img { max-width: 100%; max-height: 60px; }

/* 图表 */
.chart-container { position: relative; height: 300px; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 260px; padding: 10px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bar-chart .bar {
  width: 70%; background: linear-gradient(180deg, #4080ff, #165dff); border-radius: var(--radius) var(--radius) 0 0; min-height: 2px;
  transition: height .3s; position: relative;
}
.bar-chart .bar:hover { opacity: .85; }
.bar-chart .bar-label { font-size: 11px; color: var(--s500); }
.bar-chart .bar-value { font-size: 10px; color: var(--s600); font-weight: 600; }

/* 分页 */
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; }
.pagination button {
  min-width: 32px; height: 32px; border-radius: var(--radius); border: 1px solid var(--s200);
  background: #fff; font-size: 13px; transition: all .15s; color: var(--s600);
}
.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }
.pagination .page-info { font-size: 13px; color: var(--s500); margin-left: 12px; }

/* 加载状态 */
.loading { text-align: center; padding: 40px; color: var(--s400); }
.spinner { display: inline-block; width: 28px; height: 28px; border: 2px solid var(--s200); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 描述列表 */
.desc-list { display: grid; grid-template-columns: 120px 1fr; gap: 10px 16px; font-size: 13px; }
.desc-list dt { color: var(--s500); text-align: right; font-weight: 500; }
.desc-list dd { color: var(--s800); }

/* 门店概览卡片 */
.store-overview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.store-overview-card {
  background: #fff; border: 1px solid var(--s200); border-radius: var(--radius-lg);
  padding: 20px; transition: all .2s; box-shadow: var(--shadow-sm);
}
.store-overview-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.store-overview-card .so-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.store-overview-card .so-name { font-size: 16px; font-weight: 600; color: var(--s900); }
.store-overview-card .so-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.store-overview-card .so-stat { text-align: center; padding: 12px; background: var(--s50); border-radius: var(--radius-md); }
.store-overview-card .so-stat .sos-label { font-size: 12px; color: var(--s500); margin-bottom: 4px; }
.store-overview-card .so-stat .sos-value { font-size: 20px; font-weight: 700; color: var(--s800); }
.store-overview-card .so-footer { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--s100); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--s500); }

/* 收款二维码预览 */
.pay-qr-preview { display: flex; gap: 16px; margin-top: 12px; }
.pay-qr-item { text-align: center; }
.pay-qr-item .qr-img { width: 100px; height: 100px; border: 1px solid var(--s200); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--s50); }
.pay-qr-item .qr-img img { max-width: 100%; max-height: 100%; }
.pay-qr-item .qr-label { font-size: 12px; color: var(--s500); margin-top: 6px; }

/* 订单状态标签 */
.order-status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; }
.order-status .dot { width: 6px; height: 6px; border-radius: 50%; }
.order-status.completed .dot { background: var(--success); }
.order-status.unpaid .dot { background: var(--warning); }
.order-status.refunded .dot { background: var(--s400); }

/* 订单商品摘要 */
.order-goods-summary { display: flex; align-items: center; gap: 8px; }
.order-goods-summary .goods-thumb {
  width: 36px; height: 36px; border-radius: var(--radius); background: var(--s100);
  display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0;
  overflow: hidden;
}
.order-goods-summary .goods-thumb img { width: 100%; height: 100%; object-fit: cover; }
.order-goods-summary .goods-info { min-width: 0; }
.order-goods-summary .goods-name { font-size: 13px; color: var(--s800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.order-goods-summary .goods-count { font-size: 11px; color: var(--s400); }

/* 订单详情 */
.order-detail-section { margin-bottom: 20px; }
.order-detail-section .section-title { font-size: 14px; font-weight: 600; color: var(--s800); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--s100); }
.order-detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.order-detail-table th { background: var(--s50); padding: 8px 12px; text-align: left; font-weight: 600; color: var(--s500); }
.order-detail-table td { padding: 8px 12px; border-bottom: 1px solid var(--s100); color: var(--s700); }
.order-detail-summary { display: flex; justify-content: flex-end; gap: 24px; padding-top: 12px; }
.order-detail-summary .summary-item { text-align: right; }
.order-detail-summary .summary-label { font-size: 12px; color: var(--s500); }
.order-detail-summary .summary-value { font-size: 16px; font-weight: 700; color: var(--danger); }
