/* 在山在野合伙人系统 — 样式
   依据 DESIGN.md 第三章令牌 / 第四章组件规范 */

:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --surface-2: #f5f1ec;
  --line: #e8e1d8;
  --brand: #c49a6c;
  --brand-dk: #a97f52;
  --brand-lt: #f0e4d6;
  --ink: #2b2622;
  --ink-2: #7a716a;
  --ink-3: #a99e94;
  --pos: #4a7c59;
  --neg: #b5533f;
  --warn: #c08a2e;
  --info: #4a6b8a;
  --shadow: 0 1px 2px rgba(43, 38, 34, .04);
  --shadow-lg: 0 8px 24px rgba(43, 38, 34, .12);
  --radius: 12px;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --serif: Georgia, "Songti SC", "Noto Serif SC", serif;
  --sidebar-w: 224px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }

/* ══════════ 登录页 ══════════ */

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 500px at 50% -10%, #f3e7d8 0%, transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px 28px;
  box-shadow: 0 12px 40px rgba(43, 38, 34, .07);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-mark,
.sidebar-mark {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 21px;
  flex: none;
}

.login-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .02em;
}

.login-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: .04em;
}

.login-error {
  background: #fdf2f0;
  border: 1px solid #f0cdc5;
  color: var(--neg);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

.login-form { display: flex; flex-direction: column; gap: 16px; }

.login-foot {
  margin: 22px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--ink-3);
}

/* ══════════ 布局 ══════════ */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 18px;
}

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-brand-text strong { font-family: var(--serif); font-size: 15px; letter-spacing: .03em; }
.sidebar-brand-text span { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }

.nav { flex: 1; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 13.5px;
  border: none;
  background: none;
  text-align: left;
  width: 100%;
  font-family: inherit;
  position: relative;
  transition: background .14s, color .14s;
}

.nav-item:hover { background: rgba(196, 154, 108, .1); color: var(--ink); }
.nav-item.active { background: var(--surface); color: var(--brand-dk); font-weight: 500; box-shadow: var(--shadow); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}
.nav-item svg { flex: none; opacity: .85; }

.sidebar-user {
  border-top: 1px solid var(--line);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-lt);
  color: var(--brand-dk);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex: none;
}

.sidebar-user-info { min-width: 0; flex: 1; }
.sidebar-user-info strong { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-info span { font-size: 11px; color: var(--ink-3); }

.main {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-title { font-family: var(--serif); font-size: 18px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.menu-btn { display: none; }

.content {
  flex: 1;
  padding: 28px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

.sidebar-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 34, .4);
  z-index: 25;
}

/* ══════════ 通用组件 ══════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.card-title { font-family: var(--serif); font-size: 15px; font-weight: 600; }
.card-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .14s, border-color .14s, color .14s;
  white-space: nowrap;
}

.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dk); border-color: var(--brand-dk); }
.btn.danger { color: var(--neg); border-color: #e8c4bb; }
.btn.danger:hover { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.ghost { border-color: transparent; background: none; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.input, .select {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-family: inherit;
  width: 100%;
  transition: border-color .14s, box-shadow .14s;
}

.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(196, 154, 108, .14);
}

.input.invalid { border-color: var(--neg); }
.input::placeholder { color: var(--ink-3); }

select.select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a716a' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 28px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--ink-2); }
.field-hint { font-size: 12px; color: var(--ink-3); }
.field-error { font-size: 12px; color: var(--neg); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11.5px;
  letter-spacing: .03em;
  background: var(--surface-2);
  color: var(--ink-2);
}
.badge.admin { background: var(--brand-lt); color: var(--brand-dk); }
.badge.editor { background: #e4ecf3; color: var(--info); }
.badge.viewer { background: #e9f0eb; color: var(--pos); }
.badge.warn { background: #faf0da; color: var(--warn); }
.badge.danger { background: #fbeae6; color: var(--neg); }

/* ══════════ 表格 ══════════ */

.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }

.table { width: 100%; border-collapse: collapse; min-width: 640px; }

.table th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  letter-spacing: .05em;
  padding: 10px 12px;
  background: var(--surface-2);
  white-space: nowrap;
}
.table th:first-child { border-radius: 8px 0 0 8px; }
.table th:last-child { border-radius: 0 8px 8px 0; }

