
.kind-pick[data-v-dab59718] {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.kind-option[data-v-dab59718] {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  color: #0f172a;
  box-sizing: border-box;
}
.kind-option.active[data-v-dab59718] {
  border-color: rgba(37, 99, 235, 0.45);
  background: rgba(37, 99, 235, 0.06);
}
.kind-option input[type='radio'][data-v-dab59718] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  flex-shrink: 0;
  accent-color: #2563eb;
  appearance: auto;
}
.kind-option-text[data-v-dab59718] {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #334155;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dialog-group-tip-message[data-v-c45979e4] {
  white-space: pre-wrap;
  word-break: break-word;
}
.dialog-group-tip-icon.tone-danger[data-v-c45979e4] {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(185, 28, 28, 0.22);
}
.btn-danger-solid[data-v-c45979e4] {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #fff !important;
}
:root {
  --bg-0: #eef1f6;
  --bg-1: #e7ebf3;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --ink: #0f172a;
  --ink-soft: #64748b;
  --ink-faint: #94a3b8;
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.14);
  --brand: #2563eb;
  --brand-2: #1d4ed8;
  --brand-3: #3b82f6;
  --brand-soft: rgba(37, 99, 235, 0.1);
  --brand-glow: rgba(37, 99, 235, 0.28);
  --accent: #0d9488;
  --warn: #d97706;
  --danger: #e11d48;
  --sidebar-w: 300px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.14);
  --shadow-lg: 0 24px 48px -24px rgba(15, 23, 42, 0.28);
  --font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-en: "Segoe UI", "Noto Sans SC", sans-serif;
  /* 数字与正文同字体（同项目总览「年度」空心零），不用等宽/斜杠零字体 */
  --mono: var(--font);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --text-2xs: 10px;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 16px;
  --text-xl: 17px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font-family: inherit; }

.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(37, 99, 235, 0.14), transparent 55%),
    radial-gradient(700px 420px at 100% 10%, rgba(13, 148, 136, 0.1), transparent 50%),
    radial-gradient(600px 400px at 80% 100%, rgba(37, 99, 235, 0.08), transparent 55%),
    linear-gradient(160deg, #eef1f6 0%, #e8edf5 100%);
}

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* Sidebar - premium */
.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  color: #e8eef8;
  position: relative;
  background:
    radial-gradient(420px 280px at 0% 0%, rgba(59, 130, 246, 0.22), transparent 60%),
    radial-gradient(360px 240px at 100% 100%, rgba(13, 148, 136, 0.12), transparent 55%),
    linear-gradient(175deg, #0c1526 0%, #111c31 42%, #0a1220 100%);
  border-right: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow:
    12px 0 40px -28px rgba(15, 23, 42, 0.55),
    inset -1px 0 0 rgba(255, 255, 255, 0.04);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), transparent 18%, transparent 82%, rgba(0,0,0,0.15));
}

.sidebar-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 14px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #7dd3fc 0%, #3b82f6 45%, #2563eb 100%);
  box-shadow:
    0 12px 28px -12px rgba(37, 99, 235, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(15, 23, 42, 0.15);
  font-weight: 700;
  font-size: 17px;
  color: #fff;
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 12px;
  color: rgba(203, 213, 225, 0.62);
  margin-top: 3px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-search {
  position: relative;
  z-index: 1;
  padding: 0 14px 12px;
}

.search-ico {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: rgba(186, 198, 214, 0.45);
  pointer-events: none;
}

.sidebar-search input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.35);
  color: #f1f5f9;
  outline: none;
  font-size: 14px;
  backdrop-filter: blur(8px);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.sidebar-search input:focus {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(15, 23, 42, 0.5);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.sidebar-search input::placeholder { color: rgba(148, 163, 184, 0.45); }

.nav-label {
  position: relative;
  z-index: 1;
  padding: 4px 18px 10px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.45);
}

/* ── Sidebar nav: rail + accordion（四级层级） ── */
.sidebar-rail {
  background:
    radial-gradient(420px 260px at 0% 0%, rgba(59, 130, 246, 0.14), transparent 62%),
    radial-gradient(360px 220px at 100% 100%, rgba(13, 148, 136, 0.08), transparent 58%),
    linear-gradient(180deg, #1e2a42 0%, #1a2438 52%, #172033 100%);
  border-right-color: rgba(148, 163, 184, 0.16);
}

.sidebar-rail::before {
  background: linear-gradient(180deg, rgba(255,255,255,0.07), transparent 28%, transparent 100%);
}

.sidebar-rail .sidebar-brand {
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

/* L1 主模块 */
.main-nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.2) transparent;
}

.main-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0;
  padding: 11px 12px 11px 14px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.055);
  color: rgba(241, 245, 249, 0.88);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-align: left;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: background 0.2s var(--ease), color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.main-nav-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 0;
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
  background: currentColor;
  opacity: 0;
  transition: height 0.22s var(--ease), opacity 0.2s;
}

.main-nav-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 120% at 0% 50%, rgba(255, 255, 255, 0.06), transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.main-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
  transform: translateX(2px);
}

.main-nav-item:hover::before {
  height: 42%;
  opacity: 0.55;
}

.main-nav-item:hover::after {
  opacity: 1;
}

.main-nav-item.active {
  color: #fff;
  transform: translateX(2px);
}

.main-nav-item.active::before {
  height: 58%;
  opacity: 1;
}

.main-nav-item.active::after {
  opacity: 1;
}

.main-nav-item[data-module="users"]:hover,
.main-nav-item[data-module="users"].active {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.18), rgba(13, 148, 136, 0.05));
  border-color: rgba(45, 212, 191, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 20px -12px rgba(13, 148, 136, 0.45);
}

.main-nav-item[data-module="users"]::before {
  background: #2dd4bf;
}

.main-nav-item[data-module="projects"]:hover,
.main-nav-item[data-module="projects"].active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22), rgba(37, 99, 235, 0.1));
  border-color: rgba(96, 165, 250, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 20px -12px rgba(37, 99, 235, 0.55);
}

.main-nav-item[data-module="projects"]::before {
  background: #60a5fa;
}

.main-nav-item[data-module="loans"]:hover,
.main-nav-item[data-module="loans"].active {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.2), rgba(217, 119, 6, 0.06));
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 20px -12px rgba(217, 119, 6, 0.45);
}

.main-nav-item[data-module="loans"]::before {
  background: #fbbf24;
}

.main-nav-item[data-module="orgs"]:hover,
.main-nav-item[data-module="orgs"].active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(99, 102, 241, 0.06));
  border-color: rgba(129, 140, 248, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 8px 20px -12px rgba(99, 102, 241, 0.5);
}

.main-nav-item[data-module="orgs"]::before {
  background: #818cf8;
}

.main-nav-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.main-nav-icon svg {
  width: 18px;
  height: 18px;
}

.main-nav-icon.mod-users {
  background: rgba(13, 148, 136, 0.14);
  border-color: rgba(45, 212, 191, 0.22);
  color: #5eead4;
}

.main-nav-icon.mod-projects {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.28);
  color: #93c5fd;
}

.main-nav-icon.mod-dashboard {
  background: rgba(79, 70, 229, 0.16);
  border-color: rgba(129, 140, 248, 0.28);
  color: #a5b4fc;
}

.main-nav-icon.mod-overview {
  background: rgba(8, 145, 178, 0.16);
  border-color: rgba(34, 211, 238, 0.28);
  color: #67e8f9;
}

.main-nav-item[data-module="dashboard"]:hover .main-nav-icon.mod-dashboard,
.main-nav-item[data-module="dashboard"].active .main-nav-icon.mod-dashboard {
  background: rgba(79, 70, 229, 0.3);
  border-color: rgba(129, 140, 248, 0.45);
  color: #e0e7ff;
  box-shadow: 0 0 16px -6px rgba(79, 70, 229, 0.65);
}

.main-nav-icon.mod-loans {
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(251, 191, 36, 0.22);
  color: #fcd34d;
}

.main-nav-icon.mod-orgs {
  background: rgba(99, 102, 241, 0.16);
  border-color: rgba(129, 140, 248, 0.28);
  color: #a5b4fc;
}

.main-nav-icon.mod-profile {
  background: rgba(14, 165, 233, 0.14);
  border-color: rgba(56, 189, 248, 0.28);
  color: #7dd3fc;
}

.main-nav-icon.mod-repair {
  background: rgba(225, 29, 72, 0.12);
  border-color: rgba(251, 113, 133, 0.28);
  color: #fb7185;
}

.main-nav-item[data-module="users"]:hover .main-nav-icon.mod-users,
.main-nav-item[data-module="users"].active .main-nav-icon.mod-users {
  background: rgba(13, 148, 136, 0.28);
  border-color: rgba(45, 212, 191, 0.4);
  color: #99f6e4;
  box-shadow: 0 0 16px -6px rgba(13, 148, 136, 0.6);
}

.main-nav-item[data-module="projects"]:hover .main-nav-icon.mod-projects,
.main-nav-item[data-module="projects"].active .main-nav-icon.mod-projects {
  background: rgba(37, 99, 235, 0.32);
  border-color: rgba(96, 165, 250, 0.45);
  color: #fff;
  box-shadow: 0 0 16px -6px rgba(37, 99, 235, 0.65);
}

.main-nav-item[data-module="loans"]:hover .main-nav-icon.mod-loans,
.main-nav-item[data-module="loans"].active .main-nav-icon.mod-loans {
  background: rgba(217, 119, 6, 0.28);
  border-color: rgba(251, 191, 36, 0.4);
  color: #fde68a;
  box-shadow: 0 0 16px -6px rgba(217, 119, 6, 0.55);
}

.main-nav-item[data-module="repair"]:hover .main-nav-icon.mod-repair,
.main-nav-item[data-module="repair"].active .main-nav-icon.mod-repair {
  background: rgba(225, 29, 72, 0.24);
  border-color: rgba(251, 113, 133, 0.45);
  color: #ffe4e6;
  box-shadow: 0 0 16px -6px rgba(225, 29, 72, 0.55);
}

.main-nav-item[data-module="orgs"]:hover .main-nav-icon.mod-orgs,
.main-nav-item[data-module="orgs"].active .main-nav-icon.mod-orgs {
  background: rgba(99, 102, 241, 0.3);
  border-color: rgba(129, 140, 248, 0.5);
  color: #e0e7ff;
  box-shadow: 0 0 16px -6px rgba(99, 102, 241, 0.6);
}

.main-nav-label {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
}

.main-nav-icon,
.main-nav-chevron {
  position: relative;
  z-index: 1;
}

.main-nav-chevron {
  flex-shrink: 0;
  width: 9px;
  height: 9px;
  margin-right: 2px;
  border-right: 2px solid rgba(255, 255, 255, 0.88);
  border-bottom: 2px solid rgba(255, 255, 255, 0.88);
  transform: rotate(-45deg);
  opacity: 0.9;
  transition: transform 0.22s var(--ease), opacity 0.2s, border-color 0.2s;
}

.main-nav-group.open > .main-nav-item .main-nav-chevron {
  transform: rotate(45deg);
  opacity: 1;
  border-color: #fff;
}

.main-nav-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.main-nav-group > .main-nav-item.active {
  margin-bottom: 0;
}

/* L2 子树容器 */
.main-nav-sub {
  display: none;
  margin: 4px 6px 6px 14px;
  padding: 8px 0 4px 12px;
  border-left: 2px solid rgba(96, 165, 250, 0.28);
}

.main-nav-group.open .main-nav-sub {
  display: block;
}

.org-nav-sub {
  border-left-color: rgba(129, 140, 248, 0.35);
}

.org-nav-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.org-nav-link {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(203, 213, 225, 0.82);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.org-nav-link:hover {
  background: rgba(129, 140, 248, 0.12);
  color: #e0e7ff;
  border-color: rgba(129, 140, 248, 0.2);
}

.org-nav-link.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.28), rgba(99, 102, 241, 0.1));
  border-color: rgba(129, 140, 248, 0.4);
  color: #eef2ff;
  box-shadow: 0 6px 14px -10px rgba(99, 102, 241, 0.55);
}

.nav-sub-head {
  padding: 0 4px 8px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(203, 213, 225, 0.55);
}

.nav-tree {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-tree-foot {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.btn-add-tree {
  width: 100%;
  padding: 8px 10px 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(186, 198, 214, 0.82);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  transition: color 0.2s, background 0.2s;
}

.btn-add-tree:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #93c5fd;
}

/* L2 年度分组 */
.nav-node-year {
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(148, 163, 184, 0.12);
  overflow: hidden;
}

.nav-node-year.open {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(96, 165, 250, 0.26);
}

.nav-children {
  display: none;
}

.nav-node.open > .nav-children {
  display: block;
}

.nav-children-projects {
  padding: 4px 6px 8px;
  display: none;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.nav-node-year.open > .nav-children-projects {
  display: flex;
}

/* L3 分类：分区标题（与下方项目列表区分开） */
.nav-node-kind {
  border-radius: 0;
  background: transparent;
  border: none;
  border-left: 2px solid rgba(148, 163, 184, 0.22);
  overflow: visible;
  margin: 2px 0 4px;
  padding-left: 2px;
}

.nav-node-kind.open {
  background: transparent;
  border-left-color: rgba(94, 234, 212, 0.45);
}

.nav-children-kind {
  padding: 2px 0 6px 10px;
  display: none;
  flex-direction: column;
  gap: 3px;
  border-top: none;
  background: transparent;
  margin-left: 4px;
  border-left: 1px solid rgba(148, 163, 184, 0.12);
}

.nav-node-kind.open > .nav-children-kind {
  display: flex;
}

.nav-link-kind {
  padding: 6px 6px 6px 8px;
  justify-content: flex-start;
  color: #8fa3b8;
  font-size: 11px;
  border-radius: 4px;
}

.nav-link-kind:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
}

.nav-node-kind.open > .nav-link-kind {
  color: #99f6e4;
  background: rgba(45, 212, 191, 0.06);
}

.nav-link-kind .nav-level-tag {
  color: #5eead4;
  border-color: rgba(45, 212, 191, 0.28);
  background: rgba(15, 118, 110, 0.35);
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 1px 4px;
}

.nav-node-kind.open .nav-link-kind .nav-level-tag {
  color: #ccfbf1;
  border-color: rgba(94, 234, 212, 0.4);
  background: rgba(13, 148, 136, 0.45);
}

.nav-kind-label {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.92;
}

.nav-node-kind .nav-badge {
  font-size: 9px;
  padding: 1px 5px;
  min-width: 16px;
  color: rgba(148, 163, 184, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

.nav-node-kind.open .nav-badge {
  color: #99f6e4;
  background: rgba(45, 212, 191, 0.16);
}

.nav-node-kind.open > .nav-link-kind .nav-chevron {
  transform: rotate(45deg);
  opacity: 1;
  border-color: #99f6e4;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.18s var(--ease), color 0.18s;
}

.nav-level-tag {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  padding: 1px 5px;
  line-height: 1.4;
  white-space: nowrap;
}

.nav-node-year.open .nav-link-year .nav-level-tag {
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.25);
  background: rgba(59, 130, 246, 0.12);
}

.nav-link-year {
  padding: 9px 10px;
  justify-content: flex-start;
  color: #b6c4d8;
}

.nav-link-year:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
}

.nav-node-year.open > .nav-link-year {
  color: #e2e8f0;
  background: rgba(59, 130, 246, 0.06);
}

.nav-year-label {
  flex: 1;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: inherit;
}

.nav-year-label small {
  margin-left: 2px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  opacity: 0.65;
}

.nav-year-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.nav-badge {
  font-style: normal;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  color: rgba(203, 213, 225, 0.82);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

.nav-node-year.open .nav-badge {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.2);
}

.nav-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.9);
  border-bottom: 2px solid rgba(255, 255, 255, 0.9);
  transform: rotate(-45deg);
  opacity: 0.95;
  transition: transform 0.22s var(--ease), opacity 0.2s, border-color 0.2s;
}

.nav-node-year.open > .nav-link-year .nav-chevron {
  transform: rotate(45deg);
  opacity: 1;
  border-color: #fff;
}

/* L4 项目：分类下的可点列表项（比分类更醒目） */
.nav-node-project {
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.14);
  margin-left: 0;
}

.nav-node-project.is-current {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.1);
}

.nav-link-project {
  padding: 9px 10px;
  gap: 6px;
  color: rgba(241, 245, 249, 0.95);
  font-size: 13px;
  font-weight: 550;
  align-items: flex-start;
}

.nav-link-project .nav-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.nav-link-project .nav-level-tag {
  color: rgba(255, 255, 255, 0.92);
}

.nav-node-project.is-current .nav-link-project .nav-level-tag {
  color: #7dd3fc;
  border-color: rgba(96, 165, 250, 0.3);
  background: rgba(59, 130, 246, 0.15);
}

.nav-link-project:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
}

.nav-link-project.active {
  color: #fff;
  font-weight: 600;
}

.nav-group-toggle {
  margin-left: auto;
  flex-shrink: 0;
  opacity: 1;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255, 255, 255, 0.95);
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
}

.nav-children-sub {
  margin: 4px 0 6px 10px;
  padding-left: 8px;
  border-left: 1px solid rgba(148, 163, 184, 0.2);
  flex-direction: column;
  gap: 2px;
}

.nav-node-project.open > .nav-children-sub {
  display: flex;
}

.nav-node-child .nav-link-project {
  padding-left: 8px;
}

.btn-add-child {
  margin: 4px 0 2px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(147, 197, 253, 0.85);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.btn-add-child:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #bfdbfe;
}

.nav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}

/* L4 财务/资料并排 */
.nav-chips-wrap {
  display: none;
  padding: 0 8px 8px 10px;
}

.nav-node-project.open .nav-chips-wrap {
  display: block;
}

.nav-chips {
  display: flex;
  gap: 0;
  padding: 2px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.nav-chip {
  flex: 1;
  padding: 6px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: rgba(203, 213, 225, 0.82);
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  letter-spacing: 0.04em;
  transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}

.nav-chip:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.nav-chip.active {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 2px 8px -4px rgba(37, 99, 235, 0.8);
}

.year-nav {
  position: relative;
  z-index: 1;
  flex: none;
  overflow: visible;
  padding: 0;
}

.year-block {
  margin-bottom: 6px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}

.year-block.open {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(148, 163, 184, 0.1);
}

.year-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: background 0.2s var(--ease), color 0.2s;
}

.year-btn:hover {
  background: rgba(96, 165, 250, 0.08);
  color: #fff;
}

.year-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.year-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7dd3fc, #3b82f6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}

.year-count {
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mono);
  color: rgba(148, 163, 184, 0.85);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.12);
  border-radius: 999px;
  padding: 1px 7px;
}

.year-block.open .year-count {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(96, 165, 250, 0.25);
}

.year-btn .chevron {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 10px;
  opacity: 0.55;
  background: rgba(255, 255, 255, 0.05);
  transition: transform 0.2s var(--ease), background 0.2s;
}

.year-block.open .year-btn .chevron {
  transform: rotate(90deg);
  background: rgba(59, 130, 246, 0.2);
  opacity: 0.9;
}

.project-list {
  display: none;
  padding: 2px 6px 8px;
}

.year-block.open .project-list { display: block; }

.project-item { margin-bottom: 2px; }

.project-btn {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(203, 213, 225, 0.78);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s var(--ease);
  position: relative;
}

.project-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.project-btn.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0.08));
  color: #fff;
  box-shadow: inset 3px 0 0 #60a5fa;
}

.sub-menu {
  display: none;
  padding: 3px 0 4px 10px;
  position: relative;
}

.sub-menu::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 6px;
  bottom: 8px;
  width: 1px;
  background: linear-gradient(180deg, rgba(96, 165, 250, 0.35), rgba(255, 255, 255, 0.06));
}

.project-item.open .sub-menu { display: block; }

.sub-btn {
  width: 100%;
  text-align: left;
  padding: 7px 12px 7px 16px;
  margin-bottom: 2px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(148, 163, 184, 0.75);
  cursor: pointer;
  font-size: 13.5px;
  transition: all 0.2s var(--ease);
}

