:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d9e2ec;
  --line-strong: #b8c6d6;
  --text: #142033;
  --muted: #64748b;
  --soft: #eef4fa;
  --accent: #0f766e;
  --accent-strong: #0b4f4a;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #b42318;
  --green-soft: #e6f7f3;
  --blue-soft: #e8f0ff;
  --amber-soft: #fff4df;
  --red-soft: #fdecea;
  --shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 0;
  background:
    radial-gradient(circle at 18% -6%, rgba(37, 99, 235, 0.13), transparent 28%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 42%);
  color: var(--text);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 14px;
  background: linear-gradient(180deg, #0b1220 0%, #111827 58%, #0f172a 100%);
  color: #f5f7f2;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: linear-gradient(135deg, #22d3ee, #2dd4bf);
  color: #06121f;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.brand p,
.eyebrow {
  margin: 3px 0 0;
  color: #aebbae;
  font-size: 12px;
}

.brand p {
  white-space: nowrap;
}

.sidebar-toggle {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5f3f1;
  font-size: 20px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

.sidebar-toggle:hover {
  background: rgba(34, 211, 238, 0.18);
  color: #fff;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  color: #dce4da;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(34, 211, 238, 0.12);
  color: #ffffff;
  box-shadow: inset 3px 0 0 #22d3ee;
}

@media (min-width: 641px) {
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 70px minmax(0, 1fr);
  }

  body.sidebar-collapsed .sidebar {
    padding: 20px 10px;
    align-items: center;
  }

  body.sidebar-collapsed .brand {
    width: 100%;
    justify-content: center;
    gap: 0;
    padding: 2px 0 14px;
  }

  body.sidebar-collapsed .brand > div:not(.brand-mark) {
    display: none;
  }

  body.sidebar-collapsed .brand-mark {
    width: 42px;
    height: 42px;
  }

  body.sidebar-collapsed .sidebar-toggle {
    position: absolute;
    right: -21px;
    top: 8px;
    z-index: 2;
    background: #122033;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.28);
  }

  body.sidebar-collapsed .nav {
    width: 100%;
    justify-items: center;
  }

  body.sidebar-collapsed .nav-item {
    width: 46px;
    min-height: 42px;
    padding: 0;
    text-align: center;
    font-size: 0;
    display: grid;
    place-items: center;
  }

  body.sidebar-collapsed .nav-item::after {
    content: attr(data-short);
    font-size: 14px;
    font-weight: 850;
  }

  body.sidebar-collapsed .nav-item:hover,
  body.sidebar-collapsed .nav-item.active {
    box-shadow: inset 0 3px 0 #22d3ee;
  }
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.main {
  padding: 22px 28px 40px;
}

body[data-view="reimbursements"] .main {
  padding-bottom: 8px;
}

body[data-view="reimbursements"] #reimbursementsView.active-view {
  min-height: calc(100vh - 112px);
}

body[data-view="reimbursements"] #reimbursementsView > .panel {
  min-height: calc(100vh - 112px);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 26px;
  letter-spacing: 0;
}

.topbar .eyebrow {
  color: var(--muted);
}

body[data-view="projects"] .topbar > div:first-child,
body[data-view="contracts"] .topbar > div:first-child,
body[data-view="budgets"] .topbar > div:first-child,
body[data-view="reimbursements"] .topbar > div:first-child,
body[data-view="prepayments"] .topbar > div:first-child,
body[data-view="invoices"] .topbar > div:first-child,
body[data-view="labor"] .topbar > div:first-child,
body[data-view="costing"] .topbar > div:first-child {
  display: none;
}

body[data-view="projects"] .topbar,
body[data-view="contracts"] .topbar,
body[data-view="budgets"] .topbar,
body[data-view="reimbursements"] .topbar,
body[data-view="prepayments"] .topbar,
body[data-view="invoices"] .topbar,
body[data-view="labor"] .topbar,
body[data-view="costing"] .topbar {
  justify-content: flex-end;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
}

.search-box input {
  width: 210px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.year-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
}

.year-box select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 600;
}

.primary-btn,
.secondary-btn,
.small-btn,
.danger-btn {
  min-height: 36px;
  border-radius: 6px;
  padding: 0 12px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.primary-btn {
  background: linear-gradient(135deg, #0f766e, #2563eb);
  color: white;
}

.secondary-btn {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}

.sidebar .secondary-btn {
  width: 100%;
  background: transparent;
  color: #edf3eb;
  border-color: rgba(255, 255, 255, 0.26);
}

.small-btn {
  min-height: 30px;
  padding: 0 9px;
  color: var(--accent-strong);
  background: var(--green-soft);
  border-color: #c6dbd2;
}

.danger-btn {
  background: var(--red-soft);
  color: var(--red);
  border-color: #e2c2bf;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric {
  min-height: 118px;
  padding: 15px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  border-top: 3px solid rgba(37, 99, 235, 0.5);
}

.metric span {
  display: block;
  color: #334155;
  font-size: 13px;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 25px;
  letter-spacing: 0;
}

.metric em {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-style: normal;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 14px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.panel-header h3 {
  margin: 0;
  font-size: 16px;
}

.detail-toggle-header {
  align-items: center;
}

.detail-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.detail-toggle-btn {
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 999px;
  background: #eff6ff;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.panel-header .toolbar {
  margin-bottom: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.list-actions-header {
  justify-content: space-between;
  min-height: 52px;
  padding: 10px 16px;
}

.list-actions-header .toolbar {
  margin-left: auto;
}

.panel-body {
  padding: 16px;
}

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

.field {
  display: grid;
  gap: 5px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  background: #ffffff;
  color: var(--text);
}

.field textarea {
  min-height: 150px;
  resize: vertical;
  line-height: 1.5;
}

.filters {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.filters .contract-search-field {
  min-width: 420px;
  flex: 1 1 420px;
}

.reimburse-filters {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.reimburse-filters .field {
  flex: 0 0 auto;
}

.reimburse-filters .wide-select {
  width: 320px;
}

.reimburse-filters .slip-search-field input {
  width: 138px;
}

.invoice-filter-row {
  display: grid;
  grid-template-columns: 130px minmax(250px, 1fr) 130px 130px 210px auto;
  align-items: end;
  width: 100%;
  gap: 8px;
  flex-wrap: nowrap;
}

.invoice-filter-row .field,
.invoice-filter-row .secondary-btn {
  min-width: 0;
}

.invoice-filter-row .contract-search-field {
  min-width: 0;
}

.status-filter-field {
  min-width: 0;
}

.check-group {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
}

.check-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbff;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.check-pill input {
  width: 13px;
  height: 13px;
  margin: 0;
}

.table-wrap {
  overflow: auto;
  border-top: 1px solid var(--line);
}

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

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf4fb;
  color: #26364d;
  font-size: 12px;
  font-weight: 700;
}

#projectsTable th,
#projectsTable td {
  padding: 6px 6px;
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}

#projectsTable table {
  min-width: 0;
  table-layout: fixed;
}

#projectsTable th:nth-child(1),
#projectsTable td:nth-child(1) {
  width: 7.8%;
}

#projectsTable th:nth-child(2),
#projectsTable td:nth-child(2) {
  width: 8.8%;
}

#projectsTable th:nth-child(3),
#projectsTable td:nth-child(3) {
  width: 4.2%;
}

#projectsTable th:nth-child(4),
#projectsTable td:nth-child(4) {
  width: 5.6%;
}

#projectsTable th:nth-child(5),
#projectsTable td:nth-child(5) {
  width: 4.4%;
}

#projectsTable th:nth-child(6),
#projectsTable td:nth-child(6) {
  width: 8.3%;
}

#projectsTable th:nth-child(7),
#projectsTable td:nth-child(7) {
  width: 7.6%;
}

#projectsTable th:nth-child(8),
#projectsTable td:nth-child(8) {
  width: 7.4%;
}

#projectsTable th:nth-child(9),
#projectsTable td:nth-child(9) {
  width: 8%;
}

#projectsTable th:nth-child(10),
#projectsTable td:nth-child(10) {
  width: 7.7%;
}

#projectsTable th:nth-child(11),
#projectsTable td:nth-child(11) {
  width: 7%;
}

#projectsTable th:nth-child(12),
#projectsTable td:nth-child(12) {
  width: 8.3%;
}

#projectsTable th:nth-child(13),
#projectsTable td:nth-child(13) {
  width: 4.9%;
}

#projectsTable th:nth-child(14),
#projectsTable td:nth-child(14) {
  width: 5.1%;
}

@media (min-width: 901px) {
  #projectsTable td:nth-child(7),
  #projectsTable td:nth-child(8),
  #projectsTable td:nth-child(10),
  #projectsTable td:nth-child(12) {
    background: #f5f9ff;
  }

  #projectsTable tr.project-child-row td {
    background: #f8fbff;
  }

  #projectsTable tr.project-child-row td:nth-child(7),
  #projectsTable tr.project-child-row td:nth-child(8),
  #projectsTable tr.project-child-row td:nth-child(10),
  #projectsTable tr.project-child-row td:nth-child(12) {
    background: #eef6ff;
  }

  #projectsTable tbody tr:hover td:nth-child(7),
  #projectsTable tbody tr:hover td:nth-child(8),
  #projectsTable tbody tr:hover td:nth-child(10),
  #projectsTable tbody tr:hover td:nth-child(12) {
    background: #eef6ff;
  }
}

#projectsTable td.numeric,
#projectsTable th.numeric {
  font-size: 10.5px;
  white-space: nowrap;
}

#contractsTable table {
  min-width: 1180px;
  table-layout: fixed;
}

#contractsTable th,
#contractsTable td {
  padding: 6px 7px;
  font-size: 11px;
  line-height: 1.25;
  white-space: normal;
}

#contractsTable td.numeric,
#contractsTable th.numeric {
  white-space: nowrap;
}

#contractsTable th:first-child,
#contractsTable td:first-child,
#contractsTable td:first-child .linklike {
  white-space: nowrap;
}

#contractsTable .contract-no {
  width: 136px;
}

#contractsTable .contract-year {
  width: 44px;
  text-align: center;
}

#contractsTable .contract-project {
  width: 108px;
}

#contractsTable .contract-owner {
  width: 52px;
}

#contractsTable .contract-customer {
  width: 72px;
}

#contractsTable .contract-name {
  width: 166px;
}

#contractsTable .contract-type {
  width: 66px;
}

#contractsTable .contract-completion {
  width: 44px;
}

#contractsTable .contract-money {
  width: 84px;
}

#contractsTable .contract-batches {
  width: 66px;
}

#contractsTable .contract-status {
  width: 66px;
}

#contractsTable td.contract-no,
#contractsTable td.contract-name,
#contractsTable td.contract-project,
#contractsTable td.contract-customer,
#contractsTable td.contract-no .linklike {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#contractsTable .badge {
  font-size: 11px;
  padding: 3px 7px;
}

#budgetsTable .summary-bar {
  border-top: 1px solid var(--line);
}

.budget-table-wrap {
  overflow-x: auto;
}

@media (min-width: 901px) {
  #projectsTable .table-wrap,
  #contractsTable .table-wrap {
    max-height: calc(100vh - 130px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  #budgetsTable .budget-table-wrap {
    max-height: calc(100vh - 260px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }

  #projectsTable th,
  #contractsTable th,
  #budgetsTable .budget-table th {
    position: sticky;
    top: 0;
    z-index: 7;
    background: #edf4fb;
  }
}

.budget-table {
  min-width: 1260px;
  table-layout: fixed;
  box-sizing: border-box;
}

