﻿/* T-0161 应付与费用：应付明细、付款单、费用报销单（员工测试账套）
   尺寸与配色按《管理系统界面标准与整改要求 v1.0》第三章 token。 */

.p161-page,
.p161-page * { box-sizing: border-box; }

.p161-page {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  font-size: var(--fs-body);
  line-height: var(--lh);
}

/* ---------- 查询区：四列铺满 ---------- */
.p161-query {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-8) var(--sp-16);
  padding: var(--sp-12) var(--sp-16);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-query label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
  font-size: var(--fs-body);
  color: var(--text-2);
}

.p161-query input,
.p161-query select {
  width: 100%;
  height: 30px;
  padding: 0 var(--sp-8);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- 工具条：右对齐 ---------- */
.p161-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-8);
}

.p161-toolbar button,
.p161-doc-foot button,
.p161-ops button,
.p161-pager button {
  height: 30px;
  padding: 0 var(--sp-12);
  
  color: var(--brand-strong);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.p161-toolbar button.primary,
.p161-doc-foot button.primary,
.p161-ops button.primary {
  color: var(--on-action);
  background: var(--action-fill);
  border-color: var(--brand);
}

.p161-toolbar button:hover,
.p161-doc-foot button:hover,
.p161-ops button:hover,
.p161-pager button:hover { border-color: var(--brand); }

/* ---------- 分组条 / 表格 ---------- */
.p161-group-bar {
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-body);
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-table {
  max-height: calc(100vh - 500px);
  min-height: 150px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: var(--fs-body);
}

.p161-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 34px;
  padding: 0 var(--sp-8);
  font-weight: 700;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  background: var(--brand-soft);
  border-bottom: 1px solid var(--line);
}

.p161-grid th.num,
.p161-grid td.num { text-align: right; font-variant-numeric: tabular-nums; }

.p161-grid tbody td {
  height: 32px;
  padding: 0 var(--sp-8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.p161-grid tbody tr:nth-child(even) { background: var(--bg); }
.p161-grid tbody tr:hover { background: var(--bg); }

.p161-grid .p161-num { font-variant-numeric: tabular-nums; }

.p161-sort { cursor: pointer; user-select: none; }
.p161-sort:hover { background: var(--brand-soft); }

/* 列宽（合计 100%，1366 下不产生横向滚动） */
.p161-grid-ap th:nth-child(1) { width: 18%; }
.p161-grid-ap th:nth-child(2) { width: 11%; }
.p161-grid-ap th:nth-child(3) { width: 25%; }
.p161-grid-ap th:nth-child(4) { width: 12%; }
.p161-grid-ap th:nth-child(5) { width: 12%; }
.p161-grid-ap th:nth-child(6) { width: 12%; }
.p161-grid-ap th:nth-child(7) { width: 10%; }

.p161-grid-pay th:nth-child(1) { width: 15%; }
.p161-grid-pay th:nth-child(2) { width: 10%; }
.p161-grid-pay th:nth-child(3) { width: 12%; }
.p161-grid-pay th:nth-child(4) { width: 9%; }
.p161-grid-pay th:nth-child(5) { width: 6%; }
.p161-grid-pay th:nth-child(6) { width: 7%; }
.p161-grid-pay th:nth-child(7) { width: 8%; }
.p161-grid-pay th:nth-child(8) { width: 19%; }
.p161-grid-pay th:nth-child(9) { width: 14%; }

.p161-grid-exp th:nth-child(1) { width: 15%; }
.p161-grid-exp th:nth-child(2) { width: 10%; }
.p161-grid-exp th:nth-child(3) { width: 8%; }
.p161-grid-exp th:nth-child(4) { width: 8%; }
.p161-grid-exp th:nth-child(5) { width: 13%; }
.p161-grid-exp th:nth-child(6) { width: 10%; }
.p161-grid-exp th:nth-child(7) { width: 8%; }
.p161-grid-exp th:nth-child(8) { width: 8%; }
.p161-grid-exp th:nth-child(9) { width: 11%; }
.p161-grid-exp th:nth-child(10) { width: 13%; }

.p161-grid .p161-ops {
  overflow: visible;
  white-space: nowrap;
}

.p161-grid .p161-ops button {
  height: 24px;
  padding: 0 var(--sp-4);
  margin-right: var(--sp-4);
  
}

.p161-ops button:last-child { margin-right: 0; }

/* ---------- 汇总行 ---------- */
.p161-foot { min-height: 0; }

.p161-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-4) var(--sp-24);
  padding: var(--sp-8) var(--sp-16);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--th-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-summary b { font-weight: 700; }
.p161-summary .p161-book { margin-left: auto; color: var(--text); }
.p161-summary em { margin-left: var(--sp-4); font-style: normal; }
.p161-ok { color: var(--text-2); }
.p161-bad { color: var(--danger-text); }

/* ---------- 分页 ---------- */
.p161-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-8);
  font-size: var(--fs-body);
  color: var(--text-2);
}

.p161-pager-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: var(--sp-4); min-width: 0; }
.p161-pager button { height: 28px; padding: 0 var(--sp-8);  }
.p161-goto, .p161-size { display: flex; align-items: center; gap: var(--sp-4); }

