/* Chat workspaces must stay inside the main content panel; the application shell's
   generic fixed `aside` rule is intentionally neutralized for topic navigation. */
.messages-shell{padding:0;overflow:hidden}
.messages-shell .message-toolbar{margin:0;padding:20px 22px;border-bottom:1px solid var(--line);background:#fff}
.messages-shell .message-workspace{border:0;border-radius:0;box-shadow:none}
.message-workspace{position:relative;display:grid;grid-template-columns:minmax(250px,320px) minmax(0,1fr);align-items:stretch;width:100%;min-width:0;max-width:100%;max-height:80dvh;margin:0;padding:0;overflow:hidden;background:#fff}
.message-workspace>.message-topics{position:static!important;z-index:auto!important;inset:auto!important;width:auto!important;height:auto;min-width:0;max-height:none;margin:0!important;padding:18px;align-self:stretch;justify-content:flex-start;overflow:hidden;border:0;border-right:1px solid var(--line);background:#f7f8fc}
.message-topics .new-topic-form{flex:0 0 auto}
.message-topics h2{flex:0 0 auto;margin:0}
.message-topic-list{flex:1 1 auto;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.message-topic{flex:0 0 auto}
.message-topic>span{display:block;margin-top:4px;color:var(--muted);font-size:.82rem;line-height:1.25}
.message-workspace>.conversation-main{display:flex;min-width:0;min-height:560px;max-height:80dvh;overflow:hidden;flex-direction:column;background:#fff}
.conversation-main>.chat-thread{flex:1 1 auto;min-height:300px;max-height:none;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.conversation-main>.chat-compose-panel,.rental-chat>.chat-compose-panel{flex:0 0 auto;width:100%;margin:0;padding:16px 18px;border-top:1px solid var(--line);background:#fff}
.chat-compose-form{display:grid!important;width:100%;min-width:0;grid-template-columns:minmax(0,1fr) auto!important;gap:12px;align-items:end}
.chat-compose-form>.chat-message-input{grid-column:1/-1;width:100%;min-width:0}
.chat-compose-form>.chat-message-input textarea{display:block;width:100%;min-height:108px;resize:vertical}
.chat-compose-form>.chat-attachment{grid-column:1;min-width:0;width:100%}
.chat-compose-form>.chat-attachment input{width:100%}
.chat-compose-form>button{grid-column:2;min-height:46px;white-space:nowrap}
.property-chat-compose>.chat-tenancy-input{grid-column:1/-1;width:100%}
.rental-chat>.chat-thread{max-height:80dvh;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}

/* A short collection keeps its natural height. Once a data-heavy region would
   exceed 80% of the viewport, it scrolls internally instead of stretching the page. */
.table-wrap,.data-scroll-region{max-height:80dvh;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable}
.table-wrap>table thead{position:sticky;z-index:1;top:0;background:#fff}
.utility-identifier-groups{display:grid;gap:18px;margin:0 0 24px;padding-right:4px}
.utility-group{overflow:hidden;border:1px solid var(--line);border-radius:18px;background:#f7f9fd}
.utility-group>h3{margin:0;padding:16px 18px;border-bottom:1px solid var(--line);background:#edf2ff;color:var(--ink)}
.utility-supplier-group{display:grid;gap:12px;padding:16px 18px}
.utility-supplier-group+.utility-supplier-group{border-top:1px solid var(--line)}
.utility-supplier-group>h4{margin:0;color:var(--muted);font-size:.92rem;letter-spacing:.02em}
.utility-identifier-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,360px),1fr));gap:12px;margin:0}
.utility-identifier-card{display:grid;gap:12px;padding:16px;border:1px solid var(--line);border-radius:14px;background:#fff}
.utility-identifier-card.historical{background:#f5f6f9;color:var(--muted)}
.utility-identifier-summary{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.utility-identifier-summary>div{display:grid;gap:5px;min-width:0}
.utility-identifier-summary code{overflow-wrap:anywhere;color:inherit;font:600 .95rem/1.35 ui-monospace,SFMono-Regular,Menlo,monospace}
.utility-identifier-summary .badge{flex:0 0 auto}
.utility-identifier-summary .origin-manual{background:#e7f8f2;color:#08785e}
.utility-identifier-summary .origin-invoice_import{background:#eaf0ff;color:#3158c7}
.utility-identifier-summary .origin-legacy{background:#f0f1f4;color:#626b7f}
.matching-disabled{color:#b42338}
.utility-identifier-controls{display:flex!important;flex-direction:column;align-items:flex-end;gap:7px!important}
.identifier-switch-form{margin:0}
.identifier-switch{position:relative;display:block;width:60px;height:28px;padding:0;border:0;border-radius:999px;color:#fff;box-shadow:inset 0 2px 4px rgba(13,25,50,.24);cursor:pointer;transition:background .2s ease,box-shadow .2s ease}
.identifier-switch.is-on{background:linear-gradient(135deg,#38b82e,#75d85e)}
.identifier-switch.is-off{background:linear-gradient(135deg,#db3e2d,#f27668)}
.identifier-switch i{position:absolute;top:3px;width:22px;height:22px;border-radius:50%;background:linear-gradient(#fff,#dfe2e8);box-shadow:0 2px 4px rgba(16,24,40,.42);transition:left .2s ease}
.identifier-switch.is-on i{left:35px}.identifier-switch.is-off i{left:3px}
.identifier-switch span{position:absolute;top:0;display:flex;height:28px;align-items:center;font-size:.61rem;font-weight:800;letter-spacing:.03em}
.identifier-switch .switch-on{left:8px}.identifier-switch .switch-off{right:6px}
.identifier-switch.is-on .switch-off,.identifier-switch.is-off .switch-on{visibility:hidden}
.identifier-switch:hover{filter:saturate(1.1);box-shadow:inset 0 2px 5px rgba(13,25,50,.28),0 0 0 3px rgba(78,102,235,.12)}
.identifier-switch:focus-visible{outline:3px solid rgba(78,102,235,.35);outline-offset:3px}
.identifier-remove-form{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-top:18px;padding-top:16px;border-top:1px solid #f3c3c7}
.identifier-remove-form .check{flex:1;margin:0}
.utility-identifier-add{padding-top:20px;border-top:1px solid var(--line)}
.utility-identifier-card details{border-top:1px solid var(--line);padding-top:12px}
.utility-identifier-card summary{width:max-content;list-style:none}
.utility-identifier-card summary::-webkit-details-marker{display:none}
.utility-identifier-card details[open] summary{margin-bottom:14px}
@media(max-width:700px){.utility-supplier-group{padding:14px}.utility-identifier-summary{align-items:stretch;flex-direction:column}.utility-identifier-summary .badge{width:max-content}.utility-identifier-controls{align-items:flex-start}.identifier-remove-form{align-items:stretch;flex-direction:column}}
.batch-file-picker{display:grid;gap:8px;max-width:680px;margin-bottom:18px}
.batch-invoice-panel{display:grid;grid-template-columns:minmax(0,1fr);gap:18px;align-items:start}
.batch-invoice-panel>.section-head,.batch-invoice-panel>.batch-file-picker{grid-column:1/-1}
.batch-invoice-panel>[data-batch-table],.batch-invoice-panel>.batch-import-actions,.batch-invoice-panel>.batch-preview{grid-column:1/-1}
.batch-invoice-panel [data-batch-table]{max-height:80dvh;overflow:auto}
.batch-invoice-panel,[data-cost-form]{position:relative}
.invoice-processing-overlay{position:absolute;inset:0;z-index:30;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.8rem;min-height:10rem;border-radius:inherit;background:rgba(248,250,255,.9);color:var(--ink,#17213b);text-align:center;cursor:progress;backdrop-filter:blur(2px)}
.invoice-processing-overlay[hidden]{display:none!important}
.processing-hourglass{display:block;font-size:2.4rem;line-height:1;animation:processing-hourglass 1.2s ease-in-out infinite}
@keyframes processing-hourglass{0%,100%{transform:rotate(0deg) scale(1)}50%{transform:rotate(180deg) scale(1.08)}}
.batch-preview{position:sticky;top:18px;min-width:0;padding:14px;border:1px solid var(--line);border-radius:18px;background:#f7f8fc}
.batch-preview object,.batch-preview img{display:block;width:100%;height:68dvh;object-fit:contain;border:0;border-radius:10px;background:#fff}
.batch-import-actions{display:flex;align-items:center;justify-content:flex-end;gap:16px;margin-top:14px}.batch-status{display:inline-flex;align-items:center;gap:5px}.batch-status.warning{color:var(--danger,#c83248);font-weight:800}.batch-invoice-panel input[data-batch-select]{width:20px;height:20px;accent-color:var(--primary)}
.batch-review-actions{display:flex;justify-content:flex-end;gap:10px}.batch-review-actions .primary,.batch-review-actions .secondary{min-width:150px}
.warning-row{background:#fff1f2}
.invoice-queue{display:flex;align-items:stretch;gap:12px;overflow-x:auto;padding:3px 3px 10px}.invoice-queue [data-batch-table]{flex:0 0 auto;overflow:visible;max-height:none}.invoice-queue table{display:block;min-width:0}.invoice-queue thead{display:none}.invoice-queue tbody{display:flex;gap:12px}.invoice-queue tr{position:relative;display:grid;grid-template-columns:1fr auto;grid-template-rows:auto auto auto auto;width:210px;min-height:190px;padding:14px;border:1px solid var(--line);border-radius:15px;background:#fff;cursor:pointer;box-shadow:0 5px 16px rgba(29,43,82,.05)}.invoice-queue tr::before{content:'🧾';grid-column:1/-1;display:grid;place-items:center;width:42px;height:42px;margin:0 auto 8px;border-radius:12px;background:#eef1f8;font-size:1.35rem}.invoice-queue tr.active{border-color:var(--primary);box-shadow:0 0 0 3px rgba(82,105,232,.12)}.invoice-queue tr.warning-row::after{content:'!';position:absolute;right:10px;top:10px;display:grid;place-items:center;width:24px;height:24px;border-radius:50%;background:var(--danger);color:#fff;font-weight:900}.invoice-queue td{display:none;padding:2px;border:0;min-width:0}.invoice-queue td:nth-child(1){display:block;position:absolute;left:10px;top:10px}.invoice-queue td:nth-child(2){display:block;grid-column:1/-1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:800;text-align:center}.invoice-queue td:nth-child(3),.invoice-queue td:nth-child(4),.invoice-queue td:nth-child(9),.invoice-queue td:nth-child(10){display:block;grid-column:1/-1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;font-size:.74rem}.invoice-queue td:nth-child(3){color:var(--muted)}.invoice-queue td:nth-child(9){white-space:normal}.invoice-queue td:nth-child(10) .button{width:100%;margin-top:5px;padding:7px 9px}.invoice-add-tile{flex:0 0 210px;min-height:190px;margin:0;place-content:center;justify-items:center;padding:16px;border:2px dashed #b9c3d7;border-radius:15px;background:#f8f9fc;color:var(--muted);cursor:pointer;text-align:center}.invoice-add-tile>span{font-size:2rem;color:var(--primary)}.invoice-add-tile input{position:absolute;width:1px;height:1px;opacity:0}.invoice-add-tile:hover,.invoice-add-tile:focus-within{border-color:var(--primary);background:#f0f2ff;color:var(--primary-dark)}.batch-select-all{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;margin-right:auto;border:1px solid var(--line);border-radius:11px;background:#fff;cursor:pointer}.batch-select-all:hover,.batch-select-all:focus-within{border-color:var(--primary);background:#f0f2ff;outline:3px solid rgba(82,105,232,.12)}.multi-select-icon{position:relative;width:27px;height:24px}.multi-select-icon,.multi-select-icon::before,.multi-select-icon::after{display:block;border:2px solid #778198;border-radius:4px;background:#fff}.multi-select-icon{width:17px;height:15px;margin:0 0 0 10px}.multi-select-icon::before,.multi-select-icon::after{content:'';position:absolute;width:13px;height:11px}.multi-select-icon::before{right:5px;top:3px}.multi-select-icon::after{right:10px;top:8px}.batch-select-all input:checked+.multi-select-icon,.batch-select-all input:checked+.multi-select-icon::before,.batch-select-all input:checked+.multi-select-icon::after{border-color:var(--primary);background:#e8ecff}.batch-import-actions{flex-wrap:wrap}[data-batch-review-shell]>.panel{margin-top:18px}[data-batch-review-shell] .invoice-import-top{grid-template-columns:1fr}[data-batch-review-shell] .invoice-import-top>label{display:none}

.invoice-queue tr{width:154px;min-height:142px;padding:9px;border-radius:13px;box-shadow:0 4px 12px rgba(29,43,82,.05)}
.invoice-queue tr::before{width:30px;height:30px;margin-bottom:5px;border-radius:9px;font-size:.95rem}
.invoice-queue td:nth-child(2){font-size:.7rem;font-weight:700}
.invoice-queue td:nth-child(3),.invoice-queue td:nth-child(4),.invoice-queue td:nth-child(9),.invoice-queue td:nth-child(10){font-size:.65rem}
.invoice-queue td:nth-child(10) .button{margin-top:3px;padding:5px 7px;font-size:.65rem}
.invoice-add-tile{display:grid;flex-basis:154px;min-height:142px;gap:5px;padding:10px;border-radius:13px;font:inherit}
.invoice-add-tile>span{font-size:1.2rem}.invoice-add-tile>strong{font-size:.72rem;line-height:1.25}.invoice-manual-tile{appearance:none}

[data-batch-review-shell] .invoice-import-top>label{display:none!important}
[data-batch-review-shell] .invoice-import-top{display:block;padding:0;border:0;background:transparent}
[data-batch-review-shell] .invoice-preview{width:100%;margin-bottom:18px}
.invoice-workspace-head{align-items:center}.invoice-workspace-head .batch-import-actions{margin:0 0 0 auto}
.batch-select-all{position:relative}.batch-select-all::after{content:'✓';position:absolute;right:5px;bottom:4px;display:none;place-items:center;width:16px;height:16px;border-radius:50%;background:var(--primary);color:#fff;font-size:.7rem;font-weight:900;line-height:1}.batch-select-all:has(input:checked)::after,.batch-select-all.selection-active::after{display:grid}
.invoice-queue tr,.invoice-add-tile{height:142px;min-height:142px;max-height:142px;overflow:hidden}
[data-batch-review-shell] .invoice-preview object,[data-batch-review-shell] .invoice-preview img{height:min(70dvh,760px);object-fit:contain}

.clickable-detail-row{cursor:pointer;transition:background-color .15s,box-shadow .15s}.clickable-detail-row:hover,.clickable-detail-row:focus-visible{background:#f4f6ff;box-shadow:inset 3px 0 0 var(--primary);outline:none}.clickable-detail-row td:last-child{white-space:nowrap}.clickable-row-chevron{display:inline-grid;place-items:center;margin-left:10px;color:var(--primary);font-size:1.35rem;font-weight:800;vertical-align:middle}

.property-document-upload{display:flex;align-items:end;gap:12px;flex-wrap:wrap}.property-document-upload>label:first-of-type{flex:1 1 220px}.inventory-assignment-picker{position:relative;flex:0 1 auto;min-width:150px}.inventory-assignment-picker>summary{height:44px;display:flex;align-items:center;gap:8px;padding:0 13px;border:1px solid #ccd3e0;border-radius:10px;background:#fff;color:#3e4960;font-size:.84rem;font-weight:700;cursor:pointer;list-style:none}.inventory-assignment-picker>summary::-webkit-details-marker{display:none}.inventory-assignment-picker>summary::after{content:'›';margin-left:auto;color:var(--primary);font-size:1.15rem;transition:transform .15s}.inventory-assignment-picker[open]{display:flex;align-items:end;gap:10px;flex:1 1 420px}.inventory-assignment-picker[open]>summary::after{transform:rotate(180deg)}.inventory-assignment-picker>label{display:none;flex:1;min-width:220px}.inventory-assignment-picker[open]>label{display:grid}.compact-document-picker{flex:1 1 250px}.property-document-upload .compact-document-picker.upload-drop-label{min-height:44px!important;height:44px;padding:5px 10px!important;display:flex!important;align-items:center;justify-content:flex-start;overflow:hidden}.property-document-upload .compact-document-picker .upload-drop-prompt{display:flex;grid-template-columns:none;align-items:center;gap:8px;min-width:0}.property-document-upload .compact-document-picker .upload-drop-prompt>strong{width:30px;height:30px;flex:0 0 30px;border-radius:8px;font-size:1rem}.property-document-upload .compact-document-picker [data-drop-title]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:.78rem}.property-document-upload .compact-document-picker [data-drop-files],.property-document-upload .compact-document-picker>small{display:none}.property-document-upload>.check{flex:1 1 100%;max-width:none}.property-document-upload>.actions{margin-left:auto}

.topic-input-row{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:8px;align-items:end}.topic-input-row>label:first-child{min-width:0}.topic-type-switch{display:grid!important;place-items:center;width:44px;height:44px;padding:0;border:1px solid var(--line);border-radius:10px;background:#fff;cursor:pointer;transition:.15s}.topic-type-switch>input{position:absolute;width:1px;height:1px;opacity:0}.topic-type-icon{display:grid;place-items:center;width:30px;height:30px;border-radius:8px;background:#edf0f6;filter:grayscale(1);transition:.15s}.topic-type-switch:has(input:checked){border-color:#d4a44c;background:#fff8e8;box-shadow:inset 3px 0 0 #d99a28}.topic-type-switch>input:checked+.topic-type-icon{background:#ffe6aa;filter:none}.topic-type-switch:has(input:focus-visible){outline:3px solid rgba(217,154,40,.2)}.maintenance-topic-icon{display:inline-grid;place-items:center;width:22px;height:22px;margin-right:6px;border-radius:6px;background:#fff0c9;font-size:.78rem;vertical-align:middle}

.meter-active-filter-list{margin:0;padding:12px 18px 0}.meter-filter-link{gap:4px}.meter-filter-link .table-filter-icon{width:20px;height:15px;padding:0;border:0;background:transparent;opacity:.5}.meter-filter-link .table-filter-icon svg{width:18px;height:12px}.meter-filter-link:hover .table-filter-icon,.meter-filter-link:focus-visible .table-filter-icon{border:0;background:transparent}

@media(max-width:860px){
  .batch-invoice-panel{grid-template-columns:1fr}.batch-preview{position:static}.batch-preview object,.batch-preview img{height:60dvh}
  .message-workspace{grid-template-columns:1fr;max-height:none}
  .message-workspace>.message-topics{max-height:36dvh;border-right:0;border-bottom:1px solid var(--line)}
  .message-workspace>.conversation-main{min-height:520px;max-height:80dvh}
  .chat-compose-form{grid-template-columns:1fr!important}
  .chat-compose-form>.chat-message-input,.chat-compose-form>.chat-attachment,.chat-compose-form>button,.property-chat-compose>.chat-tenancy-input{grid-column:1}
  .chat-compose-form>button{width:100%}
}