.sub-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

.sub-btn.active {
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow:
    0 8px 20px -10px rgba(37, 99, 235, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sidebar-footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  padding: 10px 12px 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.12);
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.12));
}

.todo-reminder {
  padding: 10px 10px 8px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.35);
}

.todo-reminder-head {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.55);
  margin-bottom: 8px;
  padding: 0 2px;
}

.todo-reminder-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 4px;
  padding: 7px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(226, 232, 240, 0.78);
  font-size: 12.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.todo-reminder-item:last-child {
  margin-bottom: 0;
}

.todo-reminder-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.todo-reminder-item.hot {
  color: #fde68a;
}

.todo-reminder-item.hot:hover {
  background: rgba(245, 158, 11, 0.12);
  color: #fef3c7;
}

.todo-reminder-text {
  flex: 1;
  min-width: 0;
}

.todo-reminder-num {
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #0f172a;
  background: linear-gradient(145deg, #fbbf24, #f59e0b);
}

.btn-ghost {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  color: #cbd5e1;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s var(--ease);
}

.btn-ghost:hover {
  border-color: rgba(96, 165, 250, 0.45);
  background: rgba(59, 130, 246, 0.14);
  color: #fff;
  box-shadow: 0 8px 18px -12px rgba(37, 99, 235, 0.55);
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* 桌面默认隐藏手机导航控件，避免影响电脑版 */
.mobile-nav-toggle,
.mobile-nav-close,
.mobile-nav-backdrop {
  display: none;
}

.breadcrumb {
  font-size: 15px;
  font-weight: 650;
}

.breadcrumb-label {
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.breadcrumb {
  font-size: 16px;
  font-weight: 650;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.topbar-actions .btn-outline.active {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--brand);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 550;
}

.status-chip .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-faint);
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.25);
}

.status-chip.good {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.08);
  border-color: rgba(13, 148, 136, 0.18);
}
.status-chip.good .dot {
  background: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
  animation: pulse-dot 1.8s ease infinite;
}

.status-chip.mid {
  color: #b45309;
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.18);
}
.status-chip.mid .dot { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }

.status-chip.bad {
  color: #be123c;
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.18);
}
.status-chip.bad .dot { background: #f43f5e; box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2); }

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.75; }
}

.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px 14px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.18) transparent;
}

/* 未打开的 dialog 绝不占文档流高度（否则项目管理页底部会多出大块空白） */
dialog:not([open]) {
  display: none !important;
}

.finance-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  position: relative;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px 12px;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95), transparent);
  pointer-events: none;
}

/* 项目管理三大板块 */
.finance-section {
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 12px 28px -18px rgba(15, 23, 42, 0.28);
}

.finance-section::before {
  height: 3px;
  background: var(--section-accent, linear-gradient(90deg, #60a5fa, #2563eb));
  opacity: 1;
}

.finance-section > *:not(.finance-section-head) {
  padding-left: 14px;
  padding-right: 14px;
}

.finance-section > *:last-child {
  padding-bottom: 14px;
}

.finance-section-head {
  margin: 0 0 12px;
  padding: 13px 14px 11px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--section-head-bg, linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.4)));
}

.finance-section-head .panel-title {
  gap: 10px;
}

.finance-section-head .panel-title h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--ink);
}

.finance-section-head .panel-desc {
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--ink-soft);
  font-weight: 500;
}

.finance-section-tag {
  flex-shrink: 0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.finance-section-tag.tone-blue {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.16);
}

.finance-section-tag.tone-amber {
  color: #b45309;
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.18);
}

.finance-section-tag.tone-teal {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.18);
}

.finance-section-tag.tone-indigo {
  color: #4338ca;
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.22);
}

/* 一级多级：合同/成本只读（项目信息仍可改） */
.finance-group-readonly .contract-block input,
.finance-group-readonly .cost-detail-table input,
.finance-group-readonly .cost-detail-table select {
  pointer-events: none;
  background: #f8fafc;
  color: #334155;
}

.finance-group-readonly .contract-block .search-select,
.finance-group-readonly .cost-panel .search-select {
  pointer-events: none;
}

.finance-group-readonly .contract-block .search-select-control,
.finance-group-readonly .cost-panel .search-select-control,
.search-select.is-disabled .search-select-control {
  background: #f8fafc;
  color: #64748b;
  cursor: not-allowed;
  box-shadow: none;
}

.search-select.is-disabled {
  pointer-events: none;
  opacity: 0.92;
}

/* 详情弹窗在一级汇总下也只读（保留关闭） */
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) input,
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) select,
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) textarea,
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) .search-select,
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) .btn-add-detail,
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) .btn-icon,
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) .money-input {
  pointer-events: none !important;
  cursor: default !important;
}

.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) .search-select-control {
  background: #f8fafc;
  color: #64748b;
}

.finance-group-readonly .dialog-contract .dialog-close,
.finance-group-readonly .dialog-contract .btn-close-detail,
.finance-group-readonly .dialog-contract .dialog-actions .btn-outline,
.finance-group-readonly .dialog-contract .dialog-actions .btn-primary,
.finance-group-readonly .dialog-contract .detail-hero-actions .btn-primary,
.finance-group-readonly .dialog-contract .detail-hero-actions .btn-outline {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) .btn-add-detail,
.finance-group-readonly .dialog-contract:not(.dialog-settle-edit) td.col-act .btn-icon {
  display: none !important;
}

/* 主合同开票/回款编辑：允许操作 */
.finance-group-readonly .dialog-contract.dialog-settle-edit input,
.finance-group-readonly .dialog-contract.dialog-settle-edit select,
.finance-group-readonly .dialog-contract.dialog-settle-edit textarea,
.finance-group-readonly .dialog-contract.dialog-settle-edit .search-select,
.finance-group-readonly .dialog-contract.dialog-settle-edit .btn-add-detail,
.finance-group-readonly .dialog-contract.dialog-settle-edit .btn-icon,
.finance-group-readonly .dialog-contract.dialog-settle-edit .money-input,
.finance-group-readonly .dialog-contract.dialog-settle-edit .btn-row-action {
  pointer-events: auto !important;
  cursor: pointer !important;
}

.finance-group-readonly .dialog-contract.dialog-settle-edit .btn-add-detail,
.finance-group-readonly .dialog-contract.dialog-settle-edit td.col-act .btn-icon {
  display: inline-flex !important;
}

.col-source-project {
  min-width: 88px;
  max-width: 120px;
  font-size: 11px;
  color: #475569;
  font-weight: 550;
}

/* 汇总只读：所属项目与供方/收款方并列时防止内容互相压盖 */
.cost-detail-table th.col-source-project,
.cost-detail-table td.col-source-project {
  width: 96px;
  min-width: 88px;
  max-width: 112px;
  padding-right: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.cost-detail-table th.col-supplier,
.cost-detail-table td.col-supplier,
.cost-detail-table th.col-company,
.cost-detail-table td.col-company {
  overflow: hidden;
  box-sizing: border-box;
}

.cost-detail-table td.col-supplier .search-select,
.cost-detail-table td.col-company .search-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.cost-detail-table td.col-supplier .search-select-control,
.cost-detail-table td.col-company .search-select-control {
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* 只读汇总：截断显示，悬停 title 看全称 */
.cost-detail-table .cost-cell-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 550;
  color: var(--ink);
  cursor: default;
}

/* 列多时保底宽度；字号/列宽收紧后可减少横向滑动 */
.cost-detail-table.cost-table-material,
.cost-detail-table.cost-table-fee {
  min-width: 1120px;
}

.finance-group-readonly .cost-detail-table.cost-table-material,
.finance-group-readonly .cost-detail-table.cost-table-fee {
  min-width: 1220px;
}

.panel-index.blue {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.18);
}

.overview-panel {
  --section-accent: linear-gradient(90deg, #60a5fa, #2563eb);
  --section-head-bg: linear-gradient(180deg, rgba(239, 246, 255, 0.95), rgba(255, 255, 255, 0.55));
}

.cost-panel {
  --section-accent: linear-gradient(90deg, #fbbf24, #d97706);
  --section-head-bg: linear-gradient(180deg, rgba(255, 251, 235, 0.95), rgba(255, 255, 255, 0.55));
}

.stats-panel {
  --section-accent: linear-gradient(90deg, #2dd4bf, #0d9488);
  --section-head-bg: linear-gradient(180deg, rgba(240, 253, 250, 0.95), rgba(255, 255, 255, 0.55));
}

.overview-panel .panel-index.blue,
.cost-panel .panel-index.amber,
.stats-panel .panel-index.teal {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 14px -8px rgba(15, 23, 42, 0.35);
}

.overview-panel .panel-index.blue {
  color: #fff;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  border-color: transparent;
  box-shadow: 0 6px 14px -8px rgba(37, 99, 235, 0.5);
}

.cost-panel .panel-index.amber {
  color: #fff;
  background: linear-gradient(145deg, #fbbf24, #d97706);
  border-color: transparent;
  box-shadow: 0 6px 14px -8px rgba(217, 119, 6, 0.45);
}

.stats-panel .panel-index.teal {
  color: #fff;
  background: linear-gradient(145deg, #2dd4bf, #0d9488);
  border-color: transparent;
  box-shadow: 0 6px 14px -8px rgba(13, 148, 136, 0.45);
}

.overview-panel .finance-section-head .panel-title h2 {
  color: #1e3a8a;
}

.cost-panel .finance-section-head .panel-title h2 {
  color: #92400e;
}

.stats-panel .finance-section-head .panel-title h2 {
  color: #115e59;
}

.reveal {
  animation: rise-in 0.45s var(--ease) both;
  animation-delay: calc(var(--d, 0) * 60ms);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.panel-sub { display: none; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-index {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid rgba(37, 99, 235, 0.12);
  border-radius: 6px;
  padding: 3px 6px;
  letter-spacing: 0.04em;
}

.panel-index.teal {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.18);
}

.panel-index.amber {
  color: #b45309;
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.18);
}

.panel-desc {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 400;
}

.panel-tag {
  font-size: 13px;
  color: var(--brand-2);
  background: var(--brand-soft);
  border: 1px solid rgba(37, 99, 235, 0.1);
  padding: 4px 10px;
  border-radius: 999px;
}

.panel-tag.muted {
  color: var(--ink-soft);
  background: rgba(15, 23, 42, 0.04);
  border-color: var(--line);
}

.panel-head-actions { display: flex; gap: 8px; }

/* Overview - client card */
.client-card {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 10px;
  border: 1px solid rgba(37, 99, 235, 0.1);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(13, 148, 136, 0.04)),
    rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.contract-block {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.contract-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(180deg, #f8fafc, #fff);
  border-bottom: 1px solid var(--line);
}

.client-avatar {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #60a5fa, #2563eb 55%, #1d4ed8);
  box-shadow: 0 8px 16px -10px rgba(37, 99, 235, 0.5);
  user-select: none;
}

.client-fields {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1fr 0.7fr;
  gap: 8px;
  min-width: 0;
}

.client-fields-3 {
  grid-template-columns: 1.4fr 0.9fr 1fr;
}

.client-fields-3 .field-assignees {
  grid-column: 1 / -1;
}

/* 项目信息：名称/甲方/联系人姓名/电话/部门 */
.client-fields-contact {
  grid-template-columns: 1.4fr 1.1fr 0.9fr 0.85fr 0.75fr;
}

.client-fields-contact .field-assignees {
  grid-column: 1 / -1;
}

.assignee-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  max-height: 140px;
  overflow: auto;
}

.assignee-opt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  user-select: none;
}

.assignee-opt small {
  margin-left: 2px;
  color: #94a3b8;
  font-size: 11px;
}

.assignee-empty,
.assignee-readonly {
  font-size: 13px;
  color: #64748b;
  padding: 6px 0;
}

.assignee-readonly {
  color: #0f172a;
  font-weight: 550;
}

.client-fields-4 {
  grid-template-columns: 1.3fr 1.3fr 0.75fr 0.9fr;
}

.client-fields-6 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 1100px) {
  .client-fields-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.client-fields .field label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 3px;
  font-weight: 500;
}

.client-fields .field input:not(.search-select-input):not(.search-select-value),
.client-fields .field select.org-select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  outline: none;
  font-size: 13.5px;
  box-shadow: 0 0 0 1px var(--line);
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.client-fields .field input:not(.search-select-input):not(.search-select-value):hover,
.client-fields .field select.org-select:hover {
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.28);
}

.client-fields .field input:not(.search-select-input):not(.search-select-value):focus,
.client-fields .field select.org-select:focus {
  background: #fff;
  box-shadow: 0 0 0 1px var(--brand), 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field-count .count-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-2);
  font-size: 13.5px;
  font-weight: 650;
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.field-count .count-pill span {
  font-family: var(--mono);
  margin-right: 4px;
}

/* Overview - contract block */
.contract-block-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
}

.contract-block-tip {
  font-size: 12px;
  color: var(--ink-faint);
}

.contract-extra-row > td {
  padding: 8px 10px 10px !important;
  background: rgba(248, 250, 252, 0.7);
  border-top: none;
  vertical-align: top;
}

.contract-meta-fields {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(160px, 220px) minmax(180px, 1fr) minmax(140px, 170px);
  gap: 10px 16px;
  padding: 0;
  align-items: end;
}

.contract-meta-fields .field-work {
  min-width: 0;
}

.contract-meta-fields .field label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 3px;
  font-weight: 500;
}

.contract-meta-fields .field-accepted-at label,
.contract-meta-fields .field-assignee label {
  color: #0d9488;
  font-weight: 700;
  font-size: 13px;
}

.contract-meta-fields .field-accepted-at input,
.contract-meta-fields .field-assignee .assignee-readonly {
  color: #0f766e;
  font-weight: 700;
  border: 1px solid rgba(13, 148, 136, 0.45);
  background: linear-gradient(180deg, #f0fdfa 0%, #fff 100%);
}

.contract-meta-fields .field-assignee .assignee-readonly {
  height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}

.contract-meta-fields .field-accepted-at input:focus {
  outline: none;
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.contract-meta-fields .field input {
  width: 100%;
  height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #0f172a;
  box-sizing: border-box;
}

.contract-meta-fields .field input:disabled {
  background: rgba(248, 250, 252, 0.9);
  color: #64748b;
  cursor: not-allowed;
}

.contract-table-wrap {
  overflow-x: auto;
  border: none;
  border-radius: 0;
  background: transparent;
}

.contract-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13.5px;
}

.contract-table th,
.contract-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid rgba(15, 23, 42, 0.06);
  text-align: left;
  vertical-align: middle;
}

.contract-table th:last-child,
.contract-table td:last-child {
  border-right: none;
}

.contract-table th {
  background: #f1f5f9;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 12.5px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.contract-table th.col-money {
  color: #1e40af;
}

.contract-table th.col-payment {
  color: #0f766e;
}

.contract-table th.col-invoice {
  color: #0369a1;
}

.contract-table th.col-tax-rate,
.contract-table td.col-tax-rate {
  width: 88px;
  max-width: 88px;
  padding-right: 8px;
  text-align: center;
  overflow: hidden;
}

.contract-table .col-tax-rate .tax-rate-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
  color: #334155;
  text-align: center;
}

.contract-table th.col-date {
  color: #64748b;
}

.contract-table tbody tr {
  transition: background 0.15s;
}

.contract-table tbody tr:nth-child(even) td.col-name,
.contract-table tbody tr:nth-child(even) td.col-idx,
.contract-table tbody tr:nth-child(even) td.col-act {
  background: rgba(15, 23, 42, 0.015);
}

.contract-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.03);
}

/* 列宽：名称收窄，金额/日期更清晰 */
.contract-table .col-idx { width: 40px; }
.contract-table .col-act { width: 36px; }
.contract-table .col-detail { width: 84px; text-align: center; vertical-align: middle; }
.contract-table .col-name {
  width: 16%;
  overflow: hidden;
  vertical-align: middle;
}

.contract-table .contract-name-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  text-align: left;
}

.contract-table .contract-name-src {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-table .contract-name-main {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contract-table .text-readonly {
  display: inline-block;
  font-size: 13px;
  color: #334155;
}
.contract-table .col-money { width: 9%; }
.contract-table .col-signed { width: 9%; }
.contract-table .col-warranty { width: 8%; }
.contract-table .col-accept { width: 7%; min-width: 88px; }
.contract-table .contract-name-work {
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.35;
  word-break: break-word;
}
.contract-table .col-debt,
.contract-table .col-debt-invoice { width: 9%; }

/* 金额列与日期列底色区分 */
.contract-table th.col-money,
.contract-table td.col-money {
  background: rgba(37, 99, 235, 0.04);
  text-align: right;
}

.contract-table th.col-date,
.contract-table td.col-date,
.contract-table th.col-signed,
.contract-table td.col-signed,
.contract-table th.col-warranty,
.contract-table td.col-warranty {
  background: rgba(148, 163, 184, 0.08);
  text-align: center;
}

.contract-table th.col-payment,
.contract-table td.col-payment {
  background: rgba(13, 148, 136, 0.08);
}

.contract-table th.col-invoice,
.contract-table td.col-invoice {
  background: rgba(14, 165, 233, 0.08);
}

.contract-table th.col-retention,
.contract-table td.col-retention {
  background: rgba(124, 58, 237, 0.06);
}

.contract-table th.col-debt,
.contract-table td.col-debt,
.contract-table th.col-debt-invoice,
.contract-table td.col-debt-invoice {
  background: rgba(217, 119, 6, 0.08);
}

.contract-table tbody tr:hover td.col-money {
  background: rgba(37, 99, 235, 0.08);
}

.contract-table tbody tr:hover td.col-date,
.contract-table tbody tr:hover td.col-signed,
.contract-table tbody tr:hover td.col-warranty {
  background: rgba(148, 163, 184, 0.14);
}

.contract-table tbody tr:hover td.col-payment {
  background: rgba(13, 148, 136, 0.14);
}

.contract-table tbody tr:hover td.col-invoice {
  background: rgba(14, 165, 233, 0.14);
}

.contract-table tbody tr:hover td.col-retention {
  background: rgba(124, 58, 237, 0.1);
}

.contract-table tbody tr:hover td.col-debt,
.contract-table tbody tr:hover td.col-debt-invoice {
  background: rgba(217, 119, 6, 0.14);
}

.contract-table .col-readonly {
  vertical-align: middle;
}

.money-readonly {
  display: inline-block;
  min-width: 72px;
  padding: 4px 6px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: #1e40af;
  text-align: right;
}

.money-input {
  font-family: var(--mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  letter-spacing: 0.01em;
}

.cost-detail-table .col-amount .money-input,
.data-table .col-amount .money-input {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  outline: none;
}

.cost-detail-table .col-amount .money-input:focus,
.data-table .col-amount .money-input:focus {
  border-color: rgba(37, 99, 235, 0.35);
  background: #fff;
}

.money-readonly.accent { color: #0f766e; }
.money-readonly.warn { color: #b45309; }
.money-readonly.ok { color: #0f766e; }
.money-readonly.muted { color: #94a3b8; }

.btn-detail {
  border: 1px solid rgba(37, 99, 235, 0.28);
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-2);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-detail:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.contract-detail-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.btn-detail-edit {
  border: 1px solid rgba(217, 119, 6, 0.35);
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.btn-detail-edit:hover {
  background: #f59e0b;
  border-color: #d97706;
  color: #fff;
}

.btn-linked-cost {
  border: none;
  background: transparent;
  padding: 2px 6px;
  margin: 0;
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: inherit;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
}
.btn-linked-cost.accent {
  color: #0f766e;
  font-weight: 600;
}
.btn-linked-cost:hover:not(:disabled) {
  background: rgba(15, 118, 110, 0.1);
}
.btn-linked-cost:disabled,
.btn-linked-cost.empty {
  cursor: default;
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 400;
}

dialog.dialog-adj-cost {
  width: min(420px, 92vw);
  max-height: min(72vh, 560px);
  padding: 0;
  border: none;
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}
dialog.dialog-adj-cost::backdrop {
  background: rgba(15, 23, 42, 0.35);
}
.dialog-adj-cost-body {
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 560px);
  padding: 18px 20px 16px;
}
.adj-cost-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.adj-cost-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}
.adj-cost-head .dialog-sub {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.adj-cost-cats {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}
.adj-cost-cat {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fafbfc;
}
.adj-cost-cat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.adj-cost-cat-head strong {
  font-size: 14px;
}
.adj-cost-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.adj-cost-items li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 2px 0;
}
.adj-cost-item-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
}
.adj-cost-empty {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}
.adj-cost-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  font-size: 14px;
}
.adj-cost-foot strong {
  font-size: 16px;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}

.total-amt.warn {
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.25);
}

.contract-table .total-row .col-debt {
  background: #fffbeb;
}

.row-idx {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-2);
  background: var(--brand-soft);
}

.contract-table .col-money {
  position: relative;
}

.contract-table .money-prefix {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 12px;
  pointer-events: none;
  z-index: 1;
}

.contract-table .col-money input {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
  outline: none;
}

.contract-table .col-name input,
.contract-table .col-date input,
.contract-table .col-signed input,
.contract-table .col-warranty input,
.contract-table .col-warranty .warranty-select {
  width: 100%;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  outline: none;
}

.contract-table .col-warranty .warranty-select:hover,
.contract-table .col-warranty .warranty-select:focus {
  border-color: var(--line-strong);
  background: #fff;
}

.contract-table .col-name input {
  font-family: var(--font);
  min-width: 0;
}

.contract-table .col-date input,
.contract-table .col-signed input,
.contract-table .col-warranty input {
  font-family: var(--font);
  min-width: 0;
  text-align: center;
}

.contract-table input:hover,
.contract-table input:focus {
  border-color: var(--line-strong);
  background: #fff;
}

.contract-table input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

/* 合计行：对齐各金额列，清晰突出 */
.contract-table .total-row td {
  border-bottom: none;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 650;
  padding: 9px 6px;
  background: #eff6ff;
  color: var(--ink);
  border-top: 2px solid #2563eb;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.contract-table .total-row .total-label {
  font-family: var(--font);
  text-align: left;
  background: #eff6ff;
}

.total-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.total-amt {
  display: inline-block;
  min-width: 72px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(37, 99, 235, 0.15);
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  color: #1e40af;
  text-align: right;
}

.total-amt.accent {
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.25);
  background: rgba(255, 255, 255, 0.9);
}

.contract-table .total-row .col-money {
  text-align: right;
  background: #eff6ff;
}

.contract-table .total-row .col-payment {
  background: #ecfdf5;
}

.contract-table .total-row .col-retention {
  background: #f5f3ff;
}

.contract-table .total-row .col-date,
.contract-table .total-row .col-idx,
.contract-table .total-row .col-act {
  background: #eff6ff;
}

/* legacy shared table styles for other sections */
.client-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  outline: none;
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field input:hover { border-color: rgba(37, 99, 235, 0.35); }

.field input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field input[readonly] {
  color: var(--ink-soft);
  background: rgba(15, 23, 42, 0.03);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.65);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  background: rgba(15, 23, 42, 0.03);
  color: var(--ink-soft);
  font-weight: 550;
  font-size: 13px;
}