.budget-table th,
.budget-table td {
  box-sizing: border-box;
  padding: 7px 6px;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

.budget-table th:nth-child(1),
.budget-table td:nth-child(1) {
  width: 40px;
  text-align: center;
}

.budget-table th:nth-child(2),
.budget-table td:nth-child(2) {
  width: 88px;
}

.budget-table th:nth-child(3),
.budget-table td:nth-child(3) {
  width: 96px;
}

.budget-table th:nth-child(4),
.budget-table td:nth-child(4) {
  width: 185px;
}

.budget-table th:nth-child(5),
.budget-table td:nth-child(5) {
  width: 150px;
}

.budget-table th:nth-child(6),
.budget-table td:nth-child(6) {
  width: 78px;
}

.budget-table th:nth-child(7),
.budget-table td:nth-child(7) {
  width: 100px;
}

.budget-table th:nth-child(8),
.budget-table td:nth-child(8) {
  width: 98px;
}

.budget-table th:nth-child(9),
.budget-table td:nth-child(9) {
  width: 104px;
}

.budget-table th:nth-child(10),
.budget-table td:nth-child(10) {
  width: 104px;
}

.budget-table th:nth-child(11),
.budget-table td:nth-child(11) {
  width: 86px;
}

.budget-table th:nth-child(12),
.budget-table td:nth-child(12) {
  width: 70px;
  text-align: center;
}

.budget-table th:nth-child(13),
.budget-table td:nth-child(13) {
  width: 200px;
}

.budget-table td:nth-child(7) .badge,
.budget-table .text-clip {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-amount-input {
  width: 100%;
  min-width: 0;
  height: 30px;
  box-sizing: border-box;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: right;
  padding: 4px 6px;
}

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

.budget-table tr.is-used-up td {
  background: #f3f6f8;
  color: var(--muted);
}

.budget-table tr.is-used-up .badge {
  opacity: 0.75;
}

.budget-pager {
  border-top: 0;
}

.project-summary {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  flex-wrap: nowrap;
  gap: 14px;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 12px;
}

.project-summary span {
  flex: 0 0 auto;
}

.projects-table {
  table-layout: fixed;
}

.projects-table th,
.projects-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.projects-table th:nth-child(1),
.projects-table td:nth-child(1) {
  width: 108px;
}

.projects-table th:nth-child(2),
.projects-table td:nth-child(2) {
  width: 152px;
}

.projects-table th:nth-child(3),
.projects-table td:nth-child(3) {
  width: 52px;
}

.projects-table th:nth-child(4),
.projects-table td:nth-child(4) {
  width: 72px;
}

.projects-table th:nth-child(5),
.projects-table td:nth-child(5) {
  width: 58px;
}

.projects-table th:nth-child(6),
.projects-table td:nth-child(6) {
  width: 112px;
}

.projects-table th:nth-child(7),
.projects-table td:nth-child(7) {
  width: 102px;
}

.projects-table th:nth-child(8),
.projects-table td:nth-child(8) {
  width: 100px;
}

.projects-table th:nth-child(9),
.projects-table td:nth-child(9) {
  width: 104px;
}

.projects-table th:nth-child(10),
.projects-table td:nth-child(10) {
  width: 100px;
}

.projects-table th:nth-child(11),
.projects-table td:nth-child(11) {
  width: 92px;
}

.projects-table th:nth-child(12),
.projects-table td:nth-child(12) {
  width: 102px;
}

.projects-table th:nth-child(13),
.projects-table td:nth-child(13) {
  width: 66px;
}

.projects-table th:nth-child(14),
.projects-table td:nth-child(14) {
  width: 68px;
}

.projects-table td:nth-child(10),
.projects-table td:nth-child(12) {
  background: #f4f8fc;
}

.projects-table .project-group-row td {
  background: #eef6ff;
  font-weight: 700;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.projects-table .project-child-row td {
  background: #f8fbff;
}

.projects-table .project-child-row td:nth-child(7),
.projects-table .project-child-row td:nth-child(8),
.projects-table .project-child-row td:nth-child(10),
.projects-table .project-child-row td:nth-child(12) {
  background: #eef6ff;
}

.projects-table .project-child-row td:first-child {
  padding-left: 24px;
}

.projects-table .group-toggle {
  min-width: 44px;
}

.projects-table .child-project-link::before {
  content: "└ ";
  color: var(--muted);
}

td.numeric,
th.numeric {
  text-align: right;
}

.muted {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--soft);
  color: var(--muted);
}

.badge.green {
  color: var(--accent-strong);
  background: var(--green-soft);
}

.badge.blue {
  color: var(--blue);
  background: var(--blue-soft);
}

.badge.amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.badge.red {
  color: var(--red);
  background: var(--red-soft);
}

.payment-kind-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.payment-kind-inline .badge {
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.form-grid .wide {
  grid-column: span 2;
}

.reimburse-entry-grid {
  display: grid;
  grid-template-columns: 190px 170px 140px 140px;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.reimburse-entry-grid .wide {
  min-width: 0;
}

.reimburse-lines-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}

.reimburse-lines-table {
  min-width: 1320px;
  table-layout: fixed;
}

.reimburse-lines-table th,
.reimburse-lines-table td {
  padding: 7px 8px;
  font-size: 12px;
}

.reimburse-lines-table th:nth-child(1),
.reimburse-lines-table td:nth-child(1) {
  width: 34px;
}

.reimburse-lines-table th:nth-child(2),
.reimburse-lines-table td:nth-child(2) {
  width: 270px;
}

.reimburse-lines-table th:nth-child(3),
.reimburse-lines-table td:nth-child(3) {
  width: 190px;
}

.reimburse-lines-table th:nth-child(4),
.reimburse-lines-table td:nth-child(4) {
  width: 130px;
}

.reimburse-lines-table th:nth-child(5),
.reimburse-lines-table td:nth-child(5) {
  width: 260px;
}

.reimburse-lines-table th:nth-child(6),
.reimburse-lines-table td:nth-child(6) {
  width: 140px;
}

.reimburse-lines-table th:nth-child(7),
.reimburse-lines-table td:nth-child(7) {
  width: 110px;
}

.reimburse-lines-table th:nth-child(8),
.reimburse-lines-table td:nth-child(8) {
  width: 90px;
}

.reimburse-lines-table th:nth-child(9),
.reimburse-lines-table td:nth-child(9) {
  width: 140px;
}

.reimburse-lines-table select,
.reimburse-lines-table input {
  width: 100%;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  background: #ffffff;
  color: var(--text);
}

.reimburse-import-actions {
  margin-top: 12px;
  margin-bottom: 0;
}

.batch-form-grid {
  display: grid;
  grid-template-columns: 130px minmax(320px, 1fr) 130px 160px auto;
  gap: 10px;
  align-items: end;
}

.batch-form-grid .batch-action {
  display: flex;
  align-items: end;
}

.batch-form-grid .batch-action .primary-btn {
  min-height: 36px;
  white-space: nowrap;
}

.split {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid #d7c7a9;
  background: #faf4e8;
  color: #694711;
}

.bars {
  display: grid;
  gap: 11px;
}

.bar-row {
  display: grid;
  grid-template-columns: 112px minmax(220px, 1fr) 96px;
  align-items: center;
  gap: 10px;
}

.bar-track {
  height: 12px;
  background: #e7ebe4;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #22d3ee);
}

.bar-fill.alt {
  background: linear-gradient(90deg, #2563eb, #60a5fa);
}

.bar-fill.warn {
  background: var(--amber);
}

.empty-state {
  padding: 26px;
  text-align: center;
  color: var(--muted);
}

.inline-input {
  width: 88px;
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.inline-input.month-input {
  width: 128px;
}

.inline-input.wide-input {
  width: 160px;
}

.inline-save-btn {
  margin-top: 8px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  white-space: nowrap;
}

.compact-action {
  min-height: 26px;
  padding: 0 8px;
  border-radius: 5px;
}

.action-link {
  color: var(--blue);
  font-weight: 650;
}

.costing-detail {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.costing-process {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 14px;
  align-items: start;
}

.costing-process h4 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text);
}

.process-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.process-card h4 {
  padding: 12px 12px 0;
}

.process-card .table-wrap {
  border-top: 1px solid var(--line);
}

.formula-box {
  padding: 12px;
  border: 1px solid #d8e6f3;
  border-radius: 6px;
  background: #f7fbff;
  color: #26364d;
  line-height: 1.7;
}

.formula-box.compact {
  margin: 8px 12px 12px;
}

.process-mini-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 8px 12px 12px;
  color: var(--muted);
  font-size: 12px;
}

.process-mini-summary strong {
  color: var(--text);
  font-size: 13px;
}

.inline-select {
  min-height: 30px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
}

.linklike {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--blue);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.detail-meta strong {
  color: var(--text);
}

#projectDetailView .table-wrap,
#contractDetailView .table-wrap {
  overflow-x: auto;
}

#projectDetailView table,
#contractDetailView table {
  font-size: 12px;
}

#projectDetailView th,
#projectDetailView td,
#contractDetailView th,
#contractDetailView td {
  padding: 6px 8px;
  line-height: 1.35;
}

#projectDetailView td,
#contractDetailView td {
  height: 38px;
}

#projectDetailView .detail-meta,
#contractDetailView .detail-meta {
  gap: 10px 16px;
  margin-top: 12px;
  font-size: 12px;
}

#projectDetailView .summary-bar,
#contractDetailView .summary-bar {
  padding: 8px 12px;
  font-size: 12px;
}

#projectDetailView .panel-header,
#contractDetailView .panel-header {
  min-height: 54px;
}

.contract-reimburse-panel table {
  min-width: 1080px;
  table-layout: fixed;
}

.contract-reimburse-panel th:nth-child(1),
.contract-reimburse-panel td:nth-child(1) {
  width: 112px;
}

.contract-reimburse-panel th:nth-child(2),
.contract-reimburse-panel td:nth-child(2),
.contract-reimburse-panel th:nth-child(3),
.contract-reimburse-panel td:nth-child(3) {
  width: 60px;
}

.contract-reimburse-panel th:nth-child(4),
.contract-reimburse-panel td:nth-child(4) {
  width: 96px;
}

.contract-reimburse-panel th:nth-child(5),
.contract-reimburse-panel td:nth-child(5) {
  width: 90px;
}

.contract-reimburse-panel th:nth-child(6),
.contract-reimburse-panel td:nth-child(6) {
  width: 170px;
}

.contract-reimburse-panel th:nth-child(7),
.contract-reimburse-panel td:nth-child(7),
.contract-reimburse-panel th:nth-child(9),
.contract-reimburse-panel td:nth-child(9) {
  width: 96px;
  white-space: nowrap;
}

.contract-reimburse-panel th:nth-child(8),
.contract-reimburse-panel td:nth-child(8) {
  width: 54px;
  white-space: nowrap;
}

.contract-reimburse-panel th:nth-child(10),
.contract-reimburse-panel td:nth-child(10) {
  width: 74px;
}

.contract-reimburse-panel th:nth-child(11),
.contract-reimburse-panel td:nth-child(11) {
  width: 132px;
  text-align: center;
  white-space: nowrap;
}

.contract-reimburse-panel th:nth-child(12),
.contract-reimburse-panel td:nth-child(12) {
  width: 96px;
  white-space: nowrap;
}

.stacked-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.stacked-text b {
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 700;
}

.stacked-text i {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  overflow-wrap: anywhere;
}

.metric .dual {
  display: flex;
  gap: 18px;
  margin-top: 10px;
}

.metric .dual > div,
.metric .triple > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.metric .dual i,
.metric .triple i {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
}

.metric .dual b,
.metric .triple b {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.metric .triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.metric .triple b {
  font-size: 15px;
}

#projectDetailView .metric {
  min-height: 104px;
  padding: 13px;
}

#projectDetailView .metric .dual {
  gap: 14px;
}

#projectDetailView .metric .dual b {
  font-size: 18px;
}

#projectDetailView .metric .triple {
  gap: 8px;
}

.metric.alert {
  border-top-color: var(--red);
}

.dashboard-fit {
  display: grid;
  gap: 8px;
}

.dashboard-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 0;
}

.metric.compact {
  min-height: 76px;
  padding: 10px 12px;
}

.metric.compact strong {
  margin-top: 5px;
  font-size: 20px;
}

