/* ==========================================================================
   财务管理系统 · Apple 风格视觉
   设计原则：大量留白、克制的灰阶、极细分割线、圆角柔和、动效轻微
   ========================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* 灰阶（参考 apple.com） */
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --text: #1d1d1f;
  --text-2: #424245;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --line: rgba(0, 0, 0, .08);
  --line-strong: #d2d2d7;

  /* 强调色 */
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --income: #00875a;
  --expense: #de3b30;
  --recv: #0071e3;
  --pay: #c86a00;
  --worth: #6e46cf;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 980px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .045);
  --shadow-lg: 0 12px 44px rgba(0, 0, 0, .12);
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }
.spacer { flex: 1; }
.center { text-align: center; }
.num { text-align: right; }
.pair { white-space: nowrap; }
.amount-recv { color: var(--recv); font-weight: 600; }
.amount-pay { color: var(--pay); font-weight: 600; }
.amount-muted { color: #c7c7cc; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(120% 90% at 50% 0%, #ffffff 0%, #f5f5f7 55%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 40px 36px 34px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .09);
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.login-card h1 {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.02em;
  text-align: center;
}
.login-card .sub { text-align: center; color: var(--muted); margin-bottom: 10px; font-size: 13.5px; }
.login-card label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }

/* ---------- 顶栏（苹果式毛玻璃导航） ---------- */
.topbar {
  height: 52px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 4px; }
.user-tag { color: var(--muted); font-size: 13px; margin: 0 10px 0 4px; }

/* 顶栏公司切换 */
.company-picker {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted); margin-right: 6px;
}
.company-picker > span { flex: none; white-space: nowrap; }
.company-picker select {
  max-width: 200px;
  border: none;
  background: rgba(0, 0, 0, .04);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text);
}

