/* ACCGEN v18.13 — targeted visual harmonization.
   Presentation-only rules; frozen OCR/address/mapping/generation logic stays unchanged. */
:root{--accgen-u13-ink:#173b56;--accgen-u13-muted:#60788d;--accgen-u13-line:#d9e5ee;--accgen-u13-soft:#f5f9fc;--accgen-u13-blue:#005a9e;--accgen-u13-radius:12px;--accgen-u13-shadow:0 2px 9px rgba(13,50,78,.055)}
/* A: QR image batch review uses the existing Person-style information hierarchy. */
#view-batch-review{max-width:100%;min-width:0}
#view-batch-review .accgen-ui13-qr-header{padding:0 0 12px;margin-bottom:13px;border-bottom:1px solid var(--accgen-u13-line)}
#view-batch-review .accgen-ui13-eyebrow{margin:0 0 6px;color:var(--accgen-u13-muted);font-size:11px;font-weight:750;letter-spacing:.055em}
#view-batch-review .accgen-ui13-qr-header h2{margin:0 0 5px;padding:0;border:0;color:var(--accgen-u13-ink);font-size:clamp(19px,4vw,25px);line-height:1.3;overflow-wrap:anywhere}
#view-batch-review .accgen-ui13-qr-header p:last-child{margin:0;color:var(--accgen-u13-muted);font-size:12px;line-height:1.5}
#view-batch-review .accgen-ui13-qr-summary{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin:0 0 14px;padding:0;background:none;border:0}
#view-batch-review .accgen-ui13-qr-stat{display:flex;flex-direction:column;gap:4px;min-width:0;padding:11px 12px;border:1px solid var(--accgen-u13-line);border-radius:10px;background:#fff;box-shadow:var(--accgen-u13-shadow)}
#view-batch-review .accgen-ui13-qr-stat-label{color:var(--accgen-u13-muted);font-size:11px;line-height:1.3;font-weight:600}
#view-batch-review .accgen-ui13-qr-stat-value{font-size:22px;line-height:1.2;color:var(--accgen-u13-ink);font-variant-numeric:tabular-nums}
#view-batch-review .accgen-ui13-qr-stat--ready .accgen-ui13-qr-stat-value,#view-batch-review .accgen-ui13-qr-stat--created .accgen-ui13-qr-stat-value{color:#197348}
#view-batch-review .accgen-ui13-qr-stat--review .accgen-ui13-qr-stat-value{color:#965a12}
#view-batch-review .accgen-ui13-qr-stat--invalid .accgen-ui13-qr-stat-value{color:#a32929}
#view-batch-review .accgen-ui13-qr-table{min-width:0;margin:0 0 14px!important}
#view-batch-review #accgen-ui13-qr-table{width:100%;min-width:0}
#view-batch-review #accgen-ui13-qr-table thead th{font-size:12px;color:var(--accgen-u13-muted)}
#view-batch-review #accgen-ui13-qr-table td{overflow-wrap:anywhere;line-height:1.45}
#view-batch-review #accgen-ui13-qr-table .batch-row-actions{display:flex;flex-wrap:wrap;gap:7px}
#view-batch-review #accgen-ui13-qr-table .batch-row-actions>.btn{min-height:38px;margin:0;white-space:normal}
#view-batch-review .accgen-ui13-qr-actions{display:flex;align-items:center;justify-content:flex-end;gap:9px;flex-wrap:wrap;padding:12px 0 0;margin:0;border-top:1px solid var(--accgen-u13-line)}
#view-batch-review .accgen-ui13-qr-actions .btn{min-height:43px;margin:0}
/* A: mobile Admin tabs must visibly afford horizontal scrolling. */
#view-admin #admin-section-tabs.accgen-ui13-admin-tabs{box-sizing:border-box;display:flex!important;flex-wrap:nowrap!important;gap:7px!important;max-width:100%;min-width:0;padding:3px 1px 10px!important;overflow-x:auto!important;overflow-y:hidden!important;overscroll-behavior-x:contain;scrollbar-width:thin!important;scrollbar-color:#92b7d2 #e7f0f7;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch}
#view-admin #admin-section-tabs.accgen-ui13-admin-tabs::-webkit-scrollbar{display:block!important;height:5px!important}
#view-admin #admin-section-tabs.accgen-ui13-admin-tabs::-webkit-scrollbar-thumb{border-radius:8px;background:#92b7d2}
#view-admin #admin-section-tabs.accgen-ui13-admin-tabs::-webkit-scrollbar-track{background:#e7f0f7}
#view-admin #admin-section-tabs.accgen-ui13-admin-tabs>.btn{flex:0 0 auto!important;white-space:nowrap;scroll-snap-align:center;margin:0;min-height:40px!important}
#view-admin .accgen-ui13-admin-tabs-hint{display:none;margin:-7px 0 13px;color:var(--accgen-u13-muted);font-size:11px;line-height:1.4;text-align:right}
/* A: template mapping + preview share the exact same low-noise card treatment. */
#templates-admin-detail .accgen-ui13-mapping,#templates-admin-detail .accgen-ui13-preview{box-sizing:border-box;min-width:0;padding:clamp(12px,2.5vw,20px)!important;margin:0 0 16px!important;border:1px solid var(--accgen-u13-line)!important;border-radius:var(--accgen-u13-radius)!important;background:#fff!important;box-shadow:var(--accgen-u13-shadow)!important}
#templates-admin-detail .accgen-ui13-mapping>.template-mapping-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:9px;margin:0 0 12px!important;padding-bottom:12px;border-bottom:1px solid #e9f0f5}
#templates-admin-detail .accgen-ui13-mapping>.template-mapping-toolbar h3,#templates-admin-detail .accgen-ui13-preview>h3{flex:1 1 180px;min-width:0;margin:0!important;color:var(--accgen-u13-ink)!important;font-size:16px!important;line-height:1.35}
#templates-admin-detail .accgen-ui13-mapping>.template-mapping-toolbar .btn{margin:0;min-height:40px}
#templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table-wrapper{max-width:100%;margin:0!important;border:1px solid #e4edf4;border-radius:9px;overflow-x:auto}
#templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table{margin:0;min-width:0}
#templates-admin-detail #tpl-mapping-msg,#templates-admin-detail #tpl-preview-msg{margin:0 0 11px!important;line-height:1.5;border-radius:9px}
#templates-admin-detail .accgen-ui13-preview>h3{display:block;margin:0 0 13px!important;padding-bottom:10px;border-bottom:1px solid #e9f0f5}
#templates-admin-detail .accgen-ui13-preview .form-grid{align-items:end;gap:9px;margin:0 0 12px!important}
#templates-admin-detail .accgen-ui13-preview .form-group{min-width:0;margin:0}
#templates-admin-detail #tpl-preview-sample{box-sizing:border-box;width:100%;min-width:0;min-height:43px;border-color:#ccdae6;border-radius:9px}
#templates-admin-detail #btn-template-preview{min-height:43px;margin:0}
#templates-admin-detail #tpl-preview-empty{box-sizing:border-box;padding:13px!important;border:1px dashed #cbdce9!important;border-radius:9px!important;background:var(--accgen-u13-soft)!important;color:#576f83!important;line-height:1.5}
#templates-admin-detail #tpl-preview-table-wrapper{max-width:100%;border:1px solid #e2ebf3;border-radius:9px;overflow-x:auto}
#templates-admin-detail #tpl-preview-table{width:100%;min-width:0;margin:0}
#templates-admin-detail .accgen-ui13-source-controls,#templates-admin-detail .accgen-ui13-lifecycle{min-width:0;border-color:#e5edf4!important}
#templates-admin-detail .accgen-ui13-source-controls input{box-sizing:border-box;min-width:0!important;max-width:100%;border-color:#cbdbe7;border-radius:9px}
#templates-admin-detail .accgen-ui13-lifecycle button{min-height:41px}
/* A/B: small non-rotating loading feedback for content modules; do not replace login/OCR loaders. */
#home-plan-loading,#account-plan-usage-loading,#user-plan-catalog-loading,#admin-dashboard-loading,#admin-usage-loading,#admin-plan-quota-loading,#admin-branches-loading,#admin-quota-loading,#admin-cleanup-loading,#admin-cleanup-eligibility-loading{box-sizing:border-box;max-width:100%;padding:11px 13px!important;border:1px solid #d4e7f4!important;border-radius:10px!important;background:#f2f8fd!important;color:#285c7c!important;font-size:12.5px;line-height:1.5}
#home-plan-loading::before,#account-plan-usage-loading::before,#user-plan-catalog-loading::before,#admin-dashboard-loading::before,#admin-usage-loading::before,#admin-plan-quota-loading::before,#admin-branches-loading::before,#admin-quota-loading::before,#admin-cleanup-loading::before,#admin-cleanup-eligibility-loading::before{content:'•••';display:inline-block;min-width:24px;margin-right:8px;color:var(--accgen-u13-blue);font-size:16px;font-weight:850;letter-spacing:2px;vertical-align:middle;animation:accgen-u13-pulse 1.5s ease-in-out infinite}
@keyframes accgen-u13-pulse{0%,100%{opacity:.35}50%{opacity:1}}
@media(prefers-reduced-motion:reduce){#home-plan-loading::before,#account-plan-usage-loading::before,#user-plan-catalog-loading::before,#admin-dashboard-loading::before,#admin-usage-loading::before,#admin-plan-quota-loading::before,#admin-branches-loading::before,#admin-quota-loading::before,#admin-cleanup-loading::before,#admin-cleanup-eligibility-loading::before{animation:none;opacity:1}}
/* B: restrained alignment across editing forms without changing OCR/address/form structure. */
#view-persons-form,#view-businesses-form,#view-companies-form{min-width:0}
:is(#view-persons-form,#view-businesses-form,#view-companies-form)>.accgen-ui13-form-title{color:var(--accgen-u13-ink)!important;font-size:clamp(19px,3.6vw,24px);line-height:1.35;margin:0 0 14px!important;padding:0 0 11px!important;border-bottom:1px solid var(--accgen-u13-line)!important;overflow-wrap:anywhere}
:is(#view-persons-form,#view-businesses-form,#view-companies-form) form fieldset{min-width:0;margin-bottom:14px;border-color:#dce7ef;border-radius:var(--accgen-u13-radius);background:#fff;box-shadow:var(--accgen-u13-shadow)}
:is(#view-persons-form,#view-businesses-form,#view-companies-form) form legend{max-width:100%;color:var(--accgen-u13-ink);font-weight:750;line-height:1.4;overflow-wrap:anywhere}
:is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-group{min-width:0}
:is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-group label{color:#344e65;font-size:12.5px;font-weight:650;line-height:1.4}
:is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-group input:not([type=checkbox]),:is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-group select,:is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-group textarea{box-sizing:border-box;min-width:0;max-width:100%;border-color:#cddbe7;border-radius:9px}
:is(#view-persons-form,#view-businesses-form,#view-companies-form) .alert{min-width:0;border-radius:9px;line-height:1.5;overflow-wrap:anywhere}
:is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-actions{gap:9px;flex-wrap:wrap}
/* B: preserve the frozen modal interactions, simply align QR scanner and admin dialog surfaces. */
#qr-scanner-modal .qr-scanner-content{box-sizing:border-box;max-width:min(560px,calc(100vw - 24px));min-width:0;border-radius:15px;overflow:hidden}
#qr-scanner-modal .qr-scanner-content h3{font-size:18px;line-height:1.35;overflow-wrap:anywhere}
#qr-scanner-modal #qr-scanner-msg{border-radius:9px;line-height:1.45}
#qr-scanner-modal .qr-video-wrapper{max-width:100%;overflow:hidden;border-radius:10px}
#qr-scanner-modal #btn-qr-scanner-close{min-height:44px;min-width:120px;border-radius:9px}
#view-admin :is(#admin-plan-dialog,#admin-user-plan-dialog,#admin-quota-dialog,#admin-branch-dialog){max-width:calc(100vw - 24px);border-radius:14px}
#view-admin :is(.admin-u5e-dialog-header,.admin-u5e-dialog-actions){gap:10px}
/* B: administrative secondary sections use the same spacing, borders and heading hierarchy. */
#view-admin :is(#admin-plan-quota-panel,#admin-branches-panel,#admin-cleanup-panel){min-width:0}
#view-admin :is(#admin-plan-quota-panel,#admin-branches-panel) .admin-u5e-section,#view-admin #admin-cleanup-panel .admin-cleanup-section{min-width:0;border:1px solid var(--accgen-u13-line);border-radius:var(--accgen-u13-radius);background:#fff;box-shadow:var(--accgen-u13-shadow)}
#view-admin :is(#admin-plan-quota-panel,#admin-branches-panel) .admin-u5e-section-header h3,#view-admin #admin-cleanup-panel .admin-cleanup-section-header h3{color:var(--accgen-u13-ink);line-height:1.35;overflow-wrap:anywhere}
#view-admin :is(#admin-plan-quota-panel,#admin-branches-panel,#admin-cleanup-panel) .btn{max-width:100%;white-space:normal;line-height:1.3}
#view-admin :is(#admin-plan-quota-panel,#admin-branches-panel,#admin-cleanup-panel) :is(.admin-u5e-table-wrap,.admin-cleanup-table-wrap){max-width:100%;min-width:0}
/* Keyboard focus and consistent clickable target visibility within modified areas. */
:is(#view-batch-review,#view-admin,#templates-admin-detail,#view-persons-form,#view-businesses-form,#view-companies-form) :is(button,input,select,textarea):focus-visible{outline:2px solid #4b9bd4;outline-offset:2px}
@media(max-width:700px){
  #view-admin .accgen-ui13-admin-tabs-hint{display:block}
  #view-admin #admin-section-tabs.accgen-ui13-admin-tabs{padding-bottom:10px!important;margin-bottom:8px!important}
  #view-batch-review .accgen-ui13-qr-summary{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #view-batch-review .accgen-ui13-qr-stat{padding:10px 11px}
  #view-batch-review .accgen-ui13-qr-stat-value{font-size:19px}
  #view-batch-review .accgen-ui13-qr-stat--created{grid-column:1/-1}
  #view-batch-review .accgen-ui13-qr-table{overflow:visible!important;border:0!important}
  #view-batch-review #accgen-ui13-qr-table{display:block!important;width:100%!important;min-width:0!important;border:0!important;background:transparent!important}
  #view-batch-review #accgen-ui13-qr-table thead{display:none!important}
  #view-batch-review #accgen-ui13-qr-table tbody{display:grid!important;gap:11px;width:100%;min-width:0}
  #view-batch-review #accgen-ui13-qr-table tbody tr{display:flex!important;flex-direction:column;gap:0;width:100%;min-width:0;padding:13px!important;border:1px solid var(--accgen-u13-line)!important;border-radius:var(--accgen-u13-radius)!important;background:#fff!important;box-shadow:var(--accgen-u13-shadow);box-sizing:border-box}
  #view-batch-review #accgen-ui13-qr-table tbody tr td{display:block!important;float:none!important;box-sizing:border-box;width:100%!important;min-width:0!important;margin:0!important;padding:9px 0!important;border:0!important;border-bottom:1px solid #edf2f6!important;text-align:left!important;white-space:normal!important;overflow-wrap:anywhere}
  #view-batch-review #accgen-ui13-qr-table tbody tr td::before{display:block!important;float:none!important;position:static!important;content:attr(data-label)!important;margin:0 0 3px!important;color:var(--accgen-u13-muted)!important;font-size:10.5px!important;font-weight:650!important;line-height:1.35!important}
  #view-batch-review #accgen-ui13-qr-table tbody tr td:nth-child(2){order:1;padding-top:0!important}
  #view-batch-review #accgen-ui13-qr-table tbody tr td:nth-child(2)::before{display:none!important}
  #view-batch-review #accgen-ui13-qr-table tbody tr td:nth-child(2)>strong{color:var(--accgen-u13-ink);font-size:15px;line-height:1.4}
  #view-batch-review #accgen-ui13-qr-table tbody tr td:nth-child(2)>small{color:var(--accgen-u13-muted);font-size:12px}
  #view-batch-review #accgen-ui13-qr-table tbody tr td:nth-child(1){order:2;color:var(--accgen-u13-muted);font-size:11px}
  #view-batch-review #accgen-ui13-qr-table tbody tr td:nth-child(3){order:3}
  #view-batch-review #accgen-ui13-qr-table tbody tr td:nth-child(4){order:4;padding-bottom:0!important;border-bottom:0!important}
  #view-batch-review #accgen-ui13-qr-table .batch-row-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;width:100%}
  #view-batch-review #accgen-ui13-qr-table .batch-row-actions>.btn{box-sizing:border-box;width:100%!important;min-width:0;min-height:42px;padding:7px 5px;margin:0}
  #view-batch-review .accgen-ui13-qr-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;padding-bottom:10px}
  #view-batch-review .accgen-ui13-qr-actions .btn{box-sizing:border-box;min-width:0;width:100%;margin:0;min-height:44px}
  #templates-admin-detail .accgen-ui13-mapping>.template-mapping-toolbar{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #templates-admin-detail .accgen-ui13-mapping>.template-mapping-toolbar h3{grid-column:1/-1;font-size:16px!important}
  #templates-admin-detail .accgen-ui13-mapping>.template-mapping-toolbar>.btn{width:100%;min-width:0;font-size:12px;min-height:43px;margin:0}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table-wrapper{overflow:visible!important;border:0!important;background:transparent}
  #templates-admin-detail #tpl-mapping-table{display:block!important;min-width:0!important;width:100%!important;border:0!important}
  #templates-admin-detail #tpl-mapping-table thead{display:none!important}
  #templates-admin-detail #tpl-mapping-table tbody{display:grid!important;gap:10px;width:100%;min-width:0}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 10px;box-sizing:border-box;min-width:0;padding:13px!important;border:1px solid #dce7ee!important;border-radius:10px;background:#fff!important;box-shadow:0 1px 5px rgba(14,50,75,.04)}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-group-row{display:block!important;min-width:0;margin:6px 0 0!important;padding:10px 12px!important;border:1px solid #dce7ef!important;border-radius:9px!important;background:#edf5fb!important}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-group-row td{display:block!important;width:100%!important;border:0!important;padding:0!important}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell{display:flex!important;flex-direction:column;align-items:flex-start;gap:5px;box-sizing:border-box;float:none!important;width:100%!important;max-width:100%;min-width:0;margin:0!important;padding:0!important;border:0!important;white-space:normal!important;text-align:left!important;overflow-wrap:anywhere}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell::before{display:block!important;position:static!important;float:none!important;content:attr(data-label)!important;margin:0!important;font-size:10.5px!important;font-weight:650!important;line-height:1.3!important;color:var(--accgen-u13-muted)!important}
  #templates-admin-detail #tpl-mapping-table .template-mapping-cell--placeholder,#templates-admin-detail #tpl-mapping-table .template-mapping-cell--source,#templates-admin-detail #tpl-mapping-table .template-mapping-cell--action{grid-column:1/-1}
  #templates-admin-detail #tpl-mapping-table .template-mapping-cell--placeholder{grid-row:auto!important;font-size:14px!important;color:var(--accgen-u13-ink);font-weight:750}
  #templates-admin-detail #tpl-mapping-table .template-mapping-cell--source select{box-sizing:border-box;width:100%;min-height:44px;min-width:0;max-width:100%;border:1px solid #c8d9e5;border-radius:9px;font-size:14px}
  #templates-admin-detail #tpl-mapping-table .template-mapping-cell--action button{box-sizing:border-box;width:100%;min-height:42px;max-width:100%;margin:0}
  #templates-admin-detail #tpl-mapping-table .template-mapping-cell--bulk{order:-1;grid-column:1/-1;grid-row:auto!important;flex-direction:row!important;align-items:center!important;gap:9px!important;padding:8px!important;border:1px solid #e3edf4!important;border-radius:8px;background:#f6f9fc}
  #templates-admin-detail #tpl-mapping-table .template-mapping-cell--bulk::before{font-size:12px!important}
  #templates-admin-detail #tpl-mapping-table .template-mapping-cell--bulk input{width:20px;height:20px;accent-color:var(--accgen-u13-blue)}
  #templates-admin-detail .accgen-ui13-preview .form-grid{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px}
  #templates-admin-detail .accgen-ui13-preview .form-grid>.form-group{min-width:0}
  #templates-admin-detail #btn-template-preview{width:100%;margin:0}
  #templates-admin-detail #tpl-preview-table-wrapper{overflow:visible!important;border:0!important}
  #templates-admin-detail #tpl-preview-table{display:block!important;min-width:0!important;width:100%!important;border:0!important}
  #templates-admin-detail #tpl-preview-table thead{display:none!important}
  #templates-admin-detail #tpl-preview-table tbody{display:grid!important;gap:9px;width:100%;min-width:0}
  #templates-admin-detail #tpl-preview-table tbody tr{display:block!important;box-sizing:border-box;width:100%;min-width:0;padding:11px 12px!important;border:1px solid var(--accgen-u13-line)!important;border-radius:10px;background:#fff!important}
  #templates-admin-detail #tpl-preview-table tbody td{display:block!important;box-sizing:border-box;width:100%!important;min-width:0;float:none!important;padding:7px 0!important;border:0!important;border-bottom:1px solid #eef2f6!important;text-align:left!important;white-space:normal!important;overflow-wrap:anywhere}
  #templates-admin-detail #tpl-preview-table tbody td:last-child{border-bottom:0!important}
  #templates-admin-detail #tpl-preview-table tbody td::before{display:block!important;position:static!important;float:none!important;content:attr(data-label)!important;margin:0 0 3px!important;color:var(--accgen-u13-muted)!important;font-size:10.5px!important;font-weight:650!important}
  #templates-admin-detail #tpl-preview-table tbody td:first-child{color:var(--accgen-u13-ink);font-weight:750}
  #templates-admin-detail .accgen-ui13-source-controls .form-group>div{flex-direction:column!important;align-items:stretch!important;gap:8px!important}
  #templates-admin-detail .accgen-ui13-source-controls input{width:100%!important;flex:0 1 auto!important}
  #templates-admin-detail .accgen-ui13-source-controls .btn{min-height:42px;max-width:100%;margin:0}
  #templates-admin-detail .accgen-ui13-lifecycle>div{display:grid!important;gap:11px}
  #templates-admin-detail .accgen-ui13-lifecycle>div>div{min-width:0!important}
  #templates-admin-detail .accgen-ui13-lifecycle button{min-height:42px;margin:0}
  :is(#view-persons-form,#view-businesses-form,#view-companies-form) form fieldset{padding:13px 11px}
  :is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  :is(#view-persons-form,#view-businesses-form,#view-companies-form) .form-actions .btn{min-width:0;min-height:43px;margin:0;white-space:normal}
}
@media(min-width:701px) and (max-width:1024px){#view-batch-review .accgen-ui13-qr-summary{grid-template-columns:repeat(3,minmax(0,1fr))}}

/* ACCGEN v18.13.1: compact, scannable Mapping / Preview on small screens.
   CSS-only correction to v18.13. Retain DOM, select, checkbox, status and API behavior. */
@media(max-width:1050px){
  #templates-admin-detail .accgen-ui13-mapping,
  #templates-admin-detail .accgen-ui13-preview{padding:11px!important;margin-bottom:12px!important}
  #templates-admin-detail .accgen-ui13-mapping>.template-mapping-toolbar{gap:7px;margin-bottom:9px!important;padding-bottom:9px}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody{gap:7px!important}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody tr.template-mapping-row{
    display:grid!important;grid-template-columns:minmax(0,1fr) auto auto!important;
    align-items:center;column-gap:9px!important;row-gap:5px!important;
    min-width:0;padding:11px 12px!important;border-color:#d9e5ed!important;
    border-radius:10px!important;box-shadow:0 1px 4px rgba(13,50,78,.035)!important
  }
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell{
    display:flex!important;flex-direction:row!important;align-items:center!important;
    justify-content:flex-start;align-self:center;box-sizing:border-box;
    gap:5px!important;min-width:0;width:100%!important;max-width:100%!important;
    margin:0!important;padding:0!important;border:0!important;
    line-height:1.35!important;order:0!important;background:transparent!important
  }
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell::before{display:none!important}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--placeholder{
    grid-column:1/3!important;grid-row:1!important;align-items:flex-start!important;
    font-size:14px!important;line-height:1.4!important;font-weight:750!important;
    color:#173b56!important;overflow-wrap:anywhere
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--bulk{
    grid-column:3!important;grid-row:1!important;justify-self:end!important;
    justify-content:flex-end!important;min-height:28px!important;width:auto!important;
    border:0!important;background:transparent!important;padding:0!important
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--bulk input{
    flex:0 0 auto;width:19px;height:19px;margin:0;accent-color:#005a9e
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--status{grid-column:1/3!important;grid-row:2!important}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--analysis{grid-column:3!important;grid-row:2!important;justify-content:flex-end!important}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--count{
    grid-column:1/3!important;grid-row:3!important;font-size:11.5px!important;color:#61798d!important
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--count::before{display:inline!important;content:'Số lần:'!important;font-weight:600}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--confidence{grid-column:3!important;grid-row:3!important;justify-content:flex-end!important}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--required{
    grid-column:1/-1!important;grid-row:4!important;font-size:11.5px!important;color:#647a8d!important
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--required::before{display:inline!important;content:'Bắt buộc:'!important;font-weight:600}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--count::before,
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--required::before{display:inline!important;position:static!important;float:none!important;margin:0 4px 0 0!important}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--source{
    grid-column:1/3!important;grid-row:5!important;min-width:0!important;overflow:hidden
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--source select{
    box-sizing:border-box;display:block;flex:1 1 auto;width:100%!important;min-width:0!important;
    height:41px;min-height:41px!important;max-width:100%!important;
    padding:7px 27px 7px 9px;font-size:12.5px!important;
    white-space:nowrap;text-overflow:ellipsis;overflow:hidden;border-radius:8px
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--source>span{
    font-size:11.5px;overflow-wrap:anywhere
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--action{
    grid-column:3!important;grid-row:5!important;justify-self:end!important;width:auto!important
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--action button{
    width:auto!important;min-width:86px!important;height:41px;min-height:41px!important;
    padding:7px 9px!important;font-size:12px!important;margin:0!important;border-radius:8px
  }
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-row td.template-mapping-cell--action>span{font-size:11px}
  #templates-admin-detail #tpl-mapping-table tbody tr.template-mapping-group-row{margin:5px 0 0!important;padding:9px 11px!important}
  #templates-admin-detail .accgen-ui13-preview .form-grid{
    grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important;align-items:end
  }
  #templates-admin-detail .accgen-ui13-preview .form-grid>.form-group{min-width:0!important}
  #templates-admin-detail #tpl-preview-sample{font-size:12.5px!important;min-height:41px!important;height:41px}
  #templates-admin-detail #btn-template-preview{width:auto!important;min-width:88px;min-height:41px!important;padding:7px 10px!important;font-size:12px!important}
  #templates-admin-detail #tpl-preview-table tbody{gap:7px!important}
  #templates-admin-detail #tpl-preview-table tbody tr{
    display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
    gap:4px 9px!important;align-items:center;
    padding:10px 11px!important;border-radius:9px!important;
    border-color:#d9e5ed!important;box-shadow:0 1px 4px rgba(13,50,78,.035)
  }
  #templates-admin-detail #tpl-preview-table tbody tr td{
    display:block!important;box-sizing:border-box;min-width:0;width:100%!important;
    padding:0!important;margin:0!important;border:0!important;
    font-size:12px!important;line-height:1.45!important;overflow-wrap:anywhere
  }
  #templates-admin-detail #tpl-preview-table tbody tr td::before{display:none!important}
  #templates-admin-detail #tpl-preview-table tbody tr td:nth-child(1){grid-column:1/-1!important;grid-row:1;font-size:13.5px!important;font-weight:750!important;color:#173b56}
  #templates-admin-detail #tpl-preview-table tbody tr td:nth-child(2){grid-column:1/-1!important;grid-row:2;font-size:11px!important;color:#60778b}
  #templates-admin-detail #tpl-preview-table tbody tr td:nth-child(3){grid-column:1!important;grid-row:3;font-size:13px!important;font-weight:650!important;color:#173b56}
  #templates-admin-detail #tpl-preview-table tbody tr td:nth-child(4){grid-column:2!important;grid-row:3;justify-self:end!important;width:auto!important}
}


/* ACCGEN v18.13.2: production UI regression recovery. Scoped CSS only. */
/* 1. Identical, calm loaders for cached Person/Business/Company and History lists. */
:is(#view-persons-list,#view-businesses-list,#view-companies-list,#templates-user-state) .accgen-data-status--loading{
  display:flex!important;align-items:center;box-sizing:border-box;min-width:0;max-width:100%;
  gap:9px!important;min-height:43px;padding:10px 12px;border:1px solid #bbd9eb;
  border-radius:9px;background:#eef7fd;color:#17527c;box-shadow:none;font-size:12.5px;
  font-weight:650;line-height:1.45;overflow-wrap:anywhere;
}
:is(#view-persons-list,#view-businesses-list,#view-companies-list,#templates-user-state) .accgen-data-status--loading::before{
  content:""!important;display:block;position:static;top:auto;transform:none;
  flex:0 0 28px!important;width:28px!important;min-width:28px!important;
  height:12px!important;min-height:12px!important;margin:0!important;border:0!important;
  border-radius:0!important;background:
  radial-gradient(circle,#005a9e 62%,transparent 67%) left center/7px 7px no-repeat,
  radial-gradient(circle,#4598c5 62%,transparent 67%) center center/7px 7px no-repeat,
  radial-gradient(circle,#88bfdf 62%,transparent 67%) right center/7px 7px no-repeat;
  animation:accgen-u13-pulse 1.45s ease-in-out infinite!important;
}
@media(prefers-reduced-motion:reduce){
  :is(#view-persons-list,#view-businesses-list,#view-companies-list,#templates-user-state) .accgen-data-status--loading::before{animation:none!important;opacity:1;}
}
/* 2. Mobile select bottom sheet: restore the scrollable, fully contained choice list.
   This protects the shared picker without altering option loading/search logic. */
@media(max-width:767px){
  .mobile-select-sheet.is-open{
    position:fixed!important;inset:auto 0 0 0!important;width:100%!important;
    max-width:100vw!important;max-height:calc(88dvh - env(safe-area-inset-top,0px))!important;
    box-sizing:border-box!important;overflow:hidden!important;padding:10px 12px max(12px,env(safe-area-inset-bottom,0px))!important;
    border-radius:17px 17px 0 0!important;z-index:14001;
  }
  .mobile-select-sheet__head,.mobile-select-sheet__head-actions{min-width:0;box-sizing:border-box;}
  .mobile-select-sheet__title{min-width:0;flex:1 1 0;line-height:1.3;white-space:normal;overflow-wrap:anywhere;}
  .mobile-select-sheet__close{flex:0 0 42px!important;width:42px!important;min-width:42px!important;max-width:42px!important;}
  .mobile-select-sheet__search{box-sizing:border-box;flex:0 0 auto;max-width:100%;margin:0 0 8px;}
  .mobile-select-sheet__list{box-sizing:border-box;flex:1 1 auto;min-width:0;min-height:0;overflow-y:auto!important;overflow-x:hidden!important;overscroll-behavior:contain;}
  .mobile-select-sheet__option{box-sizing:border-box;width:100%;max-width:100%;min-width:0;padding:10px 12px!important;border:1px solid #e1eaf2;border-radius:9px;background:#fff;overflow-wrap:anywhere;white-space:normal;}
  .mobile-select-sheet__option+.mobile-select-sheet__option{margin-top:4px;}
  .mobile-select-sheet__option.is-selected{border-color:#8bbfe0;background:#edf6fc;}
  .accgen-picker-panel:not([hidden]){box-sizing:border-box!important;max-width:100vw!important;left:0!important;right:0!important;overflow:hidden!important;}
  .accgen-picker-header,.accgen-picker-body,.accgen-picker-list{min-width:0;max-width:100%;box-sizing:border-box;}
}
/* 3. Do not allow preview tables or Admin cleanup's wide tables to widen the app or nav. */
#view-main-layout,.app-content,#view-admin,#admin-templates-panel,#templates-admin-detail,
#admin-cleanup-panel,#admin-cleanup-content,#admin-cleanup-panel .admin-cleanup-shell,
#admin-cleanup-panel .admin-cleanup-section{box-sizing:border-box;min-width:0;max-width:100%;}
#admin-cleanup-panel{overflow-x:clip;}
#admin-cleanup-panel :is(.admin-cleanup-table-wrap,.admin-cleanup-table-wrapper,.table-responsive){box-sizing:border-box;max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-x:contain;}
#view-admin #admin-section-tabs{max-width:100%;}
#templates-admin-detail .accgen-ui13-preview{max-width:100%;min-width:0;overflow-x:clip;}
#templates-admin-detail #tpl-preview-table-wrapper{box-sizing:border-box;width:100%;max-width:100%;min-width:0;overflow-x:clip!important;}
#templates-admin-detail #tpl-preview-table,#templates-admin-detail #tpl-preview-table tbody,
#templates-admin-detail #tpl-preview-table tbody tr{box-sizing:border-box;width:100%!important;max-width:100%!important;min-width:0!important;}
#templates-admin-detail #tpl-preview-table tbody td{box-sizing:border-box;min-width:0!important;max-width:100%!important;overflow-wrap:anywhere;}
@media(max-width:1050px){
  #templates-admin-detail #tpl-preview-table-wrapper{overflow:clip!important;}
  #templates-admin-detail #tpl-preview-table tbody tr{margin:0!important;}
  #templates-admin-detail #tpl-preview-table tbody td:nth-child(1),
  #templates-admin-detail #tpl-preview-table tbody td:nth-child(2){grid-column:1/-1!important;}
  #templates-admin-detail #tpl-preview-table tbody td:nth-child(3){grid-column:1!important;}
  #templates-admin-detail #tpl-preview-table tbody td:nth-child(4){grid-column:2!important;}
}
/* The navigation remains fixed to the viewport; do not alter its established iOS bottom offset. */
@media(max-width:767px){.app-nav{box-sizing:border-box;left:0!important;right:0!important;max-width:100vw!important;min-width:0!important;}}
/* 4. Company capture buttons use the exact same visible icons as Business. */
#company-ocr-actions .accgen-capture-btn{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;}
#company-ocr-actions .accgen-capture-btn__icon{display:inline-flex!important;flex:0 0 18px!important;align-items:center!important;justify-content:center!important;width:18px!important;height:18px!important;visibility:visible!important;opacity:1!important;}
#company-ocr-actions .accgen-capture-btn__icon svg{display:block!important;width:18px!important;height:18px!important;visibility:visible!important;opacity:1!important;stroke:currentColor;}
#company-ocr-actions .accgen-capture-btn__label{display:inline-block!important;white-space:normal!important;}
/* 5. A 701-1050px tablet must not mix a native table row group with grid cards.
      Keep mapping and preview at the same compact layout as 320-700px. */
@media(min-width:701px) and (max-width:1050px){
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table,
  #templates-admin-detail #tpl-preview-table{display:block!important;width:100%!important;min-width:0!important;max-width:100%!important;}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table thead,
  #templates-admin-detail #tpl-preview-table thead{display:none!important;}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody,
  #templates-admin-detail #tpl-preview-table tbody{display:grid!important;width:100%!important;min-width:0!important;max-width:100%!important;gap:8px;}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody tr.template-mapping-row,
  #templates-admin-detail #tpl-preview-table tbody tr{display:grid!important;width:100%!important;min-width:0!important;}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody tr.template-mapping-group-row{display:block!important;width:100%!important;}
  #templates-admin-detail .accgen-ui13-mapping #tpl-mapping-table tbody td.template-mapping-cell,
  #templates-admin-detail #tpl-preview-table tbody td{display:flex!important;min-width:0!important;max-width:100%!important;box-sizing:border-box;}
}

/* ACCGEN v18.13.3: scoped fixes verified against the v18.13.2 production source. */
/* The cleanup audit contains very wide data tables. Constrain every ancestor
   before the inner table scrolls; never allow document-level horizontal panning. */
@media(max-width:767px){
 html,body{max-width:100%;overflow-x:clip!important;}
 #view-main-layout{box-sizing:border-box!important;width:100%!important;max-width:100vw!important;min-width:0!important;overflow-x:clip!important;}
 #view-main-layout>.app-content{box-sizing:border-box!important;min-width:0!important;max-width:100%!important;}
 #view-admin{box-sizing:border-box!important;width:100%!important;max-width:100%!important;min-width:0!important;overflow-x:clip!important;}
 #view-admin #admin-cleanup-panel,
 #view-admin #admin-cleanup-panel .admin-cleanup-shell,
 #view-admin #admin-cleanup-panel #admin-cleanup-content,
 #view-admin #admin-cleanup-panel .admin-cleanup-section,
 #view-admin #admin-cleanup-panel .admin-cleanup-policy,
 #view-admin #admin-cleanup-panel .admin-cleanup-summary-grid,
 #view-admin #admin-cleanup-panel .admin-cleanup-eligibility-summary-grid,
 #view-admin #admin-cleanup-panel .admin-cleanup-toolbar{box-sizing:border-box!important;width:100%;min-width:0!important;max-width:100%!important;}
 #view-admin #admin-cleanup-panel :is(.admin-cleanup-table-wrap,.admin-cleanup-table-wrapper,.table-responsive){
   box-sizing:border-box!important;display:block;max-width:100%!important;min-width:0!important;
   overflow-x:auto!important;overflow-y:hidden;overscroll-behavior-x:contain;
 }
 #view-admin #admin-cleanup-panel .admin-cleanup-summary-card{min-width:0;max-width:100%;overflow-wrap:anywhere;}
}
/* Preview uses the same rich two-line record chooser as Generate documents,
   preserving the native #tpl-preview-sample and onchange contract. */
#templates-admin-detail .accgen-preview-picker-trigger{margin-top:0;box-sizing:border-box;min-width:0;max-width:100%;}
#templates-admin-detail .accgen-ui13-preview .form-group .mobile-select-trigger,
#templates-admin-detail .accgen-ui13-preview .form-group .mobile-select-trigger-wrap{display:none!important;}
#templates-admin-detail #tpl-preview-sample.accgen-preview-picker-native{position:absolute!important;width:1px!important;height:1px!important;opacity:0!important;pointer-events:none!important;}
.accgen-preview-picker-panel .accgen-picker-option{align-items:center;}
.accgen-preview-picker-panel .accgen-picker-option-title{font-weight:700;overflow-wrap:anywhere;}
.accgen-preview-picker-panel .accgen-picker-option-detail{color:#5d7289;overflow-wrap:anywhere;}
@media(max-width:767px){
 .accgen-preview-picker-panel:not([hidden]){box-sizing:border-box!important;max-width:100vw!important;width:100%!important;min-height:0!important;max-height:86dvh!important;left:0!important;right:0!important;overflow:hidden!important;}
 .accgen-preview-picker-panel .accgen-picker-header{flex:0 0 auto;min-width:0;}
 .accgen-preview-picker-panel .accgen-picker-body{min-height:0;flex:1 1 auto;}
 .accgen-preview-picker-panel .accgen-picker-list{min-height:0;overflow-y:auto;overscroll-behavior:contain;}
}

@supports not (overflow:clip){
 @media(max-width:767px){html,body,#view-main-layout,#view-admin{overflow-x:hidden!important;}}
}

/* v18.13.4: prevent horizontal gestures on wide Admin sections from panning
   the application shell. The Admin tab rail and table wrappers remain scrollable. */
@media(max-width:767px){
  html,body,#view-main-layout{overscroll-behavior-x:none!important;}
  #view-main-layout,.app-content,#view-admin,
  #admin-cleanup-panel,#admin-templates-panel,#templates-admin-detail{
    box-sizing:border-box!important;min-width:0!important;max-width:100%!important;
  }
  #view-admin #admin-section-tabs,
  #admin-cleanup-panel .admin-cleanup-table-wrap,
  #templates-admin-detail #tpl-mapping-table-wrapper,
  #templates-admin-detail #tpl-preview-table-wrapper{
    overscroll-behavior-x:contain!important;
  }
  #admin-cleanup-panel :is(.admin-cleanup-summary-card,.admin-cleanup-policy,
   .admin-cleanup-section,.admin-cleanup-section-header),
  #templates-admin-detail :is(.accgen-ui13-mapping,.accgen-ui13-preview){
    min-width:0!important;max-width:100%!important;overflow-wrap:anywhere;
  }
}


/* ACCGEN v18.13.5 — compact version-detail header; preserve all existing IDs. */
#templates-admin-detail .accgen-template-detail-header{
  box-sizing:border-box;min-width:0;margin:0 0 10px!important;padding:11px 12px 12px;
  border:1px solid #cfdfed;border-left:3px solid #005a9e;border-radius:12px;
  background:linear-gradient(115deg,#ecf7ff 0%,#f8fbff 68%,#fff 100%);
  box-shadow:0 2px 8px rgba(19,68,103,.045)
}
#templates-admin-detail .accgen-template-detail-back{
  align-self:flex-start;min-height:30px!important;margin:0 0 8px!important;
  padding:4px 8px!important;border:1px solid #cddfec!important;
  border-radius:7px!important;background:#fff!important;color:#245877!important;
  font-size:11px!important;font-weight:650;line-height:1.25
}
#templates-admin-detail .accgen-template-detail-kicker{
  margin:0 0 4px!important;font-size:9.5px!important;letter-spacing:.08em;
  line-height:1.25!important;color:#4f7794
}
#templates-admin-detail .accgen-template-detail-header h2{
  margin:0 0 8px!important;font-size:clamp(18px,4.8vw,23px)!important;
  line-height:1.23!important;letter-spacing:-.015em;color:#0d4267!important
}
#templates-admin-detail .accgen-template-detail-chips{gap:6px!important}
#templates-admin-detail .accgen-template-detail-status,
#templates-admin-detail .accgen-template-detail-subject{
  padding:4px 8px!important;border-radius:7px!important;font-size:10.5px!important;
  line-height:1.2!important
}
#templates-admin-detail .accgen-template-detail-card{
  min-width:0!important;margin:0 0 11px!important;padding:10px 12px!important;
  border-radius:12px!important;background:#fff;box-shadow:0 2px 10px rgba(17,54,86,.045)!important
}
#templates-admin-detail .accgen-template-detail-info{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;column-gap:12px!important
}
#templates-admin-detail .accgen-template-detail-field{
  gap:3px!important;padding:7px 0!important;margin:0!important;min-width:0
}
#templates-admin-detail .accgen-template-detail-field label{
  font-size:10px!important;line-height:1.25!important;letter-spacing:.005em
}
#templates-admin-detail .accgen-template-detail-field>div{
  font-size:12.5px!important;font-weight:650;line-height:1.3!important;min-width:0;overflow-wrap:anywhere
}
#templates-admin-detail .accgen-template-detail-field--source{
  padding:9px 0 7px!important;border-bottom:0!important
}
#templates-admin-detail .accgen-template-detail-field--source>div{
  padding:7px 9px!important;font-size:11.5px!important;font-weight:500!important;
  background:#f4f8fb!important;border:1px solid #e6edf4;border-radius:7px
}
#templates-admin-detail #tpl-source-controls,
#templates-admin-detail #tpl-lifecycle-controls{
  margin-top:8px!important;padding-top:10px!important;border-top:1px solid #e7edf3!important
}
#templates-admin-detail #tpl-lifecycle-controls>div{
  display:flex!important;flex-wrap:wrap!important;align-items:center!important;
  justify-content:space-between!important;gap:8px!important
}
#templates-admin-detail #tpl-lifecycle-controls>div>div{min-width:0!important;max-width:100%}
#templates-admin-detail #tpl-lifecycle-controls>div>div:first-child{flex:1 1 155px!important}
#templates-admin-detail #tpl-lifecycle-controls>div>div:nth-child(2){flex:0 1 auto!important}
#templates-admin-detail #tpl-lifecycle-controls>div>div:first-child>div{font-size:12px;font-weight:750!important;color:#194e72;margin:0 0 2px!important}
#templates-admin-detail #tpl-lifecycle-help{font-size:10.5px;line-height:1.4;color:#657d91!important;display:block;max-width:100%}
#templates-admin-detail #tpl-lifecycle-controls .btn{
  min-height:36px!important;padding:7px 11px!important;margin:0!important;border-radius:8px;
  font-size:11.5px!important
}
@media(max-width:420px){
  #templates-admin-detail .accgen-template-detail-header{padding:10px 11px 11px!important}
  #templates-admin-detail .accgen-template-detail-card{padding:9px 11px!important}
  #templates-admin-detail .accgen-template-detail-field{padding:6px 0!important}
  #templates-admin-detail .accgen-template-detail-field>div{font-size:12px!important}
  #templates-admin-detail #tpl-lifecycle-controls>div{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important}
  #templates-admin-detail #tpl-lifecycle-controls>div>div:first-child{min-width:0!important;flex:none!important}
  #templates-admin-detail #tpl-lifecycle-controls .btn{white-space:normal!important}
}
/* v18.13.5 — prevent Admin panels and the fixed nav from acquiring page width
   from descendant data tables; authorized inner scrollers retain overflow:auto. */
@media(max-width:767px){
  body.accgen-admin-active,body.accgen-admin-active #view-main-layout,
  body.accgen-admin-active #view-main-layout>.app-content,
  body.accgen-admin-active #view-admin{
    box-sizing:border-box!important;min-width:0!important;max-width:100%!important;
    overflow-x:clip!important;overscroll-behavior-x:none!important
  }
  body.accgen-admin-active #view-main-layout{width:100%!important;max-width:100vw!important}
  body.accgen-admin-active #view-admin :is(#admin-templates-panel,#templates-admin-detail,
    #admin-cleanup-panel,.admin-cleanup-shell,#admin-cleanup-content,
    .admin-cleanup-section,.admin-cleanup-policy,.admin-cleanup-summary-grid,
    .admin-cleanup-eligibility-summary-grid){box-sizing:border-box!important;min-width:0!important;max-width:100%!important}
  body.accgen-admin-active .app-nav{
    box-sizing:border-box!important;left:0!important;right:0!important;
    width:100%!important;max-width:100vw!important;overflow-x:hidden!important
  }
  body.accgen-admin-active #view-admin #admin-section-tabs,
  body.accgen-admin-active #admin-cleanup-panel .admin-cleanup-table-wrap,
  body.accgen-admin-active #templates-admin-detail #tpl-mapping-table-wrapper,
  body.accgen-admin-active #templates-admin-detail #tpl-preview-table-wrapper{
    max-width:100%!important;min-width:0!important;overscroll-behavior-x:contain!important
  }
}
/* The older mobile .accgen-ui13-lifecycle>div{display:grid!important} also matched
   the hidden message, reserving empty space below the lifecycle action. */
#templates-admin-detail #tpl-lifecycle-msg[style*="display: none"],
#templates-admin-detail #tpl-source-msg[style*="display: none"]{
  display:none!important;margin:0!important;padding:0!important;border:0!important
}

/* v18.13.6 — Only the user-reported vertical-only Admin sections are guarded.
   Do not change legitimate horizontal scrolling in the Admin tabs and wide tables. */
@media (max-width:767px){
  #view-admin #templates-admin-detail #tpl-preview-table-wrapper,
  #view-admin #admin-cleanup-panel .admin-cleanup-summary-grid,
  #view-admin #admin-old-record-section .admin-cleanup-eligibility-controls,
  #view-admin #admin-old-record-section .admin-cleanup-eligibility-summary-grid,
  #view-admin #admin-old-record-section .admin-cleanup-batch-toolbar,
  #view-admin #admin-old-record-section .admin-cleanup-section-header{
    box-sizing:border-box!important;max-width:100%!important;min-width:0!important;
    overflow-x:clip!important;overscroll-behavior-x:none!important;touch-action:pan-y!important;
  }
  #view-admin #admin-cleanup-panel .admin-cleanup-summary-grid,
  #view-admin #admin-old-record-section .admin-cleanup-eligibility-summary-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;width:100%!important;
  }
  #view-admin #admin-cleanup-panel .admin-cleanup-summary-grid>* ,
  #view-admin #admin-old-record-section .admin-cleanup-eligibility-summary-grid>*{
    box-sizing:border-box!important;min-width:0!important;max-width:100%!important;
    overflow-wrap:anywhere;
  }
  #view-admin #admin-old-record-section .admin-cleanup-eligibility-controls>*{
    min-width:0!important;max-width:100%!important;
  }
}


/* v18.13.7: Hidden mobile native selects must not be expanded by Admin form widths.
   Only override the two controls confirmed to cause viewport overflow on phones.
   Visible mobile-select-trigger buttons and native desktop selects are unchanged. */
@media(max-width:767px){
 #view-admin #templates-admin-detail #tpl-mapping-table select.template-mapping-select.mobile-select-native,
 #view-admin #admin-cleanup-panel select#admin-old-record-entity-type.mobile-select-native{
   position:absolute!important;box-sizing:border-box!important;
   width:1px!important;min-width:1px!important;max-width:1px!important;
   height:1px!important;min-height:1px!important;max-height:1px!important;
   margin:0!important;padding:0!important;border:0!important;
   opacity:0!important;pointer-events:none!important;clip-path:inset(50%)!important;
 }
}