.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  vertical-align: middle;
  white-space: nowrap;
}

.table tbody tr:hover { background: #fbf9f6; }
.table tbody tr:last-child td { border-bottom: none; }
.table .right { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions .btn { margin-left: 6px; }

.empty {
  padding: 52px 20px;
  text-align: center;
  color: var(--ink-3);
}
.empty svg { opacity: .4; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 13px; }

/* ══════════ KPI ══════════ */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.kpi-label { font-size: 12px; color: var(--ink-2); letter-spacing: .04em; }
.kpi-value {
  font-family: var(--serif);
  font-size: 27px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -.01em;
}
.kpi-value small { font-size: 14px; font-weight: 400; color: var(--ink-3); margin-right: 2px; }
.kpi-foot { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

/* ══════════ 仪表板网格 ══════════ */

.grid-2 { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2 > .card { margin: 0; }

/* ══════════ 图表 ══════════ */

.chart { width: 100%; display: block; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--ink-2); }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; vertical-align: middle; }

.donut-wrap { display: flex; align-items: center; gap: 20px; }
.donut-center-value { font-family: var(--serif); font-size: 19px; font-weight: 600; fill: var(--ink); }
.donut-center-label { font-size: 10px; fill: var(--ink-3); }

.bars { display: flex; flex-direction: column; gap: 13px; }
.bar-row { display: flex; flex-direction: column; gap: 5px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; }
.bar-label span:first-child { color: var(--ink); }
.bar-label span:last-child { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bar-track { height: 22px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; transition: width .4s ease; }

/* ══════════ 工具条 ══════════ */

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .field { min-width: 130px; }
.toolbar .grow { flex: 1; }
.toolbar-spacer { flex: 1; }

.chip-group { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.chip {
  border: none;
  background: none;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { color: var(--ink); }
.chip.active { background: var(--surface); color: var(--brand-dk); font-weight: 500; box-shadow: var(--shadow); }

/* ══════════ 弹窗 ══════════ */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(43, 38, 34, .42);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade .16s ease;
}
@keyframes fade { from { opacity: 0; } }

.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: pop .18s cubic-bezier(.2, .9, .3, 1.2);
}
.modal.wide { max-width: 660px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* 分成比例编辑器 */
.split-row {
  display: grid;
  grid-template-columns: 1fr 110px 130px;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.split-row:last-of-type { border-bottom: none; }
.split-amount { text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.split-pct-input { text-align: right; }

/* 名称 + 括号内文字 双输入 */
.split-name-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
}
.split-name-input { min-width: 0; }
.split-alias-input { min-width: 0; }
/* 括号内文字输入框用浅色区分 */
.split-alias-input { background: var(--surface-2); }
.split-alias-input:focus { background: var(--surface); }
.split-alias-input::placeholder { color: var(--ink-3); font-size: 12.5px; }

.sum-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-top: 12px;
  background: #e9f0eb;
  color: var(--pos);
}
.sum-bar.invalid { background: #fbeae6; color: var(--neg); }

/* ══════════ Toast ══════════ */

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--pos);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 11px 16px;
  font-size: 13px;
  min-width: 220px;
  max-width: 380px;
  animation: slide .2s ease;
}
.toast.error { border-left-color: var(--neg); background: #fdf7f5; }
@keyframes slide { from { transform: translateX(16px); opacity: 0; } }

/* ══════════ 店铺卡片 ══════════ */

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }

.shop-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.shop-card.inactive { opacity: .62; }
.shop-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.shop-name { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.shop-note { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.shop-stats { display: flex; gap: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.shop-stat-label { font-size: 11.5px; color: var(--ink-3); }
.shop-stat-value { font-family: var(--serif); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ══════════ 用户列表 ══════════ */

.user-list { display: flex; flex-direction: column; }
.user-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}
.user-row:last-child { border-bottom: none; }
.user-row-info { flex: 1; min-width: 0; }
.user-row-info strong { font-size: 13.5px; font-weight: 500; }
.user-row-info span { font-size: 12px; color: var(--ink-3); margin-left: 8px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox-row input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }

/* ══════════ 设置分区 ══════════ */

.section { margin-bottom: 18px; }
.section-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-desc { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; }

/* ══════════ 骨架 / 加载 ══════════ */

.skeleton {
  background: linear-gradient(90deg, #f0ebe4 25%, #f7f3ee 50%, #f0ebe4 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-kpi { height: 96px; }
.skeleton-block { height: 260px; }

/* ══════════ 错误条 ══════════ */

.error-bar {
  background: #fdf2f0;
  border: 1px solid #f0cdc5;
  color: var(--neg);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ══════════ 店铺切换器 ══════════ */

.shop-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 4px 4px 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.shop-switch-label {
  font-size: 11.5px;
  color: var(--ink-2);
  letter-spacing: .05em;
  white-space: nowrap;
}

.shop-switch-select {
  height: 28px;
  width: auto;
  min-width: 130px;
  max-width: 210px;
  padding: 0 26px 0 9px;
  font-size: 12.5px;
  border: none;
  background-color: var(--surface);
  border-radius: 6px;
}
.shop-switch-select:focus { box-shadow: 0 0 0 2px rgba(196, 154, 108, .25); }

.shop-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  vertical-align: middle;
}

.shop-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
}

/* 合计模式提示横幅 */
.scope-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #faf3e4;
  border: 1px solid #ecd9ae;
  color: #8a6520;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px;
  line-height: 1.6;
  margin-bottom: 16px;
}
.scope-banner svg { flex: none; margin-top: 2px; }
.scope-banner strong { font-weight: 600; }

/* 表单内的店铺锁定提示 */
.scope-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 16px;
}
.scope-hint strong { color: var(--ink); font-weight: 600; }

/* ══════════ 支出共担 ══════════ */

.share-row {
  display: grid;
  grid-template-columns: 1fr 110px 130px;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
}
.share-row:last-child { border-bottom: none; }
.share-check { font-size: 13.5px; }
.share-check input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.share-pct-input { text-align: right; }
.share-amount { text-align: right; font-variant-numeric: tabular-nums; font-size: 13.5px; }
.share-row.is-off .share-check span { color: var(--ink-3); text-decoration: line-through; }

/* ══════════ 应得预览 ══════════ */

.payable-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.payable-row:last-child { margin-bottom: 0; }
.payable-name { font-weight: 500; min-width: 110px; }
.payable-detail { color: var(--ink-3); font-size: 12px; flex: 1; }
.payable-value { font-size: 15px; font-weight: 600; }

/* ══════════ 店铺分成标签页 ══════════ */

.shop-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.shop-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .14s;
}
.shop-tab:hover { background: var(--surface-2); color: var(--ink); }
.shop-tab.active {
  background: var(--brand-lt);
  border-color: var(--brand);
  color: var(--brand-dk);
  font-weight: 500;
}
.shop-tab-count { font-size: 11px; opacity: .7; }

.settings-actions { margin-top: 12px; display: flex; gap: 8px; }

/* ══════════ 店铺卡片合伙人信息 ══════════ */

.shop-partners { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.shop-partners-title { font-size: 11.5px; color: var(--ink-3); margin-bottom: 7px; letter-spacing: .04em; }
.shop-partners-list { display: flex; flex-wrap: wrap; gap: 6px; }

.partner-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface-2);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--ink-2);
}
.partner-chip strong { color: var(--brand-dk); font-variant-numeric: tabular-nums; }
.partner-chip .no-bear {
  font-style: normal;
  font-size: 10.5px;
  color: var(--neg);
  background: #fbeae6;
  border-radius: 3px;
  padding: 1px 4px;
}

.shop-payables { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.shop-payable-row {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  padding: 3px 0;
  color: var(--ink-2);
}
.shop-payable-row .num { color: var(--ink); }

/* 合计行 */
.table .total-row td {
  background: var(--surface-2);
  font-weight: 600;
  border-top: 1px solid var(--line);
  border-bottom: none;
}

/* 5 列 KPI */
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ══════════ 合伙人应得卡片 ══════════ */

.partner-cards-card { margin-bottom: 16px; }

.partner-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.partner-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
}

.partner-card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}

.partner-card-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.partner-card-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.partner-card-value {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: 6px;
}

.partner-card-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-bottom: 9px;
  flex-wrap: wrap;
}
.partner-card-detail strong { color: var(--ink-2); font-weight: 500; }
.partner-card-minus { color: var(--ink-3); }

