/* 古物商台帐系统 — 左侧菜单 + 满屏布局 */
:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --ink: #1a1a2e;
  --mid: #3a3a5c;
  --muted: #8a8aaa;
  --border: #e5e7eb;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --green: #16a34a;
  --green-light: #f0fdf4;
  --red: #dc2626;
  --red-light: #fef2f2;
  --amber: #d97706;
  --amber-light: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06);
  --sidebar-w: 232px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }
body {
  font-family: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.7;
}
button { font-family: inherit; cursor: pointer; border: none; background: none }
input, select, textarea { font-family: inherit; font-size: 15px }
a { color: var(--accent); text-decoration: none }

/* ══ 左侧菜单 ══ */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w);
  background: #fff; border-right: 1px solid #eaecf0;
  display: flex; flex-direction: column; z-index: 200; overflow-y: auto;
  box-shadow: 2px 0 8px rgba(0,0,0,.03);
}
.sidebar-brand {
  padding: 22px 20px 18px; flex-shrink: 0; border-bottom: 1px solid #eaecf0;
}
.sidebar-brand a {
  color: var(--accent); font-size: 18px; font-weight: 800; letter-spacing: -.3px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-brand a::before {
  content: ''; display: block; width: 8px; height: 8px; border-radius: 2px;
  background: var(--accent); flex-shrink: 0;
}
.sidebar-nav { flex: 1; padding: 6px 0; display: flex; flex-direction: column; gap: 0 }

/* 分组 */
.nav-group { margin-bottom: 0 }
.nav-group-header {
  padding: 7px 14px; margin: 2px 8px; border-radius: 6px;
  background: #e8f0fe; user-select: none;
}
.nav-group-label {
  font-size: 14px; font-weight: 700; color: #3b7dd8;
}

/* 菜单项 */
.nav-group-items { display: flex; flex-direction: column; gap: 0; padding: 2px 0 4px }
.sidebar-nav a {
  display: block;
  padding: 6px 16px 6px 28px; font-size: 13px; font-weight: 500;
  color: #475467; transition: all .12s; white-space: nowrap;
  position: relative; text-decoration: none; margin: 0 8px; border-radius: 5px;
}
.sidebar-nav a:hover {
  background: #eaecf0; color: #1d2939;
}
.sidebar-nav a.active {
  background: #eaecf0; color: #1d2939; font-weight: 700;
}

/* 分隔线 */
.sidebar-nav .sep { height: 1px; background: var(--border); margin: 8px 4px }

/* Footer */
.sidebar-footer {
  padding: 14px 16px; border-top: 1px solid #eaecf0; flex-shrink: 0;
  background: #fafbfc;
}
.sidebar-user {
  font-size: 13px; font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-user::before {
  content: ''; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  flex-shrink: 0;
}
.sidebar-user .role {
  font-size: 10px; color: #fff; font-weight: 700; background: var(--accent);
  padding: 1px 6px; border-radius: 3px; margin-left: auto;
}
.sidebar-actions { display: flex; flex-direction: column; gap: 6px }

/* 语言切换 */
.lang-btn {
  padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface); color: var(--mid);
  cursor: pointer; text-align: center; width: 100%;
}
.lang-btn:hover { border-color: var(--accent); color: var(--accent) }
.lang-btn.police-mode { background: #dc2626; color: #fff; border-color: #dc2626; animation: pulse 2s infinite }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.7} }

/* 移动端汉堡 */
.hamburger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 210;
  padding: 8px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; box-shadow: var(--shadow);
}
.hamburger span { display: block; width: 20px; height: 2px; background: var(--ink); margin: 4px 0; border-radius: 2px }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 190 }

/* ══ 主内容区 ══ */
.main-content { margin-left: var(--sidebar-w); min-height: 100vh; }
.container { max-width: 100%; padding: 24px 32px }
.page-title { font-size: 24px; font-weight: 800; margin-bottom: 6px }
.page-sub { font-size: 14px; color: var(--muted); margin-bottom: 24px }

