/* Keep wide content inside its own scroll area, not wider than the page. */
.main, .main > *, .panel, .detail-layout > *, .settings-layout > *, .chat-layout > *, .crm-profile > *, .form-grid > * { min-width:0; }
.main img, .main video { max-width:100%; }
.main :is(h1,h2,h3,p,dd,.person-row strong,.task-row-title,.installation-card) { overflow-wrap:anywhere; }
.form-stack fieldset { min-width:0; }
.form-stack :is(input,select,textarea) { max-width:100%; min-width:0; }
.rich-content, .tiptap { overflow-wrap:anywhere; }
.rich-content table { display:block; max-width:100%; overflow-x:auto; }
/* Equal side columns keep navigation centered regardless of brand width. */
@media(min-width:1201px) {
  .topbar { display:grid; grid-template-columns:minmax(0,1fr) auto minmax(0,1fr); }
  .topbar > .brand { justify-self:start; }
  .topbar > nav { justify-self:center; }
  .topbar > .top-actions { justify-self:end; }
}
@media(max-width:1200px) {
  .topbar { height:auto; display:flex; flex-wrap:wrap; gap:14px; padding:16px 20px; }
  .topbar .brand { min-width:0; }
  .topbar nav { order:3; width:100%; min-width:0; display:flex; flex-wrap:wrap; justify-content:center; gap:4px; }
  .top-actions { margin-left:auto; flex-wrap:wrap; }
}
@media(max-width:900px) {
  .main { width:auto; max-width:100%; margin:0; padding:28px 20px 48px; }
  .page-heading { flex-wrap:wrap; }
  .page-heading > * { min-width:0; max-width:100%; }
  .detail-layout, .dashboard-columns { grid-template-columns:minmax(0,1fr); }
  .installation-week { max-width:100%; }
}
@media(max-width:600px) {
  .topbar { padding:12px 16px; gap:10px; }
  .topbar .brand { font-size:17px; }
  .top-actions { gap:10px; }
  .topbar nav .nav-link { padding:10px 8px; }
  .subbar { padding:12px 16px; gap:12px; min-height:0; }
  .subbar-admin { flex-wrap:wrap; gap:12px; }
  .search-launcher { min-width:0; }
  .search-launcher kbd { display:none; }
  .main { padding:24px 16px 40px; }
  .panel { padding:18px; }
  .form-grid, .installation-filters { grid-template-columns:minmax(0,1fr); }
  .form-actions, .filter-form, .filter-tabs, .crm-tabs { flex-wrap:wrap; gap:10px; }
  .page-heading > .form-actions { max-width:100%; }
  .form-stack :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea), .installation-filters :is(input,select) { font-size:16px; }
  .installation-job-list > section { grid-template-columns:minmax(0,1fr); }
  .installation-hours > label:first-child { min-width:0; }
  .installation-availability .installation-hours label:not(.settings-check) { flex:1 1 100%; min-width:0; }
  .installation-availability .installation-hours input { min-width:0; }
  .installation-availability .installation-hours input[type=date] { width:100%; }
  .installation-booked-panel .installation-week { grid-template-columns:minmax(0,1fr); overflow:visible; }
  .installation-day { min-height:0; border-right:0; border-bottom:1px solid var(--line); padding:14px 0; }
  .installation-day:last-child { border-bottom:0; }
  .installation-day-empty { margin:8px 0; }
  .installation-available-panel .installation-week { grid-template-columns:minmax(0,1fr); }
  .installation-photo-groups { grid-template-columns:minmax(0,1fr); }
  .crm-dialog:has(.installation-booking) { width:100%; max-width:100%; border-radius:0; padding:20px 16px; }
  .installation-slot-picker { max-height:45dvh; }
  .chat-header { flex-wrap:wrap; padding:14px; }
  .chat-header-actions { margin-left:auto; }
  .chat-message-content { min-width:0; }
  .chat-details-drawer { width:100%; max-width:100%; padding:20px 16px; }
  .crm-merge-deals { grid-template-columns:minmax(0,1fr); }
  .crm-merge-grid { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .crm-merge-confirm-details { grid-template-columns:minmax(0,1fr); }
  .site-footer { flex-wrap:wrap; gap:10px; margin:0 16px; }
}