.metric.compact em {
  margin-top: 3px;
  font-size: 12px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 8px;
}

.dashboard-issues {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dashboard-sections {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
}

.compact-header {
  padding: 8px 10px;
}

.compact-header h3 {
  font-size: 14px;
}

.dashboard-progress {
  display: grid;
  gap: 8px;
  padding: 10px 12px 8px;
}

.progress-line {
  display: grid;
  gap: 5px;
}

.progress-line > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
}

.progress-line b {
  color: var(--text);
  font-size: 13px;
}

.progress-line i {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #eaf0f7;
}

.progress-line em {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e, #2563eb);
}

.progress-line em.danger {
  background: linear-gradient(90deg, #d97706, #dc2626);
}

.mini-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 12px 12px;
}

.mini-board.focus-board {
  padding-top: 10px;
}

.section-list {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 6px;
}

.mini-board h4 {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.mini-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
  min-height: 32px;
  margin-top: 4px;
  padding: 5px 7px;
  text-align: left;
  border: 1px solid #d8e6f3;
  border-radius: 7px;
  background: #fbfdff;
}

.mini-row.insight-row {
  min-height: 52px;
}

.mini-row span,
.mini-row b,
.mini-row i {
  min-width: 0;
}

.mini-row b {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-row i {
  display: block;
  overflow: hidden;
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-row strong {
  align-self: end;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}

.danger-text {
  color: var(--red) !important;
}

.dashboard-alerts {
  min-height: 0;
}

.alert-list {
  display: grid;
  align-content: start;
  gap: 4px;
  padding: 6px;
}

.alert-list.expanded {
  align-content: start;
}

.alert-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: start;
  min-height: 58px;
  padding: 6px 7px;
  border: 1px solid #d8e6f3;
  border-left: 4px solid #2563eb;
  border-radius: 7px;
  background: #fbfdff;
}

.alert-card.danger {
  border-left-color: var(--red);
  background: #fffafa;
}

.alert-card.warn {
  border-left-color: #d97706;
  background: #fffaf0;
}

.alert-card span {
  display: inline-flex;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.alert-card b,
.alert-card i {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.alert-card b {
  color: var(--text);
  font-size: 12px;
}

.alert-card i {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.alert-card small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.alert-card strong {
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
  text-align: right;
}

.summary-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
  min-height: 86px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d8e6f3;
  border-left: 4px solid #2563eb;
  border-radius: 7px;
  background: #fbfdff;
}

.summary-card.issue-card {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-height: 86px;
  align-items: start;
}

.issue-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 8px;
  align-items: center;
}

.summary-card.danger {
  border-left-color: var(--red);
  background: #fffafa;
}

.summary-card.warn {
  border-left-color: #d97706;
  background: #fffaf0;
}

.summary-card span,
.summary-card div,
.summary-card b,
.summary-card i {
  min-width: 0;
}

.summary-card span {
  display: block;
  overflow: hidden;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card b {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-card i {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.summary-card.issue-card i {
  display: block;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.summary-card.issue-card i.invoice-line {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-all;
}

@media (min-height: 900px) {
  .dashboard-sections .summary-card {
    gap: 5px;
    min-height: 98px;
  }
}

.summary-card strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  align-self: center;
}

.compact-empty {
  padding: 34px 10px;
}

.mini-empty {
  display: grid;
  min-height: 72px;
  place-items: center;
  border: 1px dashed #d8e6f3;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
}

.summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  padding: 11px 16px;
  border-top: 1px solid var(--line);
  background: var(--soft);
  font-size: 13px;
  color: var(--muted);
}

.summary-bar strong {
  color: var(--text);
}

.invoice-compact-panel {
  margin-bottom: 12px;
}

.invoice-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: end;
  padding: 10px 14px;
}

.invoice-toolbar .field input,
.invoice-toolbar .field select {
  min-height: 32px;
  padding: 5px 8px;
}

.inline-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.inline-summary strong {
  color: var(--text);
  font-size: 13px;
}

.invoice-bill-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 180px auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.invoice-bill-grid .bill-batch-field {
  grid-column: 1 / -1;
}

.invoice-bill-grid .bill-split-field {
  grid-column: 1 / -1;
}

.invoice-bill-grid textarea {
  min-height: 76px;
}

.invoice-bill-actions {
  display: flex;
  align-items: end;
}

.invoice-bill-actions .primary-btn {
  min-height: 36px;
  white-space: nowrap;
}

.invoice-receipt-grid {
  display: grid;
  grid-template-columns: 180px 180px minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.invoice-receipt-grid .receipt-batch-field {
  grid-column: 1 / -1;
}

.invoice-receipt-actions {
  display: flex;
  align-items: end;
}

.invoice-receipt-actions .primary-btn {
  min-height: 36px;
  white-space: nowrap;
}

.invoice-detail-panel {
  margin-top: 0;
  max-width: 100%;
}

.invoice-table-slot {
  max-width: 100%;
  overflow: hidden;
}

.invoice-table-slot .table-wrap {
  min-height: 444px;
  max-height: calc(100vh - 390px);
  border-top: 0;
  overflow: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.invoice-detail-panel table {
  width: 100%;
  min-width: 1120px;
  table-layout: fixed;
}

.invoice-detail-panel th {
  position: sticky;
  top: 0;
  z-index: 5;
}

.invoice-detail-panel th,
.invoice-detail-panel td {
  padding: 7px 7px;
  font-size: 12px;
  line-height: 1.35;
  vertical-align: middle;
}

.invoice-detail-panel tbody tr {
  height: 40px;
}

.invoice-detail-panel .invoice-contract-col {
  width: 15.5%;
}

.invoice-detail-panel .invoice-project-col {
  width: 9.5%;
}

.invoice-detail-panel .invoice-owner-col {
  width: 5.5%;
}

.invoice-detail-panel .invoice-batch-col {
  width: 4.5%;
}

.invoice-detail-panel .invoice-no-col {
  width: 13%;
}

.invoice-detail-panel .invoice-month-col {
  width: 6%;
}

.invoice-detail-panel .invoice-money-col {
  width: 7%;
}

.invoice-detail-panel .invoice-income-col {
  width: 7.5%;
}

.invoice-detail-panel .invoice-status-col {
  width: 5.5%;
}

.invoice-detail-panel .invoice-note-col {
  width: 16%;
}

.invoice-detail-panel td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-detail-panel td.numeric {
  font-size: 12px;
  white-space: nowrap;
}

.invoice-contract-cell {
  display: grid;
  gap: 2px;
  min-width: 0;
  align-content: center;
  justify-items: start;
}

.invoice-contract-cell .linklike,
.invoice-contract-cell span {
  display: block;
  width: 100%;
  max-width: 100%;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-contract-cell span {
  color: var(--muted);
  font-size: 12px;
}

/* 口径说明页 */
.gloss-panel {
  margin-top: 10px;
}

.gloss-panel:first-child {
  margin-top: 0;
}

.gloss-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 14px;
  padding-top: 10px;
  padding-bottom: 10px;
}

.gloss-panel > .panel-header {
  justify-content: flex-start;
  min-height: 38px;
  padding: 8px 12px;
}

.gloss-panel > .panel-header h3 {
  flex: 0 0 auto;
  font-size: 14px;
}

.gloss-note {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.gloss-panel .panel-body {
  padding-left: 12px;
  padding-right: 12px;
}

.gloss-item {
  padding: 7px 0;
  border-top: 1px solid #edf2f7;
}

.gloss-item > b {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
  color: var(--accent-strong);
}

.gloss-item p b {
  color: var(--accent-strong);
}

.gloss-item p {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text);
}

.gloss-line {
  display: inline-block;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .gloss-panel > .panel-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .gloss-note {
    white-space: normal;
  }

  .gloss-grid {
    grid-template-columns: 1fr;
    padding: 8px 12px;
  }

  .gloss-line {
    white-space: normal;
  }
}

.text-clip {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 报销导入表：压缩字体/留白，尽量在一屏宽度内显示 */
#reimbursementTable table {
  font-size: 12px;
  table-layout: fixed;
  min-width: 1420px;
}

#reimbursementTable.reimbursement-table-readonly table {
  min-width: 1270px;
}

#reimbursementTable .table-wrap {
  max-height: calc(100vh - 360px);
  overflow: auto;
}

body[data-view="reimbursements"] #reimbursementTable {
  flex: 1 1 auto;
  min-height: 0;
}

body[data-view="reimbursements"] #reimbursementTable .table-wrap {
  height: 100%;
  max-height: none;
}

#reimbursementTable th,
#reimbursementTable td {
  padding: 5px 5px;
  vertical-align: middle;
}

#reimbursementTable th {
  position: sticky;
  top: 0;
  z-index: 8;
  background: var(--soft);
}

#reimbursementTable .text-clip {
  max-width: 100%;
}

#reimbursementTable th:nth-child(1),
#reimbursementTable td:nth-child(1) {
  width: 112px;
}

#reimbursementTable th:nth-child(2),
#reimbursementTable td:nth-child(2) {
  width: 58px;
}

#reimbursementTable th:nth-child(3),
#reimbursementTable td:nth-child(3) {
  width: 58px;
}

#reimbursementTable th:nth-child(4),
#reimbursementTable td:nth-child(4) {
  width: 142px;
}

#reimbursementTable th:nth-child(5),
#reimbursementTable td:nth-child(5) {
  width: 112px;
}

#reimbursementTable th:nth-child(6),
#reimbursementTable td:nth-child(6) {
  width: 90px;
}

#reimbursementTable th:nth-child(7),
#reimbursementTable td:nth-child(7) {
  width: 172px;
}

#reimbursementTable th:nth-child(8),
#reimbursementTable td:nth-child(8),
#reimbursementTable th:nth-child(10),
#reimbursementTable td:nth-child(10) {
  width: 90px;
  white-space: nowrap;
}

#reimbursementTable th:nth-child(9),
#reimbursementTable td:nth-child(9) {
  width: 46px;
  white-space: nowrap;
}

#reimbursementTable th:nth-child(11),
#reimbursementTable td:nth-child(11) {
  width: 110px;
  text-align: center;
  white-space: nowrap;
}

#reimbursementTable th:nth-child(12),
#reimbursementTable td:nth-child(12) {
  width: 150px;
  text-align: left;
  white-space: nowrap;
}

#reimbursementTable th:nth-child(8),
#reimbursementTable td:nth-child(8),
#reimbursementTable th:nth-child(9),
#reimbursementTable td:nth-child(9),
#reimbursementTable th:nth-child(10),
#reimbursementTable td:nth-child(10),
#reimbursementTable th:nth-child(11),
#reimbursementTable td:nth-child(11),
#reimbursementTable th:nth-child(12),
#reimbursementTable td:nth-child(12) {
  padding-left: 3px;
  padding-right: 3px;
}

#reimbursementTable th:nth-child(13),
#reimbursementTable td:nth-child(13) {
  width: 190px;
}

#reimbursementTable .reimburse-status-inline {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  width: 100%;
  max-width: none;
  white-space: nowrap;
}

#reimbursementTable .reimburse-status-inline .badge {
  flex: 0 0 68px;
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

#reimbursementTable th:nth-child(-n + 7),
#reimbursementTable td:nth-child(-n + 7) {
  position: sticky;
  background: var(--panel);
  z-index: 7;
}

#reimbursementTable th:nth-child(-n + 7) {
  z-index: 12;
  background: var(--soft);
}

#reimbursementTable th:nth-child(1),
#reimbursementTable td:nth-child(1) {
  left: 0;
}

#reimbursementTable th:nth-child(2),
#reimbursementTable td:nth-child(2) {
  left: 112px;
}

#reimbursementTable th:nth-child(3),
#reimbursementTable td:nth-child(3) {
  left: 170px;
}

#reimbursementTable th:nth-child(4),
#reimbursementTable td:nth-child(4) {
  left: 228px;
}

#reimbursementTable th:nth-child(5),
#reimbursementTable td:nth-child(5) {
  left: 370px;
}

