:root {
  --brand: #8A4B1E;
  --brand-deep: #6A3814;
  --brand-soft: #F4E7D9;
  --gold: #C89B4A;
  --ink: #2A211A;
  --ink-2: #5B4C3E;
  --muted: #93826E;
  --line: #EADFCC;
  --sand: #EFE6D6;
  --bg: #F5F0E6;
  --ok: #2E7D5B;
  --warn: #B26A00;
  --err: #B3352B;
  --radius: 14px;
  --shadow: 0 6px 22px rgba(90, 58, 26, .08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex: 0 0 218px;
  background: linear-gradient(180deg, #2A211A, #3B2C20);
  color: #E7DCCB; padding: 22px 14px; position: fixed; top: 0; bottom: 0; left: 0;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 14px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #C89B4A, #8A4B1E); display: grid; place-items: center; color: #fff; font-weight: 700; }
.brand-name { font-size: 15px; font-weight: 600; color: #fff; letter-spacing: 1px; }
.brand-sub { font-size: 11px; color: rgba(231,220,203,.6); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: rgba(231,220,203,.78); cursor: pointer; font-size: 14px; margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.on { background: linear-gradient(135deg, rgba(200,155,74,.32), rgba(138,75,30,.32)); color: #fff; box-shadow: inset 0 0 0 1px rgba(200,155,74,.35); }
.nav-item .ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-foot { position: absolute; bottom: 16px; left: 14px; right: 14px; font-size: 12px; color: rgba(231,220,203,.45); }

.main { flex: 1; margin-left: 218px; min-width: 0; }
.topbar {
  height: 58px; background: rgba(255,253,249,.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 600; margin: 0; }
.userbox { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-soft); display: grid; place-items: center; color: var(--brand-deep); font-weight: 600; }
.content { padding: 22px; }

/* ---------- 卡片 / 统计 ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 26px; font-weight: 700; color: var(--ink); margin-top: 4px; letter-spacing: .5px; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 18px; }
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 15px; margin: 0; font-weight: 600; }
.panel-body { padding: 16px 18px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.table th { background: #FBF7EF; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #FDFAF4; }
.table .thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--sand); }
.nowrap { white-space: nowrap; }
.empty { padding: 46px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 控件 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2); cursor: pointer; font-size: 13px;
  transition: all .15s;
}
.btn:hover { border-color: var(--gold); color: var(--brand-deep); }
.btn.primary { background: linear-gradient(135deg, #A75C26, #7A4016); border-color: transparent; color: #fff; box-shadow: 0 4px 12px rgba(122,64,22,.22); }
.btn.primary:hover { color: #fff; filter: brightness(1.06); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); border-color: rgba(179,53,43,.3); }
.btn.danger:hover { background: rgba(179,53,43,.06); border-color: var(--err); color: var(--err); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select, textarea.input {
  width: 100%; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px;
  background: #FFFDF9; font-size: 13px; color: var(--ink); outline: none; font-family: inherit;
}
.input:focus, .select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200,155,74,.14); }
textarea.input { min-height: 84px; resize: vertical; }
.field { margin-bottom: 14px; }
.field > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--brand-soft); color: var(--brand-deep); }
.badge.ok { background: rgba(46,125,91,.12); color: var(--ok); }
.badge.warn { background: rgba(178,106,0,.12); color: var(--warn); }
.badge.err { background: rgba(179,53,43,.12); color: var(--err); }
.badge.gray { background: #F0EBE2; color: var(--muted); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .input, .toolbar .select { width: auto; min-width: 150px; }
.spacer { flex: 1; }

/* ---------- 弹层 ---------- */
.mask { position: fixed; inset: 0; background: rgba(42,33,26,.5); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 16px; width: 560px; max-width: 100%; max-height: 86vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.24); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.close { cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }

.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%);
  background: rgba(42,33,26,.94); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, #F9F2E5, #EFE6D6 60%, #E7DCC8); }
.login-card { width: 380px; background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 50px rgba(90,58,26,.12); padding: 32px 30px; }
.login-card h2 { margin: 0 0 4px; font-size: 20px; }
.login-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--muted); background: #FBF7EF; border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; }

.imgs { display: flex; gap: 6px; flex-wrap: wrap; }
.imgs img { width: 46px; height: 46px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: #F6F1E7; color: var(--ink-2); }
.muted { color: var(--muted); }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding: 12px 18px; font-size: 13px; color: var(--muted); }
