/* Shared authenticated layout rhythm. Specialized media, charts and navigation keep their geometry. */
:root{
 --space-inline:8px;--space-fields:12px;--space-section:16px;--space-panel:16px;
 --control-target:44px;--topbar-content-height:50px;--topbar-gap:8px;--topbar-inline:12px;--action-padding-block:8px;--action-padding-inline:12px;--action-radius:10px;
}
@media(max-width:700px){:root{--space-fields:10px;--space-section:12px;--space-panel:12px}}
body.in-workspace .workspace-heading{margin:8px 0 var(--space-section)}
body.in-workspace .os-module{gap:var(--space-section)}
body.in-workspace .os-dialog:not(.os-wizard) .os-body{gap:var(--space-section)}
body.in-workspace .os-toolbar{gap:var(--space-inline)}
body.in-workspace :is(#workspace-content,dialog,.chat-preview) :is(.submit-button,.glass-button):not(.chat-send):not(.app-tabs>button):not(.os-progress>button):not(.settings-module-card){
 box-sizing:border-box;min-height:var(--control-target);height:auto;min-width:var(--control-target);max-width:100%;
 padding:var(--action-padding-block) var(--action-padding-inline);gap:var(--space-inline);border-radius:var(--action-radius);
 white-space:normal;overflow-wrap:anywhere;line-height:1.4;
}
body.in-workspace :is(#workspace-content,dialog,.chat-preview) :is(.submit-button,.glass-button):not(.chat-send):not(.settings-module-card)>.icon{width:18px;height:18px;flex-shrink:0}
body.in-workspace :is(.listing-control-bar,.os-kanban-toolbar){padding:10px;gap:var(--space-inline);margin-bottom:var(--space-section)}
body.in-workspace :is(.listing-control-bar .customer-toolbar,.operations-toolbar,.stock-list-toolbar){gap:var(--space-inline)}
body.in-workspace :is(.listing-control-bar,.os-kanban-toolbar) :is(.customer-new,.listing-filters-toggle,.catalog-scan){margin:0}
:root body.in-workspace :is(.customer-fields,.operations-fields,.profile-section-fields,.os-grid,.os-quote-fields){gap:var(--space-fields)}
:root body.in-workspace :is(.address-street-row,.address-city-row){gap:var(--space-fields)}
body.in-workspace dialog :is(.customer-fields,.operations-fields) label{margin-bottom:0;margin-left:0}
body.in-workspace dialog :is(.modal-content-scroll,.inventory-body){gap:var(--space-fields)}
body.in-workspace dialog :is(.modal-compact-header,.customer-dialog-header):not(.os-order-header){gap:12px;margin-bottom:12px}
body.in-workspace dialog :is(.modal-action-footer,.customer-dialog-actions,.os-actions){gap:var(--space-inline)}
body.in-workspace dialog .modal-action-footer{margin-top:8px;padding-top:8px}
body.in-workspace dialog :is(.modal-action-footer,.customer-dialog-actions,.os-actions)>:is(.submit-button,.glass-button){margin:0}
body.in-workspace dialog .modal-compact-header>button.modal-close-control{width:44px;height:44px;min-width:44px;flex:0 0 44px;padding:0}
body.in-workspace .operations-actions{gap:var(--space-inline)}
body.in-workspace .team-profile-grid{gap:12px}
body.in-workspace .team-profile-grid>.team-profile-card{padding:16px;gap:14px}
body.in-workspace .team-profile-card>.operations-actions>button{min-height:44px;padding:8px 10px;border-radius:10px}
/* Compact people cards use the same responsive columns as module settings. */
body.in-workspace .operations-list.team-profile-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,220px),1fr));gap:12px;justify-content:stretch}
body.in-workspace .team-profile-grid>.team-profile-card{min-height:0;border-radius:16px;gap:10px}
body.in-workspace .team-profile-card .team-profile-avatar{width:56px;height:56px;margin-bottom:4px;font-size:22px}
body.in-workspace .team-profile-card .team-profile-status{width:20px;height:20px;border-width:2px}
body.in-workspace .team-profile-card .team-profile-status::after{inset:4px}
body.in-workspace .team-profile-card>.operations-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;width:100%}
body.in-workspace .team-profile-card>.operations-actions>.team-chat-action{grid-column:1/-1;color:var(--text-link);background:var(--accent-soft);border-color:var(--accent-ring)}
body.in-workspace .team-profile-card>.operations-actions>.team-chat-action:hover{background:var(--surface-hover)}
body.in-workspace .team-profile-card>.operations-actions>.team-chat-action:active{background:var(--surface-pressed)}
body.in-workspace .team-profile-card .team-chat-error{width:100%;font-size:11px;text-align:left;overflow-wrap:anywhere}
body.in-workspace .settings-module-grid{gap:var(--space-inline)}
body.in-workspace .settings-module-card{display:grid;grid-template-columns:36px minmax(0,1fr);grid-template-rows:auto auto 1fr;align-items:start;padding:var(--action-padding-inline);min-height:116px;border-radius:var(--space-section);gap:var(--space-inline)}
body.in-workspace .settings-module-icon{grid-column:1;grid-row:1;align-self:center;width:36px;height:36px;border-radius:var(--action-radius);margin-bottom:0}
body.in-workspace .settings-module-icon .icon{width:20px;height:20px}
body.in-workspace .settings-module-card>strong{grid-column:2;grid-row:1;align-self:center;margin:0;min-width:0}
body.in-workspace .settings-module-card .settings-module-summary{grid-column:1/-1;grid-row:2;min-width:0}
body.in-workspace .settings-module-card .settings-module-open{grid-column:1/-1;grid-row:3;padding-top:0;margin-top:0;align-self:end;min-width:0}
body.in-workspace .settings-module-card .whatsapp-module-heading{display:contents}
body.in-workspace .settings-module-card .whatsapp-module-heading .settings-module-icon{margin-bottom:0}
body.in-workspace .settings-module-card .whatsapp-module-status{grid-column:1/-1;grid-row:3;justify-self:start;align-self:end;max-width:calc(100% - 26px);box-sizing:border-box;margin:0;overflow-wrap:anywhere}
body.in-workspace .settings-module-card[data-settings-kind=whatsapp] .settings-module-open{justify-content:flex-end}
body.in-workspace .settings-module-card[data-settings-kind=whatsapp] .settings-module-open-label{display:none}
body.in-workspace .settings-module-open{padding-top:12px}
body.in-workspace .settings-panel .settings-panel-header{margin-bottom:12px;gap:12px}
body.in-workspace .settings-panel .settings-row{padding:12px;gap:6px 12px}
body.in-workspace .settings-panel .settings-row-copy{gap:4px}
/* Keep icon-only actions square; do not inherit the text button's horizontal inset. */
body.in-workspace :is(#workspace-content,dialog) :is(.catalog-scan,.catalog-row-action,.os-icon-button,.chat-icon-button){box-sizing:border-box;width:44px;min-width:44px;height:44px;min-height:44px;padding:0;gap:0;flex-shrink:0}
@media(max-width:700px){
 body.in-workspace .listing-control-bar{padding:8px}
 body.in-workspace .team-profile-grid>.team-profile-card{padding:14px 12px;gap:12px}
 body.in-workspace .operations-list.team-profile-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 body.in-workspace .team-profile-grid>.team-profile-card{padding:12px 8px;gap:8px}
 body.in-workspace .team-profile-card .team-profile-avatar{width:48px;height:48px}
 body.in-workspace .team-profile-card .team-action-label{display:none}
 body.in-workspace .team-profile-card>.operations-actions:has(>.team-chat-action){grid-template-columns:repeat(3,minmax(0,1fr))}
 body.in-workspace .team-profile-card>.operations-actions{gap:4px}
 body.in-workspace .team-profile-card>.operations-actions>.team-chat-action{grid-column:auto}
 body.in-workspace .team-profile-card>.operations-actions>button{padding:6px;gap:5px}
 body.in-workspace .settings-module-card{padding:var(--action-padding-inline);min-height:116px;border-radius:var(--space-section)}
 body.in-workspace .settings-module-card .settings-module-icon{width:36px;height:36px;margin-bottom:0}
 body.in-workspace .settings-module-card .settings-module-icon .icon{width:20px;height:20px}
 body.in-workspace .settings-module-card .whatsapp-module-heading .settings-module-icon{margin-bottom:0}
 body.in-workspace .settings-panel .settings-row{padding:10px 12px}
 body.in-workspace dialog :is(.modal-compact-header,.customer-dialog-header):not(.os-order-header){gap:8px;margin-bottom:10px}
}
@media(max-width:359px){
 /* Three 44px targets still fit inside each of the two cards at 320px. */
 body.in-workspace .operations-list.team-profile-grid{gap:4px}
 body.in-workspace .team-profile-grid>.team-profile-card{padding-inline:2px}
 body.in-workspace .team-profile-card>.operations-actions{gap:2px}
 :root body.in-workspace #workspace-content .team-profile-grid>.team-profile-card>.operations-actions>button.glass-button{padding:0;gap:0}
}
@media(min-width:701px){
 /* Reserve room for all three labeled actions instead of breaking their words. */
 body.in-workspace .operations-list.team-profile-grid{grid-template-columns:repeat(auto-fill,minmax(min(100%,340px),1fr))}
 body.in-workspace .team-profile-card>.operations-actions:has(>.team-chat-action){grid-template-columns:repeat(3,auto)}
 body.in-workspace .team-profile-card>.operations-actions>.team-chat-action{grid-column:auto}
 :root body.in-workspace #workspace-content .team-profile-grid>.team-profile-card>.operations-actions>button.glass-button{padding:8px;gap:6px;white-space:nowrap;overflow-wrap:normal}
 body.in-workspace .team-profile-card .team-action-label{white-space:nowrap;overflow-wrap:normal}
}
/* Listing actions retain their touch targets in one line. */
body.in-workspace .customers-section .customer-results :is(.catalog-row-actions,.people-row-actions),body.in-workspace .operations-actions.listing-row-actions{display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-end;gap:6px}
body.in-workspace .customers-section .customer-results :is(.catalog-row-actions,.people-row-actions)>button,body.in-workspace .operations-actions.listing-row-actions>button{flex:0 0 44px;width:44px;min-width:44px;min-height:44px;height:44px;margin:0;padding:0;display:inline-flex;align-items:center;justify-content:center;white-space:nowrap;box-shadow:none;border:1px solid var(--line);border-radius:10px;background:transparent;color:var(--text-secondary)}
body.in-workspace :is(.people-row-actions,.listing-row-actions)>button:hover{background:var(--surface-hover);color:var(--text-link)}
body.in-workspace :is(.people-row-actions,.listing-row-actions)>button:active{background:var(--surface-pressed)}
body.in-workspace :is(.people-row-actions,.listing-row-actions)>button:focus-visible{outline:2px solid var(--text-link);outline-offset:2px}
.record-row-action .icon{width:18px;height:18px}
body.in-workspace .origin-filters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;flex:1 1 320px;min-width:0;max-width:520px}
body.in-workspace .origin-filters label{display:grid;gap:4px;min-width:0;margin:0;font-size:11px;color:var(--text-secondary)}
body.in-workspace .origin-filters select{box-sizing:border-box;width:100%;min-width:0;min-height:44px;margin:0;padding:8px 26px 8px 10px;font:inherit;font-size:13px;border:1px solid var(--line);border-radius:10px;color:var(--text-primary);background:var(--surface-field)}
body.in-workspace .origin-filters select:focus-visible{outline:2px solid var(--text-link);outline-offset:2px}
@media(min-width:601px){
 body.in-workspace .customers-section .customer-results table{table-layout:auto}
 body.in-workspace .customers-section .customer-results th:last-child{width:176px;min-width:176px;box-sizing:border-box}
 body.in-workspace .products-section .customer-results th:last-child{width:276px;min-width:276px}
}
@media(max-width:600px){
 body.in-workspace .customers-section .customer-results .customer-action{grid-column:1/-1;grid-row:5;padding-top:4px}
 body.in-workspace .products-section .customer-results .catalog-stock{grid-column:1/-1;grid-row:4}
 body.in-workspace .products-section .customer-results .catalog-action-cell{grid-column:1/-1;grid-row:5;padding-top:4px}
 body.in-workspace .customers-section .customer-results .customer-contact{grid-column:1/-1}
 body.in-workspace .origin-filters{flex-basis:100%;max-width:none}
}
/* Read-only detail modals use text, rather than disabled edit controls. */
body.in-workspace .record-details-dialog{width:min(640px,calc(100% - 24px));box-sizing:border-box}
.record-details-dialog .record-details-body{min-width:0}
.record-details-body{display:grid;gap:12px}
.record-details-section{min-width:0;border-top:1px solid var(--line);padding-top:12px}
.record-details-section:first-of-type{border-top:0;padding-top:0}
.record-details-dialog .record-details-section>h3{margin:0 0 8px;font-size:12px;line-height:1.4;font-weight:600;color:var(--text-primary)}
.record-details-section .record-detail{border:0;padding-bottom:0}
.record-details-dialog .record-details-notes{margin:0;font-size:13px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--text-primary)}
.record-details-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 16px;margin:0}
.record-detail{min-width:0;padding-bottom:10px;border-bottom:1px solid var(--line)}
.record-detail.full{grid-column:1/-1}
.record-detail dt{font-size:11px;line-height:1.4;color:var(--text-secondary);margin:0 0 4px}
.record-detail dd{font-size:13px;line-height:1.5;color:var(--text-primary);margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.record-detail-photo{display:block;width:80px;height:80px;object-fit:contain;border:1px solid var(--line);border-radius:12px;margin-bottom:12px;background:var(--surface-field)}
.record-details-dialog .customer-dialog-header>button{width:44px;height:44px;padding:0;flex:0 0 44px;display:grid;place-items:center}
.record-details-dialog .customer-dialog-header>button .icon{width:18px;height:18px}
@media(max-width:380px){.record-details-grid{gap:10px}.record-detail.full{grid-column:1/-1}}
@media(min-width:701px){
 body.in-workspace .record-details-dialog{width:min(880px,calc(100% - 48px))}
 .record-details-dialog .record-details-grid{gap:10px 16px}
 .record-details-dialog .record-detail{padding-bottom:8px}
}
@media(min-width:1000px){
 .record-details-dialog .record-details-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
 .record-details-dialog .record-detail-wide{grid-column:span 2}
}
body.in-workspace .customers-section{width:100%;max-width:100%;min-width:0;box-sizing:border-box}
body.in-workspace .customers-section .customer-results{width:100%;max-width:100%;min-width:0;box-sizing:border-box}
/* Center each stock indicator with the same icon/value/caption rhythm. */
body.in-workspace .workspace-heading-summary:has(.module-summary-stock){grid-template-columns:1fr}
body.in-workspace .module-summary-stock{grid-column:1/-1}
body.in-workspace .module-summary-stock dl>div,body.in-workspace .stock-metrics>div{display:grid;grid-template-columns:36px minmax(0,auto);justify-content:center;align-items:center;gap:3px 10px;min-width:0;text-align:left}
body.in-workspace .stock-metrics-bar{position:relative;display:flex;align-items:center;gap:14px;min-width:0;margin:8px 0 10px}
body.in-workspace .stock-metrics{flex:1;min-width:0;gap:22px;margin:0}
body.in-workspace .stock-metrics>div{padding:0}
body.in-workspace .stock-metrics dt{display:contents}
body.in-workspace .stock-metrics dt>span:last-child{grid-column:2;grid-row:2;font-size:11px;line-height:1.4;color:var(--text-secondary);overflow-wrap:anywhere}
body.in-workspace .stock-metric-icon{grid-column:1;grid-row:1/3;width:36px;height:36px;flex-shrink:0}
body.in-workspace .stock-metric-icon .icon{width:19px;height:19px}
body.in-workspace .stock-metrics dd{grid-column:2;grid-row:1;margin:0;font-size:20px;line-height:1.3;letter-spacing:-.4px;color:var(--text-primary)}
body.in-workspace .stock-metrics>div:first-child dd{color:var(--text-link);font-weight:700}
body.in-workspace .stock-metrics>div:first-child .stock-metric-icon{border-color:var(--text-link)}
body.in-workspace .stock-metrics-bar .module-summary-info{display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;margin:0;padding:0}
@media(max-width:800px){body.in-workspace .stock-metrics{gap:16px}body.in-workspace .stock-metrics dd{font-size:18px}}
@media(max-width:600px){
 body.in-workspace .stock-metrics-bar{padding-right:38px;gap:0}
 body.in-workspace .module-summary-stock dl>div,body.in-workspace .stock-metrics>div{grid-template-columns:28px minmax(0,auto);gap:2px 7px}
 body.in-workspace .stock-metrics{gap:10px 12px}
 body.in-workspace .stock-metric-icon{width:28px;height:28px;border-radius:9px}
 body.in-workspace .stock-metric-icon .icon{width:16px;height:16px}
 body.in-workspace .stock-metrics dd{font-size:17px;line-height:1.25;letter-spacing:-.3px}
 body.in-workspace .stock-metrics dt>span:last-child{font-size:10px;line-height:1.3}
}

/* Registry consultations keep identity prominent and factual grids compact. */
:root body.in-workspace dialog.record-compact-details{width:min(720px,calc(100vw - 24px))}
.record-compact-details .record-details-body{gap:var(--space-fields)}
.record-identity-hero{display:flex;align-items:center;gap:var(--space-fields);min-width:0;padding-bottom:0}
.record-identity-hero .record-identity-name{margin:0;font-size:var(--type-section-title);font-weight:600;line-height:1.5;overflow-wrap:anywhere;min-width:0}
.record-identity-hero .record-detail-photo{width:64px;height:64px;flex:none;object-fit:contain;border-radius:var(--action-radius);margin:0}
.record-compact-details .record-details-section{padding-top:var(--space-fields)}
.record-compact-details .record-details-section>h3{margin:0 0 var(--space-inline);font-size:var(--type-label);color:var(--text-secondary)}
.record-compact-details .record-details-grid{gap:var(--space-inline) var(--space-fields)}
.record-compact-details .record-detail dt{font-size:var(--type-meta);line-height:1.4;margin-bottom:4px}
.record-compact-details .record-detail dd{font-size:var(--type-body);line-height:1.5;margin:0;overflow-wrap:anywhere}
.record-compact-details .record-catalog-values{grid-template-columns:repeat(2,minmax(0,1fr))}
.record-catalog-values .record-detail dd{font-weight:600}
.record-catalog-values .record-detail:last-child dd{color:var(--text-link)}
.record-compact-details .record-details-notes{font-size:var(--type-body);line-height:1.5}
@media(max-width:700px){.record-compact-details .record-details-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Contact consultation: stable identity/navigation, one contained content scroller. */
:root body.in-workspace dialog.record-contact-details{padding:var(--space-panel);overflow:hidden;height:min(720px,calc(100dvh - 32px));max-height:calc(100dvh - 32px);box-sizing:border-box}
:root body.in-workspace dialog.record-contact-details[open]{display:flex;flex-direction:column;gap:var(--space-fields)}
.record-contact-details>[hidden],.record-contact-details [hidden]{display:none!important}
:root body.in-workspace .record-contact-details .customer-dialog-header{flex:none;gap:var(--space-fields);margin:0}
.record-contact-details .customer-dialog-header>div{min-width:0;flex:1}
.record-contact-identity{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-inline);margin-top:var(--space-fields);min-width:0}
:root body.in-workspace .record-contact-identity .record-identity-name{margin:0;font-size:var(--type-section-title);line-height:1.4;overflow-wrap:anywhere;min-width:0}
.record-contact-status{display:inline-flex;align-items:center;gap:var(--space-inline);padding:4px var(--space-inline);border:1px solid var(--line);border-radius:var(--action-radius);font-size:var(--type-meta);color:var(--text-secondary)}
.record-contact-status::before{content:'';width:6px;height:6px;border-radius:50%;background:var(--text-subtle);flex:none}
.record-contact-status[data-active="1"]::before{background:var(--text-success)}
.record-contact-details .record-contact-tabs{flex:none;margin:0}
:is(.record-contact-tabs,.app-tabs-surface).app-tabs>button{min-width:var(--control-target);padding:var(--space-inline) var(--space-fields);white-space:normal;overflow-wrap:anywhere}
:root body.in-workspace .record-contact-details .record-details-body{display:block;min-height:0;flex:1;overflow:auto;overscroll-behavior:contain;scrollbar-gutter:stable;scrollbar-width:thin;scrollbar-color:var(--scroll-thumb) transparent;padding:var(--space-inline) var(--space-inline) var(--space-inline) 0}
.record-contact-data{display:grid;align-content:start;gap:var(--space-inline);min-width:0}
:root body.in-workspace .record-contact-details .record-details-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-inline) var(--space-fields)}
:root body.in-workspace .record-contact-data .record-details-section{padding-top:var(--space-inline)}
:root body.in-workspace .record-contact-data .record-details-section:first-child{padding-top:0}
:root body.in-workspace .record-contact-data .record-detail{padding-bottom:0}
:root body.in-workspace .record-contact-data .record-detail dt{margin-bottom:2px}
:root body.in-workspace .record-contact-data .record-details-section>h3{margin:0 0 var(--space-inline)}
:root body.in-workspace .record-contact-data .record-contact-address{grid-template-columns:repeat(4,minmax(0,1fr))}
.record-contact-address>.record-detail:nth-child(2){grid-column:span 2}
:root body.in-workspace .record-contact-details .record-contact-fields{grid-template-columns:minmax(0,1fr) minmax(0,2fr)}
:root body.in-workspace .record-contact-details .customer-dialog-actions{flex:none;margin:0;padding-top:var(--space-fields);gap:var(--space-inline)}
.record-contact-finance .customer-receivables{border:0;padding:0}
.record-contact-finance .customer-receivables-heading h3{color:var(--text-primary)}
.record-contact-details :is(.record-contact-data,.record-contact-finance):focus-visible{outline:2px solid var(--text-link);outline-offset:-2px}
@media(max-width:700px){
 :root body.in-workspace dialog.record-contact-details{height:min(720px,calc(100dvh - 24px));max-height:calc(100dvh - 24px)}
 :is(.record-contact-tabs,.app-tabs-surface).app-tabs>button{flex:1 0 auto;min-width:var(--control-target);padding-inline:var(--space-inline);white-space:nowrap;overflow-wrap:normal}
 :root body.in-workspace .record-contact-details :is(.record-details-grid,.record-contact-fields,.record-contact-address){grid-template-columns:repeat(2,minmax(0,1fr))}
 .record-contact-address>.record-detail:nth-child(2){grid-column:auto}
 .record-contact-details .record-contact-email{grid-column:1/-1}
}

:root body.in-workspace :is(.record-contact-tabs,.app-tabs-surface).app-tabs>button{font-size:var(--type-action);background:var(--surface-field);backdrop-filter:none;box-shadow:none;border:0;border-radius:6px 6px 0 0}
:root body.in-workspace :is(.record-contact-tabs,.app-tabs-surface).app-tabs>button:hover{background:var(--surface-hover)}
:root body.in-workspace :is(.record-contact-tabs,.app-tabs-surface).app-tabs>button:active{background:var(--surface-pressed)}

@media(max-width:480px){:root{--topbar-gap:4px;--topbar-inline:8px}}
