/* Instruction editor: aligned fields and responsive sections. */
.record-dialog{width:min(1680px,calc(100vw - 64px));max-height:92vh;border:1px solid #e0e6f1;border-radius:20px;background:#f5f7fb}
.record-dialog>.dialog-head{padding:24px 30px;gap:24px;border-bottom:1px solid #e3e8f1;background:#fff}
.record-dialog>.dialog-head>div{min-width:0}
.record-dialog .dialog-head h2{font-size:23px;line-height:1.4;overflow-wrap:anywhere}
.record-dialog .dialog-head .icon-btn{flex:none;border:1px solid #e3e8f1}
#recordForm{display:grid;gap:18px;padding:22px 28px 0}
.record-section{min-width:0;padding:22px 24px;border:1px solid #e2e7f0;border-radius:14px;background:#fff;box-shadow:0 3px 12px rgba(24,45,88,.025)}
.record-section-heading{display:flex;align-items:center;gap:10px;margin-bottom:18px}
.record-section-heading::before{content:"";width:4px;height:17px;border-radius:4px;background:var(--blue)}
.record-section-heading h3{margin:0;font-size:16px;color:#233552}
.record-section-heading p{margin:0 0 0 auto;font-size:12px;color:var(--muted);font-weight:400}
.record-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px 24px}
.record-field{display:grid;grid-template-columns:108px minmax(0,1fr);align-items:center;gap:10px;min-width:0;margin:0}
.record-field .field-label{color:#4b566b;font-size:13px;line-height:1.55;font-weight:600;white-space:nowrap}
.record-field .field-label em{margin-left:4px;color:#d34a53;font-size:12px;font-style:normal}
.record-field input,.record-field select,.record-field textarea{min-width:0;font-size:14px;font-weight:400;border-color:#dbe2ed;background:#fcfdff}
.record-field input,.record-field select{height:42px;padding:9px 12px}
.record-field textarea{line-height:1.65;padding:10px 12px}
.record-field input:disabled,.record-field select:disabled,.record-field textarea:disabled{color:#58657c;background:#f5f7fa;opacity:1}
.record-field-full{grid-column:1/-1;align-items:start}
.record-field-full .field-label{padding-top:10px}
.amount-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.settlement-grid{grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:18px}
.price-ledger [data-pricing-hidden],.record-dialog[data-record-type="price_confirmation"] [data-pricing-hidden]{display:none}
.record-dialog[data-record-type="price_confirmation"] .amount-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.record-section-finance .record-field{grid-template-columns:146px minmax(0,1fr)}
.record-section-finance input[type=number]{font-variant-numeric:tabular-nums}
#recordForm .attachments{border:1px solid #e2e7f0;padding:22px 24px;border-radius:14px;background:#fff}
#recordForm .attachment-groups{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-top:0}
#recordForm .attachment-group{min-width:0;padding:16px;border-color:#e0e6f0;background:#fafbfe}
#recordForm .attachment-group h4{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:13px;line-height:1.5;color:#354662;margin:0 0 12px}
#recordForm .attachment-group h4 small{padding:2px 8px;border-radius:20px;background:#e9effa;color:#52688f;white-space:nowrap}
#recordForm .upload-line{align-items:center;gap:8px}
#recordForm .upload-line input{min-width:0;flex:1;padding:6px;font-size:11px;background:white}
#recordForm .upload-line input::file-selector-button{margin-right:7px;padding:5px 7px;border:0;border-radius:5px;background:#eef2f9;color:#344866;cursor:pointer}
#recordForm .upload-line button{flex:none;white-space:nowrap;padding:9px 12px;font-size:12px}
#recordForm .file-list{margin-top:12px;gap:7px}
#recordForm .file-item{min-width:0;align-items:flex-start;padding:9px;gap:8px;border:1px solid #ecf0f6}
#recordForm .file-item .attachment-link{min-width:0;color:var(--blue);font-size:12px;font-weight:500;white-space:normal;overflow-wrap:anywhere;line-height:1.6}
#recordForm .file-size{padding-top:2px;font-size:11px;flex:none}
#recordForm .file-delete{flex:none;font-size:17px;line-height:1.1;padding:2px 4px;color:var(--danger)}
#recordForm .file-item.has-thumbnail{display:grid;grid-template-columns:88px minmax(0,1fr);align-items:start;gap:8px 10px}
#recordForm .attachment-thumbnail{grid-column:1;grid-row:1/span 2;width:88px;height:66px;padding:0;border:1px solid #dce5f2;border-radius:6px;overflow:hidden;background:#f3f6fb;cursor:pointer}
#recordForm .attachment-thumbnail img{display:block;width:100%;height:100%;object-fit:contain}
#recordForm .attachment-thumbnail:hover{border-color:var(--blue)}
#recordForm .attachment-thumbnail:focus-visible{outline:3px solid #adc3f6;outline-offset:2px}
#recordForm .has-thumbnail>.attachment-link{grid-column:2}
#recordForm .file-item-meta{display:flex;align-items:center;justify-content:flex-end;gap:8px}
#recordForm .has-thumbnail>.file-item-meta{grid-column:2}
#recordForm .file-item.thumbnail-failed{display:flex}
#recordForm .attachment-history{grid-column:1/-1;color:var(--muted);font-size:12px}
#recordForm .attachment-history summary{cursor:pointer}
#recordForm .attachment-history .file-list{grid-template-columns:repeat(3,minmax(0,1fr))}
#recordForm>.dialog-actions{margin:0 -28px;padding:16px 28px;justify-content:space-between;align-items:center;gap:16px;z-index:4;box-shadow:0 -5px 20px rgba(35,51,83,.035)}
.record-footer-note{color:var(--muted);font-size:12px}
.record-footer-buttons{display:flex;gap:10px;flex:none}
.danger-button{border:1px solid #e4a7ac;border-radius:9px;background:#fff4f4;color:#b52b38;font-weight:700}
.danger-button:hover{background:#ffe5e7}
.danger-button:disabled{opacity:.55;cursor:wait}
.record-footer-buttons button{min-width:100px;padding:11px 20px}
.status.签证单未办理{background:#fff3da;color:#976400}
.status.签证单已办理{background:#e8f6f2;color:#22775a}
@media(min-width:1550px){.amount-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.record-section-finance .record-field{grid-template-columns:124px minmax(0,1fr)}}
@media(max-width:1250px){.record-grid{grid-template-columns:repeat(2,minmax(0,1fr))}#recordForm .attachment-groups{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.record-dialog{width:calc(100vw - 20px);max-height:96vh;border-radius:14px}.record-dialog>.dialog-head{padding:16px;gap:12px}.record-dialog .dialog-head h2{font-size:18px}#recordForm{padding:14px 12px 0;gap:12px}.record-section,#recordForm .attachments{padding:16px 12px}.record-section-heading{flex-wrap:wrap;gap:8px;margin-bottom:16px}.record-section-heading p{width:100%;margin:0;line-height:1.6}.record-grid{grid-template-columns:minmax(0,1fr);gap:14px}.record-field,.record-section-finance .record-field{grid-template-columns:112px minmax(0,1fr);gap:8px}.record-field .field-label{font-size:12px;white-space:normal}.record-field input,.record-field select,.record-field textarea{font-size:14px}#recordForm .attachment-groups{grid-template-columns:minmax(0,1fr)}#recordForm>.dialog-actions{margin:0 -12px;padding:12px;gap:8px}.record-footer-note{display:none}.record-footer-buttons{width:100%}.record-footer-buttons button{flex:1;min-width:0}}

/* Status summary tabs retain counts when the selected tab changes. */
.summary-grid{grid-template-columns:repeat(5,minmax(120px,1fr)) minmax(220px,1.35fr);gap:14px}
.summary-card{display:block;min-width:0;text-align:left;padding:20px;background:#fff;color:var(--ink);border:1px solid var(--line);border-radius:14px;transition:border-color .18s,box-shadow .18s,background .18s}
.summary-card>span,.summary-card>small{display:block;color:var(--muted);font-size:12px;font-weight:400}
.summary-card>strong{display:flex;align-items:baseline;gap:7px;font-size:28px;margin:11px 0 6px;font-variant-numeric:tabular-nums}
.summary-card>strong>span{display:inline;color:inherit;font-size:inherit}
.summary-card>strong>em{font-size:12px;font-style:normal;font-weight:400;color:var(--muted)}
.summary-card:hover{border-color:#9fb7ec;background:#fbfcff}
.summary-card.is-active{border-color:#6e91e7;box-shadow:inset 0 3px 0 var(--blue),0 3px 12px rgba(37,87,214,.06)}
.summary-card:focus-visible{outline:3px solid #adc3f6;outline-offset:2px}
.summary-grid .accent-card{min-width:0}
.summary-grid .accent-card strong{font-size:24px;overflow-wrap:anywhere}
.summary-grid .amount-summary{display:flex;flex-direction:column;justify-content:center;gap:8px}
.amount-summary-row{position:relative;z-index:1;display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:3px 10px}
.summary-grid .amount-summary strong{font-size:17px;line-height:1.3;margin:0;font-variant-numeric:tabular-nums;white-space:nowrap}
.summary-grid .amount-summary::after{content:none}
.handler-picker{position:relative;min-width:0;width:100%;font-size:13px}
.handler-picker summary{cursor:pointer;border:1px solid #dce3ef;border-radius:8px;padding:9px 12px;background:#fff;display:flex;align-items:center;gap:8px;min-height:38px}
.handler-picker summary::after{content:'⌄';margin-left:auto;color:#64748b}
.handler-picker summary::-webkit-details-marker{display:none}
#handlerSelection{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.handler-options{position:absolute;z-index:20;top:calc(100% + 5px);left:0;right:0;min-width:240px;max-height:none;overflow:visible;padding:10px;background:#fff;border:1px solid #dce3ef;border-radius:10px;box-shadow:0 8px 24px #0f172a20}
.handler-options small{display:block;color:#64748b;margin-bottom:6px}
.handler-options label{display:flex!important;align-items:center;gap:8px;padding:8px;cursor:pointer;border-radius:5px}
.handler-options label:hover{background:#f1f5ff}
.handler-options input[type=checkbox]{width:16px!important;height:16px!important;min-height:0!important;margin:0;flex:0 0 16px;accent-color:#2454d6}
.price-ledger .summary-grid{grid-template-columns:repeat(4,minmax(120px,1fr)) minmax(220px,1.35fr)}
@media(max-width:1650px){.price-ledger .summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:1250px){#recordForm .attachment-history .file-list{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:850px){.price-ledger .summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.settlement-grid,.record-dialog[data-record-type="price_confirmation"] .amount-grid{grid-template-columns:minmax(0,1fr);margin-bottom:14px}#recordForm .attachment-history .file-list{grid-template-columns:minmax(0,1fr)}}
@media(max-width:1650px){.summary-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:850px){.summary-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.summary-card{padding:16px}.summary-card>strong{font-size:24px}}

/* Shared four-ledger presentation; payment and overview layouts stay untouched. */
.app.ledger-layout-active>main{min-width:0}
#ledgerPage .summary-grid{display:flex;flex-wrap:wrap;align-items:stretch;gap:14px}
#ledgerPage .summary-grid>.summary-card{flex:0 0 250px;width:250px;min-width:250px;max-width:250px}
#ledgerPage .summary-grid>.amount-summary{flex:1 1 max-content;width:auto;min-width:0;max-width:min(400px,100%);padding:18px 16px}
#ledgerPage .amount-summary-row>span{font-size:16px;font-weight:700;line-height:1.5}
#ledgerPage .summary-grid .amount-summary strong{font-size:20px;font-weight:800;line-height:1.35}
#ledgerPage .summary-card[data-status="未办理签证"]>span{font-size:14px;font-weight:700}
#ledgerPage .toolbar>.search-box{width:440px;max-width:100%;min-width:0;flex:0 1 440px}
#ledgerPage #searchInput{width:400px;max-width:100%;min-width:0;flex:0 1 400px}
#ledgerPage .table-wrap>table{table-layout:fixed;min-width:2200px}
#ledgerPage .table-wrap>table th{width:120px}
#ledgerPage .table-wrap>table th:first-child{width:60px}
#ledgerPage .table-wrap>table th:nth-child(3){width:var(--ledger-number-width,340px)}
#ledgerPage .table-wrap>table th:nth-child(4),#ledgerPage .table-wrap>table th:nth-child(5){width:330px}
#ledgerPage.compact-rows .table-wrap>table th:nth-child(4){width:260px}
#ledgerPage.compact-rows .table-wrap>table th:nth-child(5){width:300px}
#ledgerPage .table-wrap>table th:nth-child(6){width:80px}
#ledgerPage #ledgerBody td:nth-child(6){width:80px;min-width:80px;max-width:80px}
#ledgerPage #ledgerBody td:nth-child(6) .ledger-cell-text{max-width:52px;overflow-wrap:anywhere}
#ledgerPage .table-wrap>table th.money{width:120px}
#ledgerPage .table-wrap>table th:nth-child(11){width:130px}
#ledgerPage .table-wrap>table th:nth-child(12){width:420px}
#ledgerPage.compact-rows .table-wrap>table th:nth-child(12){width:330px}
#ledgerPage .table-wrap>table th:last-child{width:180px}
#ledgerPage #ledgerBody .status.未办理签证{font-size:12px;font-weight:900}
#ledgerPage.compact-rows #ledgerBody .status{padding:0 8px;line-height:20px}

/* Shared ledgers: remove horizontal overflow without dropping core fields. */
#ledgerPage.ledger-responsive>.panel>.table-wrap{max-width:100%;overflow-x:hidden}
#ledgerPage.ledger-responsive .table-wrap>table{width:var(--ledger-table-width,100%);max-width:100%}
#ledgerPage.ledger-fit .table-wrap>table{width:var(--ledger-table-width,100%);min-width:0;table-layout:fixed}
#ledgerPage.ledger-fit .table-wrap>table tr>:nth-child(5),#ledgerPage.ledger-fit .table-wrap>table tr>:nth-child(13){display:none}
#ledgerPage.ledger-fit .table-wrap>table th{padding-left:8px;padding-right:8px;white-space:normal;overflow-wrap:anywhere}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(1){width:var(--ledger-fit-col-1)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(2){width:var(--ledger-fit-col-2)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(3){width:var(--ledger-fit-col-3)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(4){width:var(--ledger-fit-col-4)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(5){width:var(--ledger-fit-col-5)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(6){width:var(--ledger-fit-col-6)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(7){width:var(--ledger-fit-col-7)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(8){width:var(--ledger-fit-col-8)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(9){width:var(--ledger-fit-col-9)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(10){width:var(--ledger-fit-col-10)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(11){width:130px;min-width:130px;max-width:130px}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(12){width:var(--ledger-fit-col-12)}
#ledgerPage.ledger-responsive .table-wrap>table th:nth-child(13){width:var(--ledger-fit-col-13)}
#ledgerPage.ledger-fit #ledgerBody td{width:auto;min-width:0;max-width:none;padding-left:8px;padding-right:8px;white-space:normal;overflow-wrap:anywhere}
#ledgerPage.ledger-fit #ledgerBody .cell-text-clamp,#ledgerPage.ledger-fit #ledgerBody .ledger-cell-text{width:100%;min-width:0;max-width:100%}
#ledgerPage.ledger-fit #ledgerBody .number-cell .ledger-cell-text,#ledgerPage.ledger-fit #ledgerBody .record-number{max-height:none;white-space:normal;overflow-wrap:anywhere;overflow:visible;text-overflow:clip}
#ledgerPage.ledger-fit #ledgerBody td.number-cell{height:auto}
#ledgerPage.ledger-responsive #ledgerBody td:nth-child(11){padding-left:8px;padding-right:8px;white-space:normal}
#ledgerPage.ledger-responsive #ledgerBody .status{max-width:100%;white-space:normal;overflow-wrap:anywhere}
#ledgerPage.ledger-responsive #ledgerBody td:nth-child(11) .ledger-cell-text{max-height:none;white-space:normal;overflow:visible}
#ledgerPage.ledger-fit #ledgerBody td.money .ledger-cell-text{max-height:none;white-space:normal;overflow-wrap:anywhere;text-overflow:clip}
#ledgerPage.ledger-fit #ledgerBody .attachment-scroll{max-width:100%;overflow-x:hidden}
#ledgerPage.ledger-fit #ledgerBody .attachment-row .attachment-link{max-width:100%}

/* Very narrow containers keep the remaining fields as labeled records. */
#ledgerPage.ledger-stacked .table-wrap>table,#ledgerPage.ledger-stacked #ledgerBody{display:block;width:100%}
#ledgerPage.ledger-stacked .table-wrap>table thead{display:none}
#ledgerPage.ledger-stacked #ledgerBody tr{display:grid;grid-template-columns:repeat(var(--ledger-record-columns,2),minmax(0,1fr));height:auto;gap:0 16px;padding:10px;border-bottom:1px solid var(--line)}
#ledgerPage.ledger-stacked #ledgerBody td{display:grid;grid-template-columns:96px minmax(0,1fr);height:auto;border:0;gap:8px;padding:8px 4px}
#ledgerPage.ledger-stacked #ledgerBody td::before{content:attr(data-label);color:var(--muted);font-size:12px;font-weight:600;text-align:left}
#ledgerPage.ledger-stacked #ledgerBody td:nth-child(3),#ledgerPage.ledger-stacked #ledgerBody td:nth-child(4),#ledgerPage.ledger-stacked #ledgerBody td:nth-child(12){grid-column:1/-1}
#ledgerPage.ledger-stacked #ledgerBody td:nth-child(5),#ledgerPage.ledger-stacked #ledgerBody td:nth-child(13){display:none}
#ledgerPage.ledger-stacked #ledgerBody .attachment-scroll{height:auto;max-height:96px;white-space:normal;overflow-y:auto}
#ledgerPage.ledger-stacked #ledgerBody .attachment-row{display:flex;white-space:normal}
#ledgerPage.ledger-stacked #ledgerBody .attachment-row+.attachment-row{margin-left:0}
#ledgerPage.ledger-stacked #ledgerBody .attachment-file-links{flex-wrap:wrap;white-space:normal}
/* The pricing ledger's hidden settlement amount must stay hidden in stacked layout. */
#ledgerPage.price-ledger #ledgerBody [data-pricing-hidden],#ledgerPage.price-ledger .table-wrap>table th[data-pricing-hidden]{display:none}