.p161-goto input,
.p161-size select {
  width: 56px;
  height: 28px;
  padding: 0 var(--sp-4);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-size select { width: 70px; }

/* ---------- 空数据 / 提示 ---------- */
.p161-empty {
  margin: 0;
  padding: var(--sp-32) 0;
  font-size: var(--fs-sm);
  color: var(--text-2);
  text-align: center;
}

.p161-msg {
  min-height: 18px;
  margin: 0;
  font-size: var(--fs-body);
  color: var(--danger-text);
}

/* ---------- 状态标记 ---------- */
.p161-badge {
  display: inline-block;
  padding: 0 var(--sp-8);
  font-size: var(--fs-sm);
  line-height: var(--lh);
  border-radius: var(--radius);
}

.p161-draft { color: var(--warn-text); background: var(--warn-soft); }
.p161-posted { color: var(--text-2); background: var(--brand-soft); }
.p161-reversed { color: var(--danger-text); background: var(--danger-soft); }
.p161-void { color: var(--text); background: var(--th-bg); }

/* ---------- 单据弹层 ---------- */
.p161-dialog {
  width: 90%;
  max-width: 1120px;
  height: 82vh;
  max-height: 82vh;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-dialog::backdrop { background: var(--scrim); }

.p161-doc {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin: 0;
  padding: 0;
}

.p161-doc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-8) var(--sp-16);
  border-bottom: 1px solid var(--line);
}

.p161-doc-head h2 { margin: 0; font-size: var(--fs-section); font-weight: 700; color: var(--text); }

.p161-doc-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-16);
  padding: var(--sp-8) var(--sp-16);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.p161-doc-bar em { margin-right: var(--sp-4); font-style: normal; color: var(--text-2); }

.p161-doc-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-8) var(--sp-16);
  padding: var(--sp-12) var(--sp-16);
}

.p161-doc-fields label,
.p161-form-wide label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-width: 0;
  font-size: var(--fs-body);
  color: var(--text-2);
}

.p161-doc-fields input,
.p161-doc-fields select,
.p161-form-wide input,
.p161-form-wide textarea,
.p161-grid-lines input.p161-amount {
  width: 100%;
  height: 30px;
  padding: 0 var(--sp-8);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-doc-fields input[readonly] { background: var(--bg); }

.p161-form-wide { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-8) var(--sp-16); padding: var(--sp-12) var(--sp-16); }
.p161-form-wide textarea { height: 52px; padding: var(--sp-4) var(--sp-8); resize: vertical; }

.p161-lines-head {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  padding: 0 var(--sp-16) var(--sp-8);
  font-size: var(--fs-body);
  color: var(--text);
}

.p161-lines-head button {
  height: 26px;
  padding: 0 var(--sp-8);
  
  color: var(--brand-strong);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.p161-lines-head span { margin-left: auto; font-size: var(--fs-body); color: var(--text-2); }

.p161-lines {
  flex: 1;
  min-height: 0;
  margin: 0 var(--sp-16);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.p161-grid-lines th:nth-child(1) { width: 7%; }
.p161-grid-lines th:nth-child(2) { width: 22%; }
.p161-grid-lines th:nth-child(3) { width: 12%; }
.p161-grid-lines th:nth-child(4) { width: 15%; }
.p161-grid-lines th:nth-child(5) { width: 14%; }
.p161-grid-lines th:nth-child(6) { width: 14%; }
.p161-grid-lines th:nth-child(7) { width: 16%; }

.p161-grid-lines td { height: 34px; }
.p161-grid-lines input.p161-amount { height: 26px; text-align: right; }
.p161-grid-lines .p161-check { text-align: center; }
.p161-grid-lines input[type="checkbox"] { width: 16px; height: 16px; }

.p161-doc-summary {
  max-height: 150px;
  padding: var(--sp-8) var(--sp-16) 0;
  overflow: auto;
}

.p161-journal-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-4) var(--sp-16);
  padding: var(--sp-4) var(--sp-8);
  font-size: var(--fs-body);
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom: none;
}

.p161-grid-journal th:nth-child(1) { width: 60%; }
.p161-grid-journal th:nth-child(2) { width: 20%; }
.p161-grid-journal th:nth-child(3) { width: 20%; }

/* T-0161 底部按钮固定可见（内容短时也贴底） */.p161-doc-foot {
  display: flex;
  margin-top: auto;
  justify-content: flex-end;
  gap: var(--sp-8);
  padding: var(--sp-8) var(--sp-16);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.p161-doc .p161-msg { padding: 0 var(--sp-16); }

/* ---------- 打印页（只补列表打印所需，其余复用 delivery-print.css） ---------- */

@media (max-width: 1200px) {
  .p161-query, .p161-doc-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}



/* T-0161 金额输入右对齐 */
.p161-grid-lines input.p161-amount,
.p161-doc-fields #p161-pay-total { text-align: right; }


/* T-0161 报销单无明细表时去掉空框 */
.p161-lines-plain { flex: 0 0 auto; border: none; overflow: visible; }