.data-table tbody tr:hover { background: rgba(37, 99, 235, 0.03); }

.data-table input {
  width: 100%;
  min-width: 80px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: var(--mono);
  font-size: 13.5px;
}

.data-table input:hover,
.data-table input:focus {
  border-color: var(--line-strong);
  background: #fff;
  outline: none;
}

.data-table input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.data-table input[type="date"] {
  font-family: var(--font);
  min-width: 120px;
}

.data-table select.org-select,
.cost-detail-table select.org-select {
  width: 100%;
  min-width: 80px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--ink);
  outline: none;
  cursor: pointer;
}

.data-table select.org-select:hover,
.data-table select.org-select:focus,
.cost-detail-table select.org-select:hover,
.cost-detail-table select.org-select:focus {
  border-color: var(--line-strong);
  background: #fff;
}

.data-table select.org-select:focus,
.cost-detail-table select.org-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cost-detail-table select.org-select {
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}

.cost-detail-table select.org-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.cost-detail-table .search-select-compact .search-select-control {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.cost-detail-table .search-select-compact .search-select-input {
  padding: 2px 4px;
  font-size: 12px;
  border: none;
  margin: 0;
  background: transparent;
  box-shadow: none;
}

.cost-detail-table .search-select-compact .search-select-toggle {
  width: 20px;
}

.cost-detail-table .btn-detail {
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 5px;
}

.data-table .name-input {
  font-family: var(--font);
  min-width: 140px;
}

/* 可搜索下拉 */
.search-select {
  position: relative;
  width: 100%;
}

.search-select-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  margin: 0;
  padding: 0 8px;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
  user-select: none;
}

.search-select-input.is-placeholder {
  color: var(--ink-faint);
}

.search-select-control {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  cursor: pointer;
  font: inherit;
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
}

.search-select.is-open .search-select-control,
.search-select-control:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

.search-select-toggle {
  flex-shrink: 0;
  width: 28px;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.search-select-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 300;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-select-panel.is-portal {
  position: fixed !important;
  right: auto !important;
  z-index: 2147483646 !important;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
}

.search-select-panel.is-portal[hidden] {
  display: none !important;
}

/* 下拉挂到 dialog 根节点：仅放宽 dialog 裁剪，避免改内部滚动区导致弹窗跳动/无法滑动 */
dialog.dialog-contract.search-select-portal-open {
  overflow: visible;
}

dialog.dialog-contract.search-select-portal-open .dialog-body,
dialog.dialog-contract.search-select-portal-open .dialog-detail {
  overflow: visible;
}

/* 合同/成本详情：保持标题固定 + 下方大区域可滚；下拉已 portal 到 dialog，不必放开 detail-scroll */
dialog.dialog-contract.dialog-detail-scrollable.search-select-portal-open {
  overflow: visible;
}

dialog.dialog-contract.dialog-detail-scrollable.search-select-portal-open .dialog-body,
dialog.dialog-contract.dialog-detail-scrollable.search-select-portal-open .dialog-detail {
  overflow: hidden;
}

dialog.dialog-contract.dialog-detail-scrollable.search-select-portal-open .detail-scroll {
  overflow: auto;
}

.search-select-panel.is-portal.is-dialog-portal {
  position: absolute !important;
  z-index: 3000 !important;
  /* 覆盖 is-portal 的 fixed，确保落在 dialog 顶层内 */
}

.search-select-filter-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.95);
}

.search-select-filter {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: none;
  font-family: var(--font);
  font-size: 13px;
  box-sizing: border-box;
}

.search-select-filter:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-select-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 200px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.search-select-panel.is-portal .search-select-list {
  max-height: none;
}

.search-select-group {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  pointer-events: none;
}

.search-select-option {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

.search-select-option:hover,
.search-select-option.is-highlight {
  background: rgba(37, 99, 235, 0.08);
}

.search-select-option.is-selected {
  color: var(--brand);
  font-weight: 600;
}

.search-select-option.is-orphan {
  color: var(--ink-soft);
}

.search-select-empty {
  padding: 14px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.search-select-edit-wrap {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.search-select-edit-input {
  flex: 1;
  min-width: 0;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  cursor: text;
}

.search-select-toggle-btn {
  flex: 0 0 28px;
  border: 1px solid var(--line);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.search-select-toggle-btn:hover:not(:disabled) {
  color: var(--ink);
  background: #f8fafc;
}

.search-select-toggle-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.search-select-compact .search-select-edit-input,
.search-select-compact .search-select-toggle-btn {
  height: 32px;
  min-height: 32px;
  max-height: 32px;
}

.search-select-compact .search-select-control {
  height: 32px;
  min-height: 32px;
  max-height: 32px;
}

.search-select-compact .search-select-input {
  height: 30px;
  line-height: 30px;
  font-size: 13px;
}

.search-select-compact .search-select-toggle {
  height: 30px;
}

.multi-search-select-panel .multi-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.multi-search-select-panel .multi-check {
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  color: var(--brand, #2563eb);
  font-weight: 700;
}

.multi-search-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(248, 250, 252, 0.95);
  flex-shrink: 0;
}

.multi-search-count {
  font-size: 12px;
  color: #64748b;
}

.client-fields .field .search-select-control {
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 0 1px var(--line);
}

.client-fields .field .search-select-control:hover {
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.28);
}

.client-fields .field .search-select.is-open .search-select-control,
.client-fields .field .search-select-control:focus-within {
  background: #fff;
  box-shadow: 0 0 0 1px var(--brand), 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.client-fields .field .search-select-input {
  padding: 6px 8px;
  font-size: 13.5px;
}

.dialog-loan-edit .search-select-control,
.dialog-loan-apply .search-select-control {
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 0;
  min-height: 42px;
}

.dialog-loan-edit .search-select-input,
.dialog-loan-apply .search-select-input {
  padding: 10px 12px;
  font-size: 14px;
  border: none;
  margin-bottom: 0;
  background: transparent;
  box-shadow: none;
}

.dialog-loan-edit .search-select-input:focus,
.dialog-loan-apply .search-select-input:focus {
  border: none;
  box-shadow: none;
}

.dialog-loan-edit .search-select,
.dialog-loan-apply .search-select {
  margin-bottom: 12px;
}

.total-row td {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.08), rgba(13, 148, 136, 0.05));
  font-weight: 650;
  border-bottom: none;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--brand-2);
}

.total-row td:first-child {
  font-family: var(--font);
  color: var(--ink);
}

.btn-icon {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}

.btn-icon:hover {
  color: var(--danger);
  background: rgba(225, 29, 72, 0.08);
}

.btn-primary,
.btn-outline {
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-primary {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 10px 20px -10px var(--brand-glow);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  transform: translateY(-1px);
}

.btn-outline {
  background: #fff;
  border-color: rgba(15, 23, 42, 0.28);
  color: #0f172a;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-outline:hover {
  border-color: rgba(37, 99, 235, 0.55);
  color: #1d4ed8;
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px -6px rgba(37, 99, 235, 0.35);
}

/* 弹窗底部取消等描边按钮再加强一档，避免发灰看不清 */
.dialog-actions .btn-outline,
.dialog-unsaved-actions .btn-outline,
.dialog-group-tip-body .btn-outline {
  min-width: 88px;
  border-color: rgba(15, 23, 42, 0.34);
  color: #0f172a;
  background: #fff;
}

.btn-outline.sm,
.btn-primary.sm {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 8px;
}

/* Cost */
.cost-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cost-tab:hover {
  border-color: rgba(37, 99, 235, 0.3);
  color: var(--ink);
}

.cost-tab.active {
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 8px 18px -10px var(--brand-glow);
}

.cost-tab-sum {
  font-family: var(--mono);
  font-size: 12px;
  opacity: 0.85;
}

.cost-tab.active .cost-tab-sum {
  background: rgba(255, 255, 255, 0.18);
  padding: 1px 7px;
  border-radius: 999px;
}

.cost-compose {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.05), rgba(13, 148, 136, 0.05));
  border: 1px solid var(--line);
}

.compose-track {
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}

.cost-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cost-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  transition: all 0.2s var(--ease);
}

.cost-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,250,252,0.9));
  border-bottom: 1px solid var(--line);
}

.cost-card-foot {
  display: flex;
  gap: 8px;
  padding: 6px 10px 8px;
}

.cost-detail-table th,
.cost-detail-table td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.cost-detail-table input:not(.search-select-input):not(.search-select-value) {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  outline: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.stat-card {
  position: relative;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat-bar {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.cost-compose-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--ink-soft);
}

.cost-compose-head strong {
  color: var(--ink);
  font-weight: 600;
}

.compose-seg {
  height: 100%;
  transition: width 0.45s var(--ease);
}

.compose-seg.s1 { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.compose-seg.s2 { background: linear-gradient(90deg, #2dd4bf, #0d9488); }
.compose-seg.s3 { background: linear-gradient(90deg, #fbbf24, #d97706); }
.compose-seg.s4 { background: linear-gradient(90deg, #c084fc, #7c3aed); }

.compose-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 13px;
  color: var(--ink-soft);
}

.compose-legend-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  min-width: 0;
}

.compose-legend-inv {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-left: auto;
  font-family: var(--mono);
  font-weight: 600;
  white-space: nowrap;
}

.compose-inv-item.special {
  color: #0369a1;
}

.compose-inv-item.general {
  color: #0f766e;
}

.compose-inv-item.none {
  color: #64748b;
}

.compose-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}

.compose-legend .d1 { background: #2563eb; }
.compose-legend .d2 { background: #0d9488; }
.compose-legend .d3 { background: #d97706; }
.compose-legend .d4 { background: #7c3aed; }

.cost-empty {
  padding: 24px;
  text-align: center;
  color: var(--ink-faint);
}

.cost-panel.panel,
.panel.cost-panel {
  overflow: visible;
}

.cost-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  overflow: visible;
  box-shadow: var(--shadow-sm);
}

.cost-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,250,252,0.9));
  border-bottom: 1px solid var(--line);
}

.cost-card-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.cost-card-sum {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--brand);
  font-weight: 600;
  background: var(--brand-soft);
  padding: 3px 8px;
  border-radius: 7px;
}

.cost-detail-table .sub-index {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  font-size: 10.5px;
}

.sub-index {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-2);
  background: var(--brand-soft);
  border: 1px solid rgba(37, 99, 235, 0.12);
}

.cost-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 12px 12px;
}

.cost-detail-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 12px;
}

.cost-detail-table th,
.cost-detail-table td {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.cost-detail-table th {
  background: transparent;
  color: var(--ink-soft);
  font-weight: 650;
  font-size: 11px;
  white-space: nowrap;
  letter-spacing: 0.01em;
  padding-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.cost-detail-table th.col-no,
.cost-detail-table td.col-no { width: 32px; padding-right: 4px; }
.cost-detail-table th.col-phone,
.cost-detail-table td.col-phone { width: 96px; padding-right: 6px; }
.cost-detail-table th.col-company,
.cost-detail-table td.col-company { width: 14%; min-width: 120px; padding-right: 6px; }
.cost-detail-table th.col-date,
.cost-detail-table td.col-date { width: 96px; padding-right: 6px; }
.cost-detail-table th.col-amount,
.cost-detail-table td.col-amount { width: 92px; min-width: 84px; padding-right: 6px; }
.cost-detail-table th.col-action,
.cost-detail-table td.col-action { width: 28px; padding-left: 0; }
.cost-detail-table th.col-name,
.cost-detail-table td.col-name { width: 14%; max-width: 180px; padding-right: 6px; }
.cost-detail-table th.col-content,
.cost-detail-table td.col-content { width: 18%; min-width: 120px; padding-right: 6px; }
.cost-detail-table th.col-remark,
.cost-detail-table td.col-remark { width: auto; padding-right: 6px; }

.cost-detail-table th.col-adj-link,
.cost-detail-table td.col-adj-link {
  width: 100px;
  min-width: 88px;
  padding-right: 6px;
}
.cost-detail-table th.col-wo-link,
.cost-detail-table td.col-wo-link {
  width: 140px;
  min-width: 120px;
  padding-right: 6px;
}
.cost-detail-table .adj-link-select {
  width: 100%;
  max-width: 140px;
  font-size: 11px;
}

.cost-detail-table .wo-link-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  min-width: 0;
}

.cost-detail-table .wo-link-cell .adj-link-select {
  max-width: 100%;
}

.cost-detail-table .wo-link-open {
  appearance: none;
  border: none;
  background: transparent;
  color: #1d4ed8;
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  padding: 0;
  margin: 0;
  text-align: left;
  cursor: pointer;
  line-height: 1.3;
}

.cost-detail-table .wo-link-open:hover {
  color: #1e40af;
  text-decoration: underline;
}

.cost-detail-table .wo-link-open.as-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1d4ed8;
  font-weight: 550;
}
.cost-detail-table .adj-link-text {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-size: 11px;
}
.dialog-writeoff-picker {
  width: min(960px, 96vw);
  max-height: min(84vh, 860px);
}
.dialog-writeoff-picker-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(80vh, 820px);
}
.dialog-writeoff-picker-body .detail-table-wrap {
  overflow: auto;
  flex: 1;
}

.cost-detail-table th.col-supplier,
.cost-detail-table td.col-supplier {
  width: 14%;
  min-width: 120px;
  padding-right: 6px;
}
.cost-detail-table th.col-signed,
.cost-detail-table td.col-signed { width: 96px; padding-right: 6px; }
.cost-detail-table td.col-signed input[type="date"] {
  width: 100%;
  min-width: 0;
  padding: 3px 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-family: var(--font);
  font-size: 11.5px;
  outline: none;
}
.cost-detail-table td.col-signed input[type="date"]:hover,
.cost-detail-table td.col-signed input[type="date"]:focus {
  border-color: rgba(37, 99, 235, 0.35);
  background: #fff;
}
.cost-detail-table th.col-qty,
.cost-detail-table td.col-qty { width: 60px; padding-right: 6px; }
.cost-detail-table th.col-unit,
.cost-detail-table td.col-unit { width: 72px; padding-right: 6px; }
.cost-detail-table th.col-detail,
.cost-detail-table td.col-detail { width: 48px; padding-right: 0; text-align: left; }

.cost-detail-table .detail-na {
  display: inline-block;
  min-width: 2em;
  color: var(--ink-soft);
  text-align: center;
}

.cost-detail-table .money-readonly {
  display: block;
  width: 100%;
  padding: 3px 5px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 5px;
  background: rgba(15, 23, 42, 0.02);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 650;
  color: #1e40af;
  text-align: left;
  box-sizing: border-box;
}

.cost-detail-table .money-readonly.accent { color: #0f766e; }
.cost-detail-table .money-readonly.warn { color: #b45309; }
.cost-detail-table .money-readonly.ok { color: #0f766e; }

.cost-detail-table th.col-money-ro,
.cost-detail-table td.col-money-ro { width: 76px; padding-right: 6px; text-align: left; }

.cost-detail-table th.col-tax-rate,
.cost-detail-table td.col-tax-rate {
  width: 56px;
  min-width: 48px;
  max-width: 64px;
  padding-right: 4px;
  text-align: center;
  overflow: hidden;
}

.cost-detail-table th.col-inv-type,
.cost-detail-table td.col-inv-type {
  width: 72px;
  min-width: 64px;
  max-width: 84px;
  padding-right: 4px;
  text-align: center;
  overflow: hidden;
}

.cost-detail-table .col-inv-type select.org-select,
.cost-detail-table .col-tax-rate select.org-select {
  width: 100%;
  max-width: 100%;
  height: 26px;
  padding: 0 2px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 11px;
  color: var(--ink);
  box-sizing: border-box;
}

.cost-detail-table .inv-multi-tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(79, 70, 229, 0.1);
  color: #4338ca;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.4;
  white-space: nowrap;
}

.cost-detail-table .col-tax-rate .tax-rate-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 650;
  color: #334155;
  text-align: center;
}

.cost-detail-table .cost-total-row td {
  padding: 7px 6px;
  border-bottom: none;
  background: rgba(248, 250, 252, 0.95);
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  font-weight: 650;
}

.cost-detail-table .cost-total-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.03em;
}

.cost-detail-table .cost-total-row .money-readonly {
  border-color: transparent;
  background: transparent;
  padding-left: 0;
}

.cost-detail-table input:not(.search-select-input):not(.search-select-value) {
  width: 100%;
  min-width: 0;
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  font-size: 12px;
  outline: none;
  text-align: left;
  box-sizing: border-box;
}

.cost-detail-table input.amount,
.cost-detail-table input[data-f="qty"],
.cost-detail-table input[data-f="unitPrice"] {
  font-family: var(--mono);
  text-align: left;
}

.th-del {
  border: none;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 15px;
}

.th-del:hover { color: var(--danger); }

.cost-detail-table tbody tr:hover { background: rgba(37, 99, 235, 0.025); }

.cost-detail-table .empty-row td {
  text-align: center;
  color: var(--ink-faint);
  padding: 16px;
}