#reimbursementTable th:nth-child(6),
#reimbursementTable td:nth-child(6) {
  left: 482px;
}

#reimbursementTable th:nth-child(7),
#reimbursementTable td:nth-child(7) {
  left: 572px;
  box-shadow: 8px 0 12px -12px rgba(15, 23, 42, 0.45);
}

#reimbursementTable .row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  min-width: max-content;
}

#reimbursementTable .compact-month-input {
  width: 92px;
}

#reimbursementTable .compact-action-btn,
#reimbursementTable .tiny-btn {
  min-height: 28px;
  padding: 0 6px;
}

#reimbursementTable .reimb-item-cell {
  max-width: 166px;
}

#reimbursementTable .icon-delete-btn {
  min-height: 24px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 11px;
}

#reimbursementsView .reimburse-footer {
  gap: 12px;
  min-height: 38px;
  padding: 6px 16px;
}

#reimbursementsView .reimburse-footer .pager {
  min-height: 0;
  padding: 0;
  border-top: 0;
}

#reimbursementsView .reimburse-footer .small-btn {
  min-height: 28px;
  padding: 0 10px;
}

.labor-panel .panel-header {
  min-height: 50px;
}

.labor-table-wrap {
  max-height: calc(100vh - 210px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.labor-table {
  width: 100%;
  min-width: 1900px;
  table-layout: fixed;
  font-size: 11px;
  border-collapse: separate;
  border-spacing: 0;
}

.labor-col-project {
  width: 210px;
}

.labor-col-budget-ratio {
  width: 72px;
}

.labor-col-total,
.labor-col-actual-ratio,
.labor-col-diff {
  width: 54px;
}

.labor-col-month {
  width: 52px;
}

.labor-col-month-cost {
  width: 70px;
}

.labor-distribution-table {
  min-width: 1180px;
}

.labor-table th,
.labor-table td {
  padding: 4px 5px;
  vertical-align: middle;
  height: 30px;
  white-space: nowrap;
  background: #ffffff;
}

.labor-table th {
  position: sticky;
  top: 0;
  background: #e8f2fb;
  z-index: 8;
}

.labor-table th:nth-child(1),
.labor-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 4;
  width: auto;
  background: #f7fbff;
}

.labor-table th:nth-child(2),
.labor-table td:nth-child(2) {
  position: sticky;
  left: 210px;
  z-index: 4;
  width: auto;
  background: #f7fbff;
}

.labor-table th:nth-child(3),
.labor-table td:nth-child(3) {
  position: sticky;
  left: 282px;
  z-index: 4;
  width: auto;
  background: #f7fbff;
}

.labor-table th:nth-child(4),
.labor-table td:nth-child(4) {
  position: sticky;
  left: 336px;
  z-index: 4;
  width: auto;
  background: #f7fbff;
}

.labor-table th:nth-child(5),
.labor-table td:nth-child(5) {
  position: sticky;
  left: 390px;
  z-index: 4;
  width: auto;
  background: #f7fbff;
  box-shadow: 5px 0 8px rgba(30, 64, 105, 0.14);
}

.labor-table th:nth-child(-n+5) {
  background: #deebf7;
}

.labor-table th:nth-child(5) {
  box-shadow: 3px 0 5px rgba(30, 64, 105, 0.1);
}

.labor-table thead th:nth-child(-n+5) {
  z-index: 10;
}

.labor-table th:nth-child(n+6),
.labor-table td:nth-child(n+6) {
  width: auto;
}

.labor-table th:nth-child(2n+6),
.labor-table td:nth-child(2n+6) {
  background: #fbfdff;
}

.labor-table th:nth-child(2n+7),
.labor-table td:nth-child(2n+7) {
  border-right: 2px solid #c8d6e6;
}

.labor-table th:nth-child(6),
.labor-table td:nth-child(6) {
  border-left: 2px solid #c8d6e6;
}

.labor-table th:nth-child(2n+7) {
  border-right-color: #d6e2ef;
}

.labor-table th:nth-child(6) {
  border-left-color: #d6e2ef;
}

.labor-table thead th,
.labor-table thead th:nth-child(-n+5),
.labor-table thead th:nth-child(2n+6) {
  background: #e8f2fb;
}

.labor-table thead th:nth-child(5) {
  box-shadow: none;
}

.labor-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 24px;
  padding: 2px 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: var(--text);
  text-align: right;
  font-size: 11px;
  appearance: textfield;
  -moz-appearance: textfield;
}

.labor-input::-webkit-outer-spin-button,
.labor-input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.labor-input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  border-color: #93b4e7;
}

.ratio-input-wrap {
  display: grid;
  grid-template-columns: minmax(56px, 1fr) auto;
  align-items: center;
  gap: 3px;
}

.ratio-input-wrap .ratio-input {
  min-width: 56px;
  padding-right: 4px;
  text-align: center;
}

.ratio-input-wrap span {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
}

.labor-table tfoot td {
  position: sticky;
  bottom: 0;
  height: 26px;
  padding: 3px 5px;
  border-top: 1px solid #c8d6e6;
  border-bottom: 0;
  background: #eef5fb;
  font-weight: 700;
  z-index: 5;
}

.labor-table tfoot td:nth-child(1) {
  left: 0;
  background: #eef5fb;
  z-index: 6;
}

.labor-table tfoot td:nth-child(2) {
  left: 210px;
  background: #eef5fb;
  z-index: 6;
}

.labor-table tfoot td:nth-child(3) {
  left: 282px;
  background: #eef5fb;
  z-index: 6;
}

.labor-table tfoot td:nth-child(4) {
  left: 336px;
  background: #eef5fb;
  z-index: 6;
}

.labor-table tfoot td:nth-child(5) {
  left: 390px;
  background: #eef5fb;
  box-shadow: none;
  z-index: 6;
}

.labor-table tfoot td:nth-child(2n+6) {
  background: #eef5fb;
}

.labor-table tfoot .labor-input,
.labor-table tfoot input {
  display: none;
}

.labor-project-cell {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.labor-project-cell .linklike {
  flex: 0 0 auto;
  font-size: 11px;
}

.labor-project-cell span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
}

.labor-summary {
  padding: 8px 12px;
  font-size: 12px;
}

.labor-mobile-list {
  display: none;
}

.blue-text {
  color: var(--blue);
  font-weight: 700;
}

/* 预付核销页：与预算/报销列表保持同一密度 */
#prepaymentsView .panel-body {
  padding: 12px 14px;
}

#prepaymentsView .notice {
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

#prepaymentsView .field span {
  font-size: 12px;
}

#prepaymentsView .field input,
#prepaymentsView .field select {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 13px;
}

#prepaymentsView .toolbar {
  margin-top: 10px;
}

.writeoff-form-grid {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) minmax(280px, 2fr) auto;
  gap: 10px;
  align-items: end;
}

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

.writeoff-form-grid #writeoffLine {
  width: 100%;
}

.writeoff-form-grid .writeoff-action {
  display: flex;
  align-items: end;
}

.writeoff-form-grid .writeoff-action .primary-btn {
  min-height: 32px;
  white-space: nowrap;
}

#prepayBalanceTable table,
#writeoffTable table {
  min-width: 1120px;
  table-layout: fixed;
  font-size: 12px;
}

#prepayBalanceTable th,
#prepayBalanceTable td,
#writeoffTable th,
#writeoffTable td {
  padding: 7px 8px;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
}

#prepayBalanceTable td.numeric,
#prepayBalanceTable th.numeric,
#writeoffTable td.numeric,
#writeoffTable th.numeric {
  white-space: nowrap;
}

#prepayBalanceTable th:nth-child(1),
#prepayBalanceTable td:nth-child(1),
#writeoffTable th:nth-child(1),
#writeoffTable td:nth-child(1) {
  width: 11%;
}

#prepayBalanceTable th:nth-child(2),
#prepayBalanceTable td:nth-child(2),
#writeoffTable th:nth-child(4),
#writeoffTable td:nth-child(4) {
  width: 22%;
}

#prepayBalanceTable th:nth-child(3),
#prepayBalanceTable td:nth-child(3),
#writeoffTable th:nth-child(3),
#writeoffTable td:nth-child(3) {
  width: 14%;
}

#prepayBalanceTable th:nth-child(4),
#prepayBalanceTable td:nth-child(4),
#prepayBalanceTable th:nth-child(5),
#prepayBalanceTable td:nth-child(5),
#prepayBalanceTable th:nth-child(6),
#prepayBalanceTable td:nth-child(6),
#writeoffTable th:nth-child(5),
#writeoffTable td:nth-child(5),
#writeoffTable th:nth-child(7),
#writeoffTable td:nth-child(7),
#writeoffTable th:nth-child(8),
#writeoffTable td:nth-child(8) {
  width: 10%;
}

#prepayBalanceTable th:nth-child(7),
#prepayBalanceTable td:nth-child(7),
#prepayBalanceTable th:nth-child(8),
#prepayBalanceTable td:nth-child(8),
#writeoffTable th:nth-child(6),
#writeoffTable td:nth-child(6) {
  width: 9%;
}

#writeoffTable th:nth-child(2),
#writeoffTable td:nth-child(2) {
  width: 12%;
}

#writeoffTable th:nth-child(9),
#writeoffTable td:nth-child(9) {
  width: 12%;
}

