/* Shared business UI tokens. Scoped components retain all original API/actions. */
:root{--workbench-brand:#2563eb;--workbench-ink:#17243b;--workbench-muted:#65748b;--workbench-line:#e3e9f2;--workbench-surface:#fff;--workbench-bg:#f3f6fb;--workbench-radius:14px;--workbench-shadow:0 4px 18px #1935580a}
body{background:var(--workbench-bg);color:var(--workbench-ink);font-family:Inter,"PingFang SC","Microsoft YaHei",system-ui,sans-serif}
.card{border:1px solid var(--workbench-line);border-radius:var(--workbench-radius);box-shadow:var(--workbench-shadow)}
.btn,button,input,select,textarea{font:inherit}.btn,button{border-radius:9px}.btn:focus-visible,button:focus-visible,a:focus-visible,summary:focus-visible{outline:3px solid #93b9ff;outline-offset:3px}
input:focus,select:focus,textarea:focus{outline:2px solid #bfdbfe;outline-offset:1px}table th{color:#52627b;background:#f5f8fd}table td{vertical-align:top}
.muted{color:var(--workbench-muted)}[hidden]{display:none!important}
.permission-filter{display:flex;align-items:end;gap:12px;flex-wrap:wrap;padding:14px;border:1px solid var(--workbench-line);border-radius:12px;background:#f8faff;margin:12px 0}
.permission-filter label{display:grid;gap:5px;font-size:12px;font-weight:600}.permission-filter input,.permission-filter select{padding:9px 11px;border:1px solid #d8e2ef;border-radius:8px;background:#fff;color:var(--workbench-ink);min-height:38px}.permission-filter input{min-width:220px}.perm-table{background:#fff;border-radius:10px;overflow:hidden}.permission-filter .muted{font-size:12px;flex:1;min-width:200px}
.perm-table input[type=checkbox]{width:18px;height:18px;accent-color:var(--workbench-brand);cursor:pointer}.perm-group{background:#edf3fd;font-weight:650}.perm-table th:first-child{min-width:210px}
.audit-document{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.audit-document>div{padding:11px;background:#f5f8fd;border-radius:9px}.audit-document dt{font-size:12px;color:var(--workbench-muted)}.audit-document dd{margin:5px 0 0;white-space:pre-wrap;overflow-wrap:anywhere}
.audit-link{color:var(--workbench-brand);background:none;border:0;padding:4px;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.project-filter{min-width:180px}.project-filter summary{list-style:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 13px;background:#fff;border:1px solid #d7e2f1;border-radius:11px;cursor:pointer;font-size:14px;color:#243b61}.project-filter summary::-webkit-details-marker{display:none}.project-filter summary:after{content:'⌄';color:#6982a5}.project-filter[open] summary{border-color:var(--workbench-brand)}
.project-panel{position:absolute;z-index:150;background:#fff;border:1px solid var(--workbench-line);border-radius:15px;padding:16px;min-width:290px;max-width:90vw;box-shadow:0 14px 45px #18395b26;margin-top:8px}
.project-heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.project-heading strong{font-size:17px}.project-heading button{background:#edf2f8;border:0;width:34px;height:34px;color:#52647e}
.project-search{display:block;width:100%;box-sizing:border-box;border:1px solid #dce5f0;padding:10px 12px;border-radius:9px;margin:10px 0}.project-tools{display:flex;gap:10px;padding:4px 0 10px}.project-tools button{background:#eef4ff;color:#245ac0;border:0;padding:8px 13px;font-size:13px}.project-options{max-height:270px;overflow:auto;overscroll-behavior:contain}.project-options label{display:flex;align-items:center;gap:10px;min-height:44px;padding:3px 9px;border-radius:8px;cursor:pointer;overflow-wrap:anywhere}.project-options label:has(input:checked){background:#eef4ff;color:#1d4fb8}.project-options input{width:18px;height:18px;accent-color:var(--workbench-brand);flex:none}
.project-footer{display:flex;justify-content:flex-end;gap:10px;border-top:1px solid var(--workbench-line);padding-top:12px;margin-top:10px}.project-footer button{padding:10px 16px;border:1px solid #d7e2f1;background:#fff;color:#3a4f71}.project-footer .primary{background:var(--workbench-brand);color:#fff;border-color:var(--workbench-brand)}.project-backdrop{display:none}
.source-evidence{padding:10px 12px;background:#f6f9fd;border-radius:10px;margin:10px 0;font-size:13px}.source-evidence summary{cursor:pointer;font-weight:600}.source-evidence li{margin:9px 0;overflow-wrap:anywhere}
@media(max-width:640px){.btn,button{min-height:40px}input:not([type=checkbox]):not([type=radio]),select{min-height:42px}.card{margin-bottom:12px}.permission-filter{display:grid;grid-template-columns:1fr}.permission-filter input{min-width:0;width:100%;box-sizing:border-box}.permission-filter .muted{min-width:0}.audit-document{grid-template-columns:1fr}.project-filter{width:100%;position:static}.project-filter summary{min-height:28px}.project-filter[open] .project-backdrop{display:block;position:fixed;inset:0;z-index:3500;background:#10243e66;border:0;border-radius:0;width:100%;height:100%;min-height:0}.project-panel{position:fixed;z-index:3501;bottom:0;left:0;right:0;margin:0;border-radius:22px 22px 0 0;min-width:0;max-width:none;box-sizing:border-box;max-height:85dvh;overflow:auto;padding:19px 18px max(18px,env(safe-area-inset-bottom))}.project-options{max-height:42dvh}.project-options label{min-height:46px}.project-heading strong{font-size:19px}.project-footer button{min-height:46px;flex:1}.project-search{font-size:16px}.toolbar{gap:10px;flex-wrap:wrap}.perm-chip{min-height:38px;align-items:center}.scroll{overscroll-behavior:contain}}


/* Finance list and project sheet share the same mobile controls. */
.mobile-finance-toolbar { display:grid; gap:12px; margin:0 0 10px; }
.mobile-finance-toolbar .project-filter { width:100%; }
.mobile-finance-toolbar .project-filter summary { min-height:44px; box-sizing:border-box; }
.mobile-project-filter .project-caption { display:grid; min-width:0; gap:2px; }
.mobile-project-filter .project-caption > small { color:#536783; font-size:11px; }
.mobile-project-filter .project-caption > strong { color:#193759; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mobile-project-filter .project-panel { border-color:#c8d8e9; }
.mobile-project-filter .project-options label { gap:12px; padding:9px 10px; background:#f6f9fc; border:1px solid #e4edf5; border-radius:8px; margin:4px 0; min-height:44px; }
.mobile-project-filter .project-options label[hidden] { display:none; }
.mobile-project-filter .project-options label:has(input:checked) { border-color:#b8d0ed; background:#edf5ff; }
.mobile-finance-results { display:grid; gap:8px; }
.mobile-finance-card { display:grid; gap:8px; width:100%; min-height:64px; box-sizing:border-box; margin:0; padding:13px; color:#1d3651; text-align:left; font:inherit; border:1px solid #dce6f0; border-radius:11px; background:#fff; }
.mobile-finance-card:focus-visible,.mobile-finance-toolbar :focus-visible { outline:2px solid #2a61bc; outline-offset:2px; }
.mobile-finance-card:active { background:#f0f6ff; }
.mobile-finance-line { display:flex; align-items:flex-start; justify-content:space-between; gap:8px; }
.mobile-finance-line > b { overflow-wrap:anywhere; min-width:0; }
.mobile-finance-meta { display:block; color:#526981; font-size:12px; line-height:1.5; overflow-wrap:anywhere; }
.mobile-finance-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px 8px; padding-top:7px; border-top:1px solid #e6edf4; }
.mobile-finance-metrics > span { display:grid; justify-items:start; gap:2px; min-width:0; }
.mobile-finance-metrics small { font-size:11px; font-weight:500; color:#536783; }
.mobile-finance-metrics b,.mobile-finance-summary b { font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
.mobile-finance-summary { display:flex; justify-content:space-between; gap:8px; margin:0 0 2px; padding:10px 12px; background:#ebf3fd; border-radius:8px; color:#1a4775; }
.mobile-finance-detail { margin:8px 0; padding:9px 12px; border:1px solid #dbe7f2; border-radius:10px; background:#f8fbff; }
.mobile-finance-detail button.mobile-finance-history { width:100%; min-height:44px; margin-top:6px; border:1px solid #b9cfea; border-radius:8px; background:#fff; color:#14549b; font-size:14px; }

/* Dense business tables and mobile forms keep readable controls and focus. */
body .btn:disabled, body button:disabled { cursor: not-allowed; }
body input:disabled, body select:disabled, body textarea:disabled { color: #64748b; background-color: #f1f5f9; }
body input[readonly], body textarea[readonly] { background-color: #f8fafc; }
body .scroll { scrollbar-width: thin; scrollbar-color: #a9bbcf #edf2f7; }
body .scroll > table tbody tr:hover > td { background-color: #f3f7fd; }
body .scroll > table tbody tr:focus-within > td { box-shadow: inset 0 -1px #89abd5; }
/* Administrative dialogs use their own scrolling surface inside the overlay. */
#mask:not(.delivery-drawer-mask) { --admin-modal-gap: clamp(10px,4vh,36px); padding: var(--admin-modal-gap) 12px; }
#mask:not(.delivery-drawer-mask) > #modal {
  box-sizing: border-box;
  min-width: 0;
  max-height: calc(100vh - 2 * var(--admin-modal-gap));
  max-height: calc(100dvh - 2 * var(--admin-modal-gap));
  overflow: auto;
  overscroll-behavior: contain;
}
#mask:not(.delivery-drawer-mask) > #modal .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
#mask:not(.delivery-drawer-mask) > #modal .modal-foot { flex-wrap: wrap; }
@media(max-width: 640px) {
  #mask:not(.delivery-drawer-mask) > #modal { padding: 16px; }
  #mask:not(.delivery-drawer-mask) > #modal .form-grid { grid-template-columns: minmax(0,1fr); }
}
body.m3 .topbar .t { white-space: normal; line-height: 1.3; }
body.m3 .sheet h3 { padding-right: 38px; }
body.m3 .sheet-x { width: 42px; height: 42px; min-height: 42px; }
body.m3 .sheet { max-height: 90dvh; }
body.m3 .sheet textarea { resize: vertical; min-height: 88px; }
@media(max-width: 640px) {
  body.m3 input:not([type=checkbox]):not([type=radio]), body.m3 select, body.m3 textarea { font-size: 16px; }
  body.m3 .topbar #app-ver { max-width: 21vw; }
  body.m3 .topbar .me { max-width: 24vw; }
  body.m3 .sheet input, body.m3 .sheet select, body.m3 .sheet textarea { max-width: 100%; min-width: 0; }
  body .project-footer { position: sticky; bottom: 0; background: #fff; }
}
@media(prefers-reduced-motion: reduce) {
  body.m3 .kpi, body .v3toast { animation: none; transition: none; }
  body.m3 .kpi:active { transform: none; }
}