.cost-detail-table input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.cost-detail-table input[type="date"] { font-family: var(--font); }

.cost-card-foot {
  display: flex;
  gap: 8px;
  padding: 6px 10px 8px;
}

.cost-pager {
  margin: 8px 10px 4px;
  padding: 0;
}

.labor-formula-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.labor-simple-panel {
  margin: 8px 12px 16px;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(8, 145, 178, 0.2);
  background: rgba(8, 145, 178, 0.04);
}

.labor-formula-eq {
  margin: 0;
  font-size: 14px;
  color: #334155;
  line-height: 1.7;
}

.labor-pct-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 2px;
  vertical-align: middle;
}

.labor-pct-input {
  width: 64px !important;
  height: 28px;
  padding: 0 6px !important;
  border: 1px solid rgba(8, 145, 178, 0.4) !important;
  border-radius: 6px !important;
  text-align: center;
  font-weight: 700;
  color: #0e7490;
  background: #fff !important;
}

.labor-pct-input:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.labor-child-list {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.labor-child-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 13px;
  color: #334155;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.stat-card {
  position: relative;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  overflow: hidden;
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
}

.stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stat-card.highlight {
  background: linear-gradient(145deg, rgba(239, 246, 255, 0.95), rgba(255, 255, 255, 0.85));
  border-color: rgba(37, 99, 235, 0.18);
}

.stat-card.highlight::before {
  background: linear-gradient(180deg, #60a5fa, #2563eb);
}

.stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
  font-weight: 500;
}

.stat-value {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.stat-value.accent { color: var(--accent); }
.stat-value.warn { color: var(--warn); }

.stat-bar {
  margin-top: 6px;
  height: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.stat-bar > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
  transition: width 0.45s var(--ease);
}

.stat-bar.teal > span {
  background: linear-gradient(90deg, #2dd4bf, #0d9488);
}

.stat-hint,
.formula-note { display: none; }

.stat-formula {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.35;
  color: #64748b;
  letter-spacing: 0.01em;
}

.docs-placeholder { padding: 8px 0; }

.module-table-wrap {
  padding: 0 4px 8px;
  overflow-x: auto;
}

.module-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.module-table th,
.module-table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  text-align: left;
  vertical-align: middle;
}

.module-table th {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
}

.module-table .col-no { width: 56px; }
.module-table .col-money { width: 120px; font-family: var(--mono); font-weight: 650; }
.module-table .col-date { width: 110px; }
.module-table .col-action { width: 40px; text-align: center; }

.tag-pill,
.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
}

.tag-pill {
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand);
}

.status-pill.ok {
  background: rgba(13, 148, 136, 0.1);
  color: #0f766e;
}

.status-pill.warn {
  background: rgba(217, 119, 6, 0.1);
  color: #b45309;
}

.status-pill.off {
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
}

/* ── Users page ── */
.users-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Overview / 项目总览 ── */
.overview-panel .panel-head {
  margin-bottom: 8px;
}

.overview-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-bottom: 10px;
}

.overview-time-tabs,
.overview-year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.overview-month-select,
.overview-year-select,
.overview-client-select {
  height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: #fff;
  font-size: 12.5px;
  color: #334155;
  outline: none;
}

.overview-month-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.overview-month-select:focus,
.overview-year-select:focus,
.overview-client-select:focus {
  border-color: rgba(8, 145, 178, 0.55);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.overview-client-select {
  min-width: 140px;
  max-width: 200px;
}

.overview-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 1 1 360px;
  justify-content: flex-end;
}

.year-tab {
  appearance: none;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.85);
  color: #475569;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.year-tab:hover:not(:disabled) {
  border-color: rgba(8, 145, 178, 0.45);
  color: #0e7490;
}

.year-tab.active {
  background: rgba(8, 145, 178, 0.12);
  border-color: rgba(8, 145, 178, 0.4);
  color: #0e7490;
}

.year-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.overview-search {
  position: relative;
  min-width: 180px;
  flex: 1 1 200px;
  max-width: 320px;
}

.overview-search-input {
  width: 100%;
  height: 34px;
  padding: 0 32px 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  color: #0f172a;
  outline: none;
}

.overview-search-input:focus {
  border-color: rgba(8, 145, 178, 0.55);
  box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.12);
}

.overview-search-btn {
  flex-shrink: 0;
  height: 34px;
  padding: 0 14px;
}

.btn-clear-search {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  line-height: 1;
}

.btn-clear-search:hover {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}

.overview-filter-hint {
  margin: -2px 0 10px;
  font-size: 12px;
  color: #0e7490;
}

.overview-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-top: 12px;
  padding: 2px 2px 0;
}

.overview-pager-meta {
  font-size: 12.5px;
  color: #64748b;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.overview-pager-size select {
  margin: 0 4px;
  padding: 4px 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  color: #334155;
}

.overview-pager-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.overview-pager-actions .btn-outline:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.overview-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.overview-table {
  width: 100%;
  min-width: 1480px;
  border-collapse: collapse;
  font-size: 13px;
}

.overview-table th,
.overview-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  text-align: left;
  vertical-align: middle;
}

.overview-table thead th {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  background: rgba(248, 250, 252, 0.9);
  white-space: nowrap;
}

.overview-table tbody tr:hover {
  background: rgba(241, 245, 249, 0.65);
}

.overview-table .empty-row td {
  text-align: center;
  color: #94a3b8;
  padding: 36px 12px;
}

.overview-table .col-expand { width: 36px; }
.overview-table .col-year { width: 64px; }
.overview-table .col-kind {
  min-width: 148px;
  width: 148px;
  white-space: nowrap;
}
.overview-table .col-name { min-width: 160px; }
.overview-table .col-client {
  min-width: 180px;
  width: 200px;
  max-width: 260px;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
}
.overview-table .col-status { width: 80px; }
.overview-table .col-warranty { width: 72px; white-space: nowrap; }
.overview-table .col-warranty-status { width: 96px; white-space: nowrap; }

.overview-table .warranty-status {
  font-size: 13px;
}

.overview-table .warranty-status.active {
  color: #15803d;
  font-weight: 700;
}

.overview-table .warranty-status.ended {
  color: #dc2626;
  font-weight: 800;
}

.overview-table .warranty-status.none,
.overview-table .warranty-status.pending {
  color: var(--ink-faint);
  font-weight: 500;
}
.overview-table .col-money {
  width: 108px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.overview-table .col-action {
  position: sticky;
  right: 0;
  z-index: 1;
  min-width: 92px;
  width: 92px;
  padding-left: 14px;
  padding-right: 14px;
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: -6px 0 10px -8px rgba(15, 23, 42, 0.18);
}
.overview-table thead th.col-action {
  background: rgba(248, 250, 252, 0.98);
  z-index: 2;
}
.overview-table tbody tr:hover .col-action {
  background: rgba(241, 245, 249, 0.96);
}
.overview-table .mono { font-family: var(--mono); font-size: 12.5px; }
.overview-table .accent { color: var(--accent); font-weight: 600; }

.btn-expand {
  width: 26px;
  height: 26px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 6px;
  background: #fff;
  color: #475569;
  cursor: pointer;
  line-height: 1;
  font-size: 12px;
}

.btn-expand:hover {
  border-color: rgba(37, 99, 235, 0.4);
  color: #1d4ed8;
}

.kind-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.kind-tag.group {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
}

.kind-tag.normal {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
}

.kind-tag.repair {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
}

.kind-tag.renovation {
  color: #0e7490;
  background: rgba(8, 145, 178, 0.12);
}

.kind-tag.child {
  color: #6d28d9;
  background: rgba(124, 58, 237, 0.1);
}

.overview-row .proj-name {
  font-weight: 600;
  color: #0f172a;
}

.overview-row .proj-name.indent {
  padding-left: 12px;
  font-weight: 550;
}

.overview-row .child-count {
  display: inline-block;
  margin-left: 8px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.overview-row.is-child td {
  background: rgba(248, 250, 252, 0.85);
  color: #334155;
}

.overview-row.is-group.open {
  background: rgba(239, 246, 255, 0.45);
}

.overview-total-row td {
  padding: 10px 12px;
  border-top: 2px solid rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.95);
  font-weight: 700;
  vertical-align: middle;
}

.overview-total-label {
  color: #0f172a;
}

.overview-total-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1.25;
}

.overview-total-tag {
  font-size: 10px;
  font-weight: 500;
  color: #94a3b8;
  letter-spacing: 0;
}

.overview-total-cell .mono {
  font-size: 12.5px;
}

/* ── Orgs / 资料管理 ── */
.orgs-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.orgs-panel .panel-head {
  margin-bottom: 4px;
}

.orgs-table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.orgs-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13.5px;
}

.orgs-table th,
.orgs-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  text-align: left;
  vertical-align: middle;
}

.orgs-table thead th {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  background: rgba(248, 250, 252, 0.95);
  letter-spacing: 0.03em;
}

.orgs-table tbody tr:hover {
  background: rgba(99, 102, 241, 0.035);
}

.orgs-table tbody tr:last-child td {
  border-bottom: none;
}

.orgs-toolbar {
  margin-top: 2px;
}

.orgs-table .col-no { width: 56px; }
.orgs-table .col-name { width: 28%; }
.orgs-table .col-bank { width: 28%; }
.orgs-table .col-account { width: 24%; font-family: var(--mono); font-size: 13px; }
.orgs-table .col-phone { width: 18%; font-family: var(--mono); font-size: 13px; }
.orgs-table .col-company { width: 22%; }
.orgs-table .col-dept { width: 16%; }
.orgs-table .col-action { width: 148px; text-align: right; }

.orgs-table-contact .col-name { width: 16%; }

.orgs-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--ink-soft);
}

.orgs-empty p {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--ink);
}

.orgs-empty span {
  font-size: 12px;
  color: var(--ink-faint);
}

.dialog-org .dialog-body {
  min-width: min(480px, 92vw);
}

.org-form-grid .form-field-full {
  grid-column: 1 / -1;
}

.users-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.user-stat-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s;
}

.user-stat-card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.user-stat-card.highlight {
  background: linear-gradient(145deg, rgba(240, 253, 250, 0.95), rgba(255, 255, 255, 0.88));
  border-color: rgba(13, 148, 136, 0.18);
}

.user-stat-icon {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.user-stat-icon svg {
  width: 20px;
  height: 20px;
}

.user-stat-icon.stat-total {
  background: rgba(37, 99, 235, 0.1);
  color: var(--brand);
}

.user-stat-icon.stat-active {
  background: rgba(13, 148, 136, 0.12);
  color: #0d9488;
}

.user-stat-icon.stat-off {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.user-stat-icon.stat-roles {
  background: rgba(217, 119, 6, 0.1);
  color: #d97706;
}

.user-stat-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 2px;
}

.user-stat-value {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}

.users-panel {
  padding-bottom: 12px;
}

.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding: 0 2px;
}

.users-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  display: flex;
  align-items: center;
}

.users-search svg {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--ink-faint);
  pointer-events: none;
}

.users-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.users-search input:focus {
  border-color: rgba(13, 148, 136, 0.45);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.users-search input::placeholder {
  color: var(--ink-faint);
}

.users-role-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.filter-chip:hover {
  border-color: rgba(13, 148, 136, 0.25);
  color: #0f766e;
}

.filter-chip.active {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.14), rgba(13, 148, 136, 0.06));
  border-color: rgba(13, 148, 136, 0.35);
  color: #0f766e;
  box-shadow: 0 2px 8px -4px rgba(13, 148, 136, 0.35);
}

.users-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.85);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.users-table th,
.users-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  text-align: left;
  vertical-align: middle;
}

.users-table thead th {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid var(--line);
}

.users-table tbody tr {
  transition: background 0.15s;
}

.users-table tbody tr:hover {
  background: rgba(13, 148, 136, 0.04);
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.users-table .col-no { width: 52px; }
.users-table .col-role { width: 120px; }
.users-table .col-phone { width: 130px; font-family: var(--mono); font-size: 13px; }
.users-table .col-wecom { width: 100px; }
.users-table .col-status { width: 96px; }
.users-table .col-action { width: 220px; text-align: right; }

.wecom-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}
.wecom-pill.ok {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.2);
}
.wecom-pill.warn {
  color: #b45309;
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.2);
}
.wecom-pill.off {
  color: #64748b;
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.2);
}
.wecom-pill.muted {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.08);
  border-color: rgba(148, 163, 184, 0.14);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.user-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.user-avatar.avatar-sysadmin {
  background: linear-gradient(145deg, #2dd4bf, #0d9488);
  box-shadow: 0 6px 14px -8px rgba(13, 148, 136, 0.65);
}

.user-avatar.avatar-finance {
  background: linear-gradient(145deg, #fbbf24, #d97706);
  box-shadow: 0 6px 14px -8px rgba(217, 119, 6, 0.55);
}

.user-avatar.avatar-auditor {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  box-shadow: 0 6px 14px -8px rgba(37, 99, 235, 0.55);
}

.user-avatar.avatar-pay {
  background: linear-gradient(145deg, #22d3ee, #0891b2);
  box-shadow: 0 6px 14px -8px rgba(8, 145, 178, 0.55);
}

.user-avatar.avatar-pm,
.user-avatar.avatar-worker,
.user-avatar.avatar-user {
  background: linear-gradient(145deg, #94a3b8, #64748b);
  box-shadow: 0 6px 14px -8px rgba(100, 116, 139, 0.45);
}

.user-meta {
  min-width: 0;
}

.user-name {
  display: block;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.user-sub {
  display: block;
  margin-top: 1px;
  font-size: 12px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.role-pill.role-sysadmin {
  background: rgba(13, 148, 136, 0.1);
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.18);
}

.role-pill.role-finance {
  background: rgba(217, 119, 6, 0.1);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.18);
}

.role-pill.role-auditor {
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand);
  border-color: rgba(37, 99, 235, 0.14);
}

.role-pill.role-pay {
  background: rgba(8, 145, 178, 0.1);
  color: #0e7490;
  border-color: rgba(8, 145, 178, 0.18);
}

.role-pill.role-pm,
.role-pill.role-worker,
.role-pill.role-user {
  background: rgba(100, 116, 139, 0.1);
  color: #475569;
  border-color: rgba(100, 116, 139, 0.18);
}

.status-dot-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
}

.status-dot-pill.ok {
  background: rgba(13, 148, 136, 0.1);
  color: #0f766e;
}

.status-dot-pill.off {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-pill.ok .status-dot {
  background: #14b8a6;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.25);
}

.status-dot-pill.off .status-dot {
  background: #94a3b8;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.btn-row-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.btn-row-action svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-row-action.edit {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}

.btn-row-action.edit:hover {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.35);
  color: #1e40af;
  box-shadow: 0 4px 12px -6px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-row-action.del {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.2);
  color: #be123c;
  box-shadow: 0 1px 2px rgba(225, 29, 72, 0.06);
}

.btn-row-action.del:hover {
  background: rgba(225, 29, 72, 0.14);
  border-color: rgba(225, 29, 72, 0.32);
  color: #9f1239;
  box-shadow: 0 4px 12px -6px rgba(225, 29, 72, 0.4);
  transform: translateY(-1px);
}

.btn-row-action.detail {
  background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.22);
  color: #b45309;
  box-shadow: 0 1px 2px rgba(217, 119, 6, 0.08);
}

.btn-row-action.detail:hover {
  background: rgba(217, 119, 6, 0.16);
  border-color: rgba(217, 119, 6, 0.35);
  color: #92400e;
  box-shadow: 0 4px 12px -6px rgba(217, 119, 6, 0.4);
  transform: translateY(-1px);
}

.btn-row-action.writeoff {
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.22);
  color: #0f766e;
  box-shadow: 0 1px 2px rgba(13, 148, 136, 0.08);
}

.btn-row-action.writeoff:hover {
  background: rgba(13, 148, 136, 0.16);
  border-color: rgba(13, 148, 136, 0.35);
  color: #115e59;
  box-shadow: 0 4px 12px -6px rgba(13, 148, 136, 0.42);
  transform: translateY(-1px);
}

.btn-row-action.pay {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.22);
  color: #1d4ed8;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);
}

.btn-row-action.pay:hover {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.35);
  color: #1e40af;
  box-shadow: 0 4px 12px -6px rgba(37, 99, 235, 0.42);
  transform: translateY(-1px);
}

.btn-row-action.danger {
  background: rgba(225, 29, 72, 0.08);
  border-color: rgba(225, 29, 72, 0.2);
  color: #be123c;
  box-shadow: 0 1px 2px rgba(225, 29, 72, 0.08);
}

.btn-row-action.danger:hover {
  background: rgba(225, 29, 72, 0.14);
  border-color: rgba(225, 29, 72, 0.35);
  color: #9f1239;
  box-shadow: 0 4px 12px -6px rgba(225, 29, 72, 0.4);
  transform: translateY(-1px);
}

.btn-icon.neutral:hover {
  color: var(--brand);
  background: rgba(37, 99, 235, 0.08);
}

.users-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--ink-soft);
}

.users-empty-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.users-empty p {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--ink);
}

.users-empty span {
  font-size: 12px;
  color: var(--ink-faint);
}

@media (max-width: 960px) {
  .users-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .users-table .col-action { width: 120px; }

  .btn-row-action {
    padding: 6px 8px;
  }
}

/* User edit dialog */
.dialog-user .dialog-body {
  min-width: min(520px, 92vw);
  padding: 0;
}

.dialog-user-form {
  display: flex;
  flex-direction: column;
}

.dialog-user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 0;
}

.dialog-user-head .dialog-sub {
  margin-bottom: 0;
}

.dialog-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 16px;
}

.dialog-user-form form {
  padding: 16px 22px 22px;
}

.user-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 14px;
}

.form-field-full {
  grid-column: 1 / -1;
}

.form-field input[readonly] {
  background: #f8fafc;
  color: var(--ink-soft);
  cursor: default;
}

.field-hint {
  display: block;
  margin: -10px 0 12px;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.dialog-user-form input,
.dialog-user-form select {
  margin-bottom: 12px;
}

.dialog-user-form .dialog-actions {
  margin-top: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ── Loans page (borrower) ── */
.loans-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.loans-panel {
  padding-bottom: 12px;
}

.loan-summary-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.loan-year-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.loan-year-tab {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.loan-year-tab:hover {
  border-color: rgba(217, 119, 6, 0.35);
  color: var(--ink);
}

.loan-year-tab.active {
  background: linear-gradient(180deg, #fbbf24, #d97706);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 14px -8px rgba(217, 119, 6, 0.55);
}

.loan-summary-person {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.08);
  border: 1px solid rgba(217, 119, 6, 0.14);
}

.loan-summary-person-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
}

.loan-summary-person strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.loan-staff-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.loan-staff-picker {
  gap: 10px;
}

.loan-staff-select {
  min-width: 160px;
  max-width: 220px;
  padding: 4px 10px;
  border: 1px solid rgba(217, 119, 6, 0.22);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
  outline: none;
}

.loan-staff-select-project {
  min-width: 180px;
  max-width: 280px;
}

.loan-staff-select:focus {
  border-color: rgba(217, 119, 6, 0.55);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.loan-summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.loan-summary-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.loan-summary-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.loan-summary-section-head strong,
.loan-summary-section-title strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.loan-summary-section-head span,
.loan-summary-section-title span {
  font-size: 12px;
  color: var(--ink-faint);
}

.loan-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.loan-status-filters .filter-chip.active {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.16), rgba(217, 119, 6, 0.06));
  border-color: rgba(217, 119, 6, 0.35);
  color: #b45309;
  box-shadow: 0 2px 8px -4px rgba(217, 119, 6, 0.35);
}

.loan-status-filters .filter-chip:hover {
  border-color: rgba(217, 119, 6, 0.28);
  color: #b45309;
}

.loan-stat-card {
  padding: 14px 14px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.9));
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.loan-stat-card.tone-teal {
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.95), rgba(255, 255, 255, 0.9));
  border-color: rgba(13, 148, 136, 0.14);
}

.loan-stat-card.tone-amber {
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.95), rgba(255, 255, 255, 0.9));
  border-color: rgba(217, 119, 6, 0.14);
}