/* 加宽的下拉（编号+描述） */
.wide-select {
  min-width: 320px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.pager .small-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

tr.cf-net {
  background: var(--soft);
}

tr.cf-net td,
tr.cf-pos td.numeric {
  color: var(--accent-strong);
}

tr.cf-neg td.numeric {
  color: var(--red);
}

.th-filter {
  width: 100%;
  min-height: 28px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.tabs {
  display: inline-flex;
  gap: 4px;
}

.mobile-card-title,
.mobile-card-meta,
.mobile-card-stats,
.mobile-card-flags,
.mobile-card-action,
.mobile-contract-titleline,
.mobile-contract-no {
  display: none;
}

.mobile-card-kicker,
.desktop-cell-text {
  display: inline;
}

.metric .mobile-money,
.mobile-money {
  display: none;
}

#detailBatchTable .mobile-card-kicker {
  display: none;
}

.mobile-filter-toggle {
  display: none;
}

.tab {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
}

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
  }

  .main {
    padding: 18px;
  }

  .topbar,
  .grid-2,
  .split {
    display: block;
  }

  .top-actions {
    margin-top: 12px;
    justify-content: space-between;
  }

  .kpi-grid,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .invoice-toolbar {
    grid-template-columns: 1fr;
  }

  .inline-summary {
    justify-content: flex-start;
  }

  .filters .contract-search-field {
    min-width: 100%;
    flex-basis: 100%;
  }

  .invoice-filter-row {
    grid-template-columns: 1fr 1fr;
  }

  .invoice-filter-row .contract-search-field {
    grid-column: 1 / -1;
  }

  .invoice-bill-grid {
    grid-template-columns: 1fr 1fr;
  }

  .invoice-bill-grid .bill-batch-field {
    grid-column: 1 / -1;
  }

  .invoice-receipt-grid {
    grid-template-columns: 1fr 1fr;
  }

  .invoice-receipt-grid .receipt-batch-field {
    grid-column: 1 / -1;
  }

  .batch-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .batch-form-grid .batch-action {
    grid-column: 1 / -1;
  }

  .writeoff-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  body {
    background: #f6f8fb;
    font-size: 13px;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .sidebar {
    position: relative;
    top: auto;
    z-index: 20;
    height: auto;
    min-height: 0;
    padding: 10px 12px;
    background: #0f172a;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
  }

  .brand {
    min-height: 42px;
    padding: 0;
    border-bottom: 0;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    font-size: 13px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p,
  .sidebar-footer {
    display: none;
  }

  .sidebar-toggle {
    display: none;
  }

  .nav {
    position: fixed !important;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    width: min(100%, 430px);
    margin: 0 auto;
    overflow-x: visible;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -12px 24px rgba(15, 23, 42, 0.12);
    scrollbar-width: none;
    transform: translateZ(0);
    will-change: transform;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    width: 100%;
    min-width: 0;
    min-height: 36px;
    padding: 0 3px;
    border: 1px solid #dbe3ee;
    background: #ffffff;
    color: #334155;
    text-align: center;
    white-space: nowrap;
  }

  .nav-item[data-view="budgets"],
  .nav-item[data-view="labor"],
  .nav-item[data-view="glossary"] {
    font-size: 0;
  }

  .nav-item[data-view="budgets"]::after,
  .nav-item[data-view="labor"]::after,
  .nav-item[data-view="glossary"]::after {
    font-size: 12px;
  }

  .nav-item[data-view="budgets"]::after {
    content: "预算";
  }

  .nav-item[data-view="labor"]::after {
    content: "人工";
  }

  .nav-item[data-view="glossary"]::after {
    content: "说明";
  }

  .nav-item:hover,
  .nav-item.active {
    background: #0f766e;
    border-color: #0f766e;
    color: #ffffff;
    box-shadow: none;
  }

  .nav-item[data-view="reimbursements"],
  .nav-item[data-view="prepayments"],
  .nav-item[data-view="invoices"],
  .nav-item[data-view="costing"] {
    display: none;
  }

  .main {
    padding: 0 12px calc(76px + env(safe-area-inset-bottom));
    width: 100%;
    max-width: 100vw;
    min-width: 0;
    overflow-x: hidden;
  }

  .topbar {
    position: static;
    z-index: 10;
    margin: 0 -12px 8px;
    padding: 8px 12px 10px;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 248, 251, 0.96);
  }

  .topbar h2 {
    font-size: 19px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    margin-top: 8px;
  }

  .year-box,
  .search-box {
    width: 100%;
    height: 36px;
    padding: 0 9px;
  }

  .year-box span,
  .search-box span {
    display: none;
  }

  .search-box input {
    width: 100%;
  }

  .dashboard-fit {
    gap: 10px;
  }

  .dashboard-kpis,
  .kpi-grid.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .metric.compact {
    min-height: 108px;
    padding: 10px;
    border-radius: 7px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
  }

  .metric.compact span {
    font-size: 12px;
  }

  .metric.compact strong {
    font-size: 16px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }

  .metric.compact em {
    display: block;
    line-height: 1.3;
  }

  .dashboard-sections {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel {
    border-radius: 8px;
    min-width: 0;
    box-shadow: 0 7px 20px rgba(15, 23, 42, 0.06);
  }

  .compact-header {
    min-height: 42px;
    padding: 10px 12px;
  }

  .compact-header h3 {
    font-size: 15px;
  }

  .section-list,
  .alert-list {
    gap: 6px;
    padding: 8px;
  }

  .mini-row.insight-row,
  .alert-card {
    min-height: 0;
    padding: 7px 8px;
    border-radius: 7px;
  }

  .mini-row.insight-row.summary-card {
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
    gap: 6px;
  }

  .mini-row b,
  .alert-card b {
    font-size: 12px;
  }

  .mini-row i,
  .alert-card i {
    font-size: 11.5px;
    line-height: 1.25;
  }

  .mini-row.insight-row i:first-of-type {
    display: none;
  }

  .mini-row.insight-row strong {
    justify-self: end;
    font-size: 12px;
  }

  .summary-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-card strong,
  .mini-row strong,
  .alert-card strong {
    justify-self: start;
    text-align: left;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

  #projectsView .panel-header .toolbar,
  #contractsView .panel-header .toolbar,
  #budgetsView .panel-header .toolbar {
    display: none;
  }

  #projectsView .panel-header,
  #contractsView .panel-header,
  #budgetsView .panel-header {
    align-items: center;
    min-height: 46px;
  }

  #projectsView .summary-bar,
  #budgetsView .summary-bar {
    align-items: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 10px 12px;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  #projectsTable .table-wrap,
  #contractsTable .table-wrap,
  #budgetsTable .table-wrap {
    overflow: visible;
    border-top: 0;
  }

  #projectsTable table,
  #contractsTable table,
  #budgetsTable table,
  #projectsTable .projects-table,
  #budgetsTable .budget-table {
    display: block;
    width: 100%;
    min-width: 0;
    table-layout: auto;
  }

  #projectsTable thead,
  #contractsTable thead,
  #budgetsTable thead {
    display: none;
  }

  #projectsTable tbody,
  #contractsTable tbody,
  #budgetsTable tbody {
    display: grid;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 8px 0 0;
  }

  #projectsTable tr,
  #contractsTable tr,
  #budgetsTable tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 12px;
    row-gap: 7px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-sizing: border-box;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  }

  #projectsTable tr,
  #contractsTable tr,
  #budgetsTable tr {
    position: relative;
  }

  #projectsTable tr.project-group-row {
    border-left: 4px solid var(--accent);
    background: #fbfffd;
  }

  #projectsTable tr.project-child-row {
    border-left: 4px solid #bfdbfe;
  }

  #projectsTable th,
  #projectsTable td,
  #contractsTable th,
  #contractsTable td,
  #budgetsTable th,
  #budgetsTable td,
  #contractsTable td.contract-no,
  #contractsTable td.contract-name,
  #contractsTable td.contract-project,
  #contractsTable td.contract-customer,
  #contractsTable td.contract-no .linklike {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    align-items: start;
    gap: 8px;
    width: 100%;
    padding: 0;
    border-bottom: 0;
    overflow: visible;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
    text-overflow: clip;
    white-space: normal;
  }

  #projectsTable td > *,
  #contractsTable td > *,
  #budgetsTable td > *,
  #budgetsTable .text-clip {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  #projectsTable th,
  #projectsTable td,
  #contractsTable th,
  #contractsTable td,
  #budgetsTable th,
  #budgetsTable td,
  #budgetsTable .budget-table th,
  #budgetsTable .budget-table td {
    min-width: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  #projectsTable .panel-header .toolbar button,
  #contractsTable .panel-header .toolbar button,
  #budgetsTable .panel-header .toolbar button,
  #projectsView .panel-header .toolbar button,
  #contractsView .panel-header .toolbar button,
  #budgetsView .panel-header .toolbar button {
    display: none;
  }

  #projectsTable td::before,
  #contractsTable td::before,
  #budgetsTable td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
  }

  #projectsTable td.numeric,
  #projectsTable th.numeric,
  #contractsTable td.numeric,
  #contractsTable th.numeric,
  #budgetsTable td.numeric,
  #budgetsTable th.numeric {
    font-size: 11.5px;
    white-space: normal;
  }

  #projectsTable td:nth-child(2),
  #projectsTable td:nth-child(3),
  #projectsTable td:nth-child(4),
  #projectsTable td:nth-child(5),
  #projectsTable td:nth-child(8),
  #projectsTable td:nth-child(9),
  #contractsTable td:nth-child(2),
  #contractsTable td:nth-child(3),
  #contractsTable td:nth-child(4),
  #contractsTable td:nth-child(5),
  #contractsTable td:nth-child(6),
  #contractsTable td:nth-child(7),
  #contractsTable td:nth-child(8),
  #contractsTable td:nth-child(9),
  #contractsTable td:nth-child(11),
  #budgetsTable td:nth-child(1),
  #budgetsTable td:nth-child(3),
  #budgetsTable td:nth-child(5),
  #budgetsTable td:nth-child(6),
  #budgetsTable td:nth-child(7),
  #budgetsTable td:nth-child(13) {
    display: none;
  }

  #projectsTable td:nth-child(1),
  #projectsTable td:nth-child(2),
  #contractsTable td:nth-child(1),
  #contractsTable td:nth-child(6),
  #budgetsTable td:nth-child(2),
  #budgetsTable td:nth-child(4) {
    grid-column: 1 / -1;
    grid-template-columns: 1fr;
  }

  #projectsTable td:nth-child(1)::before,
  #projectsTable td:nth-child(2)::before,
  #contractsTable td:nth-child(1)::before,
  #contractsTable td:nth-child(6)::before,
  #budgetsTable td:nth-child(2)::before,
  #budgetsTable td:nth-child(4)::before {
    display: none;
  }

  #projectsTable td:nth-child(1),
  #contractsTable td:nth-child(1),
  #budgetsTable td:nth-child(2) {
    order: -3;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
  }

  #projectsTable .mobile-card-action,
  #contractsTable .mobile-card-action,
  #budgetsTable .mobile-card-action {
    display: none;
    position: absolute;
    top: 9px;
    right: 10px;
    align-items: center;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid rgba(15, 118, 110, 0.22);
    border-radius: 999px;
    background: #ecfdf5;
    color: var(--accent-strong);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
  }

  #projectsTable .mobile-card-action::after,
  #contractsTable .mobile-card-action::after,
  #budgetsTable .mobile-card-action::after {
    content: "";
    margin-left: 3px;
    font-size: 13px;
    line-height: 1;
  }

  #projectsTable td:nth-child(2),
  #contractsTable td:nth-child(6),
  #budgetsTable td:nth-child(4) {
    order: -2;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
  }

  #contractsTable td:nth-child(14),
  #budgetsTable td:nth-child(11),
  #budgetsTable td:nth-child(12) {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: auto !important;
    color: var(--muted);
    font-size: 11.5px;
  }

  #contractsTable td:nth-child(14)::before,
  #budgetsTable td:nth-child(11)::before,
  #budgetsTable td:nth-child(12)::before {
    display: none;
  }

  #projectsTable td:nth-child(1),
  #contractsTable td:nth-child(1) {
    gap: 2px;
  }

  #projectsTable td:nth-child(1) .linklike,
  #contractsTable td:nth-child(1) .linklike {
    min-height: 22px;
    width: fit-content;
    max-width: calc(100% - 86px);
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  #contractsTable td:nth-child(1) .linklike {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #contractsTable td:nth-child(1) > .linklike {
    display: none;
  }

  #projectsTable .mobile-card-title,
  #contractsTable .mobile-card-title {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
  }

  #contractsTable .mobile-contract-titleline {
    display: flex;
    align-items: baseline;
    gap: 5px;
    max-width: calc(100% - 30px);
    min-width: 0;
  }

  #contractsTable .mobile-contract-titleline .mobile-card-title {
    order: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #contractsTable .mobile-contract-no {
    order: 2;
    display: inline-block;
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 9.6px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
  }

  #projectsTable .mobile-card-meta,
  #contractsTable .mobile-card-meta {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.25;
  }

  #projectsTable .mobile-card-stats,
  #contractsTable .mobile-card-stats,
  #budgetsTable .mobile-card-stats {
    display: block;
    margin-top: 4px;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
  }

  #projectsTable .mobile-card-stats {
    font-size: 11.2px;
    line-height: 1.35;
  }

  #projectsTable .project-mobile-metrics,
  #laborView .compact-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    margin-top: 5px;
    color: var(--text);
    font-size: 10.8px;
    font-weight: 700;
    line-height: 1.2;
  }

  #projectsTable .project-mobile-metrics i,
  #laborView .compact-metrics i {
    display: flex;
    min-width: 0;
    justify-content: space-between;
    gap: 6px;
    font-style: normal;
  }

  #projectsTable .project-mobile-metrics em,
  #laborView .compact-metrics em {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-style: normal;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #projectsTable .project-mobile-metrics b,
  #laborView .compact-metrics b {
    color: var(--text);
    white-space: nowrap;
  }

  #budgetsTable .mobile-card-title {
    display: block;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.25;
  }

  #budgetsTable .mobile-card-meta {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.25;
  }

  #budgetsTable td:nth-child(2) .linklike {
    justify-self: start;
    min-height: 22px;
    max-width: calc(100% - 70px);
    padding: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-align: left;
  }

  #projectsTable tr,
  #contractsTable tr,
  #budgetsTable tr {
    grid-template-columns: minmax(0, 1fr);
  }

  #projectsTable td:nth-child(n + 2),
  #contractsTable td:nth-child(n + 2),
  #budgetsTable td:not(:nth-child(2)) {
    display: none;
  }

  #projectsTable td:nth-child(1),
  #contractsTable td:nth-child(1),
  #budgetsTable td:nth-child(2) {
    display: grid;
    grid-column: 1 / -1;
    width: 100% !important;
    min-height: 0;
    padding: 0;
    background: transparent;
  }

  #budgetsTable td:nth-child(11) {
    order: -1;
  }

  #projectsTable td:nth-child(6),
  #projectsTable td:nth-child(7),
  #projectsTable td:nth-child(8),
  #projectsTable td:nth-child(9),
  #projectsTable td:nth-child(10),
  #projectsTable td:nth-child(11),
  #contractsTable td:nth-child(10),
  #contractsTable td:nth-child(12),
  #contractsTable td:nth-child(13),
  #budgetsTable td:nth-child(8),
  #budgetsTable td:nth-child(9),
  #budgetsTable td:nth-child(10) {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  #projectsTable td:nth-child(6),
  #projectsTable td:nth-child(7),
  #projectsTable td:nth-child(10),
  #projectsTable td:nth-child(11),
  #contractsTable td:nth-child(10),
  #contractsTable td:nth-child(12),
  #contractsTable td:nth-child(13),
  #contractsTable td:nth-child(14),
  #budgetsTable td:nth-child(8),
  #budgetsTable td:nth-child(9),
  #budgetsTable td:nth-child(10),
  #budgetsTable td:nth-child(11),
  #budgetsTable td:nth-child(12) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: auto !important;
    min-height: 38px;
    padding: 6px 7px;
    border-radius: 6px;
    background: #f8fbff;
  }

  #projectsTable td:nth-child(6)::before,
  #projectsTable td:nth-child(7)::before,
  #projectsTable td:nth-child(10)::before,
  #projectsTable td:nth-child(11)::before,
  #contractsTable td:nth-child(10)::before,
  #contractsTable td:nth-child(12)::before,
  #contractsTable td:nth-child(13)::before,
  #contractsTable td:nth-child(14)::before,
  #budgetsTable td:nth-child(8)::before,
  #budgetsTable td:nth-child(9)::before,
  #budgetsTable td:nth-child(10)::before,
  #budgetsTable td:nth-child(11)::before,
  #budgetsTable td:nth-child(12)::before {
    display: block;
    margin-bottom: 2px;
  }

  #projectsTable .linklike,
  #contractsTable .linklike {
    justify-self: start;
    min-height: 24px;
    padding: 0;
    color: var(--accent-strong);
    font-size: inherit;
    font-weight: 800;
    text-align: left;
    white-space: normal;
  }

  #contractsTable .badge,
  #budgetsTable .badge {
    justify-self: start;
  }

  #budgetsTable .budget-amount-input {
    justify-self: end;
    width: 112px;
    min-height: 28px;
    padding: 4px 7px;
    text-align: right;
  }

  #budgetsView .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: end;
    gap: 8px;
  }

  #budgetsView .mobile-filter-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 38px;
    margin-bottom: 8px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbff;
    color: var(--text);
    text-align: left;
  }

  #budgetsView .mobile-filter-toggle span {
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
  }

  #budgetsView .mobile-filter-toggle strong {
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #budgetsView .filters {
    display: none;
  }

  #budgetsView .filters.mobile-open {
    display: grid;
  }

  #budgetsView .filters .secondary-btn {
    grid-column: 1 / -1;
  }

  #laborView .labor-summary {
    display: none;
  }

  #laborView .labor-table-wrap {
    display: none;
  }

  #laborView .labor-mobile-list {
    display: grid;
    gap: 7px;
    padding: 8px 0 0;
  }

  #laborView .labor-mobile-card {
    display: grid;
    gap: 3px;
    width: 100%;
    padding: 8px 10px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    text-align: left;
    box-shadow: none;
  }

  #laborView .labor-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
  }

  #laborView .labor-mobile-title {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.12;
    min-width: 0;
  }

  #laborView .labor-mobile-meta {
    color: var(--muted);
    font-size: 10.8px;
    font-weight: 700;
    line-height: 1.08;
  }

  #laborView .labor-mobile-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    margin-top: 2px;
    font-size: 11px;
    line-height: 1.2;
  }

  #laborView .labor-mobile-stats i {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    min-width: 0;
    color: var(--muted);
    font-style: normal;
  }

  #laborView .labor-mobile-stats b {
    color: var(--text);
    white-space: nowrap;
  }

  #projectsTable tr,
  #contractsTable tr,
  #budgetsTable tr {
    grid-template-columns: minmax(0, 1fr);
  }

  #projectsTable td:nth-child(n + 2),
  #contractsTable td:nth-child(n + 2),
  #budgetsTable td:not(:nth-child(2)) {
    display: none !important;
  }

  #projectsTable td:nth-child(1),
  #contractsTable td:nth-child(1),
  #budgetsTable td:nth-child(2) {
    display: grid !important;
    grid-column: 1 / -1;
    width: 100% !important;
    min-height: 0;
    padding: 0;
    background: transparent;
  }

  #projectDetailView .panel,
  #contractDetailView .panel {
    margin-top: 10px !important;
  }

  #projectDetailView .panel:first-child,
  #contractDetailView .panel:first-child {
    margin-top: 0 !important;
  }

  #projectDetailView .panel-header,
  #contractDetailView .panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 10px 12px;
  }

  #projectDetailView .panel-header h3,
  #contractDetailView .panel-header h3 {
    display: grid;
    gap: 5px;
    font-size: 15px;
    line-height: 1.3;
  }

  #projectDetailView .detail-toggle-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  #projectDetailView .detail-toggle-header h3 {
    display: block;
  }

  #projectDetailView .detail-header-actions {
    gap: 6px;
  }

  #projectDetailView .detail-toggle-btn {
    min-height: 24px;
    padding: 0 8px;
    font-size: 11px;
  }

  #projectDetailView #backToProjects,
  #contractDetailView #backToContracts {
    justify-self: start;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--accent-strong);
    font-size: 12px;
    font-weight: 800;
  }

  #contractDetailView #toggleContractEdit,
  #contractDetailView .batch-form-grid {
    display: none;
  }

  #contractDetailView .contract-batch-panel > .panel-body {
    display: none;
  }

  #projectDetailView .panel-body,
  #contractDetailView .panel-body {
    padding: 10px 12px;
  }

  #projectDetailView .kpi-grid,
  #contractDetailView .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #projectDetailView .metric,
  #contractDetailView .metric {
    min-height: 82px;
    padding: 10px;
  }

  #contractDetailView .metric .desktop-money,
  .desktop-money {
    display: none;
  }

  #contractDetailView .metric .mobile-money,
  .mobile-money {
    display: inline;
  }

  #contractDetailView .kpi-grid {
    gap: 6px;
  }

  #contractDetailView .metric {
    min-height: 70px;
    padding: 8px 9px;
  }

  #contractDetailView .metric > span {
    font-size: 11px;
    line-height: 1.2;
  }

  #contractDetailView .metric strong,
  #contractDetailView .metric b {
    font-size: 13px;
    line-height: 1.2;
  }

  #contractDetailView .metric em {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.25;
  }

  #contractDetailView .metric .dual {
    gap: 8px;
  }

  #projectDetailView .metric strong,
  #contractDetailView .metric strong,
  #projectDetailView .metric b,
  #contractDetailView .metric b {
    font-size: 14px;
    overflow-wrap: anywhere;
  }

  #projectDetailView .detail-meta,
  #contractDetailView .detail-meta {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-top: 10px;
  }

  #projectDetailView .summary-bar,
  #contractDetailView .summary-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .panel-header,
  .summary-bar,
  .toolbar,
  .filters {
    gap: 8px;
  }

  .topbar > div:first-child {
    display: none;
  }

  .topbar {
    padding: 6px 12px 8px;
  }

  /* 列表页 header 的 h3 与 toolbar 在移动端都隐藏，整个 header 一起收掉，避免留一条空白行 */
  #dashboardView .topbar,
  #projectsView .panel > .panel-header,
  #contractsView .panel > .panel-header,
  #budgetsView .panel > .panel-header {
    display: none;
  }

  #projectsView .summary-bar {
    margin-top: 0;
  }

  #contractsTable td:nth-child(1) .linklike {
    display: block;
    width: 100%;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    word-break: keep-all;
    overflow-wrap: normal;
    letter-spacing: -0.2px;
    font-size: 10.5px;
  }

  #projectsTable tbody,
  #contractsTable tbody,
  #budgetsTable tbody {
    padding-top: 0;
  }

  #projectsTable tr,
  #contractsTable tr,
  #budgetsTable tr {
    box-shadow: none;
  }

  #projectsTable tr,
  #contractsTable tr {
    padding: 7px 9px;
  }

  #budgetsTable tbody {
    gap: 6px;
  }

  #budgetsTable tr {
    padding: 7px 9px;
    row-gap: 2px;
  }

  #projectsTable td:nth-child(1),
  #contractsTable td:nth-child(1),
  #budgetsTable td:nth-child(2) {
    position: relative;
    padding-right: 24px;
    gap: 2px;
  }

  #projectsTable .linklike,
  #contractsTable .linklike,
  #budgetsTable td:nth-child(2) .linklike {
    min-height: 0;
    width: fit-content;
    max-width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.15;
    text-decoration: none;
  }

  #contractsTable td:nth-child(1) .linklike {
    max-width: 100%;
    font-size: 10.5px;
  }

  #projectsTable .mobile-card-action,
  #contractsTable .mobile-card-action,
  #budgetsTable .mobile-card-action {
    display: block;
    position: absolute;
    inset: -7px -9px -7px -9px;
    z-index: 2;
    padding: 0;
    border: 0;
    background: transparent;
    color: transparent;
    font-size: 0;
    line-height: 0;
    cursor: pointer;
  }

  #projectsTable .mobile-card-action::after,
  #contractsTable .mobile-card-action::after,
  #budgetsTable .mobile-card-action::after {
    content: "›";
    position: absolute;
    top: 50%;
    right: 12px;
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-50%);
  }

  #budgetsTable .mobile-card-title {
    margin-top: 1px;
    font-size: 12.5px;
    line-height: 1.15;
  }

  #budgetsTable .mobile-card-meta {
    font-size: 10.5px;
    line-height: 1.12;
  }

  #budgetsTable .mobile-card-stats {
    margin-top: 1px;
    font-size: 11px;
    line-height: 1.16;
  }

  #projectsTable .mobile-card-title,
  #contractsTable .mobile-card-title {
    font-size: 13px;
    line-height: 1.16;
  }

  #projectsTable .mobile-card-meta,
  #contractsTable .mobile-card-meta {
    font-size: 11px;
    line-height: 1.15;
  }

  #projectsTable .mobile-card-stats,
  #contractsTable .mobile-card-stats {
    margin-top: 2px;
    font-size: 10.6px;
    line-height: 1.28;
  }

  #projectDetailView .table-wrap,
  #contractDetailView .table-wrap {
    overflow: visible;
    border-top: 0;
  }

  #projectDetailView table,
  #contractDetailView table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  #projectDetailView thead,
  #contractDetailView thead {
    display: none;
  }

  #projectDetailView tbody,
  #contractDetailView tbody {
    display: grid;
    gap: 8px;
  }

  #projectDetailView tr,
  #contractDetailView tr {
    display: grid;
    gap: 6px;
    width: 100%;
    padding: 8px 0;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
  }

  #projectDetailView td,
  #contractDetailView td {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 8px;
    width: 100% !important;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #projectDetailView td::before,
  #contractDetailView td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
  }

  #projectDetailView td:nth-child(n + 5),
  #contractDetailView td:nth-child(n + 5) {
    display: none;
  }

  #projectDetailView td:first-child,
  #contractDetailView td:first-child {
    grid-template-columns: 1fr;
    font-weight: 800;
  }

  #projectDetailView td:first-child::before,
  #contractDetailView td:first-child::before {
    display: none;
  }

  #detailContracts tr,
  #detailInvoices tr,
  #detailBudgets tr,
  #contractReimburseTable tr {
    gap: 2px;
  }

  #detailContracts td:nth-child(n + 2),
  #detailInvoices td:nth-child(n + 2),
  #detailBudgets td:nth-child(n + 2),
  #contractReimburseTable td:nth-child(n + 2) {
    display: none;
  }

  #detailContracts td:first-child,
  #detailInvoices td:first-child,
  #detailBudgets td:first-child,
  #contractReimburseTable td:first-child {
    display: grid;
    gap: 2px;
    width: 100% !important;
    padding: 0;
    font-weight: 700;
  }

  #detailContracts .mobile-card-title,
  #detailInvoices .mobile-card-title,
  #detailBudgets .mobile-card-title,
  #contractReimburseTable .mobile-card-title {
    display: block;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
  }

  #projectDetailView .desktop-cell-text,
  #contractDetailView .desktop-cell-text {
    display: none;
  }

  #detailContracts .mobile-card-kicker,
  #detailBatchTable .mobile-card-kicker,
  #detailInvoices .mobile-card-kicker,
  #detailBudgets .mobile-card-kicker,
  #contractReimburseTable .mobile-card-kicker {
    display: block;
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
  }

  #detailContracts tr,
  #detailBatchTable tr,
  #detailInvoices tr,
  #detailBudgets tr,
  #contractReimburseTable tr {
    padding: 6px 0;
  }

  #detailContracts td:first-child,
  #detailBatchTable td:first-child,
  #detailInvoices td:first-child,
  #detailBudgets td:first-child,
  #contractReimburseTable td:first-child {
    gap: 1px;
  }

  #detailContracts td:first-child {
    padding-left: 8px;
    border-left: 3px solid #2563eb;
  }

  #detailBatchTable td:first-child {
    padding-left: 8px;
    border-left: 3px solid #14b8a6;
  }

  #detailInvoices td:first-child {
    padding-left: 8px;
    border-left: 3px solid #38bdf8;
  }

  #detailBudgets td:first-child {
    padding-left: 8px;
    border-left: 3px solid #14b8a6;
  }

  #contractReimburseTable td:first-child {
    padding-left: 8px;
    border-left: 3px solid #f59e0b;
  }

  #detailContracts .mobile-card-meta,
  #detailInvoices .mobile-card-meta,
  #detailBudgets .mobile-card-meta,
  #contractReimburseTable .mobile-card-meta {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.25;
  }

  #detailContracts .mobile-card-stats,
  #detailInvoices .mobile-card-stats,
  #detailBudgets .mobile-card-stats,
  #contractReimburseTable .mobile-card-stats {
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
  }

  body[data-view="contracts"] .top-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  body[data-view="contracts"] .year-box {
    display: none;
  }

  body[data-view="contracts"] .search-box {
    height: 38px;
  }

  body[data-view="contractDetail"] .topbar,
  body[data-view="projectDetail"] .topbar {
    display: none;
  }

  /* 详情页 header：标题与类型徽标同行，徽标不再独占整行 */
  #projectDetailView .panel-header,
  #contractDetailView .panel-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  #projectDetailView .panel-header > .badge,
  #contractDetailView .panel-header > .badge {
    justify-self: end;
    width: fit-content;
    white-space: nowrap;
    margin-top: 2px;
  }

  /* 详情页 KPI：金额整体不逐位断行，双列放不下时整列换行 */
  #projectDetailView .metric .dual,
  #contractDetailView .metric .dual {
    gap: 10px;
    flex-wrap: wrap;
  }

  #projectDetailView .metric .triple,
  #contractDetailView .metric .triple {
    gap: 6px;
  }

  #projectDetailView .metric .dual i,
  #contractDetailView .metric .dual i,
  #projectDetailView .metric .triple i,
  #contractDetailView .metric .triple i {
    font-size: 11px;
  }

  #projectDetailView .metric .dual b,
  #contractDetailView .metric .dual b,
  #projectDetailView .metric .triple b,
  #contractDetailView .metric .triple b,
  #projectDetailView .metric strong,
  #contractDetailView .metric strong {
    font-size: 13px;
    white-space: nowrap;
    overflow-wrap: normal;
  }

  /* 详情卡片表：改用 flex 布局，绕开嵌套 grid 在 table 匿名盒里行高被压扁导致的文字重叠 */
  #projectDetailView .table-wrap table,
  #contractDetailView .table-wrap table {
    display: block;
    height: auto;
  }

  #projectDetailView tbody,
  #contractDetailView tbody {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  #projectDetailView tr,
  #contractDetailView tr {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: auto;
  }

  #projectDetailView td,
  #contractDetailView td {
    height: auto;
  }

  #detailContracts td:first-child,
  #detailInvoices td:first-child,
  #detailBudgets td:first-child,
  #contractReimburseTable td:first-child {
    display: block !important;
  }

  #detailContracts td:first-child > *,
  #detailInvoices td:first-child > *,
  #detailBudgets td:first-child > *,
  #contractReimburseTable td:first-child > * {
    display: block;
    margin: 0 0 2px;
  }

  #detailContracts .linklike,
  #detailInvoices .linklike,
  #detailBudgets .linklike,
  #contractReimburseTable .linklike {
    text-align: left;
    width: auto;
    padding: 0;
  }

  #detailContracts .mobile-card-kicker.linklike {
    display: block;
    width: fit-content;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-strong);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.15;
    text-decoration: none;
  }

  /* 合同详情·收款批次卡片：首格承载完整信息，其余列隐藏 */
  #detailBatchTable td:nth-child(n + 2) {
    display: none;
  }

  #detailBatchTable td:first-child {
    display: block !important;
    width: 100% !important;
    padding: 0 0 0 8px;
    border-left: 3px solid #14b8a6;
    font-weight: 800;
    font-size: 12px;
    line-height: 1.14;
  }

  #detailBatchTable td:first-child::before {
    display: none;
  }

  #detailBatchTable .mobile-card-flags {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 3px;
    margin: 0 0 0 6px;
    vertical-align: 1px;
  }

  #detailBatchTable .mobile-card-flags .badge {
    min-height: 17px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 800;
  }

  #detailBatchTable .mobile-card-title {
    display: block;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.14;
  }

  #detailBatchTable .mobile-card-title:empty {
    display: none;
  }

  #detailBatchTable .mobile-card-meta {
    display: block;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    line-height: 1.14;
    margin-top: 1px;
  }

  #detailBatchTable .mobile-card-stats {
    display: block;
    margin-top: 1px;
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.16;
  }
}

