/* 陪陪管理后台 · 基础样式（自研，不依赖第三方 UI 库） */
:root {
  --brand: #f76811;
  --brand-soft: #fff4ec;
  --brand-deep: #c9500c;
  --bg: #f5f7fb;
  --card: #ffffff;
  --line: #e8edf6;
  --ink: #1f2d3d;
  --ink-2: #55637a;
  --muted: #8b97a8;
  --green: #12b76a;
  --green-soft: #e7f8ef;
  --orange: #f79009;
  --orange-soft: #fff4e5;
  --red: #f04438;
  --red-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(31, 45, 61, 0.04), 0 8px 24px rgba(31, 45, 61, 0.04);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, #ffa15c, #f97316); color: #fff; font-weight: 700; font-size: 15px;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); }

.nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px;
  color: var(--ink-2); cursor: pointer; font-size: 13.5px; margin-bottom: 2px; user-select: none;
}
.nav-item:hover { background: #f7f9fd; }
.nav-item.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; }
.nav-badge { margin-left: auto; font-size: 11px; background: #fff1f0; color: var(--red); padding: 0 6px; border-radius: 9px; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); }
.who { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 22px; gap: 12px; position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 15px; }
.topbar .spacer { flex: 1; }
.tenant-pill { font-size: 12px; color: var(--ink-2); background: #f4f7fc; padding: 4px 10px; border-radius: 20px; }
.content { padding: 20px 22px 40px; }

/* ---------- 通用组件 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid.c2, .grid.c4 { grid-template-columns: 1fr; } .sidebar { display: none; } }

.stat { padding: 16px 18px; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 700; margin-top: 6px; letter-spacing: .5px; }
.stat-hint { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.stat-value.brand { color: var(--brand-deep); }
.stat-value.green { color: var(--green); }
.stat-value.orange { color: var(--orange); }
.stat-value.red { color: var(--red); }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 13px; color: var(--ink-2);
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: #cfd9ec; color: var(--ink); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-deep); }
.btn.ghost { background: var(--brand-soft); border-color: transparent; color: var(--brand-deep); }
.btn.danger { color: var(--red); border-color: #f7c9c4; background: #fff; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink-2);
  border: 1px solid transparent;
}
.tab:hover { background: #f4f7fc; }
.tab.active { background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.tab .count { margin-left: 6px; font-size: 11.5px; background: #eef2f9; border-radius: 8px; padding: 0 6px; color: var(--ink-2); }
.tab.active .count { background: #ffe4cf; color: var(--brand-deep); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--ink-2); }
.input, .select, textarea.input {
  padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; outline: none;
  transition: .15s; min-width: 0;
}
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(249,115,22,.15); }
.input::placeholder { color: #b3bdcc; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: #fafbfe; }
tbody tr:hover { background: #fafcff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; line-height: 18px; }
.tag.gray { background: #f2f5fa; color: var(--ink-2); }
.tag.blue { background: var(--brand-soft); color: var(--brand-deep); }
.tag.green { background: var(--green-soft); color: #087443; }
.tag.orange { background: var(--orange-soft); color: #b54708; }
.tag.red { background: var(--red-soft); color: #b42318; }

.money { font-variant-numeric: tabular-nums; }
.money.in { color: var(--green); }
.money.out { color: var(--red); }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(20, 30, 48, .45); display: flex; align-items: flex-start;
  justify-content: center; padding: 48px 16px; z-index: 100; overflow-y: auto;
}
.modal { width: 100%; max-width: 720px; background: #fff; border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .25); }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; }
.modal-head .x { margin-left: auto; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; }
.modal-body { padding: 18px 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }

/* 分账明细 */
.breakdown { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.breakdown-row { display: grid; grid-template-columns: 300px 1fr; gap: 10px; padding: 9px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.breakdown-row:last-child { border-bottom: 0; }
.breakdown-row .f { color: var(--ink-2); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.breakdown-row .note { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }

.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 0%, #fff1e3 0%, #fdf7f2 55%, #fffaf6 100%); }
.login-card { width: 380px; background: #fff; border-radius: 16px; box-shadow: 0 24px 70px rgba(31, 45, 61, .12); padding: 30px 28px; }
.login-card h1 { font-size: 20px; margin-bottom: 4px; }
.login-card p.sub { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.role-switch { display: flex; gap: 8px; margin-bottom: 16px; }
.role-switch .r {
  flex: 1; text-align: center; padding: 8px; border-radius: 9px; border: 1px solid var(--line);
  cursor: pointer; font-size: 13px; color: var(--ink-2);
}
.role-switch .r.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); font-weight: 600; }
.login-hint { margin-top: 14px; font-size: 12px; color: var(--muted); line-height: 1.8; background: #f8faff; border: 1px dashed #d8e2f7; border-radius: 9px; padding: 10px 12px; }
.err { color: var(--red); font-size: 12.5px; min-height: 18px; }

/* ---------- 提示 ---------- */
.toast-wrap { position: fixed; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 10px; padding: 10px 14px; font-size: 13px; min-width: 200px; }
.toast.ok { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }

.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, #eef2f8, #f7f9fd, #eef2f8); background-size: 200% 100%; animation: sk 1.2s infinite; }
@keyframes sk { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }

/* 开关 */
.switch { position: relative; display: inline-flex; width: 44px; height: 24px; flex: 0 0 44px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch::before { content: ''; position: absolute; inset: 0; background: #e2e8f3; border-radius: 22px; transition: .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: .2s; }
.switch:has(input:checked)::before { background: var(--brand); }
.switch:has(input:checked)::after { transform: translateX(20px); }

/* 品牌 logo */
.login-logo { width: 210px; height: auto; display: block; margin: 0 0 10px; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; flex: 0 0 34px; }
.color-dot{display:inline-block;width:22px;height:22px;border-radius:50%;border:1px solid var(--line);cursor:pointer}