.loan-stat-card.tone-warn {
  background: linear-gradient(180deg, rgba(255, 247, 237, 0.95), rgba(255, 255, 255, 0.9));
  border-color: rgba(234, 88, 12, 0.14);
}

.loan-stat-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.loan-stat-value {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.loan-stat-card.tone-teal .loan-stat-value { color: #0f766e; }
.loan-stat-card.tone-amber .loan-stat-value { color: #b45309; }
.loan-stat-card.tone-warn .loan-stat-value { color: #c2410c; }

.loan-stat-foot {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-faint);
}

.loan-summary-projects-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.loan-summary-projects-head strong {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
}

.loan-summary-projects-head span {
  font-size: 12px;
  color: var(--ink-faint);
}

.loan-summary-empty {
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.8);
}

.loan-summary-empty p {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.loan-summary-empty span {
  font-size: 12.5px;
  color: var(--ink-faint);
}

@media (max-width: 960px) {
  .loan-summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .loan-summary-stats {
    grid-template-columns: 1fr;
  }
}

.loans-table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.85);
}

.loans-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.loans-table th,
.loans-table td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  text-align: left;
  vertical-align: middle;
}

.loans-table thead th {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border-bottom: 1px solid var(--line);
}

.loans-table tbody tr {
  transition: background 0.15s;
}

.loans-table tbody tr:hover {
  background: rgba(217, 119, 6, 0.04);
}

.loans-table tbody tr:last-child td {
  border-bottom: none;
}

.loans-table .col-no { width: 52px; }
.loans-table .col-borrower { width: 100px; }
.loans-table .col-money { width: 130px; font-family: var(--mono); font-weight: 650; color: var(--ink); }
.loans-table .col-project { min-width: 160px; }
.loans-table .col-cat { white-space: nowrap; }
.loans-table .col-date { width: 110px; font-family: var(--mono); font-size: 13px; }
.loans-table .col-status { width: 168px; }
.loans-table .col-action { width: 220px; text-align: right; }

.loan-status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.loan-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.loan-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.loan-status-pill.pending {
  background: rgba(217, 119, 6, 0.1);
  color: #b45309;
}

.loan-status-pill.pending .loan-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

.loan-status-pill.approved {
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
}

.loan-status-pill.approved .loan-status-dot {
  background: #14b8a6;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.25);
}

.loan-status-pill.paid {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.loan-status-pill.paid .loan-status-dot {
  background: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.loan-status-pill.repaid {
  background: rgba(51, 65, 85, 0.12);
  color: #334155;
}

.loan-status-pill.repaid .loan-status-dot {
  background: #64748b;
  box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.25);
}

.loan-status-pill.revise {
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
}

.loan-status-pill.revise .loan-status-dot {
  background: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.25);
}

.loan-status-pill.rejected {
  background: rgba(225, 29, 72, 0.08);
  color: #be123c;
}

.loan-status-pill.rejected .loan-status-dot {
  background: #f43f5e;
  box-shadow: 0 0 0 2px rgba(244, 63, 94, 0.22);
}

.dialog-loan-head .dialog-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.loans-empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--ink-soft);
}

.loans-empty-icon {
  font-size: 28px;
  margin-bottom: 8px;
  opacity: 0.6;
}

.loans-empty p {
  margin: 0 0 4px;
  font-weight: 600;
  color: var(--ink);
}

.loans-empty span {
  font-size: 12px;
  color: var(--ink-faint);
}

.loan-audit-placeholder {
  padding: 32px 16px !important;
  text-align: center;
  color: var(--ink-faint);
}

.loan-module-tabs-wrap {
  padding: 0 22px 12px;
}

.loan-module-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid var(--line);
}

.loan-module-tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.loan-module-tab.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08);
}

.loan-audit-tabs {
  display: flex;
  gap: 8px;
  padding: 0 22px 14px;
}

.loan-audit-tab {
  border: 1px solid var(--line);
  background: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.loan-writeoff-pending-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #0f766e;
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid rgba(13, 148, 136, 0.2);
  white-space: nowrap;
}

.col-status .loan-status-pill + .loan-writeoff-pending-tag {
  display: block;
  width: fit-content;
}

.loan-audit-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 6px;
  margin-left: 6px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: #d97706;
}

.loan-audit-tab.active .loan-audit-tab-badge {
  background: #b45309;
}

.loan-stat-card.as-button {
  appearance: none;
  border: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.loan-stat-card.as-button:hover {
  transform: translateY(-1px);
}

.loan-audit-tab.active {
  border-color: rgba(37, 99, 235, 0.35);
  color: var(--brand);
  background: rgba(37, 99, 235, 0.08);
}

.loan-audit-stats {
  padding: 0 22px 14px;
}

.loan-audit-form {
  padding: 0 22px 16px;
}

.loan-audit-form textarea {
  width: 100%;
  min-height: 88px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}

.loan-audit-actions {
  padding: 0 22px 20px;
  flex-wrap: wrap;
}

.btn-row-action.audit {
  color: #7c3aed;
  border-color: rgba(124, 58, 237, 0.25);
  background: rgba(124, 58, 237, 0.06);
}

.btn-row-action.audit:hover {
  background: rgba(124, 58, 237, 0.12);
}

.dialog-loan-audit .dialog-body {
  min-width: min(760px, 94vw);
  max-width: min(880px, 96vw);
  padding: 0;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.dialog-loan-audit .loan-audit-scroll {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.dialog-loan-audit .loan-audit-form,
.dialog-loan-audit .loan-audit-actions {
  flex-shrink: 0;
  padding-left: 20px;
  padding-right: 20px;
}

.dialog-loan-audit .loan-audit-form {
  padding-top: 8px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.dialog-loan .loan-writeoff-files-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.09), rgba(248, 250, 252, 0.9));
  border: 1px solid rgba(13, 148, 136, 0.22);
}

.dialog-loan .btn-writeoff-files {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border: 1px solid rgba(13, 148, 136, 0.28);
  border-radius: 10px;
  background: #fff;
  color: #0f766e;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.dialog-loan .btn-writeoff-files-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: rgba(13, 148, 136, 0.12);
  color: #0f766e;
  flex-shrink: 0;
}

.dialog-loan .btn-writeoff-files-ico svg,
.dialog-loan .btn-writeoff-files > svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.dialog-loan .btn-writeoff-files-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  line-height: 1.25;
  text-align: left;
}

.dialog-loan .btn-writeoff-files-copy strong {
  font-size: 13px;
  font-weight: 700;
  color: #0f766e;
}

.dialog-loan .btn-writeoff-files-copy em {
  font-style: normal;
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
}

.dialog-loan .btn-writeoff-files:hover {
  border-color: rgba(13, 148, 136, 0.45);
  background: #f0fdfa;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.16);
  transform: translateY(-1px);
}

.dialog-loan .btn-writeoff-files:hover .btn-writeoff-files-ico {
  background: rgba(13, 148, 136, 0.18);
}

.dialog-loan .loan-writeoff-files-hint {
  font-size: 12px;
  color: #0f766e;
  font-weight: 500;
}

/* 审核弹窗仍用更醒目的主按钮样式 */
.dialog-loan-audit .btn-writeoff-files {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #0d9488;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.35);
}

.dialog-loan-audit .btn-writeoff-files:hover {
  background: #0f766e;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.4);
}

.dialog-loan-audit .btn-writeoff-files-copy strong,
.dialog-loan-audit .btn-writeoff-files-copy em {
  color: inherit;
}

.dialog-loan-audit .btn-writeoff-files-copy em {
  opacity: 0.85;
}

.dialog-loan-audit .btn-writeoff-files-ico {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.btn-outline.tone-warn {
  color: #dc2626;
  border-color: rgba(220, 38, 38, 0.35);
}

.btn-outline.tone-amber {
  color: #d97706;
  border-color: rgba(217, 119, 6, 0.35);
}

/* Loan detail dialog */
.dialog-loan .dialog-body {
  min-width: min(760px, 94vw);
  padding: 0;
  max-height: 88vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

/* 详情：顶栏与底部操作固定，中间大区域滚动（同审核弹窗） */
.dialog-loan-detail .dialog-body {
  max-width: min(880px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: auto;
}

.dialog-loan-detail .loan-detail-scroll {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.dialog-loan-detail .dialog-actions {
  flex-shrink: 0;
  margin: 0;
  padding: 12px 20px 18px;
  border-top: 1px solid rgba(15, 23, 42, 0.06);
  background: #fff;
}

.dialog-loan-writeoff .dialog-body {
  min-width: min(820px, 94vw);
  max-height: 94vh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

dialog.dialog-contract.dialog-loan-writeoff {
  width: min(860px, 96vw);
}

.dialog-loan-form {
  display: flex;
  flex-direction: column;
}

.dialog-loan-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 0;
}

.dialog-loan-head .dialog-sub {
  margin-bottom: 0;
}

.loan-detail-section {
  margin: 10px 18px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
}

.loan-detail-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffbeb, #fff);
}

.loan-detail-section-head .writeoff-count-hl {
  font-weight: 700;
  color: #ca8a04;
}

.loan-detail-badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #fbbf24, #d97706);
  box-shadow: 0 6px 14px -8px rgba(217, 119, 6, 0.55);
}

.loan-detail-badge.audit {
  background: linear-gradient(145deg, #a78bfa, #7c3aed);
  box-shadow: 0 6px 14px -8px rgba(124, 58, 237, 0.5);
}

.loan-detail-badge.writeoff {
  background: linear-gradient(145deg, #2dd4bf, #0d9488);
  box-shadow: 0 6px 14px -8px rgba(13, 148, 136, 0.5);
}

.loan-detail-badge.apply {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  box-shadow: 0 6px 14px -8px rgba(37, 99, 235, 0.45);
}

.loan-meta-section {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), #fff);
}

.loan-meta-section.compact {
  margin-top: 12px;
}

.loan-meta-grid .loan-pay-item dt {
  font-size: 11px;
}

.loan-pay-item dd.mono.accent {
  color: #0f766e;
  font-weight: 650;
}

.writeoff-detail-wrap,
.writeoff-brief-wrap {
  overflow-x: auto;
}

.dialog-loan-writeoff .loan-writeoff-records .loan-detail-section-head h4 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.dialog-loan-writeoff .loan-writeoff-records .loan-detail-section-head p {
  font-size: 12.5px;
}

.dialog-loan-writeoff .writeoff-brief-wrap {
  max-height: 112px;
  overflow: auto;
}

.writeoff-detail-table,
.writeoff-brief-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.writeoff-detail-table th,
.writeoff-detail-table td,
.writeoff-brief-table th,
.writeoff-brief-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  text-align: left;
  vertical-align: middle;
}

.writeoff-detail-table th,
.writeoff-brief-table th {
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  background: rgba(248, 250, 252, 0.85);
}

.writeoff-detail-table .col-money,
.writeoff-brief-table .col-money {
  font-family: var(--mono);
  font-weight: 650;
  white-space: nowrap;
}

.writeoff-detail-table .col-date,
.writeoff-brief-table .col-date,
.audit-logs-table .col-date {
  font-family: var(--font);
  font-size: 12.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.audit-logs-table .col-no {
  width: 48px;
  text-align: center;
  font-family: var(--font);
  font-size: 12.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.audit-logs-table .col-result {
  width: 72px;
  white-space: nowrap;
  font-weight: 650;
}

.writeoff-brief-table .col-action {
  width: 64px;
  white-space: nowrap;
}

.writeoff-detail-table tbody tr:hover,
.writeoff-brief-table tbody tr:hover {
  background: rgba(13, 148, 136, 0.03);
}

.writeoff-brief-empty {
  padding: 18px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-faint);
}

/* 冲销状态：同字号，斜体+下划线以区别借款单 */
.loan-status-pill.writeoff {
  font-style: italic;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.dialog-loan-writeoff .loan-writeoff-apply {
  margin-bottom: 8px;
}

.dialog-loan-writeoff .loan-writeoff-apply .loan-detail-section-head {
  padding: 8px 12px;
  margin-bottom: 6px;
}

.dialog-loan-writeoff .loan-writeoff-apply .loan-detail-section-head h4 {
  font-size: 14px;
  line-height: 1.25;
}

.dialog-loan-writeoff .loan-writeoff-apply .loan-detail-section-head p {
  font-size: 12px;
  margin-top: 1px;
  line-height: 1.3;
}

.dialog-loan-writeoff .loan-writeoff-apply form {
  padding: 0 12px 6px;
}

.dialog-loan-writeoff .loan-writeoff-apply .user-form-grid {
  gap: 0 10px;
}

.dialog-loan-writeoff .loan-writeoff-apply .form-field .dialog-label {
  margin-bottom: 2px;
  font-size: 12px;
  line-height: 1.2;
}

.dialog-loan-writeoff .loan-writeoff-apply input:not(.search-select-input):not(.search-select-value),
.dialog-loan-writeoff .loan-writeoff-apply select {
  padding: 4px 8px !important;
  margin-bottom: 6px !important;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.3;
  min-height: 0;
  height: 30px;
}

.writeoff-file-pick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 4px;
}

.writeoff-file-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.writeoff-file-thumbs.compact {
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
}

.writeoff-file-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  cursor: zoom-in;
  font-size: 12px;
  color: var(--ink-soft);
}

.writeoff-file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.btn-linkish {
  border: none;
  background: transparent;
  color: var(--brand, #1d4ed8);
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.writeoff-pending-files {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 72px;
  overflow: auto;
}

.writeoff-pending-files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.16);
}

.writeoff-pending-name {
  min-width: 0;
  flex: 1;
  font-size: 13px;
  color: var(--ink, #0f172a);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loan-audit-section.is-rejected .loan-detail-section-head {
  background: linear-gradient(180deg, #fff1f2, #fff);
}

.loan-audit-section.is-rejected .loan-detail-badge.audit {
  background: linear-gradient(145deg, #fb7185, #e11d48);
  box-shadow: 0 6px 14px -8px rgba(225, 29, 72, 0.45);
}

.loan-audit-section.is-revise .loan-detail-section-head {
  background: linear-gradient(180deg, #f5f3ff, #fff);
}

.loan-audit-body {
  padding: 10px 12px;
}

.loan-audit-body p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}

.loan-detail-section-head h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 650;
}

.loan-detail-section-head p {
  margin: 1px 0 0;
  font-size: 11.5px;
  color: var(--ink-faint);
}

.loan-pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
}

.loan-pay-item {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.05);
  border-right: 1px solid rgba(15, 23, 42, 0.05);
}

.loan-pay-item:nth-child(2n) {
  border-right: none;
}

.loan-pay-item.full {
  grid-column: 1 / -1;
  border-right: none;
}

.loan-pay-item dt {
  margin: 0 0 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
}

.loan-pay-item dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-all;
}

.loan-pay-item dd.mono {
  font-family: var(--font);
  font-size: 13.5px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.dialog-loan-form .dialog-actions {
  padding: 12px 18px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.loan-edit-audit-tip {
  margin: 12px 22px 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(124, 58, 237, 0.18);
  background: rgba(124, 58, 237, 0.06);
}

.loan-edit-audit-label {
  display: block;
  font-size: 11px;
  font-weight: 650;
  color: #6d28d9;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.loan-edit-audit-tip p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
}

.dialog-loan-edit form,
.dialog-loan-apply form {
  padding: 14px 22px 22px;
}

.loan-edit-grid .loan-edit-divider {
  padding-top: 4px;
  margin-bottom: -4px;
}

.loan-edit-section-label {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.dialog-loan-edit input:not(.search-select-input):not(.search-select-value),
.dialog-loan-edit select,
.dialog-loan-apply input:not(.search-select-input):not(.search-select-value),
.dialog-loan-apply select,
.dialog-loan-writeoff input:not(.search-select-input):not(.search-select-value),
.dialog-loan-writeoff select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  margin-bottom: 12px;
  outline: none;
  background: #fff;
  font-size: 14px;
}

.dialog-loan-edit input:not(.search-select-input):not(.search-select-value):focus,
.dialog-loan-edit select:focus,
.dialog-loan-apply input:not(.search-select-input):not(.search-select-value):focus,
.dialog-loan-apply select:focus,
.dialog-loan-writeoff input:not(.search-select-input):not(.search-select-value):focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dialog-loan-edit input[readonly],
.dialog-loan-apply input[readonly],
.dialog-loan-writeoff input[readonly] {
  background: #f8fafc;
  color: var(--ink-soft);
}

.dialog-loan-writeoff textarea,
.dialog-loan-writeoff .loan-writeoff-apply textarea {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  margin-bottom: 6px;
  outline: none;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.35;
  resize: vertical;
  min-height: 32px;
  max-height: 52px;
}

.dialog-loan-writeoff .loan-writeoff-apply .field-hint {
  margin: 0 0 4px;
  font-size: 12px;
  line-height: 1.3;
}

.dialog-loan-writeoff .loan-writeoff-apply .writeoff-file-pick {
  gap: 4px 8px;
  margin-bottom: 2px;
}

.dialog-loan-writeoff .dialog-actions.inline {
  padding: 8px 0 0;
  margin-top: 2px;
}

.dialog-loan-writeoff .dialog-actions.inline .btn-primary {
  min-width: 108px;
}

.dialog-loan-writeoff textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.writeoff-detail-table .col-remark {
  max-width: 140px;
  word-break: break-word;
}

.dialog-loan-apply .dialog-loan-head {
  padding-bottom: 4px;
}

.docs-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.docs-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  overflow: hidden;
}

.docs-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,250,252,0.9));
}

.docs-panel-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.docs-panel-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-faint);
}

.docs-table-wrap {
  padding: 0 6px;
  overflow-x: auto;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  table-layout: fixed;
}

.docs-table th,
.docs-table td {
  padding: 8px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  text-align: left;
  vertical-align: middle;
  color: var(--ink);
}

.docs-table th {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.docs-table .col-no { width: 48px; }
.docs-table .col-type { width: 72px; }
.docs-table .col-size { width: 88px; }
.docs-table .col-date { width: 110px; }
.docs-table .col-action { width: 210px; text-align: right; }

.docs-row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.docs-table .doc-name {
  font-weight: 550;
  color: var(--ink);
}

.docs-table .doc-type {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand);
  font-size: 12px;
  font-weight: 550;
}

.docs-table .empty-row td {
  text-align: center;
  color: var(--ink-faint);
  padding: 20px 8px;
}

.docs-panel .upload-zone {
  margin: 10px 12px 12px;
  padding: 28px 20px;
}

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 24px;
  border: 1.5px dashed rgba(37, 99, 235, 0.28);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.08), transparent 55%),
    rgba(255, 255, 255, 0.5);
  text-align: center;
  color: var(--ink-soft);
  transition: border-color 0.2s, background 0.2s;
}

.upload-zone:hover {
  border-color: rgba(37, 99, 235, 0.5);
}

.upload-zone.is-dragover {
  border-color: rgba(37, 99, 235, 0.75);
  background:
    radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.14), transparent 55%),
    rgba(239, 246, 255, 0.85);
}

.upload-ico {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 18px;
}

.upload-zone p {
  margin: 0;
  font-size: 15px;
  color: var(--ink);
  font-weight: 550;
}

.upload-zone span {
  font-size: 13px;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  box-shadow: var(--shadow-lg);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  max-width: 96vw;
}

dialog.dialog-contract:has(.dialog-detail) {
  width: min(1520px, 98vw);
}

dialog.dialog-contract:has(.dialog-loan) {
  width: min(820px, 94vw);
}

dialog.dialog-contract:has(.dialog-user-form) {
  width: min(640px, 94vw);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(3px);
}

.dialog-contract {
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(900px 420px at 0% 0%, rgba(37, 99, 235, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(13, 148, 136, 0.1), transparent 50%),
    rgba(255, 255, 255, 0.98);
  box-shadow:
    0 28px 64px -28px rgba(15, 23, 42, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.65) inset;
  animation: dialog-pop 0.32s var(--ease);
}

.dialog-contract::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(6px);
}

@keyframes dialog-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dialog-body {
  padding: 22px;
  min-width: 340px;
}