/* ── 卡片 ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}

/* ── 统计卡片 ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center }
.stat-card .num { font-size: 26px; font-weight: 800 }
.stat-card .num.blue { color: var(--accent) }
.stat-card .num.green { color: var(--green) }
.stat-card .num.red { color: var(--red) }
.stat-card .num.amber { color: var(--amber) }
.stat-card .label { font-size: 12px; color: var(--muted); margin-top: 4px }

/* ── 徽章 ── */
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 12px; border-radius: 20px }
.badge-instock { background: var(--green-light); color: var(--green) }
.badge-sold { background: var(--accent-light); color: var(--accent) }
.badge-auction { background: var(--green-light); color: var(--green) }
.badge-company { background: var(--accent-light); color: var(--accent) }
.badge-individual { background: var(--amber-light); color: var(--amber) }
.badge-initial { background: #f0f4ff; color: #6366f1 }

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 700;
  transition: all .15s; cursor: pointer; border: none;
}
.btn-primary { background: var(--accent); color: #fff }
.btn-primary:hover { background: #1d4ed8 }
.btn-success { background: var(--green); color: #fff }
.btn-success:hover { background: #15803d }
.btn-danger { background: var(--red); color: #fff }
.btn-danger:hover { background: #b91c1c }
.btn-outline { background: var(--surface); color: var(--mid); border: 1px solid var(--border) }
.btn-outline:hover { border-color: var(--accent); color: var(--accent) }
.btn-sm { padding: 6px 14px; font-size: 13px }
.btn-lg { padding: 14px 28px; font-size: 16px }

/* ── 表格 ── */
.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden }
.data-table thead th {
  background: var(--bg); padding: 10px 14px; text-align: left;
  font-size: 12px; font-weight: 700; color: var(--muted); border-bottom: 2px solid var(--border); white-space: nowrap;
}
.data-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 14px; vertical-align: middle }
.data-table tbody tr:hover { background: #fafbff }
.data-table tbody tr:last-child td { border-bottom: none }

/* ── 表单 ── */
.form-section { margin-bottom: 24px }
.form-section-title {
  font-size: 16px; font-weight: 700; margin-bottom: 14px;
  padding-bottom: 10px; border-bottom: 2px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px }
.form-field { display: flex; flex-direction: column; gap: 4px }
.form-field.full { grid-column: 1 / -1 }
.form-field label { font-size: 13px; font-weight: 700; color: var(--mid) }
.form-field label .req { color: var(--red); margin-left: 2px }
.form-field input, .form-field select, .form-field textarea {
  padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; transition: border-color .15s; background: var(--surface);
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-field textarea { resize: vertical; min-height: 60px }
.form-field .hint { font-size: 12px; color: var(--muted) }

/* 渠道切换 Tab */
.channel-tabs {
  display: flex; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 16px;
}
.channel-tab {
  flex: 1; padding: 12px; text-align: center; font-size: 14px; font-weight: 700;
  cursor: pointer; background: var(--bg); color: var(--muted); transition: all .15s;
  border-right: 1px solid var(--border);
}
.channel-tab:last-child { border-right: none }
.channel-tab.active { background: var(--accent); color: #fff }
.channel-tab:hover:not(.active) { background: var(--accent-light); color: var(--accent) }
.ch-panel { display: none }
.ch-panel.active { display: block }

/* ── 提示框 ── */
.hint-box { padding: 14px 18px; border-radius: var(--radius); font-size: 14px; line-height: 1.8; margin-bottom: 16px }
.hint-green { background: var(--green-light); border-left: 4px solid var(--green); color: #166534 }
.hint-blue { background: var(--accent-light); border-left: 4px solid var(--accent); color: #1e40af }
.hint-amber { background: var(--amber-light); border-left: 4px solid var(--amber); color: #92400e }
.hint-red { background: var(--red-light); border-left: 4px solid var(--red); color: #991b1b }

/* ── 详情页 ── */
.detail-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 16px }
.detail-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border) }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 28px }
.detail-item { font-size: 14px; line-height: 1.9 }
.detail-item .dl { color: var(--muted); font-size: 12px; font-weight: 700 }
.detail-item .dv { font-weight: 600 }

/* 证件照模糊遮罩 */
.photo-blurred { filter: blur(20px); transition: filter .3s; cursor: not-allowed; border-radius: 8px }
.photo-blurred.revealed { filter: none; cursor: default }
.photo-reveal-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; background: var(--surface); color: var(--mid);
}
.photo-reveal-btn:hover { border-color: var(--accent); color: var(--accent) }

/* ── 审计日志 ── */
.audit-row { padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 1.8 }
.audit-time { color: var(--muted); margin-right: 10px; font-size: 13px }
.audit-action { font-weight: 700; margin-right: 10px }
.audit-ip { font-size: 12px; color: var(--muted); margin-left: 8px }

/* ── Modal ── */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4);
  z-index: 300; justify-content: center; align-items: flex-start; padding: 40px 16px; overflow-y: auto;
}
.modal-overlay.open { display: flex }
.modal-box {
  background: var(--surface); border-radius: 14px; padding: 32px;
  width: 100%; max-width: 640px; box-shadow: 0 16px 48px rgba(0,0,0,.15);
}
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 20px }

/* ── 响应式：移动端收起侧栏 ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s }
  .sidebar.open { transform: translateX(0) }
  .sidebar-overlay.open { display: block }
  .hamburger { display: block }
  .main-content { margin-left: 0 }
  .container { padding: 16px; padding-top: 56px }
  .form-grid { grid-template-columns: 1fr }
  .stats-row { grid-template-columns: repeat(2, 1fr) }
}

/* ── 立入检查模式 ── */
body.police-mode .hide-on-inspect { display: none !important }
body.police-mode .sidebar { border-right-color: var(--red) }
body.police-mode .sidebar-brand { color: var(--red) }

/* ── 打印 ── */
@media print {
  .sidebar, .hamburger, .sidebar-overlay, .btn, .no-print { display: none !important }
  .main-content { margin-left: 0 }
  body { background: #fff; padding: 0 }
  .container { max-width: 100%; padding: 0 }
}