/* 移动端：项目、合同、预算、人工统一的指标小格（标签在上、数值在下） */
@media (max-width: 640px) {
  #projectsTable .project-mobile-metrics,
  #contractsTable .contract-mobile-metrics,
  #budgetsTable .budget-mobile-metrics,
  #laborView .labor-mobile-stats {
    display: grid;
    gap: 5px;
    margin-top: 6px;
    white-space: normal;
    letter-spacing: 0;
  }

  #projectsTable .project-mobile-metrics,
  #contractsTable .contract-mobile-metrics,
  #budgetsTable .budget-mobile-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #laborView .labor-mobile-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* 芯片：可选组标题（chip-cap）+ 两个并排的 标签/数值 子格 */
  #projectsTable .project-mobile-metrics i,
  #contractsTable .contract-mobile-metrics i,
  #budgetsTable .budget-mobile-metrics i,
  #laborView .labor-mobile-stats i {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px 6px;
    min-width: 0;
    padding: 5px 7px;
    border-radius: 6px;
    background: #f2f7fb;
    font-style: normal;
    color: var(--text);
  }

  #projectsTable .project-mobile-metrics i .chip-cap,
  #contractsTable .contract-mobile-metrics i .chip-cap,
  #budgetsTable .budget-mobile-metrics i .chip-cap,
  #laborView .labor-mobile-stats i .chip-cap {
    grid-column: 1 / -1;
    display: block;
    color: var(--accent-strong);
    font-style: normal;
    font-size: 9.5px;
    font-weight: 800;
    line-height: 1.2;
  }

  #projectsTable .project-mobile-metrics i > span,
  #contractsTable .contract-mobile-metrics i > span,
  #budgetsTable .budget-mobile-metrics i > span,
  #laborView .labor-mobile-stats i > span {
    display: block;
    min-width: 0;
  }

  #projectsTable .project-mobile-metrics i > span em,
  #contractsTable .contract-mobile-metrics i > span em,
  #budgetsTable .budget-mobile-metrics i > span em,
  #laborView .labor-mobile-stats i > span em {
    display: block;
    overflow: hidden;
    color: var(--muted);
    font-style: normal;
    font-size: 9.8px;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  #projectsTable .project-mobile-metrics i > span b,
  #contractsTable .contract-mobile-metrics i > span b,
  #budgetsTable .budget-mobile-metrics i > span b,
  #laborView .labor-mobile-stats i > span b {
    display: block;
    color: var(--text);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
  }

  /* 人工卡：累计人天和差异放在标题行，第一眼看到进度偏差 */
  #laborView .labor-mobile-card {
    position: relative;
  }

  #laborView .labor-mobile-badges {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    max-width: 58%;
  }

  #laborView .labor-days-pill,
  #laborView .labor-diff-flag {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
  }

  #laborView .labor-days-pill {
    background: #eef5fb;
    color: var(--accent-strong);
  }

  #laborView .labor-diff-flag {
    background: #eef2f7;
    color: var(--muted);
  }

  #laborView .labor-diff-flag.danger-text {
    background: #fdecea;
    color: var(--red);
  }

  #laborView .labor-diff-flag.blue-text {
    background: #e8f0ff;
    color: var(--blue);
  }

  /* 人工页顶部汇总（年度工时/已录入/Excel 提示）移动端不展示 */
  #laborView .labor-summary {
    display: none;
  }

  /* 卡片右侧箭头改到右上角，避免压住指标小格 */
  #projectsTable .mobile-card-action::after,
  #contractsTable .mobile-card-action::after,
  #budgetsTable .mobile-card-action::after {
    top: 14px;
    transform: none;
  }

  /* 人工页：移动端不需要卡头（标题+导出），与其他列表页一致 */
  #laborView .panel > .panel-header {
    display: none;
  }

  /* 项目/合同/预算卡头部压缩：标题 + 编号同一行，meta 紧随其后 */
  #projectsTable tr td:first-child,
  #contractsTable tr td:first-child,
  #budgetsTable tr td:nth-child(2) {
    display: flex !important;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 6px;
    row-gap: 2px;
    padding-right: 0;
  }

  #projectsTable td:first-child .mobile-card-title,
  #contractsTable td:first-child .mobile-card-title,
  #budgetsTable td:nth-child(2) .mobile-card-title {
    order: 1;
    display: inline-block;
    width: auto;
    max-width: calc(100% - 30px);
    font-size: 14px;
    line-height: 1.25;
  }

  #contractsTable td.contract-no > .linklike:not(.mobile-card-action) {
    display: none !important;
  }

  #contractsTable td.contract-no .mobile-contract-titleline {
    order: 1;
    display: flex;
    max-width: calc(100% - 30px);
  }

  #projectsTable td:first-child > .linklike,
  #contractsTable td:first-child > .linklike,
  #budgetsTable td:nth-child(2) > .linklike {
    order: 2;
    max-width: calc(100% - 30px);
    padding: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
    text-decoration: none;
  }

  #projectsTable td:first-child .mobile-card-meta,
  #contractsTable td:first-child .mobile-card-meta,
  #budgetsTable td:nth-child(2) .mobile-card-meta {
    order: 3;
    flex-basis: 100%;
    margin-top: 0;
  }

  #projectsTable td:first-child .project-mobile-metrics,
  #contractsTable td:first-child .contract-mobile-metrics,
  #budgetsTable td:nth-child(2) .budget-mobile-metrics {
    order: 4;
    flex-basis: 100%;
    width: 100%;
    gap: 4px;
  }

  #projectsTable .project-mobile-metrics i,
  #contractsTable .contract-mobile-metrics i,
  #budgetsTable .budget-mobile-metrics i {
    padding: 5px 6px;
  }

  #contractsTable td.contract-no .mobile-contract-titleline {
    align-items: baseline;
    gap: 5px;
  }

  #contractsTable td.contract-no .mobile-contract-titleline .mobile-card-title {
    order: 1;
  }

  #contractsTable td.contract-no .mobile-contract-no {
    order: 2;
    color: var(--muted);
    font-size: 9.6px;
    font-weight: 700;
  }

  #laborView .labor-mobile-card {
    gap: 3px;
    padding-top: 8px;
  }

  #laborView .labor-mobile-head {
    align-items: center;
    gap: 6px;
  }

  #laborView .labor-mobile-meta {
    line-height: 1.08;
  }

  #laborView .labor-mobile-stats {
    margin-top: 2px;
  }
}