.dialog-detail {
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 标题固定，下方大区域滚动（合同/成本详情） */
dialog.dialog-contract.dialog-detail-scrollable {
  max-height: 94vh;
}

.dialog-detail-scrollable .dialog-detail {
  max-height: min(92vh, 920px);
}

.dialog-detail .detail-hero {
  flex-shrink: 0;
}

.dialog-detail .detail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 0 0 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(15, 23, 42, 0.22) transparent;
}

.dialog-detail .detail-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.dialog-detail .detail-scroll::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.dialog-detail .detail-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(15, 23, 42, 0.28);
  background-clip: padding-box;
}

.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 18px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(13, 148, 136, 0.05)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.88));
}

.detail-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.detail-hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  margin-bottom: 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--brand-2);
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(37, 99, 235, 0.14);
}

.detail-hero-main h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.cost-detail-org {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 10px;
}

.cost-detail-org-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.cost-detail-org-item span {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}

.cost-detail-org-item strong {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}

.cost-detail-org-item strong.mono {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.detail-hero .dialog-sub {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.btn-close-detail {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
}

.btn-close-detail span {
  font-size: 15px;
  line-height: 1;
}

.btn-close-detail:hover {
  color: var(--ink);
  border-color: rgba(37, 99, 235, 0.28);
  background: #fff;
  box-shadow: 0 8px 18px -12px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  padding: 16px 22px 4px;
}

.contract-adj-filter {
  margin: 8px 22px 4px;
  padding: 12px 14px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(255, 255, 255, 0.9)),
    #fffbeb;
}

.contract-adj-filter-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.contract-adj-filter-label {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  color: #b45309;
}

.contract-adj-filter-search,
.contract-adj-filter-select {
  height: 40px;
  min-height: 40px;
  max-height: none;
  margin: 0;
  border: 1px solid rgba(180, 83, 9, 0.35);
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  box-sizing: border-box;
  overflow: visible;
  -webkit-appearance: none;
  appearance: none;
}

.contract-adj-filter-search {
  flex: 1 1 240px;
  min-width: 200px;
  padding: 0 14px;
}

.contract-adj-filter-search::placeholder {
  color: #94a3b8;
  opacity: 1;
  font-weight: 450;
  line-height: 1.35;
}

.contract-adj-filter-search::-webkit-search-decoration,
.contract-adj-filter-search::-webkit-search-cancel-button,
.contract-adj-filter-search::-webkit-search-results-button,
.contract-adj-filter-search::-webkit-search-results-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.contract-adj-filter-search:hover,
.contract-adj-filter-select:hover {
  border-color: rgba(217, 119, 6, 0.55);
}

.contract-adj-filter-search:focus,
.contract-adj-filter-select:focus {
  outline: none;
  border-color: #d97706;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  background: #fff;
}

.contract-adj-filter-select {
  flex: 1 1 260px;
  min-width: 220px;
  max-width: 420px;
  padding: 0 36px 0 14px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #b45309 50%),
    linear-gradient(135deg, #b45309 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.contract-adj-filter-select option {
  color: #0f172a;
  background: #fff;
  font-size: 14px;
  line-height: 1.4;
}

.contract-adj-filter-hint {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  color: #92400e;
}

.detail-stat {
  position: relative;
  padding: 12px 14px 11px;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.05);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  animation: stat-rise 0.38s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
  transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}

.detail-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -16px rgba(15, 23, 42, 0.2);
  border-color: rgba(15, 23, 42, 0.08);
}

.detail-stat-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 550;
}

.detail-stat strong {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--stat-value, #1e40af);
  letter-spacing: -0.02em;
}

.detail-stat.tone-blue {
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.95), rgba(255, 255, 255, 0.92));
  --stat-value: #1e40af;
}
.detail-stat.tone-amber {
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.95), rgba(255, 255, 255, 0.92));
  --stat-value: #b45309;
}
.detail-stat.tone-indigo {
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.95), rgba(255, 255, 255, 0.92));
  --stat-value: #4338ca;
}
.detail-stat.tone-sky {
  background: linear-gradient(180deg, rgba(240, 249, 255, 0.95), rgba(255, 255, 255, 0.92));
  --stat-value: #0369a1;
}
.detail-stat.tone-teal {
  background: linear-gradient(180deg, rgba(240, 253, 250, 0.95), rgba(255, 255, 255, 0.92));
  --stat-value: #0f766e;
}
.detail-stat.tone-warn {
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.95), rgba(255, 255, 255, 0.92));
  --stat-value: #b45309;
}
.detail-stat.tone-ok {
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.95), rgba(255, 255, 255, 0.92));
  --stat-value: #0f766e;
}

@keyframes stat-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 0 22px 22px;
}

.detail-block-full {
  margin: 0 22px 14px;
}

.detail-block {
  position: relative;
  border: 1px solid rgba(15, 23, 42, 0.07);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.03),
    0 10px 28px -22px rgba(15, 23, 42, 0.22);
}

.detail-block::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 3px;
  background: var(--block-accent, #2563eb);
}

.detail-block-adjust { --block-accent: linear-gradient(90deg, #f59e0b, #d97706); }
.detail-block-invoice { --block-accent: linear-gradient(90deg, #60a5fa, #2563eb); }
.detail-block-payment { --block-accent: linear-gradient(90deg, #2dd4bf, #0d9488); }

.detail-block-adjust::before { background: linear-gradient(90deg, #fbbf24, #d97706); }
.detail-block-invoice::before { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.detail-block-payment::before { background: linear-gradient(90deg, #2dd4bf, #0d9488); }

.detail-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.92));
}

.detail-block-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.detail-block-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 8px 18px -10px rgba(15, 23, 42, 0.35);
}

.detail-block-icon.adjust {
  background: linear-gradient(145deg, #fbbf24, #d97706);
}

.detail-block-icon.invoice {
  background: linear-gradient(145deg, #60a5fa, #2563eb);
}

.detail-block-icon.payment {
  background: linear-gradient(145deg, #2dd4bf, #0d9488);
}

.detail-block-head h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.detail-block-head p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-faint);
}

.btn-add-detail {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.btn-add-detail.adjust {
  color: #b45309;
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.22);
}

.btn-add-detail.invoice {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.18);
}

.btn-add-detail.payment {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.18);
}

.btn-add-detail:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px -12px rgba(15, 23, 42, 0.28);
}

.btn-add-detail.adjust:hover { background: rgba(245, 158, 11, 0.18); }
.btn-add-detail.invoice:hover { background: rgba(37, 99, 235, 0.16); }
.btn-add-detail.payment:hover { background: rgba(13, 148, 136, 0.16); }

.detail-table-wrap {
  border: none;
  border-radius: 0;
  background: transparent;
  padding: 0 12px 12px;
  overflow-x: auto;
}

.detail-table-wrap.table-wrap {
  border: none;
  background: transparent;
}

/* 合同详情：增减项 / 开票 / 回款 默认约显示 5 行，超出各自小滚动 */
.detail-table-wrap-scroll {
  --detail-visible-rows: 5;
  --detail-row-h: 42px;
  --detail-head-h: 38px;
  --detail-foot-h: 48px;
  max-height: calc(
    var(--detail-head-h) + var(--detail-visible-rows) * var(--detail-row-h) + var(--detail-foot-h)
  );
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.detail-table-wrap-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.detail-table-wrap-scroll::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, 0.35);
  border-radius: 999px;
}

.detail-table-wrap-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, 0.55);
}

.detail-table-wrap-scroll .detail-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #fff;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.08);
}

.detail-table-wrap-scroll .detail-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 3;
  background: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(15, 23, 42, 0.08);
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  table-layout: auto;
  min-width: 860px;
}

.detail-table th,
.detail-table td {
  padding: 6px 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  vertical-align: middle;
}

.detail-table th {
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
  letter-spacing: 0.02em;
  padding-bottom: 8px;
}

.detail-table th.col-money,
.detail-table td.col-money,
.detail-table th.col-invno,
.detail-table td.col-invno,
.detail-table th.col-date,
.detail-table td.col-date,
.detail-table th.col-remark,
.detail-table td.col-remark {
  text-align: left;
}

.detail-table tbody tr {
  transition: background 0.15s;
}

.detail-table tbody tr:nth-child(even) {
  background: transparent;
}

.detail-table tbody tr:hover {
  background: transparent;
}

.detail-table tbody tr:hover .field-input,
.detail-table tbody tr:hover .money-field,
.detail-table tbody tr:hover .col-invno input,
.detail-table tbody tr:hover .col-unit input:not(.search-select-input),
.detail-table tbody tr:hover .col-unit .search-select-control,
.detail-table tbody tr:hover .col-pay-method input,
.detail-table tbody tr:hover .col-pay-method select.org-select,
.detail-table tbody tr:hover .col-date input,
.detail-table tbody tr:hover .col-remark input {
  border-color: rgba(37, 99, 235, 0.24);
}

.detail-table th.col-unit,
.detail-table td.col-unit,
.detail-table th.col-pay-method,
.detail-table td.col-pay-method,
.detail-table th.col-invno,
.detail-table td.col-invno,
.detail-table th.col-date,
.detail-table td.col-date,
.detail-table th.col-remark,
.detail-table td.col-remark {
  text-align: left;
}

.detail-table .col-idx { width: 36px; padding-right: 4px; }
.detail-table .col-date { width: 12%; padding-right: 6px; }
.detail-table.detail-table-invoice .col-date { width: 112px; max-width: 112px; padding-right: 4px; }
.detail-table .col-invno { width: 12%; padding-right: 6px; }
.detail-table .col-inv-type { width: 72px; padding-right: 6px; }
.detail-table .col-tax-rate { width: 72px; padding-right: 6px; }
.detail-table .col-unit { width: 14%; padding-right: 6px; }
.detail-table .col-pay-method { width: 12%; padding-right: 6px; }
.detail-table .col-money { width: 8%; min-width: 88px; max-width: 110px; padding-right: 6px; }
.detail-table .col-remark { width: auto; min-width: 10%; padding-right: 6px; }
.detail-table .col-adj-link { width: 180px; min-width: 160px; padding-right: 6px; }
.detail-table.detail-table-payment .col-adj-link { width: 180px; min-width: 160px; }
.detail-table.detail-table-payment .col-remark { width: 14%; min-width: 80px; max-width: 160px; }
.detail-table .col-file { width: 56px; text-align: center; padding-right: 4px; }
.detail-table .col-act { width: 24px; padding-left: 0; }

.detail-table .adj-link-select {
  width: 100%;
  min-width: 0;
}

.detail-table .adj-link-text {
  display: block;
  height: 32px;
  line-height: 32px;
  font-size: 12px;
  color: #0f766e;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-table .col-inv-type select.org-select,
.detail-table .col-tax-rate select.org-select,
.detail-table .col-adj-link select.org-select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin: 0;
  padding: 0 6px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  outline: none;
  font: inherit;
  font-size: 12px;
  line-height: 30px;
  color: var(--ink);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%),
    linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 12px) calc(50% - 2px), calc(100% - 8px) calc(50% - 2px);
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 18px;
}

.detail-table .col-inv-type select.org-select:hover,
.detail-table .col-tax-rate select.org-select:hover,
.detail-table .col-adj-link select.org-select:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.detail-table .col-inv-type select.org-select:focus,
.detail-table .col-tax-rate select.org-select:focus,
.detail-table .col-adj-link select.org-select:focus {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.detail-table .col-idx .row-idx {
  margin: 0;
}

.detail-table tbody td {
  vertical-align: middle;
  padding-top: 4px;
  padding-bottom: 4px;
}

.detail-table .field-input,
.detail-table .col-invno input,
.detail-table .col-unit input:not(.search-select-input),
.detail-table .col-unit .search-select-compact .search-select-control,
.detail-table .col-pay-method select.org-select {
  display: block;
  width: 100%;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin: 0;
  padding: 0 6px;
  font-size: 13px;
  box-sizing: border-box;
}

.detail-table .col-pay-method input,
.detail-table .col-date input,
.detail-table .col-remark input {
  display: block;
  width: 100%;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  outline: none;
  font-size: 13px;
  line-height: 30px;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  box-sizing: border-box;
}

.detail-table .col-unit .search-select-compact .search-select-input {
  height: 30px;
  line-height: 30px;
  padding: 0 8px;
  cursor: pointer;
  border: none;
  margin: 0;
  background: transparent;
  box-shadow: none;
}

.detail-table .col-unit .search-select-compact .search-select-toggle {
  height: 30px;
}

.detail-table .money-field {
  display: flex;
  align-items: center;
  width: 100%;
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.detail-table .money-field .money-prefix {
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.detail-table .money-field input {
  flex: 1;
  min-width: 0;
  width: auto;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 30px;
  text-align: left;
  outline: none;
  box-shadow: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.detail-table .col-date input {
  font-family: var(--font);
  line-height: 30px;
}

.detail-table .col-date input[type="date"] {
  padding-right: 4px;
}

.detail-table .col-date input[type="date"]::-webkit-datetime-edit,
.detail-table .col-date input[type="date"]::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
  line-height: 30px;
}

.detail-table .col-date input[type="date"]::-webkit-calendar-picker-indicator {
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.detail-table .col-invno input {
  font-family: var(--mono);
  font-size: 13px;
}

.detail-table .money-field:hover,
.detail-table .col-invno input:hover,
.detail-table .col-unit input:not(.search-select-input):hover,
.detail-table .col-unit .search-select-control:hover,
.detail-table .col-pay-method input:hover,
.detail-table .col-pay-method select.org-select:hover,
.detail-table .col-date input:hover,
.detail-table .col-remark input:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: #fff;
}

.detail-table .money-field:focus-within,
.detail-table .col-invno input:focus,
.detail-table .col-unit input:not(.search-select-input):focus,
.detail-table .col-unit .search-select.is-open .search-select-control,
.detail-table .col-pay-method input:focus,
.detail-table .col-pay-method select.org-select:focus,
.detail-table .col-date input:focus,
.detail-table .col-remark input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.detail-table .field-input:hover,
.detail-table .field-input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.detail-table .empty-row td {
  padding: 0;
  border-bottom: none;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 28px 12px;
  color: var(--ink-faint);
  font-size: 13.5px;
}

.detail-empty-ico {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.04);
  color: var(--ink-faint);
  font-size: 15px;
}

.detail-total td {
  background: transparent;
  border-bottom: none;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-soft);
  padding: 10px 0 0;
}

.detail-block-adjust .detail-total td {
  background: transparent;
}

.detail-block-payment .detail-total td {
  background: transparent;
}

.detail-sum-pill {
  display: block;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: #1e40af;
  background: rgba(239, 246, 255, 0.95);
  border: 1px solid rgba(37, 99, 235, 0.16);
  text-align: left;
  box-sizing: border-box;
}

.detail-block-adjust .detail-sum-pill {
  color: #b45309;
  border-color: rgba(245, 158, 11, 0.24);
}

.detail-block-payment .detail-sum-pill {
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.24);
}

.detail-total-label {
  font-size: 12.5px;
  letter-spacing: 0.02em;
}

@media (max-width: 900px) {
  .detail-summary {
    grid-template-columns: repeat(3, 1fr);
    padding-left: 16px;
    padding-right: 16px;
  }
  .detail-grid {
    grid-template-columns: 1fr;
    padding-left: 16px;
    padding-right: 16px;
  }
  .detail-block-full { margin-left: 16px; margin-right: 16px; }
  .detail-hero { padding: 16px; }
}

.dialog-body h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.dialog-sub {
  margin: 6px 0 14px;
  font-size: 14px;
  color: var(--ink-faint);
}

.dialog-label {
  display: block;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 6px;
}

.dialog-body input,
.dialog-body select,
.dialog-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  margin-bottom: 14px;
  outline: none;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
}

.dialog-body textarea {
  resize: vertical;
  min-height: 72px;
}

.dialog-body #newColumnName { margin-bottom: 12px; }

.dialog-body input:focus,
.dialog-body select:focus,
.dialog-body textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

dialog.dialog-group-tip {
  width: min(420px, 92vw);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
}

dialog.dialog-group-tip::backdrop {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
}

.dialog-group-tip-body {
  padding: 22px 22px 18px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background:
    radial-gradient(420px 180px at 0% 0%, rgba(79, 70, 229, 0.1), transparent 55%),
    rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 48px -28px rgba(15, 23, 42, 0.45);
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px 14px;
  align-items: start;
}

.dialog-group-tip-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  font-style: italic;
  color: #4338ca;
  background: rgba(79, 70, 229, 0.12);
  border: 1px solid rgba(79, 70, 229, 0.18);
}

.dialog-group-tip-copy {
  min-width: 0;
}

.dialog-group-tip-copy h3 {
  margin: 2px 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink, #0f172a);
}

.dialog-group-tip-copy p {
  margin: 0 0 6px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-muted, #475569);
}

.dialog-group-tip-copy p:last-child {
  margin-bottom: 0;
}

.dialog-group-tip-body .dialog-actions {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding-top: 4px;
}

.dialog-group-tip-body .dialog-actions .btn-primary {
  min-width: 96px;
}

.dialog-group-tip-icon.tone-amber {
  color: #b45309;
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(217, 119, 6, 0.22);
}

.dialog-unsaved-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 1280px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1100px) {
  .client-row,
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .client-fields { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 800px) {
  .client-row,
  .stats-grid { grid-template-columns: 1fr; }
  .client-card {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
    padding: 12px;
  }
  .client-avatar { display: none; }
  .client-fields,
  .client-fields-3,
  .client-fields-contact,
  .client-fields-4,
  .client-fields-6 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    min-width: 0;
  }
  .client-fields-3 .field-assignees,
  .client-fields-contact .field-assignees {
    grid-column: 1;
  }
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  padding: 20px;
}

.login-overlay[hidden] { display: none !important; }

.app.is-login-locked {
  pointer-events: none;
  user-select: none;
  filter: blur(2px);
}

.login-card {
  width: min(420px, 96vw);
  padding: 28px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 64px -28px rgba(15, 23, 42, 0.45);
}

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

.login-brand h2 { margin: 0 0 4px; font-size: 20px; }
.login-brand p { margin: 0; color: var(--ink-soft); font-size: 13px; }
.login-form input { width: 100%; margin-bottom: 12px; }
.login-submit { width: 100%; margin-top: 4px; }
.login-error { margin: 0 0 10px; color: #dc2626; font-size: 13px; }
.login-hint { margin: 14px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }

/* ── Login screen (full page) ── */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 28px 20px 52px;
  background:
    radial-gradient(1100px 560px at 10% 12%, rgba(37, 99, 235, 0.14), transparent 58%),
    radial-gradient(900px 520px at 92% 88%, rgba(13, 148, 136, 0.1), transparent 55%),
    linear-gradient(165deg, #f4f7fb 0%, #eef2f7 45%, #e8eef6 100%);
  overflow: hidden;
}

.login-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(100, 116, 139, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 116, 139, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  opacity: 0.7;
}

.login-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  animation: login-float 14s var(--ease) infinite alternate;
}

.login-orb-a {
  width: 280px;
  height: 280px;
  left: -60px;
  top: 12%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.22), transparent 70%);
}

.login-orb-b {
  width: 220px;
  height: 220px;
  right: 8%;
  bottom: 10%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.18), transparent 70%);
  animation-delay: -4s;
}

.login-orb-c {
  width: 160px;
  height: 160px;
  right: 28%;
  top: 18%;
  background: radial-gradient(circle, rgba(96, 165, 250, 0.16), transparent 70%);
  animation-delay: -8s;
}

@keyframes login-float {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(12px, -18px, 0) scale(1.06); }
}

.login-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 0;
  border-radius: 24px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow:
    0 28px 64px -28px rgba(15, 23, 42, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.85) inset;
  backdrop-filter: blur(10px);
  animation: login-rise 0.55s var(--ease) both;
}

@keyframes login-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

.login-hero {
  padding: 48px 40px 42px;
  color: var(--ink);
  background:
    linear-gradient(160deg, rgba(37, 99, 235, 0.1), rgba(255, 255, 255, 0.35) 52%, rgba(13, 148, 136, 0.08)),
    rgba(248, 250, 252, 0.9);
  border-right: 1px solid rgba(148, 163, 184, 0.2);
}

