/* Shared dashboard layout: reflow content instead of hiding horizontal scrollbars. */
.crm-shell .crm-main,.crm-shell .crm-content,.dashboard-shell main,.dashboard-shell .dash-main{min-width:0;max-width:100%}
.crm-shell .crm-card,.crm-shell .crm-grid>*,.crm-shell .crm-form>*,.dashboard-shell section{min-width:0}
.crm-legacy,.crm-legacy .dashboard-content{min-width:0;max-width:100%}
.crm-legacy .metric-grid,.dashboard-shell .metric-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,180px),1fr))}
.crm-legacy .metric-card{min-width:0;overflow-wrap:anywhere}
.crm-shell .crm-heading,.crm-shell .crm-card-head,.crm-shell .crm-actions,.crm-shell .crm-filters,.crm-shell .crm-pager{flex-wrap:wrap}
.crm-shell .crm-filters>*{min-width:0;max-width:100%}
.crm-shell .crm-table-wrap,.hk-table-region{width:100%;min-width:0;max-width:100%;max-height:none!important;overflow:visible;container-type:inline-size}
table.hk-responsive-table,.crm-shell table.crm-table{width:100%!important;min-width:0!important;max-width:100%!important;table-layout:fixed}
.hk-responsive-table th,.hk-responsive-table td,.crm-shell .crm-table td:first-child{min-width:0!important;max-width:none;overflow-wrap:anywhere;white-space:normal}
.crm-shell .crm-table th{position:static;white-space:normal}
.hk-responsive-table :is(input,select,textarea,button),.crm-shell .crm-table .hk-select{box-sizing:border-box;min-width:0!important;max-width:100%!important}
.crm-shell .crm-table .hk-select{width:100%}
.crm-shell .crm-table button.hk-select-trigger{min-width:0;width:100%}
.crm-shell .crm-table .hk-select-label{white-space:normal;overflow-wrap:anywhere;text-overflow:clip}
.crm-shell .crm-work-table :is(td,th){padding:14px 10px}
.crm-shell .crm-work-table :is(td,th):nth-child(1){width:21%}
.crm-shell .crm-work-table :is(td,th):nth-child(2){width:16%}
.crm-shell .crm-work-table :is(td,th):nth-child(3){width:16%}
.crm-shell .crm-work-table :is(td,th):nth-child(4){width:10%}
.crm-shell .crm-work-table :is(td,th):nth-child(5){width:23%}
.crm-shell .crm-work-table :is(td,th):nth-child(6){width:14%}
.crm-shell .crm-work-table .crm-date-label{grid-template-columns:58px minmax(0,1fr);gap:6px}
.crm-shell .crm-work-table .crm-date-label input{width:100%;min-width:0;max-width:100%;padding:7px 5px;font-size:12px}
.crm-shell .crm-work-table .crm-row-actions{flex-wrap:wrap;gap:6px}
.crm-shell .crm-work-table .crm-details-button,.crm-shell .crm-work-table .crm-note-button{padding:7px 8px}
.crm-shell .overview-table td:nth-child(1){width:18%}.crm-shell .overview-table td:nth-child(2){width:14%}.crm-shell .overview-table td:nth-child(3){width:13%}.crm-shell .overview-table td:nth-child(4){width:15%}.crm-shell .overview-table td:nth-child(5){width:16%}.crm-shell .overview-table td:nth-child(6){width:9%}.crm-shell .overview-table td:nth-child(7){width:11%}.crm-shell .overview-table td:nth-child(8){width:4%}
.crm-shell .crm-board-wrap{overflow:visible}.crm-shell .crm-pipeline{min-width:0;grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))}.crm-shell .crm-column{min-width:0}
.crm-shell .crm-pipeline-card,.crm-shell .crm-address,.crm-shell .crm-note,.crm-shell .crm-remarks{overflow-wrap:anywhere}
.crm-shell img,.dashboard-shell img,.crm-shell iframe,.dashboard-shell iframe{max-width:100%}
.crm-shell pre,.dashboard-shell pre{white-space:pre-wrap;overflow-wrap:anywhere;min-width:0}
/* Wide work/overview tables become two-column records when their panel is narrow. */
@container(max-width:860px){
  .crm-shell table.crm-work-table,.crm-shell table.overview-table{display:block}
  .crm-shell :is(.crm-work-table,.overview-table) thead{display:none}
  .crm-shell :is(.crm-work-table,.overview-table) tbody{display:grid;gap:14px}
  .crm-shell :is(.crm-work-table,.overview-table) tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 20px;padding:18px;border:0;border-bottom:1px solid var(--footer-line);border-radius:0;background:#fff}
  .crm-shell :is(.crm-work-table,.overview-table) tbody td{display:block;width:auto!important;min-width:0!important;max-width:100%;padding:0;border:0}
  .crm-shell :is(.crm-work-table,.overview-table) tbody td:first-child,.crm-shell :is(.crm-work-table,.overview-table) .hk-full-cell{grid-column:1/-1}
  .crm-shell :is(.crm-work-table,.overview-table) tbody td[data-label]:before{content:attr(data-label);display:block;font-size:11px;font-weight:600;letter-spacing:.3px;color:var(--footer-muted);margin-bottom:7px}
  .crm-shell :is(.crm-work-table,.overview-table) tbody td:first-child:before,.crm-shell :is(.crm-work-table,.overview-table) .hk-full-cell:before{display:none}
  .crm-shell .crm-work-table .crm-dates-cell{grid-column:1/-1}
  .crm-shell .crm-work-table .crm-date-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
  .crm-shell .crm-work-table .crm-date-label{grid-template-columns:1fr;gap:6px}
  .crm-shell .crm-work-table .crm-date-label input{height:40px;min-height:40px;padding:8px 10px;font-size:13px}
  .crm-shell .crm-work-table .crm-actions-cell{grid-column:1/-1}
  .crm-shell .crm-table .hk-select{max-width:100%;width:100%}
}
/* Other administration tables use the same readable labelled layout on phones. */
@container(max-width:620px){
  table.hk-responsive-table{display:block}
  .hk-responsive-table thead{display:none}
  .hk-responsive-table tbody{display:grid;gap:14px}
  .hk-responsive-table tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:14px;border-bottom:1px solid #e9ecf0}
  .hk-responsive-table tbody td{display:block;width:auto!important;min-width:0!important;padding:0!important;border:0}
  .hk-responsive-table td[data-label]:before{content:attr(data-label);display:block;font-size:11px;font-weight:600;color:#6b7280;margin-bottom:6px}
  .hk-responsive-table td:first-child,.hk-responsive-table .hk-full-cell{grid-column:1/-1}
  .hk-responsive-table .hk-full-cell:before{display:none}
}
@container(max-width:380px){
  .crm-shell .crm-work-table .crm-date-fields{grid-template-columns:1fr;gap:8px}
  .crm-shell .crm-work-table .crm-date-label{grid-template-columns:65px minmax(0,1fr);gap:8px}
  .crm-shell :is(.crm-work-table,.overview-table) tbody tr{padding:12px;gap:12px}
}
@media(max-width:760px){
  .crm-shell .crm-nav nav{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible;gap:4px}
  .crm-shell .crm-nav nav a,.crm-shell:has(.studio-overview) .crm-nav nav a{min-width:0;white-space:normal;overflow-wrap:anywhere}
  .crm-shell .crm-grid,.crm-shell .crm-form,.crm-shell .crm-split{grid-template-columns:minmax(0,1fr)}
  .crm-shell .crm-form .full{grid-column:1}
  .crm-shell .crm-top{gap:10px;flex-wrap:wrap}
  .crm-shell .crm-table-wrap{border:0}
  .dashboard-shell{grid-template-columns:minmax(0,1fr)!important;min-width:0}
  .dashboard-shell .dash-sidebar{position:static;width:100%;height:auto;min-width:0}
  .dashboard-shell .dash-nav{display:flex;flex-wrap:wrap;overflow:visible}
}
.dashboard-shell .chart-card-header{flex-wrap:wrap;gap:10px}
.dashboard-shell .bar-chart-bars,.dashboard-shell .bar-col,.dashboard-shell .client-name-cell>div{min-width:0}
.dashboard-shell .bar-col span{max-width:100%;overflow-wrap:anywhere;text-align:center}
@container(max-width:380px){
 .hk-responsive-table tbody tr{grid-template-columns:minmax(0,1fr)}
}
.dashboard-shell .clients-table-footer,.dashboard-shell .pagination{flex-wrap:wrap;max-width:100%}