.assistant-widget {
  position: fixed;
  right: 20px;
  bottom: 96px;
  z-index: 80;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.assistant-avatar,
.assistant-panel {
  pointer-events: auto;
}

.assistant-avatar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 50%;
  background: #ffffff;
  color: #0f2f4f;
  box-shadow:
    0 0 0 5px rgba(45, 212, 191, 0.08),
    0 0 24px rgba(34, 211, 238, 0.18),
    0 12px 30px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(10px);
  touch-action: none;
}

.assistant-avatar::before {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: -1;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.28), rgba(37, 99, 235, 0.18));
  opacity: 0.58;
  filter: blur(8px);
}

.assistant-avatar::after {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: -2;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(45, 212, 191, 0.18), rgba(34, 211, 238, 0.08) 42%, transparent 68%);
  opacity: 0.72;
  filter: blur(3px);
}

.avatar-core {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.55), transparent 25%),
    linear-gradient(135deg, #0f766e, #1d4ed8);
  color: #fff;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.32),
    0 8px 18px rgba(37, 99, 235, 0.22);
}

.avatar-core b {
  position: relative;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.assistant-avatar strong {
  display: none;
  font-size: 12px;
  white-space: nowrap;
}

.assistant-panel {
  display: none;
  order: 1;
  width: min(560px, calc(100vw - 96px));
  height: min(700px, calc(100vh - 58px));
  overflow: hidden;
  border: 1px solid rgba(184, 198, 214, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.assistant-widget.open .assistant-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.assistant-widget.open {
  right: 18px;
  bottom: 20px;
}

.assistant-widget.open .assistant-avatar {
  order: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px 14px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(248, 255, 253, 0.96), rgba(238, 246, 255, 0.96)),
    linear-gradient(90deg, rgba(15, 118, 110, 0.12), rgba(37, 99, 235, 0.12));
}

.assistant-head b,
.assistant-head span {
  display: block;
}

.assistant-head b {
  font-size: 17px;
}

.assistant-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.assistant-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.assistant-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.assistant-expand {
  display: none;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  font-weight: 800;
  font-size: 17px;
  line-height: 1;
}

.assistant-suggestions {
  display: flex;
  gap: 8px;
  padding: 11px 14px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.assistant-suggestions button {
  flex: 0 0 auto;
  max-width: 220px;
  padding: 7px 10px;
  border: 1px solid #c8d6e5;
  border-radius: 999px;
  background: #f8fbff;
  color: #31516d;
  font-size: 12px;
  white-space: nowrap;
}

.assistant-messages {
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  background:
    linear-gradient(180deg, rgba(248, 251, 255, 0.76), rgba(255, 255, 255, 0.98));
}

.assistant-message {
  width: fit-content;
  max-width: 88%;
  margin-bottom: 10px;
  padding: 11px 13px;
  border-radius: 8px;
  line-height: 1.55;
  font-size: 14px;
}

.assistant-message p {
  margin: 0;
}

.assistant-message ul,
.assistant-message ol {
  margin: 0;
  padding-left: 17px;
}

.assistant-message li + li {
  margin-top: 4px;
}

.assistant-message strong {
  font-weight: 850;
}

.assistant-message code {
  padding: 1px 4px;
  border-radius: 5px;
  background: #eef4fa;
  color: #0f4f6d;
  font-size: 0.92em;
}

.assistant-thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.thinking-dots {
  display: inline-flex;
  gap: 4px;
}

.thinking-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: assistantDotPulse 1.05s infinite ease-in-out;
}

.thinking-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes assistantDotPulse {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.32;
  }
  40% {
    transform: translateY(-3px);
    opacity: 0.9;
  }
}

.assistant-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.assistant-table {
  width: 100%;
  min-width: 360px;
  border-collapse: collapse;
  font-size: 12.5px;
  line-height: 1.35;
}

.assistant-table th,
.assistant-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.assistant-table th {
  color: #31516d;
  font-weight: 800;
  background: #f6f9fc;
}

.assistant-table tr:last-child td {
  border-bottom: 0;
}

.assistant-table-cards {
  display: none;
}

.assistant-table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  overflow: hidden;
}

