/* v1.86: one mobile presentation policy; desktop and print keep full columns. */
.mob-scroll,.mob-name{display:contents}
.mob-detail,.mob-jv-total,.mob-jv-bar{display:none}
@media screen and (max-width:900px){
  .dk-main,.dk-view,.card,.sec,.fld,.fgrid>*,main.page,main.page .grid>*{min-width:0;max-width:100%}
  .dk-view .kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kpi{padding:12px 10px}.kpi .v{font-size:16px;white-space:nowrap}
  .mob-scroll{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .mob-table{width:100%;min-width:0!important;table-layout:fixed}
  .mob-table .hm,main.page .mob-table .hm{display:none!important}
  .mob-table colgroup{display:none}
  .mob-table col{width:auto!important}
  .mob-table th,.mob-table td{padding:12px 8px;min-width:0!important;max-width:100%;overflow-wrap:anywhere}
  .mob-table th{white-space:normal}
  .mob-table td.r,.mob-table td.text-right,.mob-table .mob-amount{white-space:nowrap;overflow-wrap:normal;font-variant-numeric:tabular-nums}
  .mob-table td.mob-summary-label{white-space:normal;overflow-wrap:anywhere}
  .mob-table[data-mobile-columns="2"] .mob-amount{width:46%}
  .mob-table[data-mobile-columns="3"] .mob-amount{width:30%}
  .mob-name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere;white-space:normal;max-height:2.9em}
  .mob-detail{display:flex;gap:2px;align-items:center;font-size:10px;font-weight:400;color:var(--muted,#7c7c7c);white-space:normal;line-height:1.35}
  .mob-table:has(.mob-detail) td:first-child{width:44%}
  .mob-table:has(.mob-detail) thead tr:first-child th:first-child{width:44%}
  .mob-sample{min-width:540px!important;table-layout:auto}.mob-sample th,.mob-sample td{white-space:nowrap;overflow-wrap:normal}
  .mob-donor{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mob-detail>span:last-child{flex-shrink:0;white-space:nowrap}
  .mob-table .pill,.mob-table .badge{font-size:10px;padding:3px 6px}
  .mob-table tr.col-flt th{padding:4px 6px 8px}
  .mob-table .cf,.col-flt-inp{height:40px;min-width:0}
  .lfoot,.lpg{flex-wrap:wrap;gap:8px;padding:12px 10px}
  .lpg-b button{min-height:40px}
  .dk-ov{grid-template-columns:minmax(0,1fr);padding:12px}
  .dk-dlg,.dk-dlg:has(.dlg-form){width:100%;max-width:100%;min-width:0;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);display:flex;flex-direction:column}
  .dk-dlg .dh{padding:12px 14px;align-items:center;flex-shrink:0;overflow-wrap:anywhere}
  .dk-dlg .db{padding:14px;overflow-y:auto;min-height:0;min-width:0;overflow-wrap:anywhere}
  .dk-dlg .df{padding:12px 14px;flex-shrink:0}
  .dk-dlg .fgrid,.fgrid,.fgrid.fg3,.fgrid.fg4{grid-template-columns:minmax(0,1fr)}
  .dk-dlg .dh button,.dk-dlg .btn,.dk-main .btn,.dk-drw .btn,main.page .btn{min-height:40px}
  .dk-dlg .dh button{min-width:40px}
  .dk-main .inp,.dk-dlg .inp,.dk-main .sel-btn,.dk-dlg .sel-btn{min-height:40px}
  .dk-main .dfld .cal,.dk-dlg .dfld .cal{height:40px;width:40px;top:0}
  .xh-chip{max-width:100%;white-space:normal}.xh-chip button{min-height:40px;min-width:40px;flex-shrink:0}
  .dk-dlg .db a:has(svg),.dk-dlg .btn:has(svg){display:inline-flex;align-items:center;gap:6px}
  .dk-dlg svg{flex-shrink:0}
  .dk-nav .dk-burger,.dk-nav .dk-mbtn,.dk-nav .dk-av,.dk-nav .dk-mact .btn,.topbar .icon-btn,.topbar .avatar-btn{position:relative}
  .dk-nav .dk-burger:before,.dk-nav .dk-mbtn:before,.dk-nav .dk-av:before,.dk-nav .dk-mact .btn:before,.topbar .icon-btn:before,.topbar .avatar-btn:before{content:'';position:absolute;left:50%;top:50%;width:max(100%,40px);height:max(100%,40px);transform:translate(-50%,-50%)}
  main.page label:has(input[type=checkbox]),.dk-view label:has(input[type=checkbox]){min-height:40px}
  .dk-main .wlinks a,.dk-side a,main.page .side-link{min-height:40px}
  .mob-entry{display:block;min-width:0!important;width:100%;table-layout:auto}
  .mob-entry colgroup{display:none}
  .mob-entry thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
  .mob-entry tbody,.mob-entry tfoot{display:block;width:100%}
  .mob-entry tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid #ededed;border-radius:8px;padding:8px;margin-bottom:12px}
  .mob-entry tbody td,.mob-entry tbody td.fd,.mob-entry tbody td.am{display:block;min-width:0!important;width:auto!important;border:0;padding:6px;white-space:normal}
  .mob-entry tbody td:has(.sel),.mob-entry tbody td:has(select),.mob-entry tbody td:has(textarea),.mob-entry tbody td:has(input[name=memo]),.mob-entry tbody td:has(input[name=note]),.mob-entry tbody td:has(input[name='account_id[]']),.mob-entry tbody td:has(input[name='account[]']){grid-column:1/-1}
  .mob-entry tbody td[data-mobile-label='Account'],.mob-entry tbody td[data-mobile-label='Fund']{grid-column:1/-1}
  .mob-entry tbody td.am{white-space:nowrap;overflow-wrap:normal}
  .mob-entry tbody td[data-mobile-label]:before{content:attr(data-mobile-label);display:block;text-align:left;margin-bottom:5px;color:#525252;font-size:12px}
  .mob-entry input,.mob-entry .sel,.mob-entry .ss-wrap,.mob-entry .mny{width:100%!important;min-width:0!important;max-width:100%;box-sizing:border-box}
  .mob-entry tbody td.x{grid-column:2;grid-row:1;text-align:right;justify-self:end;width:auto}
  .mob-entry .je-del,.mob-entry button{min-height:40px;min-width:40px}
  .mob-entry tfoot tr{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
  .mob-entry tfoot td{width:auto!important;min-width:0!important;border:0}
  .je-wrap:has(.mob-entry){overflow:visible;border:0}
  .mob-jv-page{padding-bottom:110px}
  .mob-jv-bar{position:fixed;left:0;right:0;bottom:0;z-index:45;background:#fff;border-top:1px solid #e5e5e5;box-shadow:0 -3px 12px #0000000a;padding:10px 14px calc(10px + env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px}
  .mob-jv-total{display:flex;flex-direction:column;min-width:0;font-size:12px}.mob-jv-total span{color:#7c7c7c}.mob-jv-total b{font-variant-numeric:tabular-nums;white-space:nowrap;font-size:14px}
  .mob-jv-bar .je-diff{grid-column:1/-1;margin:0;font-size:12px;white-space:normal}
  .mob-jv-difference{grid-column:1/-1;flex-direction:row;justify-content:space-between;align-items:center}
  main.page .flex:not(.flex-nowrap){flex-wrap:wrap}
  main.page form.grid,main.page form .grid{grid-template-columns:minmax(0,1fr)!important}
  main.page form [class*='col-span-']{grid-column:1/-1!important}
  main.page form.flex{flex-direction:column;align-items:stretch;width:100%}
  main.page form.flex>*,main.page form .inp,main.page form .ss-wrap{max-width:100%;min-width:0}
  main.page form.flex>[class*='w-']{width:100%!important}
  main.page .card{min-width:0;overflow-x:visible}
  main.page input:not([type=checkbox]):not([type=radio]),main.page select,main.page .ss-btn{min-height:40px;font-size:16px}
  main.page .text-2xl{font-size:19px;overflow-wrap:anywhere}
  main.page .text-xl{font-size:18px;overflow-wrap:anywhere}
  main.page .grid{grid-template-columns:minmax(0,1fr)}
  main.page .grid-cols-2:not(form){grid-template-columns:repeat(2,minmax(0,1fr))}
  main.page .break-all{overflow-wrap:anywhere}
  main.page pre{max-width:100%;overflow-x:auto}
}
@media screen and (min-width:901px){main.page .mob-table .hm{display:table-cell}}
@media print{
  .mob-table .hm,main.page .mob-table .hm{display:table-cell!important}
  .mob-scroll,.mob-name{display:contents!important}
  .mob-detail,.mob-jv-total{display:none!important}
}

/* Voucher detail retains the read-only grid; editable JV cards are unchanged. */
.vc-mobile-totals{display:none}
@media screen and (max-width:900px){
  .je-wrap:has(.je.ro){overflow-x:auto;max-width:100%;border:1px solid #ececec}
  .je.ro{display:table;width:720px;min-width:720px;table-layout:fixed}
  .je.ro th,.je.ro td{padding:10px;white-space:nowrap}
  .je.ro th.ix,.je.ro td.ix{position:sticky;left:0;width:40px;min-width:40px;background:#fff;z-index:2;vertical-align:middle;padding:10px 6px}
  .je.ro th:nth-child(2),.je.ro tbody td:nth-child(2){position:sticky;left:40px;width:180px;min-width:180px;max-width:180px;font-weight:600;background:#fff;z-index:2;border-right:1px solid #e5e5e5;overflow:hidden;text-overflow:ellipsis}
  .je.ro thead th.ix,.je.ro thead th:nth-child(2){background:#fafafa;z-index:3}
  .je.ro .fd{width:180px}.je.ro .am{width:160px}
  .je.ro .sm{font-weight:400;overflow:hidden;text-overflow:ellipsis}
  .je.ro tfoot{display:none}
  .vc-mobile-totals{display:grid;gap:14px;margin-top:18px}
  .vc-mobile-totals>div{display:grid;gap:6px;font-size:12px;color:#525252}
  .vc-mobile-totals b{display:block;padding:10px;background:#fafafa;border:1px solid #efefef;border-radius:7px;font-weight:500;color:#171717;white-space:nowrap}
}

/* New Voucher: compact mobile cards; desktop rules stay unchanged. */
@media screen and (max-width:900px){
  .mob-jv-compact .sec{padding:12px 14px}
  .mob-jv-compact .fgrid{gap:10px}
  .mob-jv-compact .sech{margin-bottom:9px}
  .mob-jv-compact #je.mob-entry tbody tr{position:relative;padding:6px;margin-bottom:8px;gap:0}
  .mob-jv-compact #je.mob-entry tbody td{padding:4px 6px}
  .mob-jv-compact #je.mob-entry tbody td.ix{display:flex;grid-column:1/-1;align-items:center;gap:3px;height:36px;padding-right:48px;color:#7c7c7c;font-size:12px}
  .mob-jv-compact #je.mob-entry tbody td.ix:before{content:'Line';display:inline;margin:0;font:inherit;color:inherit}
  .mob-jv-compact #je.mob-entry tbody td.x{position:absolute;right:4px;top:4px;grid-column:auto;grid-row:auto;width:40px!important;padding:0}
  .mob-jv-compact #je.mob-entry tbody td.x:before{display:none}
  .mob-jv-compact #je.mob-entry .je-del{display:grid;place-items:center;width:40px;height:40px;min-width:40px;min-height:40px;padding:0;color:#e03434}
  .mob-jv-compact #je.mob-entry tbody td[data-mobile-label]:not(.ix):before{margin-bottom:4px}
  .mob-jv-compact .jv-account-tools{display:flex;align-items:center;gap:6px}
  .mob-jv-compact .jv-account-tools>.sel{flex:1;min-width:0}
  .mob-jv-compact .jv-account-tools>.je-note{position:relative;display:grid;place-items:center;flex-shrink:0;width:40px;height:40px;min-width:40px;min-height:40px;padding:0;border:1px solid #ededed;border-radius:6px;background:#fafafa;color:#7c7c7c;cursor:pointer}
  .mob-jv-compact .jv-account-tools>.je-note.has-note{color:#2563eb;border-color:#93baf0;background:#eff6ff}
  .mob-jv-compact .je-note.has-note:after{content:'';position:absolute;right:3px;top:3px;width:5px;height:5px;background:#2563eb;border-radius:50%}
  .mob-jv-compact .je-memo{display:none}
  .mob-jv-compact tr.note-open .je-memo{display:block;margin-top:5px}
  .mob-jv-compact .sel-btn,.mob-jv-compact .inp{min-height:40px}
  .mob-jv-compact #je.mob-entry tfoot td:first-child,.mob-jv-compact #je.mob-entry tfoot td.am,.mob-jv-compact #je.mob-entry tfoot td:last-child{display:none}
  .mob-jv-compact #je.mob-entry tfoot td{padding:3px 0}
  .mob-jv-compact #je-diff{margin-top:5px}
  .mob-jv-compact .help{font-size:11px;margin-top:4px}
  .mob-jv-compact textarea{min-height:50px}
  .mob-jv-compact #mob-t-diff.mob-diff-unbalanced{color:#e03434}
  .mob-jv-compact #mob-t-diff.mob-diff-balanced{color:var(--green)}
}