.login-hero-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 36px;
}

.login-logo {
  height: 76px;
  width: auto;
  display: block;
  object-fit: contain;
  flex-shrink: 0;
}

.login-hero-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.login-hero-sub {
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.login-hero-title {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.4vw, 36px);
  line-height: 1.22;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.login-hero-desc {
  margin: 0 0 28px;
  max-width: 34em;
  font-size: 14px;
  line-height: 1.7;
  color: #475569;
}

.login-hero-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.login-hero-points li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  color: #334155;
}

.login-hero-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.login-panel {
  padding: 48px 40px 42px;
  background: rgba(255, 255, 255, 0.94);
}

.login-panel-head {
  margin-bottom: 28px;
}

.login-panel-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 750;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.login-panel-head p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.login-screen .login-form {
  display: grid;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 7px;
}

.login-field span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

.login-screen .login-form input {
  width: 100%;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-screen .login-form input:hover {
  border-color: rgba(37, 99, 235, 0.35);
}

.login-screen .login-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-screen .login-submit {
  width: 100%;
  margin-top: 6px;
  min-height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 650;
}

.login-screen .login-error {
  margin: 0;
}

.site-beian {
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
}
.site-beian a {
  color: inherit;
  text-decoration: none;
}
.site-beian a:hover {
  text-decoration: underline;
}
/* 登录页浅色背景：用深色字，避免看不见 */
.login-beian {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 3;
  color: #475569;
  pointer-events: auto;
}
.login-beian a:hover {
  color: #1e293b;
}
/* 侧栏深色底：用白色字 */
.sidebar-beian {
  margin-top: 10px;
  padding: 0 2px;
  color: #fff;
}
.sidebar-beian a:hover {
  color: #fff;
  opacity: 0.9;
}

@media (max-width: 860px) {
  .login-screen {
    /* 键盘弹出时可滚动，避免内容被挤乱 */
    place-items: start center;
    align-content: start;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 16px max(20px, env(safe-area-inset-bottom, 0px));
  }
  .login-shell {
    grid-template-columns: 1fr;
    margin: 12px auto 28px;
  }
  .login-hero {
    padding: 28px 24px 22px;
    border-right: none;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  }
  .login-hero-title {
    font-size: 26px;
  }
  .login-hero-points {
    display: none;
  }
  .login-panel {
    padding: 28px 24px 26px;
  }
  .login-beian {
    /* 不再贴死视口底部，避免键盘顶起后贴到输入框旁 */
    position: static;
    margin: 0 auto 8px;
    padding-bottom: 4px;
  }
  /* 输入框聚焦（键盘弹出）时隐藏备案号 */
  .login-screen:has(.login-form:focus-within) .login-beian {
    display: none;
  }
}

/* 视口很矮（常见于手机键盘已打开）时隐藏备案号 */
@media (max-height: 520px) {
  .login-beian {
    display: none;
  }
}

.current-user-chip {
  font-size: 12px;
  color: var(--ink-soft);
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  white-space: nowrap;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-session {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.user-session[hidden] {
  display: none !important;
}

.btn-logout {
  padding: 5px 12px;
  font-size: 12px;
}

/* ── Profile / 个人中心 ── */
.profile-page {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 720px;
  padding: 0 4px 28px;
}

.profile-panel .panel-head {
  margin-bottom: 8px;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  margin: 0 0 8px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(15, 23, 42, 0.02));
  border: 1px solid rgba(14, 165, 233, 0.12);
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  color: #0369a1;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(14, 165, 233, 0.2);
  flex-shrink: 0;
}

.profile-avatar.avatar-sysadmin {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.14);
  border-color: rgba(13, 148, 136, 0.22);
}

.profile-avatar.avatar-finance {
  color: #b45309;
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(217, 119, 6, 0.2);
}

.profile-avatar.avatar-auditor {
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.2);
}

.profile-avatar.avatar-pay {
  color: #0e7490;
  background: rgba(8, 145, 178, 0.12);
  border-color: rgba(8, 145, 178, 0.2);
}

.profile-avatar.avatar-pm,
.profile-avatar.avatar-worker,
.profile-avatar.avatar-user {
  color: #475569;
  background: rgba(100, 116, 139, 0.12);
  border-color: rgba(100, 116, 139, 0.2);
}

.profile-hero-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.profile-hero-meta strong {
  font-size: 18px;
  font-weight: 750;
  color: var(--ink);
}

.profile-hero-meta > span:first-of-type {
  font-size: 13px;
  color: var(--ink-soft);
}

.profile-hero-meta .role-pill {
  align-self: flex-start;
  width: fit-content;
  max-width: 100%;
}

.profile-status {
  font-size: 12px;
  font-weight: 650;
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.profile-status.on {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.12);
}

.profile-status.off {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.1);
}

.profile-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0;
  padding: 4px 4px 8px;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.profile-field:nth-child(odd) {
  border-right: 1px solid rgba(15, 23, 42, 0.06);
}

.profile-field dt {
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
}

.profile-field dd {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  word-break: break-all;
}

.profile-field dd.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.profile-pwd-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 16px 18px;
  max-width: 420px;
}

.profile-form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.profile-form-row input {
  padding: 10px 12px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 10px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.profile-form-row input:focus {
  border-color: rgba(14, 165, 233, 0.55);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.profile-form-actions {
  padding-top: 4px;
}

.current-user-link {
  border: none;
  cursor: pointer;
  font: inherit;
  transition: background 0.15s, color 0.15s;
}

.current-user-link:hover {
  background: rgba(14, 165, 233, 0.12);
  color: #0369a1;
}

@media (max-width: 640px) {
  .profile-fields {
    grid-template-columns: 1fr;
  }
  .profile-field:nth-child(odd) {
    border-right: none;
  }
  .profile-hero {
    flex-wrap: wrap;
  }
}

/* ── File preview dialog ── */
.dialog-file-preview {
  width: min(960px, 94vw);
  max-width: 960px;
}

.dialog-file-preview-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(88vh, 900px);
}

.file-preview-stage {
  flex: 1;
  min-height: 420px;
  max-height: calc(88vh - 160px);
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #0f172a0a;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-preview-image {
  max-width: 100%;
  max-height: calc(88vh - 180px);
  object-fit: contain;
  display: block;
}

.file-preview-frame {
  width: 100%;
  height: calc(88vh - 180px);
  min-height: 420px;
  border: 0;
  background: #fff;
}

.file-preview-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

.file-preview-empty p {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}

.file-preview-empty span {
  font-size: 13px;
}

/* ── File attach dialog ── */
.dialog-file-attach {
  width: min(760px, 94vw);
  max-width: 760px;
}

.dialog-file-attach-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(82vh, 760px);
}

.file-attach-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-attach-tip {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(217, 119, 6, 0.08);
  color: #92400e;
  font-size: 13px;
}

.file-attach-table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 10px;
  max-height: min(56vh, 480px);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.file-attach-table-wrap.is-drop-target.is-drag-over {
  border-color: rgba(37, 99, 235, 0.55);
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.18);
  background: rgba(239, 246, 255, 0.55);
}

.file-attach-empty-cell {
  padding: 0 !important;
  border-bottom: none !important;
}

.file-attach-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 220px;
  padding: 28px 20px;
  border: 2px dashed rgba(37, 99, 235, 0.28);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.75), rgba(255, 255, 255, 0.9));
  color: #1e3a8a;
  cursor: pointer;
  text-align: center;
  font: inherit;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.file-attach-dropzone:hover:not(:disabled),
.file-attach-table-wrap.is-drag-over .file-attach-dropzone {
  border-color: rgba(37, 99, 235, 0.65);
  background: rgba(219, 234, 254, 0.65);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.file-attach-dropzone:disabled {
  opacity: 0.7;
  cursor: wait;
}

.file-attach-dropzone-ico {
  font-size: 34px;
  line-height: 1;
  color: #2563eb;
}

.file-attach-dropzone strong {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.file-attach-dropzone span {
  font-size: 13.5px;
  color: #64748b;
  font-weight: 500;
}

.file-attach-empty-readonly {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 160px;
  padding: 24px;
  color: var(--ink-soft);
}

.file-attach-empty-readonly strong {
  font-size: 16px;
  color: var(--ink);
}

.file-attach-drag-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
  font-size: 18px;
  font-weight: 750;
  pointer-events: none;
}

.field-hint {
  display: inline-block;
  margin-left: 10px;
  font-size: 12px;
  color: var(--ink-faint);
}

.loan-writeoff-files-row {
  margin-top: 12px;
}

.btn-writeoff-files {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.dialog-loan .loan-writeoff-files-row.is-readonly {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(248, 250, 252, 0.95));
  border-color: rgba(37, 99, 235, 0.16);
}

.dialog-loan .loan-writeoff-files-row.is-readonly .btn-writeoff-files {
  border-color: rgba(37, 99, 235, 0.22);
  color: #1d4ed8;
}

.dialog-loan .loan-writeoff-files-row.is-readonly .btn-writeoff-files-ico {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
}

.dialog-loan .loan-writeoff-files-row.is-readonly .btn-writeoff-files-copy strong {
  color: #1e40af;
}

.dialog-loan .loan-writeoff-files-row.is-readonly .btn-writeoff-files:hover {
  border-color: rgba(37, 99, 235, 0.4);
  background: #eff6ff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
}

.dialog-loan .loan-writeoff-files-row.is-readonly .loan-writeoff-files-hint {
  color: #64748b;
}

.repair-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.repair-page .page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.repair-page .page-head-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.repair-page h1 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.repair-page .page-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.repair-page .filter-row,
.repair-page .users-role-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.repair-page .panel {
  overflow: auto;
}

.repair-page .ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-page .empty-cell {
  text-align: center;
  color: var(--ink-faint);
  padding: 28px 12px;
}

.repair-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.repair-stats article {
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

.repair-stats span {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
}

.repair-stats strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
}

.repair-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(15, 23, 42, 0.06);
  color: var(--ink-soft);
  white-space: nowrap;
}

