/* ERP-wide compact layout and predictable view-mode organization.
   Scope all rules to authenticated module pages; avoid dialog/print views. */
body:not(.auth-locked) #app .view.icds-module-page{
  padding:14px!important;
}
body:not(.auth-locked) #app .view :is(
  .company-page-shell,.contacts-page-shell,.leads-page-shell,.deals-page-shell,
  .commercial-page-shell,.catalog-page-shell
){
  gap:14px!important;
  padding:16px 18px 22px!important;
}
body:not(.auth-locked) #app .view :is(
  .icds-module-header,.ic-standard-header,[class*="page-header"]
) :is(h1,h2){
  font-size:clamp(21px,1.7vw,27px)!important;
  line-height:1.18!important;
  letter-spacing:-.025em!important;
  margin-top:0!important;
  margin-bottom:3px!important;
}
body:not(.auth-locked) #app .view :is(
  .icds-module-header,.ic-standard-header,[class*="page-header"]
) p{
  font-size:12.5px!important;
  line-height:1.45!important;
  margin-top:4px!important;
  margin-bottom:0!important;
  max-width:780px;
}
body:not(.auth-locked) #app .view :is(
  .icds-module-header,.ic-standard-header,[class*="page-header"]
) :is(.ic-breadcrumb-line,.icds-breadcrumb){
  font-size:11px!important;
  line-height:1.3!important;
}
body:not(.auth-locked) #app .view :is(
  .icds-module-header,.ic-standard-header,[class*="page-header"]
){
  column-gap:14px!important;
  row-gap:8px!important;
  padding-bottom:12px!important;
  margin-bottom:12px!important;
}
body:not(.auth-locked) #app .view :is(
  .icds-module-header,.ic-standard-header,[class*="page-header"]
) :is(button,.btn){
  min-height:36px!important;
  height:auto;
  font-size:12px!important;
  line-height:1.3!important;
  padding:7px 13px!important;
  width:auto!important;
  max-width:100%!important;
  white-space:nowrap;
  flex:0 0 auto;
}
/* Keep actions together rather than letting a standalone primary button grow full-width. */
body:not(.auth-locked) #app .view .ic-view-switch-create-cluster{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
  min-width:0!important;
  max-width:100%!important;
  width:max-content!important;
  margin-left:auto!important;
  white-space:nowrap;
}
body:not(.auth-locked) #app .view .ic-view-switch-create-cluster > :is(
  .ic-crm-view-switch,.ic-all-view-switch
){
  display:inline-flex!important;
  width:max-content!important;
  min-width:0!important;
  flex:0 0 auto!important;
  margin:0!important;
  align-self:center!important;
}
body:not(.auth-locked) #app .view .ic-view-switch-create-cluster > :is(button,a){
  width:auto!important;
  min-width:max-content!important;
  max-width:100%!important;
  flex:0 0 auto!important;
  margin:0!important;
}
body:not(.auth-locked) #app .view :is(.ic-all-view-switch,.ic-crm-view-switch){
  width:max-content!important;
  min-width:0!important;
  flex:0 0 auto!important;
  grid-template-columns:none!important;
  margin-top:0!important;
}
body:not(.auth-locked) #app .view :is(.ic-all-view-switch,.ic-crm-view-switch) .ic-crm-view-btn{
  min-height:34px!important;
  width:auto!important;
  padding:6px 11px!important;
  font-size:11.5px!important;
}
/* Smaller KPI tiles with consistent readable sizes across the modules. */
body:not(.auth-locked) #app .view :is(
  .company-summary-grid,.contacts-summary-grid,.contacts-kpi-grid,
  .leads-analytics-grid,.deals-analytics-grid,.commercial-kpi-grid,
  .catalog-kpi-grid,.icds-module-kpis
){
  grid-template-columns:repeat(auto-fit,minmax(min(190px,100%),1fr))!important;
  gap:10px!important;
}
body:not(.auth-locked) #app .view :is(
  .company-summary-card,.contacts-summary-card,.leads-kpi-card,
  .deals-kpi-card,.commercial-kpi-card,.catalog-kpi-card,
  .icds-kpi-card
){
  min-height:94px!important;
  padding:12px 13px!important;
  gap:10px!important;
}
body:not(.auth-locked) #app .view :is(
  .company-summary-icon,.contacts-summary-icon,.commercial-kpi-icon,
  .leads-kpi-icon,.deals-kpi-icon
){
  width:40px!important;
  height:40px!important;
  min-width:40px!important;
  flex:0 0 40px!important;
}
body:not(.auth-locked) #app .view :is(
  .company-summary-card,.contacts-summary-card,.leads-kpi-card,
  .deals-kpi-card,.commercial-kpi-card,.catalog-kpi-card
) :is(.value,[class*="-value"]){
  font-size:clamp(18px,1.6vw,24px)!important;
  line-height:1.16!important;
  overflow-wrap:normal!important;
  word-break:normal!important;
}
body:not(.auth-locked) #app .view :is(
  .company-summary-card,.contacts-summary-card,.leads-kpi-card,
  .deals-kpi-card,.commercial-kpi-card,.catalog-kpi-card
) :is(.label,[class*="-label"]){
  font-size:11px!important;
  line-height:1.3!important;
  overflow-wrap:break-word!important;
}
/* Generic record grids: 2-5 consistently sized cards instead of horizontally sprawling lanes. */
body:not(.auth-locked) #app .view :is(.ic-module-grid-view,.ic-crm-grid-view){
  min-width:0!important;
  max-width:100%!important;
}
body:not(.auth-locked) #app .view .ic-module-status-groups{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:13px!important;
  padding:12px!important;
  background:var(--icds-surface-alt,#f8fafc);
}
body:not(.auth-locked) #app .view .ic-module-status-group{
  min-width:0;
  border:1px solid var(--icds-border,#e2e8f0);
  border-radius:12px;
  overflow:hidden;
  background:var(--icds-surface,#fff);
}
body:not(.auth-locked) #app .view .ic-module-status-head{
  min-height:39px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:8px 12px;
  background:var(--icds-surface-alt,#f8fafc);
  border-bottom:1px solid var(--icds-border,#e2e8f0);
}
body:not(.auth-locked) #app .view .ic-module-status-head > div{display:flex;align-items:center;gap:8px;min-width:0}
body:not(.auth-locked) #app .view .ic-module-status-head strong{font-size:12px;font-weight:800;color:var(--icds-text,#0f172a)}
body:not(.auth-locked) #app .view .ic-module-status-head > span{font-size:11px;color:var(--icds-muted,#64748b);font-weight:750}
body:not(.auth-locked) #app .view .ic-module-status-dot{width:8px;height:8px;flex:0 0 8px;border-radius:50%;background:#94a3b8}
body:not(.auth-locked) #app .view .ic-module-status-group[data-tone="success"] .ic-module-status-dot{background:#22c55e}
body:not(.auth-locked) #app .view .ic-module-status-group[data-tone="info"] .ic-module-status-dot{background:#2563eb}
body:not(.auth-locked) #app .view .ic-module-status-group[data-tone="warning"] .ic-module-status-dot{background:#f59e0b}
body:not(.auth-locked) #app .view .ic-module-status-group[data-tone="danger"] .ic-module-status-dot{background:#ef4444}
body:not(.auth-locked) #app .view .ic-module-card-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fill,minmax(min(245px,100%),1fr))!important;
  align-items:stretch!important;
  gap:11px!important;
  padding:11px!important;
  overflow-x:visible!important;
}
body:not(.auth-locked) #app .view .ic-module-grid-card{
  display:grid!important;
  grid-template-rows:auto auto 1fr!important;
  align-content:start!important;
  min-width:0!important;
  min-height:145px!important;
  max-width:100%!important;
  height:100%!important;
  padding:13px!important;
  gap:9px!important;
}
body:not(.auth-locked) #app .view .ic-module-grid-card-top{min-width:0!important;gap:8px!important}
body:not(.auth-locked) #app .view .ic-module-grid-title{
  font-size:13px!important;
  line-height:1.38!important;
  overflow:visible!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
}
body:not(.auth-locked) #app .view .ic-module-grid-fields{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:9px!important;
  align-content:start!important;
}
body:not(.auth-locked) #app .view .ic-module-grid-fields > div{min-width:0!important}
body:not(.auth-locked) #app .view .ic-module-grid-fields :is(span,strong){
  overflow:visible!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
  line-height:1.35!important;
}
body:not(.auth-locked) #app .view .ic-module-grid-fields span{font-size:10px!important}
body:not(.auth-locked) #app .view .ic-module-grid-fields strong{font-size:11px!important}
/* Dedicated Leads/Deals pipelines retain horizontal Kanban with controlled card sizes. */
body:not(.auth-locked) #app .view .ic-crm-kanban{grid-auto-columns:minmax(250px,min(300px,85vw))!important;align-items:start!important}
body:not(.auth-locked) #app .view .ic-crm-kanban-lane{min-width:0!important}
@media(max-width:1100px){
  body:not(.auth-locked) #app .view .ic-view-switch-create-cluster{
    margin-left:0!important;
    justify-content:flex-start!important;
    justify-self:start!important;
  }
}
@media(max-width:760px){
  body:not(.auth-locked) #app .view :is(
    .company-page-shell,.contacts-page-shell,.leads-page-shell,
    .deals-page-shell,.commercial-page-shell,.catalog-page-shell
  ){padding:12px!important}
  body:not(.auth-locked) #app .view .ic-view-switch-create-cluster{
    width:100%!important;
    justify-content:flex-start!important;
    overflow-x:auto!important;
  }
  body:not(.auth-locked) #app .view .ic-module-card-grid{grid-template-columns:minmax(0,1fr)!important}
  body:not(.auth-locked) #app .view .ic-module-grid-fields{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