.partner-card-bar {
  height: 4px;
  background: rgba(43, 38, 34, .08);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 6px;
}
.partner-card-bar-fill { height: 100%; border-radius: 2px; transition: width .4s ease; }

.partner-card-foot { font-size: 11.5px; color: var(--ink-3); }

/* ══════════ 子页签 ══════════ */

.sub-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.sub-tab {
  border: none;
  background: none;
  padding: 9px 16px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--ink-2);
  cursor: pointer;
  position: relative;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.sub-tab:hover { color: var(--ink); }
.sub-tab.active {
  color: var(--brand-dk);
  font-weight: 500;
  border-bottom-color: var(--brand);
}

/* ══════════ 运营支出 ══════════ */

.expense-summary {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.expense-summary-item { display: flex; flex-direction: column; gap: 2px; }
.expense-summary-label { font-size: 11.5px; color: var(--ink-3); letter-spacing: .04em; }
.expense-summary-value { font-family: var(--serif); font-size: 19px; font-weight: 600; }

.expense-day { margin-bottom: 14px; }
.expense-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.expense-day-title { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.expense-day-total { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.expense-day-total strong { font-family: var(--serif); font-size: 17px; }

/* 流水表单里的运营支出关联行 */
.expense-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.expense-link-row:last-child { border-bottom: none; }
.expense-link-row .checkbox-row { font-size: 13.5px; }
.expense-link-row .checkbox-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--brand);
  cursor: pointer;
}
.expense-link-amount { font-variant-numeric: tabular-nums; font-size: 13.5px; white-space: nowrap; }
.expense-link-name { font-size: 13.5px; flex: 1; min-width: 0; }

/* 流水表单：当天支出合计区块 */
.expense-day-total-box {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 13px;
}
.expense-day-total-box strong { font-family: var(--serif); font-size: 20px; }
.expense-day-total-box .dim { margin-left: auto; font-size: 12px; }

.expense-link-list { margin-top: 6px; }

.expense-quick-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.expense-quick-add .input { flex: 1 1 140px; min-width: 0; }
.expense-quick-add .input.num { flex: 0 1 110px; }
.expense-quick-add .btn { flex: none; }

.expense-summary-item.warn .expense-summary-label { color: var(--warn); }
.badge.ok { background: #e9f0eb; color: var(--pos); }

.scope-banner.warn { border-color: #ecd9ae; background: #fdf7ea; color: #8a6520; }

/* ══════════ 响应式 ══════════ */

@media (max-width: 1199px) {
  .kpi-grid, .kpi-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mask.show { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
}

@media (max-width: 679px) {
  .kpi-grid, .kpi-grid-5 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .split-row { grid-template-columns: 1fr 84px 92px; gap: 7px; }
  .split-name-group { grid-template-columns: 1fr; gap: 6px; }
  .share-row { grid-template-columns: 1fr 80px 90px; gap: 7px; }
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; }
  .kpi-value { font-size: 24px; }
  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .shop-switch-label { display: none; }
  .shop-switch-select { min-width: 100px; max-width: 140px; }
  .scope-banner { font-size: 12px; }
  .payable-row { flex-wrap: wrap; gap: 4px; }
  .payable-detail { flex-basis: 100%; order: 3; }
}