.repair-pill[data-status="pending"] { background: rgba(217, 119, 6, 0.12); color: #b45309; }
.repair-pill[data-status="assigned"] { background: rgba(37, 99, 235, 0.12); color: #1d4ed8; }
.repair-pill[data-status="processing"] { background: rgba(14, 165, 233, 0.12); color: #0369a1; }
.repair-pill[data-status="accepting"] { background: rgba(99, 102, 241, 0.12); color: #4338ca; }
.repair-pill[data-status="accepted"] { background: rgba(13, 148, 136, 0.12); color: #0f766e; }
.repair-pill[data-status="cancelled"] { background: rgba(225, 29, 72, 0.1); color: #be123c; }

.repair-dl {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
}

.repair-dl div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
}

.repair-dl dt {
  margin: 0;
  color: var(--ink-soft);
}

.repair-dl dd {
  margin: 0;
}

.dialog-repair-detail {
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 860px);
}

.repair-order-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(84vh, 820px);
  overflow: auto;
}

.rod-hero {
  padding: 16px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  color: #fff;
}

.rod-hero[data-status="pending"] { background: linear-gradient(135deg, #b45309, #d97706); }
.rod-hero[data-status="assigned"] { background: linear-gradient(135deg, #1d4ed8, #2563eb); }
.rod-hero[data-status="processing"] { background: linear-gradient(135deg, #0369a1, #0ea5e9); }
.rod-hero[data-status="accepting"] { background: linear-gradient(135deg, #4338ca, #6366f1); }
.rod-hero[data-status="accepted"] { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.rod-hero[data-status="cancelled"] { background: linear-gradient(135deg, #be123c, #e11d48); }

/* 头图上的状态胶囊：白底深字，避免与渐变背景糊在一起 */
.rod-hero .repair-pill {
  background: #fff !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
  font-weight: 700;
}

.rod-hero-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rod-hero-top strong {
  font-size: 18px;
}

.rod-addr {
  margin-top: 8px;
  font-size: 15px;
}

.rod-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  font-size: 12px;
  opacity: 0.9;
}

.rod-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}

.rod-block-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.rod-block-head h4 {
  margin: 0;
  font-size: 14px;
}

.rod-block-head span {
  font-size: 12px;
  color: var(--ink-soft);
}

.rod-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.rod-step {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
}

.rod-step-dot {
  display: inline-flex;
  width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
}

.rod-step.on {
  color: var(--brand);
  font-weight: 650;
}

.rod-step.on .rod-step-dot {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.rod-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 12px;
}

.rod-grid span,
.rod-desc span {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
}

.rod-grid strong {
  font-weight: 600;
}

.rod-desc {
  margin-top: 12px;
}

.rod-desc p,
.rod-comment {
  margin: 4px 0 0;
  line-height: 1.55;
}

.rod-timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 14px;
  border-left: 2px solid var(--line);
}

.rod-timeline li {
  position: relative;
  padding: 0 0 14px 14px;
  color: var(--ink-soft);
}

.rod-timeline li::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
}

.rod-timeline li.on {
  color: var(--ink);
}

.rod-timeline li.on::before {
  background: var(--brand);
}

.rod-tl-title {
  font-weight: 650;
}

.rod-tl-desc,
.rod-tl-time {
  font-size: 13px;
  margin-top: 2px;
}

.rod-score {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.rod-score strong {
  font-size: 28px;
  color: #b45309;
}

.rod-score em {
  color: #f59e0b;
  font-style: normal;
  letter-spacing: 1px;
}

.rod-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.rod-photo-grid-sm {
  margin-top: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rod-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f8fafc;
  cursor: zoom-in;
}

.rod-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rod-sign {
  margin-top: 12px;
}

.rod-sign > span {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.rod-photo-sign {
  max-width: 220px;
  aspect-ratio: 2 / 1;
  cursor: zoom-in;
}

.finish-photos {
  margin: 10px 0 4px;
}

.finish-photos-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.rod-photo-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rod-photo-del {
  border: none;
  background: transparent;
  color: #be123c;
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.dialog-photo-preview {
  width: min(920px, calc(100vw - 24px));
  max-width: none;
  padding: 0;
  border: none;
  background: transparent;
}

.dialog-photo-preview::backdrop {
  background: rgba(15, 23, 42, 0.72);
}

.photo-preview-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 48px 56px 40px;
}

.photo-preview-body img {
  max-width: min(860px, 88vw);
  max-height: min(72vh, 720px);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.photo-preview-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  border: none;
  border-radius: 999px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 13px;
  cursor: pointer;
}

.photo-preview-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.photo-preview-nav.prev { left: 8px; }
.photo-preview-nav.next { right: 8px; }

.photo-preview-count {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.65);
  color: #fff;
  font-size: 12px;
}

@media (max-width: 640px) {
  .rod-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rod-photo-grid-sm {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .photo-preview-body {
    padding: 44px 12px 36px;
  }

  .photo-preview-nav {
    display: none;
  }
}

.repair-page .dialog-body label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--ink-soft);
}

.repair-overview .ov-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 1100px) {
  .repair-overview .ov-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .repair-overview .ov-summary {
    grid-template-columns: 1fr;
  }
}

.repair-overview .ov-summary article {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 16px 14px;
  border-radius: 16px;
  border: 1px solid var(--ov-border, rgba(15, 23, 42, 0.08));
  background: var(--ov-bg, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

.repair-overview .ov-sum-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--ov-ink, #2563eb);
  background: var(--ov-icon-bg, rgba(37, 99, 235, 0.12));
}

.repair-overview .ov-sum-icon svg {
  width: 22px;
  height: 22px;
}

.repair-overview .ov-sum-body {
  min-width: 0;
  flex: 1;
}

.repair-overview .ov-summary article span {
  display: block;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
}

.repair-overview .ov-summary article strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--ov-ink, var(--ink));
  line-height: 1.15;
  word-break: break-all;
}

.repair-overview .ov-summary article[data-metric='audit'] {
  --ov-bg: linear-gradient(145deg, #dbeafe 0%, #eff6ff 45%, #ffffff 100%);
  --ov-border: rgba(37, 99, 235, 0.18);
  --ov-ink: #1d4ed8;
  --ov-icon-bg: rgba(37, 99, 235, 0.16);
}
.repair-overview .ov-summary article[data-metric='labor'] {
  --ov-bg: linear-gradient(145deg, #ede9fe 0%, #f5f3ff 45%, #ffffff 100%);
  --ov-border: rgba(109, 40, 217, 0.16);
  --ov-ink: #6d28d9;
  --ov-icon-bg: rgba(109, 40, 217, 0.14);
}
.repair-overview .ov-summary article[data-metric='profit'] {
  --ov-bg: linear-gradient(145deg, #ccfbf1 0%, #f0fdfa 45%, #ffffff 100%);
  --ov-border: rgba(13, 148, 136, 0.2);
  --ov-ink: #0f766e;
  --ov-icon-bg: rgba(13, 148, 136, 0.16);
}
.repair-overview .ov-summary article[data-metric='orders'] {
  --ov-bg: linear-gradient(145deg, #e2e8f0 0%, #f8fafc 45%, #ffffff 100%);
  --ov-border: rgba(71, 85, 105, 0.16);
  --ov-ink: #334155;
  --ov-icon-bg: rgba(71, 85, 105, 0.12);
}
.repair-overview .ov-summary article[data-metric='accepted'] {
  --ov-bg: linear-gradient(145deg, #cffafe 0%, #ecfeff 45%, #ffffff 100%);
  --ov-border: rgba(8, 145, 178, 0.18);
  --ov-ink: #0e7490;
  --ov-icon-bg: rgba(8, 145, 178, 0.14);
}
.repair-overview .ov-summary article[data-metric='rate'] {
  --ov-bg: linear-gradient(145deg, #fde68a 0%, #fffbeb 45%, #ffffff 100%);
  --ov-border: rgba(217, 119, 6, 0.2);
  --ov-ink: #b45309;
  --ov-icon-bg: rgba(217, 119, 6, 0.16);
}
.repair-overview .ov-summary article[data-metric='cost'] {
  --ov-bg: linear-gradient(145deg, #fed7aa 0%, #fff7ed 45%, #ffffff 100%);
  --ov-border: rgba(234, 88, 12, 0.18);
  --ov-ink: #c2410c;
  --ov-icon-bg: rgba(234, 88, 12, 0.14);
}
.repair-overview .ov-summary article[data-metric='margin'] {
  --ov-bg: linear-gradient(145deg, #bbf7d0 0%, #f0fdf4 45%, #ffffff 100%);
  --ov-border: rgba(22, 163, 74, 0.2);
  --ov-ink: #15803d;
  --ov-icon-bg: rgba(22, 163, 74, 0.14);
}

.repair-overview .overview-filters {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

.repair-overview .overview-filters label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}

.repair-overview .overview-filters select {
  min-width: 120px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.repair-overview .ov-scope {
  margin: -4px 0 12px;
  font-size: 13px;
  color: #2563eb;
  font-weight: 600;
}

.repair-overview .ov-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 14px;
}

.repair-overview .ov-tab {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  background: #fff;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
}

.repair-overview .ov-tab.on {
  color: #2563eb;
  background: rgba(37, 99, 235, 0.08);
  border-color: rgba(37, 99, 235, 0.28);
}

.repair-overview .ov-charts {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

@media (max-width: 960px) {
  .repair-overview .ov-charts {
    grid-template-columns: 1fr;
  }
}

.repair-overview .ov-chart-card .panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.repair-overview .ov-chart-tip {
  font-size: 12px;
  color: var(--ink-faint);
}

.repair-overview .ov-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 220px;
  padding: 8px 4px 0;
}

.repair-overview .ov-bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.repair-overview .ov-bar-track {
  position: relative;
  width: 100%;
  max-width: 42px;
  height: 160px;
  border-radius: 10px 10px 4px 4px;
  background: rgba(15, 23, 42, 0.04);
  overflow: visible;
}

.repair-overview .ov-bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
}

.repair-overview .ov-bar-dot {
  position: absolute;
  left: 50%;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
  transform: translateY(50%);
  z-index: 1;
}

.repair-overview .ov-bar-val {
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.repair-overview .ov-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-overview .ov-donut-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 4px 4px;
}

.repair-overview .ov-donut {
  width: 148px;
  height: 148px;
  flex-shrink: 0;
}

.repair-overview .ov-donut-main {
  font-size: 11px;
  font-weight: 700;
  fill: #0f172a;
}

.repair-overview .ov-donut-sub {
  font-size: 8px;
  fill: #64748b;
}

.repair-overview .ov-legend {
  flex: 1;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.repair-overview .ov-legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.repair-overview .ov-legend-item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.repair-overview .ov-legend-item span {
  color: var(--ink-soft);
}

.repair-overview .ov-legend-item strong {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
}

.repair-overview .overview-table .col-money,
.repair-overview .overview-table .col-num {
  text-align: right;
  white-space: nowrap;
}

.repair-overview .overview-table .mono {
  font-variant-numeric: tabular-nums;
}

.repair-overview .overview-table .accent {
  color: #2563eb;
  font-weight: 650;
}

.repair-overview .ov-score-list {
  display: grid;
  gap: 10px;
  padding: 4px 0;
}

.repair-overview .ov-score-meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.repair-overview .ov-score-meta strong {
  color: #f59e0b;
  font-size: 18px;
}

.repair-overview .ov-score-row {
  display: grid;
  grid-template-columns: 36px 1fr 28px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.repair-overview .ov-score-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.repair-overview .ov-score-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

.form-error {
  margin: 0 0 10px;
  color: var(--danger);
  font-size: 13px;
}

/* ===== 数据看板 ===== */
.dashboard-page {
  padding: 4px 2px 28px;
}

.dashboard-page .page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.dashboard-page .dash-head-filters {
  justify-content: flex-end;
  margin-bottom: 8px;
}

.dash-scope {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-faint);
}

.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.dash-stats article {
  --dash-bg: linear-gradient(145deg, #e2e8f0 0%, #f8fafc 48%, #ffffff 100%);
  --dash-border: rgba(71, 85, 105, 0.16);
  --dash-ink: #334155;
  --dash-icon-bg: rgba(71, 85, 105, 0.12);
  --dash-accent: #64748b;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;
  background: var(--dash-bg);
  border: 1px solid var(--dash-border);
  box-shadow:
    0 12px 28px -22px rgba(15, 23, 42, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dash-stats article::after {
  content: '';
  position: absolute;
  right: -28px;
  top: -36px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--dash-accent) 14%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.dash-stats article:hover {
  transform: translateY(-2px);
  box-shadow:
    0 16px 32px -20px rgba(15, 23, 42, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.dash-stat-icon {
  position: relative;
  z-index: 1;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--dash-icon-bg);
  color: var(--dash-ink);
  border: 1px solid color-mix(in srgb, var(--dash-accent) 22%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.dash-stat-icon svg {
  width: 20px;
  height: 20px;
}

.dash-stats article[data-metric="projects"] {
  --dash-bg: linear-gradient(145deg, #dbeafe 0%, #eff6ff 45%, #ffffff 100%);
  --dash-border: rgba(37, 99, 235, 0.18);
  --dash-ink: #1d4ed8;
  --dash-icon-bg: rgba(37, 99, 235, 0.14);
  --dash-accent: #2563eb;
}
.dash-stats article[data-metric="contract"] {
  --dash-bg: linear-gradient(145deg, #cffafe 0%, #ecfeff 45%, #ffffff 100%);
  --dash-border: rgba(8, 145, 178, 0.18);
  --dash-ink: #0e7490;
  --dash-icon-bg: rgba(8, 145, 178, 0.14);
  --dash-accent: #0891b2;
}
.dash-stats article[data-metric="invoice"] {
  --dash-bg: linear-gradient(145deg, #ccfbf1 0%, #f0fdfa 45%, #ffffff 100%);
  --dash-border: rgba(13, 148, 136, 0.2);
  --dash-ink: #0f766e;
  --dash-icon-bg: rgba(13, 148, 136, 0.14);
  --dash-accent: #0d9488;
}
.dash-stats article[data-metric="payment"] {
  --dash-bg: linear-gradient(145deg, #bbf7d0 0%, #f0fdf4 45%, #ffffff 100%);
  --dash-border: rgba(22, 163, 74, 0.2);
  --dash-ink: #15803d;
  --dash-icon-bg: rgba(22, 163, 74, 0.14);
  --dash-accent: #16a34a;
}
.dash-stats article[data-metric="cost"] {
  --dash-bg: linear-gradient(145deg, #fed7aa 0%, #fff7ed 45%, #ffffff 100%);
  --dash-border: rgba(234, 88, 12, 0.18);
  --dash-ink: #c2410c;
  --dash-icon-bg: rgba(234, 88, 12, 0.14);
  --dash-accent: #ea580c;
}
.dash-stats article[data-metric="receivable"] {
  --dash-bg: linear-gradient(145deg, #fecdd3 0%, #fff1f2 45%, #ffffff 100%);
  --dash-border: rgba(225, 29, 72, 0.18);
  --dash-ink: #be123c;
  --dash-icon-bg: rgba(225, 29, 72, 0.12);
  --dash-accent: #e11d48;
}
.dash-stats article[data-metric="loan"] {
  --dash-bg: linear-gradient(145deg, #fde68a 0%, #fffbeb 45%, #ffffff 100%);
  --dash-border: rgba(217, 119, 6, 0.22);
  --dash-ink: #b45309;
  --dash-icon-bg: rgba(217, 119, 6, 0.16);
  --dash-accent: #d97706;
}
.dash-stats article[data-metric="margin"] {
  --dash-bg: linear-gradient(145deg, #a5f3fc 0%, #ecfeff 45%, #ffffff 100%);
  --dash-border: rgba(14, 116, 144, 0.18);
  --dash-ink: #0e7490;
  --dash-icon-bg: rgba(14, 116, 144, 0.14);
  --dash-accent: #0e7490;
}

.dash-stat-body {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-stat-body span {
  font-size: 12px;
  font-weight: 600;
  color: color-mix(in srgb, var(--dash-ink) 72%, #64748b);
}

.dash-stat-body strong {
  font-size: 18px;
  font-weight: 750;
  color: var(--dash-ink);
  letter-spacing: -0.02em;
  line-height: 1.2;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

.dash-charts {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}

.dash-chart-card .panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.dash-chart-card .panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.dash-chart-tip {
  font-size: 12px;
  color: var(--ink-faint);
}

.dash-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  min-height: 240px;
  padding: 8px 4px 0;
}

.dash-bar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dash-bar-track {
  width: 100%;
  max-width: 42px;
  height: 160px;
  border-radius: 10px 10px 4px 4px;
  background: rgba(148, 163, 184, 0.12);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.dash-bar-fill {
  width: 100%;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #818cf8, #4f46e5);
  transition: height 0.35s ease;
}

.dash-bar-count {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #4338ca;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.16);
}

.dash-bar-val {
  font-size: 11px;
  color: var(--ink-muted, #64748b);
  font-variant-numeric: tabular-nums;
}

.dash-bar-label {
  font-size: 12px;
  color: var(--ink-faint);
  white-space: nowrap;
}

.dash-structure {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 2px 4px;
}

.dash-structure-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dash-structure-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--ink);
}

.dash-structure-track {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.14);
  overflow: hidden;
}

.dash-structure-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  min-width: 4px;
}

@media (max-width: 1100px) {
  .dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dash-charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dash-stats {
    grid-template-columns: 1fr;
  }
  .dashboard-page .page-head {
    flex-direction: column;
  }
}

.dash-kind-card {
  margin-top: 14px;
}

.dash-kind-chart {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  min-height: 240px;
  padding: 8px 8px 0;
}

.dash-kind-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dash-kind-count {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #4338ca;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.16);
}

.dash-kind-track {
  max-width: 56px;
  height: 168px;
}

.dash-client-card {
  margin-top: 14px;
}

.dash-client-chart-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.dash-client-chart {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-height: 260px;
  padding: 8px 8px 0;
}

.dash-client-col {
  flex: 0 0 72px;
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.dash-client-count {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #0e7490;
  background: rgba(8, 145, 178, 0.1);
  border: 1px solid rgba(8, 145, 178, 0.18);
}

.dash-client-track {
  width: 40px;
  max-width: 40px;
  height: 180px;
}

.dash-client-fill {
  background: linear-gradient(180deg, #22d3ee, #0891b2 70%, #0e7490);
}

.dash-client-label {
  max-width: 72px;
  font-size: 11px;
  line-height: 1.25;
  text-align: center;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ═══════════════════════════════════════════
   Mobile shell & page polish (≤800px only)
   Desktop styles above remain unchanged.
   ═══════════════════════════════════════════ */
html.mobile-nav-lock,
html.mobile-nav-lock body {
  overflow: hidden;
}

@media (max-width: 800px) {
  .app {
    grid-template-columns: 1fr;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(var(--sidebar-w), 86vw);
    max-height: none;
    height: 100%;
    z-index: 1200;
    transform: translateX(-105%);
    transition: transform 0.28s var(--ease);
    box-shadow: none;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
    box-shadow:
      16px 0 48px -20px rgba(15, 23, 42, 0.55),
      inset -1px 0 0 rgba(255, 255, 255, 0.04);
  }

  .mobile-nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1190;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.46);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
  }

  .mobile-nav-toggle {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ink);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
  }

  .mobile-nav-toggle svg {
    width: 18px;
    height: 18px;
  }

  .mobile-nav-toggle:active {
    transform: scale(0.96);
  }

  .mobile-nav-close {
    display: inline-grid;
    place-items: center;
    margin-left: auto;
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.28);
    color: #e2e8f0;
    cursor: pointer;
  }

  .mobile-nav-close svg {
    width: 16px;
    height: 16px;
  }

  .main {
    height: 100%;
    max-height: 100%;
    min-height: 0;
    min-width: 0;
  }

  .topbar {
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top, 0));
    gap: 8px;
  }

  .breadcrumb-label {
    display: none;
  }

  .breadcrumb {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topbar-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .topbar-actions .status-chip {
    display: none;
  }

  .current-user-chip {
    max-width: 108px;
    padding: 5px 8px;
    font-size: 11px;
  }

  .btn-logout {
    padding: 5px 8px;
  }

  .view {
    padding: 10px 10px 16px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0));
  }

  .panel {
    padding: 10px;
    border-radius: 12px;
  }

  .panel-head {
    flex-wrap: wrap;
    gap: 8px;
  }

  .panel-head-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .panel-head-actions .btn-primary,
  .panel-head-actions .btn-outline {
    flex: 1 1 auto;
  }

  .user-form-grid,
  .org-form-grid {
    grid-template-columns: 1fr;
  }

  .loan-summary-stats,
  .users-stats,
  .repair-stats,
  .dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .loan-summary-toolbar,
  .users-toolbar,
  .overview-toolbar,
  .overview-search-row,
  .filter-row,
  .loan-module-tabs-wrap {
    flex-wrap: wrap;
  }

  .loan-module-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .page-head,
  .repair-page .page-head,
  .dashboard-page .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .page-head-actions,
  .repair-page .page-head-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .table-wrap,
  .loans-table-wrap,
  .users-table-wrap,
  .overview-table-wrap,
  .detail-table-wrap,
  .contract-table-wrap {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  .loans-table .col-action,
  .users-table .col-action {
    position: sticky;
    right: 0;
    background: #fff;
    z-index: 1;
  }

  .contract-block-head,
  .finance-section-head {
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
  }

  .contract-block-tip {
    width: 100%;
    font-size: 12px;
    line-height: 1.45;
  }

  /* ── 项目管理 / 财务页：手机端拆开挤在一起的信息区 ── */
  .finance-layout {
    gap: 12px;
  }

  .finance-section > *:not(.finance-section-head) {
    padding-left: 10px;
    padding-right: 10px;
  }

  .finance-section > *:last-child {
    padding-bottom: 12px;
  }

  .finance-section-head {
    padding: 12px 10px 10px;
    margin-bottom: 10px;
  }

  .finance-section-head .panel-title {
    flex: 1 1 auto;
    min-width: 0;
    align-items: flex-start;
  }

  .finance-section-head .panel-title h2 {
    font-size: 16px;
  }

  .finance-section-head .panel-desc {
    font-size: 12px;
    line-height: 1.4;
  }

  .finance-section-tag {
    margin-left: auto;
  }

  .client-card {
    display: block;
    padding: 12px;
    margin-bottom: 10px;
  }

  .client-avatar {
    display: none;
  }

  .client-fields,
  .client-fields-3,
  .client-fields-contact,
  .client-fields-4,
  .client-fields-6 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    min-width: 0;
    width: 100%;
  }

  .client-fields .field,
  .client-fields-3 .field-assignees,
  .client-fields-contact .field-assignees,
  .client-fields .field-project-name {
    min-width: 0;
    width: 100%;
    grid-column: 1 / -1;
  }

  .client-fields .field label {
    margin-bottom: 6px;
  }

  .client-fields .field input:not(.search-select-input):not(.search-select-value),
  .client-fields .field select.org-select,
  .client-fields .field .search-select,
  .client-fields .field .multi-search-select,
  .client-fields .field .search-select-control {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .client-fields .field .search-select-control {
    min-height: 42px;
  }

  .assignee-picker {
    max-height: none;
  }

  .contract-block {
    margin-top: 4px;
  }

  .contract-block-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 10px;
  }

  .contract-block-title {
    font-size: 14px;
  }

  /* 宽表：强制可左右滑，禁止 fixed 布局把列压扁 */
  .contract-table-wrap,
  .cost-table-wrap,
  .cost-detail-table-wrap,
  .table-wrap.contract-table-wrap,
  .detail-table-wrap {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding-bottom: 8px;
    border-radius: 10px;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    touch-action: pan-x pan-y;
  }

  .cost-table-wrap {
    padding: 0 8px 12px;
  }

  .contract-table,
  .cost-detail-table,
  .detail-table {
    table-layout: auto !important;
    width: max-content !important;
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
  }

  .contract-table th,
  .contract-table td,
  .cost-detail-table th,
  .cost-detail-table td,
  .detail-table th,
  .detail-table td {
    white-space: nowrap;
    vertical-align: middle;
  }

  .contract-table .col-name,
  .contract-table .col-money,
  .contract-table .col-signed,
  .contract-table .col-accept,
  .contract-table .col-warranty,
  .contract-table .col-detail,
  .contract-table .col-retention,
  .contract-table .col-debt,
  .contract-table .col-debt-invoice,
  .contract-table .col-invoice,
  .contract-table .col-payment {
    width: auto !important;
    max-width: none !important;
    min-width: 108px;
  }

  .contract-table .col-name {
    min-width: 160px;
  }

  .cost-detail-table .col-source-project,
  .cost-detail-table .col-supplier,
  .cost-detail-table .col-company,
  .cost-detail-table .col-name,
  .cost-detail-table .col-content,
  .cost-detail-table .col-adj-link,
  .cost-detail-table .col-wo-link,
  .cost-detail-table .col-amount,
  .cost-detail-table .col-money-ro,
  .cost-detail-table .col-signed,
  .cost-detail-table .col-date,
  .cost-detail-table .col-remark,
  .cost-detail-table .col-detail,
  .cost-detail-table .col-inv-type,
  .cost-detail-table .col-tax-rate {
    width: auto !important;
    max-width: none !important;
    min-width: 88px;
  }

  .cost-detail-table .col-source-project {
    min-width: 80px;
  }

  .cost-detail-table .col-supplier,
  .cost-detail-table .col-name,
  .cost-detail-table .col-company {
    min-width: 120px;
  }

  .cost-detail-table .col-no {
    min-width: 32px;
  }

  .contract-table input,
  .contract-table select,
  .cost-detail-table input,
  .cost-detail-table select,
  .cost-detail-table .search-select,
  .cost-detail-table .search-select-control,
  .cost-detail-table .adj-link-select {
    min-width: 88px;
    max-width: none;
  }

  .cost-detail-table .search-select-compact {
    min-width: 110px;
    display: block;
  }

  .cost-tabs {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 4px;
  }

  .cost-tab {
    flex: 0 0 auto;
  }

  .cost-card {
    overflow: visible;
  }

  .cost-panel .panel-head,
  .stats-panel .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  dialog,
  dialog.dialog-contract,
  dialog.dialog-contract.dialog-loan,
  dialog.dialog-contract.dialog-loan-writeoff,
  dialog.dialog-contract.dialog-loan-detail,
  dialog.dialog-contract.dialog-loan-audit,
  dialog.dialog-contract.dialog-loan-edit,
  dialog.dialog-contract.dialog-loan-apply,
  dialog.dialog-contract:has(.dialog-detail),
  dialog.dialog-contract:has(.dialog-loan),
  dialog.dialog-contract:has(.dialog-user-form),
  dialog.dialog-adj-cost {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    margin: auto;
    border-radius: 14px;
    overflow: hidden;
  }

  dialog.dialog-contract.dialog-detail-scrollable {
    max-height: calc(100dvh - 16px);
  }

  .dialog-detail-scrollable .dialog-detail {
    max-height: calc(100dvh - 16px);
  }

  .dialog-user .dialog-body,
  .dialog-org .dialog-body,
  .dialog-loan .dialog-body,
  .dialog-loan-audit .dialog-body,
  .dialog-loan-detail .dialog-body,
  .dialog-loan-edit .dialog-body,
  .dialog-loan-apply .dialog-body,
  .dialog-loan-writeoff .dialog-body,
  .dialog-contract .dialog-body,
  .dialog-contract .dialog-detail,
  dialog.dialog-adj-cost {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  /* 借款/冲销弹窗：内容超高时可纵向滑动（避免被 dialog overflow:hidden 裁死） */
  .dialog-loan .dialog-body,
  .dialog-loan-edit .dialog-body,
  .dialog-loan-apply .dialog-body,
  .dialog-loan-writeoff .dialog-body {
    max-height: calc(100dvh - 16px);
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: env(safe-area-inset-bottom, 0);
  }

  .dialog-loan-detail .dialog-body,
  .dialog-loan-audit .dialog-body {
    max-height: calc(100dvh - 16px);
    height: calc(100dvh - 16px);
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    touch-action: auto;
  }

  .dialog-loan-detail .loan-detail-scroll,
  .dialog-loan-audit .loan-audit-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0));
  }

  .dialog-loan-detail .dialog-actions,
  .dialog-loan-audit .loan-audit-form,
  .dialog-loan-audit .loan-audit-actions {
    flex-shrink: 0;
  }

  /* 宽表横向滚动区不要吞掉竖滑手势 */
  .dialog-loan .writeoff-detail-wrap,
  .dialog-loan .writeoff-brief-wrap,
  .dialog-loan .table-wrap {
    overflow-x: auto;
    overflow-y: visible;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
  }

  .dialog-loan-writeoff .writeoff-brief-wrap {
    max-height: min(140px, 24vh);
  }

  .dialog-loan .loan-detail-section {
    overflow: visible;
  }

  .dialog-user-head,
  .dialog-user-form form,
  .loan-audit-stats,
  .loan-audit-form,
  .loan-audit-actions {
    padding-left: 14px;
    padding-right: 14px;
  }

  .dialog-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .dialog-actions .btn-primary,
  .dialog-actions .btn-outline {
    flex: 1 1 auto;
    min-width: 0;
  }

  .detail-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .login-overlay {
    padding: 12px;
    align-items: stretch;
  }

  .login-shell {
    width: 100%;
    max-height: none;
    min-height: 0;
  }

  .repair-overview .ov-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-kind-chart,
  .dash-client-chart-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 560px) {
  .loan-summary-stats,
  .users-stats,
  .repair-stats,
  .dash-stats,
  .detail-summary,
  .repair-overview .ov-summary {
    grid-template-columns: 1fr;
  }

  .current-user-chip {
    display: none;
  }

  .btn-logout {
    padding: 6px 10px;
  }

  .loan-year-tabs,
  .overview-time-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .row-actions,
  .ke-row-actions {
    flex-wrap: wrap;
  }

  .btn-row-action {
    font-size: 12px;
  }
}
