.settlement-page-body { overflow: hidden; }
.settlement-ledger-panel { position: relative; }
.settlement-toolbar { flex-wrap: wrap; }
.sa-field {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(0,0,0,0.55);
  font-size: 12px;
  white-space: nowrap;
}
#tabHost .sa-field select { width: 220px; }
#tabHost .sa-field #saYearSelect { width: 104px; }
.sa-version-control {
  height: var(--control-height);
  display: inline-flex;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid var(--control-border);
  border-radius: 4px;
  background: #fff;
}
.sa-version-control button {
  min-width: 76px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--control-border);
  color: rgba(0,0,0,0.55);
  background: #fff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.sa-version-control button:last-child { border-right: 0; }
.sa-version-control button:hover { color: var(--primary); background: var(--brand-green-lighter); }
.sa-version-control button[aria-pressed="true"] { color: #fff; background: var(--primary); }
.sa-notice {
  min-height: 36px;
  padding: 7px 12px;
  flex: 0 0 auto;
  border: 1px solid #d9edf7;
  border-radius: 4px;
  color: #095a7a;
  background: #f0f9ff;
  font-size: 12px;
  line-height: 20px;
}
.sa-notice.is-success { color: #237804; border-color: #b7eb8f; background: #f6ffed; }
.sa-notice.is-error { color: #cf1322; border-color: #ffa39e; background: #fff1f0; }
.sa-notice[hidden] { display: none; }
.settlement-table { min-width: 1180px; }
.settlement-table th:nth-child(1) { width: 92px; }
.settlement-table th:nth-child(2),
.settlement-table th:nth-child(3),
.settlement-table th:nth-child(4) { width: 114px; }
.settlement-table th:nth-child(5),
.settlement-table th:nth-child(6) { width: 138px; }
.settlement-table th:nth-child(7) { width: 154px; }
.settlement-table th:last-child { width: 205px; }
.settlement-table .is-numeric { text-align: right; font-variant-numeric: tabular-nums; }
.sa-month-button {
  padding: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  border: 0;
  color: rgba(0,0,0,0.85);
  background: transparent;
  cursor: pointer;
}
.sa-month-button strong { font-size: 13px; line-height: 20px; }
.sa-month-button small { color: rgba(0,0,0,0.38); font-size: 10px; line-height: 16px; }
.sa-month-button:not(:disabled):hover strong { color: var(--primary); }
.sa-month-button:disabled { cursor: default; }
.sa-status-button { font-family: inherit; cursor: pointer; }
.sa-status-button:hover { box-shadow: 0 0 0 2px rgba(30,172,166,0.10); }
.sa-time { color: rgba(0,0,0,0.45) !important; font-size: 12px !important; white-space: nowrap; }
.sa-money { color: rgba(0,0,0,0.85) !important; font-weight: 600; }
.sa-row-actions { min-width: 188px; flex-wrap: nowrap; }
.sa-row-actions .btn-sm { height: 28px; padding: 0 9px; }
.sa-icon-button {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
  border: 1px solid var(--control-border);
  border-radius: 4px;
  color: rgba(0,0,0,0.55);
  background: #fff;
  cursor: pointer;
}
.sa-icon-button:hover { color: var(--primary); border-color: var(--primary-light-5); background: var(--brand-green-lighter); }
.sa-icon-button .shell-icon { width: 14px; height: 14px; }
.sa-close-symbol { font-size: 20px; font-weight: 300; line-height: 1; }
.sa-skeleton-row span {
  width: 70%;
  height: 12px;
  display: block;
  border-radius: 3px;
  background: #f0f0f0;
  animation: saPulse 1.25s ease-in-out infinite;
}
@keyframes saPulse { 50% { opacity: 0.42; } }

.sa-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 10020;
  padding: 24px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.46);
}
.sa-modal-mask.is-open { display: flex; }
.sa-preview-dialog {
  width: min(1380px, 96vw);
  height: min(920px, 94vh);
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(0,0,0,0.28);
}
.sa-preview-header {
  min-height: 64px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
}
.sa-preview-heading { min-width: 190px; flex: 1; display: flex; flex-direction: column; }
.sa-preview-heading strong { color: rgba(0,0,0,0.85); font-size: 14px; line-height: 22px; }
.sa-preview-heading span { overflow: hidden; color: rgba(0,0,0,0.45); font-size: 11px; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.sa-preview-header > select { width: 190px; flex: 0 0 190px; }
.sa-preview-actions { min-width: 0; display: flex; align-items: center; gap: 8px; }
.sa-preview-body {
  min-width: 0;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  overflow: auto;
  padding: 24px;
  background: #e9edf2;
}
.sa-preview-loading,
.sa-preview-error {
  align-items: center;
  justify-content: center;
  color: rgba(0,0,0,0.45);
  font-size: 13px;
}
.sa-preview-error { gap: 12px; }
.sa-a4-page {
  width: 210mm;
  min-width: 760px;
  min-height: 297mm;
  margin: 0 auto;
  padding: 15mm 14mm 12mm;
  flex: 0 0 auto;
  color: #1f2933;
  background: #fff;
  box-shadow: 0 3px 16px rgba(22,36,48,0.18);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}
.sa-document-brand { color: #167d78; font-size: 10px; font-weight: 700; line-height: 18px; }
.sa-a4-page > h1 { margin: 8px 0 6px; color: #12262f; font-size: 23px; font-weight: 600; line-height: 34px; text-align: center; }
.sa-document-meta {
  padding-bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 2px solid #167d78;
  color: #63727a;
  font-size: 11px;
  line-height: 20px;
}
.sa-document-facts {
  margin: 14px 0 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid #d9e0e4;
  border-left: 1px solid #d9e0e4;
}
.sa-document-facts div { min-width: 0; display: grid; grid-template-columns: 105px minmax(0,1fr); border-right: 1px solid #d9e0e4; border-bottom: 1px solid #d9e0e4; }
.sa-document-facts dt,
.sa-document-facts dd { min-width: 0; margin: 0; padding: 7px 9px; font-size: 11px; line-height: 18px; }
.sa-document-facts dt { color: #52626a; background: #f4f7f7; }
.sa-document-facts dd { overflow-wrap: anywhere; color: #17242b; }
.sa-document-section { margin-top: 16px; break-inside: avoid; }
.sa-document-section h2 {
  margin: 0;
  padding: 6px 9px;
  border-left: 3px solid #167d78;
  color: #19373a;
  background: #eef7f6;
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
}
.sa-document-section table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 10px; }
.sa-document-section th,
.sa-document-section td { padding: 6px 7px; border: 1px solid #dce3e6; line-height: 17px; overflow-wrap: anywhere; }
.sa-document-section th { width: 38%; color: #53636b; background: #f7f9fa; font-weight: 500; text-align: left; }
.sa-document-section td { color: #18262d; }
.sa-document-section td.is-numeric { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sa-document-empty { padding: 32px; color: #7c8a91; border: 1px dashed #cbd5da; text-align: center; font-size: 11px; }
.sa-point-scroll { max-width: 100%; overflow-x: auto; }
.sa-point-section table { min-width: 680px; table-layout: auto; }
.sa-point-section thead th { width: auto; white-space: nowrap; }
.sa-point-section td { white-space: nowrap; }
.sa-point-section .sa-point-index { text-align: center; color: #53636b; background: #f7f9fa; }
.sa-document-footer {
  margin-top: 24px;
  padding-top: 8px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #dce3e6;
  color: #78868d;
  font-size: 9px;
  line-height: 16px;
}
.sa-revision-panel {
  width: 280px;
  max-height: 100%;
  flex: 0 0 280px;
  overflow: auto;
  border: 1px solid #dfe5e8;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 3px 16px rgba(22,36,48,0.12);
}
.sa-revision-panel[hidden] { display: none; }
.sa-revision-heading { min-height: 48px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf0f2; font-size: 13px; }
.sa-revision-panel ol { margin: 0; padding: 6px 0; list-style: none; }
.sa-revision-panel li { padding: 10px 12px; display: grid; gap: 2px; border-bottom: 1px solid #f0f2f3; }
.sa-revision-panel li strong { color: #24343b; font-size: 12px; }
.sa-revision-panel li span { color: #738087; font-size: 10px; }
.sa-revision-panel code { color: #167d78; font-size: 10px; }
.sa-revision-loading,
.sa-revision-empty { padding: 24px 12px; color: #7a878d; font-size: 11px; text-align: center; }
.sa-revision-empty.is-error { color: #cf1322; }

@media (max-width: 900px) {
  .settlement-page .biz-page-actions { width: 100%; }
  .settlement-page .biz-page-actions .btn-sm { flex: 1; justify-content: center; }
  .settlement-toolbar { align-items: flex-end; }
  .sa-field { flex: 1 1 180px; flex-direction: column; align-items: flex-start; gap: 3px; }
  #tabHost .sa-field select,
  #tabHost .sa-field #saYearSelect { width: 100%; }
  .sa-version-control { width: 100%; order: 3; }
  .sa-version-control button { min-width: 0; flex: 1; padding: 0 6px; }
  .sa-modal-mask { padding: 0; }
  .sa-preview-dialog { width: 100vw; height: 100dvh; border-radius: 0; }
  .sa-preview-header { align-items: flex-start; flex-wrap: wrap; }
  .sa-preview-heading { width: calc(100% - 40px); flex: 1 1 auto; }
  .sa-preview-header > select { width: 100%; flex: 1 1 100%; order: 3; }
  .sa-preview-actions { width: 100%; overflow-x: auto; order: 2; }
  .sa-preview-actions .btn-sm { white-space: nowrap; }
  .sa-preview-actions .sa-icon-button { margin-left: auto; }
  .sa-preview-body { padding: 12px; }
  .sa-revision-panel { position: absolute; inset: 108px 12px 12px auto; z-index: 2; width: min(300px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
  .sa-skeleton-row span { animation: none; }
}

@media print {
  .sa-preview-header, .sa-revision-panel { display: none !important; }
  .sa-preview-body { padding: 0; background: #fff; overflow: visible; }
  .sa-a4-page { width: 210mm; min-width: 0; min-height: 297mm; box-shadow: none; }
}
