/* 店管家账单查重 - 共用样式 */
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #f4f7fb;
  color: #172033;
  font-size: 14px;
}

/* ===== 应用骨架：左菜单 + 顶部功能区 + 主数据区 ===== */
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: 232px;
  background: #ffffff;
  border-right: 1px solid #e5eaf2;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(31, 45, 75, 0.035);
}
.sidebar-brand {
  height: 74px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #eef1f6;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3668f4, #6688ff);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 5px 12px rgba(54, 104, 244, 0.22);
}
.brand-copy { min-width: 0; }
.brand-copy strong { display: block; font-size: 16px; color: #172033; letter-spacing: .3px; }
.brand-copy span { display: block; margin-top: 3px; color: #9aa4b5; font-size: 10px; letter-spacing: .5px; }

.sidebar-section-title {
  padding: 23px 20px 8px;
  color: #a3adbd;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
}
.sidebar-nav { padding: 0 10px; }
.sidebar-nav a {
  position: relative;
  min-height: 55px;
  padding: 9px 11px;
  margin: 3px 0;
  border-radius: 9px;
  color: #536075;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .15s, color .15s, transform .15s;
}
.sidebar-nav a:hover { background: #f4f7ff; color: #315ee8; transform: translateX(1px); }
.sidebar-nav a.active { background: #eaf0ff; color: #2859e4; }
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #3768f4;
}
.nav-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #f3f6fb;
  font-size: 14px;
  flex: 0 0 auto;
}
.sidebar-nav a.active .nav-icon { background: #fff; box-shadow: 0 2px 8px rgba(55, 104, 244, .12); }
.nav-copy { min-width: 0; }
.nav-copy strong { display: block; font-size: 13px; line-height: 1.25; }
.nav-copy small { display: block; margin-top: 4px; color: #a1aaba; font-size: 10px; white-space: nowrap; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px;
  border-top: 1px solid #eef1f6;
}
.store-account {
  margin-bottom: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f0fbf6;
  color: #277759;
  font-size: 11px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #20b37a; }
.sidebar-user-row { display: flex; align-items: center; gap: 9px; }
.user-avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #edf2ff;
  color: #3768f4;
  font-weight: 700;
}
.sidebar-user-copy { min-width: 0; flex: 1; }
.sidebar-user-copy strong { display: block; overflow: hidden; color: #263249; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-user-copy span { display: block; margin-top: 2px; color: #a1aaba; font-size: 10px; }
.sidebar .logout {
  padding: 5px;
  color: #9aa4b5;
  cursor: pointer;
  font-size: 11px;
  background: none;
  border: none;
}
.sidebar .logout:hover { color: #ef5350; }

.workspace {
  width: calc(100% - 232px);
  min-height: 100vh;
  margin-left: 232px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.workspace-header {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 78px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid #e5eaf2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  backdrop-filter: blur(8px);
}
.page-heading { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-heading-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 9px;
  background: #f0f4ff;
  color: #3768f4;
  font-size: 17px;
}
.page-heading h1 { margin: 0; color: #172033; font-size: 18px; line-height: 1.25; }
.page-heading p { margin: 5px 0 0; color: #8792a5; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

/* 顶部状态条 - 店管家绑定状态 */
.binding-bar {
  padding: 8px 22px;
  min-height: 38px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, .04);
}
.binding-bar.ok { background: #d1fae5; color: #065f46; }
.binding-bar.warn { background: #fef3c7; color: #92400e; }
.binding-bar.danger { background: #fee2e2; color: #991b1b; }
.binding-bar button {
  margin-left: auto;
  padding: 6px 14px;
  border: 1px solid currentColor;
  background: transparent;
  border-radius: 4px;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
}
.binding-bar button.primary {
  background: #4760ff;
  color: #fff;
  border-color: #4760ff;
}

/* 主体 */
.main {
  width: 100%;
  padding: 18px 20px 26px;
  flex: 1;
  min-width: 0;
}
.page { min-width: 0; }

/* 数据展示区始终占据主视觉，空数据时也保留完整面板 */
#dup-list > .card.center {
  min-height: calc(100vh - 345px);
  display: flex;
  align-items: center;
  justify-content: center;
}
#page-bills > .card { min-height: calc(100vh - 205px); }
#of-list { min-height: 260px; }

/* 卡片 */
.card {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  margin-bottom: 16px;
}
.card-title { font-size: 16px; font-weight: 600; margin: 0 0 14px 0; }

/* 按钮 */
.btn {
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: #1f2235;
  font-size: 14px;
}
.btn:hover { background: #f3f4f6; }
.btn-primary {
  background: #4760ff;
  color: #fff;
  border-color: #4760ff;
  font-weight: 600;
}
.btn-primary:hover { background: #3b50d0; }
.btn-primary:disabled {
  background: #9ca3af;
  border-color: #9ca3af;
  cursor: not-allowed;
}

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  color: #6b7280;
  font-size: 13px;
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
}
.form-group input:focus {
  outline: none;
  border-color: #4760ff;
}

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 12px;
  color: #6b7280;
  font-weight: 500;
  border-bottom: 2px solid #e5e7eb;
  background: #fafbfc;
  font-size: 12px;
}
td {
  padding: 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
tr:hover td { background: #fafbfc; }
tr.dup-row td { background: #fff5f5; }

/* 状态徽标 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-gray { background: #e5e7eb; color: #6b7280; }

/* 模态/弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}
.modal h2 { margin: 0 0 16px 0; font-size: 18px; }
.modal-close {
  float: right;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
}

/* 扫码弹窗：按截图原始比例展示，不能把二维码硬拉成正方形。 */
.qr-stage {
  width: 280px;
  min-height: 240px;
  max-height: 320px;
  margin: 16px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f5f6fa;
}
.qr-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 318px;
  object-fit: contain;
  image-rendering: auto;
}

/* utility */
.muted { color: #9ca3af; }
.text-sm { font-size: 12px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* 占位区(WIP) */
.placeholder {
  padding: 60px 24px;
  text-align: center;
  color: #9ca3af;
}
.placeholder h3 { color: #6b7280; margin: 0 0 8px 0; }

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: 100%;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #e5eaf2;
  }
  .sidebar-brand { height: 62px; }
  .sidebar-section-title { display: none; }
  .sidebar-nav { display: flex; gap: 4px; padding: 7px 10px 0; overflow-x: auto; }
  .sidebar-nav + .sidebar-section-title + .sidebar-nav { padding-top: 0; padding-bottom: 7px; }
  .sidebar-nav a { min-width: max-content; min-height: 42px; margin: 0; padding: 7px 10px; }
  .sidebar-nav a.active::before { display: none; }
  .nav-copy small { display: none; }
  .sidebar-footer { display: none; }
  .workspace { width: 100%; margin-left: 0; }
  .workspace-header { min-height: 68px; padding: 12px 14px; }
  .page-heading p { display: none; }
  .page-heading-icon { width: 34px; height: 34px; }
  .header-actions .btn { padding: 7px 10px; font-size: 12px; }
  .main { padding: 14px; }
  #dup-list > .card.center,
  #page-bills > .card { min-height: 280px; }
}

@media (max-width: 620px) {
  .brand-copy span, #header-bind-btn { display: none; }
  .workspace-header { align-items: center; }
  .page-heading h1 { font-size: 16px; }
  .binding-bar { padding: 8px 12px; }
}