.assistant-table-card + .assistant-table-card {
  margin-top: 8px;
}

.assistant-card-field {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid #e8eef6;
  align-items: start;
}

.assistant-card-field:last-child {
  border-bottom: 0;
}

.assistant-card-field span {
  color: var(--muted);
  font-size: 12px;
}

.assistant-card-field b {
  min-width: 0;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.assistant-message.bot {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.assistant-message.user {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
}

.assistant-review {
  order: 1;
  width: min(390px, calc(100vw - 92px));
  max-height: min(72vh, 520px);
  overflow: auto;
  padding: 14px 14px 13px;
  border: 1px solid rgba(245, 158, 11, 0.32);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(255, 251, 235, 0.96));
  color: #26384d;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

.assistant-review.blocking {
  border-color: rgba(248, 113, 113, 0.32);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(255, 250, 250, 0.98));
  color: #344256;
}

.assistant-review.toast {
  width: min(300px, calc(100vw - 92px));
  padding: 12px 14px;
  border-color: rgba(20, 184, 166, 0.24);
  background: rgba(255, 255, 255, 0.99);
}

.assistant-review-title {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.assistant-review-title b {
  color: #18283b;
  font-size: 15px;
  line-height: 1.25;
}

.assistant-review-title span {
  color: #64748b;
  font-size: 12px;
  line-height: 1.35;
}

.assistant-review ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.assistant-review-item {
  display: grid;
  gap: 4px;
  padding: 10px 11px 10px 12px;
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-left: 3px solid rgba(245, 158, 11, 0.76);
  border-radius: 8px;
  background: rgba(255, 252, 241, 0.82);
}

.assistant-review-item.blocking {
  border-color: rgba(254, 226, 226, 0.95);
  border-left-color: rgba(239, 68, 68, 0.72);
  background: rgba(255, 247, 247, 0.88);
}

.assistant-review-item b {
  color: #1f2937;
  font-size: 13px;
}

.assistant-review-item span {
  color: #475569;
  font-size: 12.5px;
  line-height: 1.45;
}

.assistant-review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.assistant-review-actions .primary-btn {
  min-width: 148px;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.16);
}

.assistant-widget.reviewing:not(.open) {
  right: 18px;
  bottom: 28px;
}

.assistant-widget.reviewing:not(.open) .assistant-avatar {
  order: 2;
  width: 44px;
  height: 44px;
}

.assistant-widget.reviewing:not(.open) .assistant-panel {
  display: none;
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.assistant-form textarea {
  height: 46px;
  min-height: 46px;
  max-height: 110px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 11px;
  outline: none;
  line-height: 44px;
  white-space: nowrap;
  overflow-x: hidden;
}

.assistant-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.assistant-form button {
  align-self: end;
  min-width: 74px;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.assistant-form button:disabled {
  cursor: wait;
  background: #94a3b8;
}

@media (max-width: 720px) {
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .assistant-widget {
    right: -36px;
    bottom: 92px;
    transition: right 0.2s ease, bottom 0.2s ease;
  }

  .assistant-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    box-shadow:
      0 0 0 4px rgba(45, 212, 191, 0.08),
      0 0 20px rgba(34, 211, 238, 0.16),
      0 10px 26px rgba(15, 23, 42, 0.2);
  }

  .avatar-core {
    width: 35px;
    height: 35px;
  }

  .assistant-avatar strong {
    display: none;
  }

  .assistant-widget.peek {
    right: 12px;
  }

  .assistant-widget.reviewing:not(.open) {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    gap: 8px;
    align-items: flex-end;
  }

  .assistant-widget.reviewing:not(.open) .assistant-avatar {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
  }

  .assistant-widget.reviewing:not(.open) .assistant-review {
    width: auto;
    flex: 1 1 auto;
    max-height: 54dvh;
    padding: 12px;
    border-radius: 12px;
  }

  .assistant-widget.reviewing:not(.open) .assistant-review-actions {
    justify-content: stretch;
  }

  .assistant-widget.reviewing:not(.open) .assistant-review-actions button {
    flex: 1;
  }

  .assistant-widget.open {
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    position: fixed;
    top: 0;
    min-height: 100dvh;
    background: rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(2px);
  }

  .assistant-widget.open .assistant-avatar {
    display: none;
  }

  .assistant-panel {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: max(18px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: auto;
    min-width: 0;
    width: min(88vw, 390px);
    height: min(62dvh, 520px);
    border: 1px solid rgba(184, 198, 214, 0.92);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 30px 90px rgba(15, 23, 42, 0.36);
    backdrop-filter: blur(14px);
  }

  .assistant-expand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-color: rgba(15, 118, 110, 0.22);
    background: rgba(255, 255, 255, 0.74);
    color: #0f766e;
  }

  .assistant-widget.expanded.open .assistant-panel {
    width: calc(100vw - 22px);
    height: calc(100dvh - 34px - env(safe-area-inset-bottom));
    bottom: max(12px, env(safe-area-inset-bottom));
    border-radius: 18px;
  }

  .assistant-widget.expanded.open .assistant-message {
    max-width: 96%;
  }

  .assistant-panel .assistant-head {
    border-bottom: 1px solid rgba(244, 114, 182, 0.26);
    background:
      radial-gradient(circle at 18% 8%, rgba(244, 114, 182, 0.22), transparent 28%),
      linear-gradient(135deg, #effef8, #fdf2f8 62%, #ecfeff);
    color: #12324a;
  }

  .assistant-panel .assistant-head span {
    color: #5e7188;
  }

  .assistant-panel .assistant-close {
    border-color: rgba(244, 114, 182, 0.28);
    background: rgba(255, 255, 255, 0.72);
    color: #0f766e;
  }

  .assistant-panel .assistant-suggestions {
    border-bottom-color: #d7e2ee;
    background:
      linear-gradient(90deg, rgba(236, 253, 245, 0.86), rgba(253, 242, 248, 0.78));
  }

  .assistant-head {
    padding: 14px 16px 12px;
  }

  .assistant-head b {
    font-size: 16px;
  }

  .assistant-suggestions {
    padding: 9px 12px;
  }

  .assistant-suggestions button {
    max-width: 76vw;
    padding: 8px 10px;
    font-size: 12px;
  }

  .assistant-messages {
    padding: 12px;
  }

  .assistant-message {
    max-width: 94%;
    font-size: 13px;
  }

  .assistant-table {
    display: none;
  }

  .assistant-table-cards {
    display: block;
  }

  .assistant-table-wrap {
    overflow-x: visible;
  }

  .assistant-form {
    grid-template-columns: minmax(0, 1fr) 62px;
    gap: 8px;
    padding: 10px 12px 12px;
  }

  .assistant-form textarea {
    height: 44px;
    min-height: 44px;
    max-height: 88px;
    border-radius: 10px;
    font-size: 16px;
    line-height: 42px;
  }

  .assistant-form button {
    min-width: 62px;
    height: 44px;
    border-radius: 10px;
  }
}
