/* 首页、商户列表、账簿余额等页面的公共样式 */
:root {
  --bg: #f6f7f9; --panel: #fff; --border: #dde1e6; --text: #1d2329; --muted: #6b7480;
  --accent: #2f6fde; --accent-text: #fff; --accent-soft: #eef4fe;
  --err: #c53030; --err-bg: #fdf0f0;
  --ok: #217a3c; --ok-bg: #edf8f0;
  --head-bg: #f1f3f6; --row-hover: #f7f9fc;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171b; --panel: #1c2026; --border: #2e343c; --text: #e3e6ea; --muted: #8b949e;
    --accent: #5b8ff0; --accent-text: #0d1117; --accent-soft: #1b2433;
    --err: #f47067; --err-bg: #2d1a1a;
    --ok: #57c47a; --ok-bg: #16281c;
    --head-bg: #232830; --row-hover: #20252c;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.6 -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); }

/* 顶部导航 */
.app-header { display: flex; align-items: center; gap: 20px; padding: 0 16px; min-height: 52px; background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.app-header .brand { font-weight: 700; font-size: 15px; color: var(--text); text-decoration: none; white-space: nowrap; }
.app-header nav { display: flex; gap: 4px; flex-wrap: wrap; }
.app-header nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; white-space: nowrap; }
.app-header nav a:hover { color: var(--text); background: var(--head-bg); }
.app-header nav a.active { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.app-header .user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: var(--muted); }

.btn { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.btn:disabled { opacity: .6; cursor: default; }

main { max-width: 1280px; margin: 0 auto; padding: 16px; }
.page-title { font-size: 18px; margin: 4px 0 12px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.toolbar input { flex: 1 1 260px; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; }
.toolbar input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.summary { color: var(--muted); margin: 0 0 8px; min-height: 22px; }
.notice { border-radius: 6px; padding: 8px 12px; margin-bottom: 10px; background: var(--accent-soft); }
.notice.error { background: var(--err-bg); color: var(--err); }
.notice.success { background: var(--ok-bg); color: var(--ok); }

/* 表单 */
.form { max-width: 560px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 16px; display: grid; gap: 14px; }
.form label { display: grid; gap: 4px; font-weight: 600; }
.form label .hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.form input, .form select { width: 100%; min-width: 0; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; font-weight: 400; }
.form input:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form .actions { display: flex; gap: 8px; }
.form h2 { font-size: 15px; margin: 0; }
.form .hint { color: var(--muted); font-size: 12px; margin: 0; }
.section { margin-top: 20px; }
.switch { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; cursor: pointer; padding: 6px 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel); }
.toolbar .switch input, .switch input { flex: none; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
.switch { white-space: nowrap; }
.btn.small { padding: 2px 8px; font-size: 13px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); }
.table-wrap td.ops { display: flex; gap: 6px; }

/* 数据表格 */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.table-wrap table { border-collapse: collapse; width: 100%; }
.table-wrap th, .table-wrap td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; white-space: nowrap; }
.table-wrap th { background: var(--head-bg); font-weight: 600; }
.table-wrap tbody tr:last-child td { border-bottom: none; }
.table-wrap tbody tr:hover td { background: var(--row-hover); }
.table-wrap td.num, .table-wrap th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap th button.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.table-wrap th button.sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.table-wrap th button.sort .arrow { color: var(--muted); font-size: 11px; }
.table-wrap th button.sort.active, .table-wrap th button.sort.active .arrow { color: var(--accent); }
.table-wrap .empty-row td { text-align: center; color: var(--muted); padding: 32px 12px; }

/* 首页菜单 */
.menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.menu a { display: block; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px; text-decoration: none; color: var(--text); }
.menu a:hover { border-color: var(--accent); }
.menu .title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.menu .desc { color: var(--muted); }

@media (max-width: 640px) {
  .app-header { gap: 8px; padding: 8px 16px; }
  .app-header .user { margin-left: 0; width: 100%; justify-content: space-between; }
}