/* ---------- 整体布局：页面不滚动，表格内部滚动 ---------- */
#app-view {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 16px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.cards, .tabs, .toolbar, .hint, .pager { flex: none; }
.panel { display: none; }
.panel.active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.panel.active > .table-wrap { flex: 1; min-height: 0; }
.pview { display: none; }
.pview.active { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pview.active > .table-wrap { flex: 1; min-height: 0; }
#panel-category.active { display: block; overflow: auto; }

/* ---------- 概览卡片 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}
.card {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.card-label {
  color: var(--muted);
  font-size: 12.5px;
  margin-bottom: 10px;
  letter-spacing: .01em;
}
.card-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
}
.card.income .card-value { color: var(--income); }
.card.expense .card-value { color: var(--expense); }
.card.balance .card-value { color: var(--blue); }
.card.recv .card-value { color: var(--recv); }
.card.pay .card-value { color: var(--pay); }
.card.worth .card-value { color: var(--text); }

/* ---------- 悬浮说明 ---------- */
.tip {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; font-size: 11px;
  background: rgba(0, 0, 0, .1); color: var(--muted); cursor: help;
  vertical-align: middle;
}
.tip:hover { background: var(--blue); color: #fff; }
.tip::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: calc(100% + 9px); transform: translateX(-50%);
  background: rgba(29, 29, 31, .95);
  color: #fff; font-size: 12px; font-weight: 400; line-height: 1.45;
  padding: 7px 11px; border-radius: 8px; white-space: nowrap;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
  opacity: 0; visibility: hidden; transition: opacity .14s ease;
  pointer-events: none; z-index: 60;
}
.tip::before {
  content: ''; position: absolute; left: 50%; top: calc(100% + 3px); transform: translateX(-50%);
  border: 5px solid transparent; border-bottom-color: rgba(29, 29, 31, .95);
  opacity: 0; visibility: hidden; transition: opacity .14s ease;
  pointer-events: none; z-index: 60;
}
.tip:hover::after, .tip:hover::before { opacity: 1; visibility: visible; }

.hint { color: var(--muted); font-size: 12.5px; margin: -6px 0 16px; }
.seg-hint { display: block; margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.row-gap { display: flex; gap: 8px; align-items: center; }
.row-gap select { flex: 1; }

/* ---------- Tab 导航 ---------- */
.tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.tab {
  background: none; border: none;
  padding: 0 0 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .18s ease;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }

/* ---------- 表单控件 ---------- */
input, select, textarea {
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 13px;
  border: 1px solid #c9c9ce;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, .14);
}
input::placeholder, textarea::placeholder { color: #a1a1a6; }
textarea { resize: vertical; }
input[type="checkbox"], input[type="radio"] {
  padding: 0; width: 15px; height: 15px; accent-color: var(--blue);
  vertical-align: middle; cursor: pointer;
}
input[type="file"] { border: none; padding: 4px 0; font-size: 13px; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 9px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar input[type="text"] { width: 210px; }
.toolbar input[type="date"] { width: 142px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-family: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .1s ease;
  white-space: nowrap;
}
.btn:hover { background: #fafafa; border-color: #bfbfc4; }
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--blue); }
.btn-ghost:hover { background: rgba(0, 113, 227, .08); border-color: transparent; color: var(--blue-hover); }
.btn-sm { padding: 6px 14px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; font-weight: 500; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn:disabled:hover { background: #fff; border-color: var(--line-strong); }

/* ---------- 分段控件（苹果式） ---------- */
.seg {
  display: inline-flex;
  border: none;
  background: rgba(0, 0, 0, .05);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
  width: fit-content;
}
.seg button {
  padding: 7px 18px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-2);
  border-radius: var(--radius-pill);
  transition: background .18s ease, color .18s ease;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.seg button.active:hover { background: #fff; }
/* 专用语义色（优先级高于上面的通用选中态） */
.seg button.active[data-type="income"] { background: var(--income); color: #fff; }
.seg button.active[data-type="expense"] { background: var(--expense); color: #fff; }
.seg button.active[data-kind="borrow_in"],
.seg button.active[data-kind="repay"] { background: var(--pay); color: #fff; }
.seg button.active[data-kind="lend_out"],
.seg button.active[data-kind="collect"] { background: var(--recv); color: #fff; }
#int-kind-seg button { padding: 7px 14px; }

/* ---------- 表格 ---------- */
.table-wrap {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left;
  padding: 14px 16px;
  background: #fafafc;
  color: var(--muted);
  font-weight: 500;
  font-size: 12.5px;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 3;
}
.table th.num { text-align: right; }
.table th.center { text-align: center; }
.table td { padding: 13px 16px; border-bottom: 1px solid rgba(0, 0, 0, .045); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #fafafc; }
.table td.center, .table th.center { white-space: nowrap; }
.table td.center .icon-btn { padding: 2px 5px; line-height: 1; }
.table td.center .act-btn { line-height: 1; }

.amount-income { color: var(--income); font-weight: 600; font-variant-numeric: tabular-nums; }
.amount-expense { color: var(--expense); font-weight: 600; font-variant-numeric: tabular-nums; }

/* 状态标签 */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  background: rgba(0, 0, 0, .05);
  color: var(--text-2);
}
.tag.income { background: rgba(0, 135, 90, .1); color: var(--income); }
.tag.expense { background: rgba(222, 59, 48, .1); color: var(--expense); }

.clip { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--blue); cursor: pointer; text-decoration: none; }
.link:hover { text-decoration: underline; }
.thumb { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; vertical-align: middle; margin-right: 5px; border: 1px solid var(--line); }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* 次要文字用更浅的灰，避免跟正文抢 */
.login-card .sub, .hint, .seg-hint, .upload-hint, .card-label, .form-grid label,
.mini-form label, .detail-row .k, .cat-list .cat-code, .perm-group-title, .form-block-title { color: var(--muted); }
.user-tag, .pager, .perm-item, .attach-item .fname, .upload-list .file-item { color: var(--muted-2); }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; gap: 12px;
  margin-top: 16px; color: var(--muted); font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* ---------- 分类科目 ---------- */
.cat-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cat-col {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px;
}
.cat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cat-head h3 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.cat-list { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.cat-list li {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: #fafafc;
  margin-bottom: 5px;
}
.cat-list .cat-name { flex: 1; font-size: 13.5px; }
.cat-list .cat-code { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.cat-list .builtin {
  font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 2px 9px;
}

/* 图标按钮（仅附件删除角标在用） */
.icon-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 13px; padding: 3px 7px; border-radius: 7px;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: rgba(0, 0, 0, .06); color: var(--text); }

/* 操作列文字按钮 */
.act-btn {
  background: none; border: none; cursor: pointer;
  color: var(--blue); font-size: 12.5px; font-family: inherit;
  padding: 3px 7px; border-radius: 7px; line-height: 1.4; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.act-btn:hover { background: rgba(0, 113, 227, .08); text-decoration: none; }
.act-btn.danger { color: var(--expense); }
.act-btn.danger:hover { background: rgba(222, 59, 48, .08); }
.row-actions { display: inline-flex; align-items: center; justify-content: center; gap: 2px; white-space: nowrap; }
.row-actions .icon-btn { line-height: 1; padding: 2px 5px; }

/* ---------- 权限 / 公司勾选 ---------- */
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 15px; background: #fafafc; }
.perm-group-title { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; font-weight: 500; }
.perm-items { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.perm-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.form-block { display: flex; flex-direction: column; gap: 9px; }
.form-block-title { font-size: 13px; color: var(--muted); }
#mini-u-perms { display: flex; flex-direction: column; gap: 10px; }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .32);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
  animation: fadeIn .18s ease;
}
/* 弹窗层级：从弹窗里再打开的子弹窗必须盖在上层 */
#modal-tx { z-index: 50; }
#modal-party { z-index: 55; }
#modal-detail { z-index: 60; }
#modal-int { z-index: 60; }
#modal-mini { z-index: 70; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-card {
  background: #fff;
  border-radius: 22px;
  width: 620px; max-width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: riseIn .22s cubic-bezier(.2, .8, .3, 1);
}
.modal-sm { width: 448px; }
.modal-card.modal-wide { width: min(1000px, 96vw); }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 26px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 2;
  border-radius: 22px 22px 0 0;
}
.modal-head h3 { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }
.modal-head .x {
  background: rgba(0, 0, 0, .05); border: none; width: 30px; height: 30px;
  border-radius: 50%; font-size: 18px; color: var(--muted); cursor: pointer;
  line-height: 1; display: flex; align-items: center; justify-content: center;
  transition: background .15s ease, color .15s ease;
}
.modal-head .x:hover { background: rgba(0, 0, 0, .1); color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 22px 26px 24px; }
.form-grid label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }
.form-grid .span-2 { grid-column: span 2; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.upload-hint { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.upload-list { display: flex; flex-direction: column; gap: 4px; margin-top: 9px; }
.upload-list .file-item { font-size: 12.5px; color: var(--muted); }
.error { color: var(--expense); font-size: 13px; min-height: 18px; }

.mini-form { padding: 22px 26px; display: flex; flex-direction: column; gap: 16px; }
.mini-form label { display: flex; flex-direction: column; gap: 7px; font-size: 13px; color: var(--muted); }
.mini-form .modal-foot { padding: 0; }
.mini-form.modal-lg-form { max-height: 66vh; overflow-y: auto; }
.mini-form.modal-lg-form .modal-foot {
  position: sticky; bottom: 0; background: #fff;
  border-top: 1px solid var(--line); padding: 14px 0 4px; margin-top: 2px;
}
.modal-card:has(.modal-lg-form) { width: 620px; }

/* ---------- 详情 ---------- */
.detail-body { padding: 20px 26px; }
.detail-row { display: flex; padding: 11px 0; border-bottom: 1px solid rgba(0, 0, 0, .045); font-size: 13.5px; }
.detail-row:last-child { border-bottom: none; }
.detail-row .k { width: 96px; color: var(--muted); flex-shrink: 0; }
.detail-row .v { flex: 1; word-break: break-all; }
.attach-section { padding: 6px 26px 26px; }
.attach-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.attach-head strong { font-size: 14px; font-weight: 600; }
.attach-list { display: flex; flex-wrap: wrap; gap: 12px; }
.attach-item {
  position: relative; width: 122px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px; text-align: center; background: #fafafc;
}
.attach-item img { width: 100%; height: 76px; object-fit: cover; border-radius: 8px; cursor: pointer; }
.attach-item .fname { font-size: 11.5px; color: var(--muted); margin-top: 6px; word-break: break-all; line-height: 1.35; }
.attach-item .del {
  position: absolute; top: 3px; right: 4px;
  background: rgba(255, 255, 255, .92); border-radius: 50%;
}

/* 往来对账弹窗内明细表：不换行、操作按钮排一行 */
#modal-party .table th,
#modal-party .table td { white-space: nowrap; }
#modal-party .table td.clip { max-width: 240px; }

.detail-mini { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
#modal-party .table-wrap { max-height: 40vh; min-height: 0; }
.detail-mini .box {
  background: #fafafc; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 16px; min-width: 136px;
}
.detail-mini .box .k { font-size: 12px; color: var(--muted); }
.detail-mini .box .v { font-size: 17px; font-weight: 600; margin-top: 4px; letter-spacing: -.02em; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 36px; left: 50%; transform: translateX(-50%);
  background: rgba(29, 29, 31, .94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff; padding: 12px 22px; border-radius: var(--radius-pill);
  font-size: 13.5px; z-index: 100;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .24);
  animation: riseIn .2s ease;
}

/* ---------- 滚动条（细、克制） ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .16); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, .3); background-clip: content-box; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .cat-cols { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .container { overflow-y: auto; }
  .panel.active > .table-wrap, .pview.active > .table-wrap { flex: none; max-height: 55vh; }
}

@media (max-width: 640px) {
  .hide-sm { display: none !important; }

  /* --- 顶栏：两~三行紧凑排列，每行都对齐 --- */
  .topbar {
    height: auto;
    padding: 9px 14px;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
    justify-content: flex-start;
  }
  /* display:contents 让内部元素直接参与顶栏换行，便于分排 */
  .topbar-right { display: contents; }
  /* 强制断行：保证按钮整组落到同一行 */
  .topbar::after { content: ''; order: 2; flex: 1 1 100%; height: 0; }
  .brand { order: 0; font-size: 15px; }
  .user-tag { order: 1; margin-left: auto; margin-right: 0; font-size: 12px; white-space: nowrap; }
  .company-picker { order: 3; flex: 1 1 100%; width: auto; margin: 0; min-width: 0; }
  .company-picker select { width: 100%; max-width: none; flex: 1; }
  .topbar-right > .btn { order: 4; flex: 1 1 0; padding: 7px 8px; font-size: 12.5px; }

  .container { padding: 16px 14px 24px; }

  /* --- 卡片：压缩高度 --- */
  .cards { gap: 10px; margin-bottom: 16px; }
  .card { padding: 13px 14px; border-radius: 14px; }
  .card-label { font-size: 11.5px; margin-bottom: 5px; }
  .card-value { font-size: 19px; }

  /* --- Tab --- */
  .tabs { gap: 20px; margin-bottom: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { padding-bottom: 10px; white-space: nowrap; font-size: 13.5px; }

  /* --- 工具栏：控件成对排、按钮保持原宽自然排列 --- */
  .toolbar { gap: 8px; margin-bottom: 14px; }
  .toolbar input[type="text"] { flex: 1 1 100%; width: 100%; }
  .toolbar select { flex: 1 1 calc(50% - 5px); min-width: 0; }
  .toolbar input[type="date"] { flex: 1 1 calc(50% - 5px); width: auto; min-width: 0; }
  .toolbar .spacer { display: none; }
  .toolbar > .btn { flex: 0 0 auto; padding: 8px 14px; font-size: 13px; }
  .toolbar .seg { flex: 1 1 100%; justify-content: center; }
  .seg button { padding: 7px 15px; font-size: 13px; }

  .tip { width: 20px; height: 20px; font-size: 12.5px; background: rgba(0, 0, 0, .14); }
  .amount-muted { color: #b0b0b5; }

  .hint { font-size: 12px; margin: 0 0 12px; }

  /* --- 表格：更紧凑，横向滑动更顺手 --- */
  .table th, .table td { padding: 10px 11px; font-size: 12.5px; }
  .table-wrap { -webkit-overflow-scrolling: touch; border-radius: 14px; }
  .act-btn { padding: 3px 5px; font-size: 12px; }
  .tag { padding: 2px 9px; font-size: 11.5px; }
  .empty { padding: 40px 16px; font-size: 13px; }
  /* 对象名不要折行 */
  #party-body td:first-child, #party-body th:first-child { white-space: nowrap; }

  .pager { gap: 8px; font-size: 12px; flex-wrap: wrap; margin-top: 12px; }
  #tx-summary, #party-summary, #int-summary { width: 100%; line-height: 1.7; }

  /* --- 弹窗 --- */
  .modal { padding: 10px; }
  .modal-card { border-radius: 18px; max-height: 94vh; }
  .modal-head { padding: 16px 18px 13px; border-radius: 18px 18px 0 0; }
  .modal-head h3 { font-size: 15.5px; }
  .form-grid { padding: 16px; gap: 13px; }
  .mini-form { padding: 16px; gap: 14px; }
  .detail-body { padding: 14px 16px; }
  .attach-section { padding-left: 16px; padding-right: 16px; }
  .detail-row { padding: 9px 0; }
  .detail-row .k { width: 80px; }
  .detail-mini { gap: 9px; margin-bottom: 12px; }
  .detail-mini .box { flex: 1; min-width: 122px; padding: 10px 12px; }
  .detail-mini .box .v { font-size: 15px; }
  .cat-col { padding: 16px; border-radius: 16px; }
  .cat-list li { padding: 11px 12px; gap: 8px; }
  #int-kind-seg button { padding: 7px 11px; }
  .seg { flex-wrap: wrap; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
