/* HUB Mobile 2.0 / dashboard: presentation only, no changes to widget state or APIs.
 * Loaded last so mobile overrides cannot affect desktop layouts.
 */
@media (max-width: 680px) {
  .exec-app {width:100%;max-width:100%;min-width:0;padding:10px 8px 28px}
  .workspace-surface,.kpi-grid,.dashboard-grid {min-width:0;max-width:100%}
  .workspace-surface > .kpi-grid,
  .workspace-surface > .dashboard-grid {display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px}
  .workspace-surface [data-widget] {
    min-width:0!important;max-width:100%!important;
    grid-column:1/-1!important;grid-row:auto!important;
    min-height:0!important;height:auto!important;
    overflow:visible;
  }
  /* Desktop free-mode positions are not suitable on a phone.
   * The existing saved coordinates are NOT modified; only their rendering changes. */
  /* Grid mode also uses absolute coordinates; make both modes truly document-flow
   * layouts on phones, without writing back to saved desktop geometry. */
  body.workspace-mode-grid .workspace-surface {min-height:0!important;height:auto!important}
  body.workspace-mode-grid .workspace-surface > .kpi-grid,
  body.workspace-mode-grid .workspace-surface > .dashboard-grid {
    display:grid!important;position:relative!important;
    grid-template-columns:minmax(0,1fr)!important;gap:10px;
    width:100%!important;height:auto!important
  }
  body.workspace-mode-grid .workspace-surface [data-widget] {
    position:relative!important;left:auto!important;right:auto!important;
    top:auto!important;bottom:auto!important;transform:none!important;
    width:100%!important;height:auto!important;min-height:0!important;
    margin:0!important;grid-column:1/-1!important
  }
  body.workspace-mode-grid .workspace-surface [data-widget] > .card-head {cursor:default}
  body.workspace-mode-free .workspace-surface {min-height:0!important;height:auto!important}
  body.workspace-mode-free .workspace-surface > .kpi-grid,
  body.workspace-mode-free .workspace-surface > .dashboard-grid {
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px
  }
  body.workspace-mode-free .workspace-surface [data-widget] {
    position:relative!important;left:auto!important;right:auto!important;
    top:auto!important;bottom:auto!important;transform:none!important;
    width:100%!important;height:auto!important;min-height:0!important;
    grid-column:1/-1!important;margin:0!important
  }
  /* Respect each widget's collapsed state even when stored free positions are ignored. */
  .workspace-surface [data-widget].widget-collapsed,
  body.workspace-mode-free .workspace-surface [data-widget].widget-collapsed {
    height:var(--free-collapsed-height,62px)!important;overflow:hidden!important
  }
  body.workspace-mode-free .workspace-surface [data-widget] > .card-head {cursor:default}
  .workspace-surface [data-widget] > .workspace-resize-handle,
  .workspace-surface [data-widget] > .workspace-drag-handle {display:none!important}
  .dashboard-grid > .panel {padding:12px;border-radius:15px}
  .kpi-summary-card {padding:12px}
  .kpi-summary-grid {display:grid;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px}
  .kpi-summary-grid > .kpi-card {min-width:0;min-height:96px;padding:11px!important}
  .kpi-summary-grid > .kpi-card strong {font-size:clamp(17px,5vw,23px);overflow-wrap:anywhere}
  .card-head,.kpi-summary-head {flex-wrap:wrap;gap:9px}
  .card-head > div,.widget-head-actions {min-width:0;max-width:100%}
  .widget-head-actions {flex-wrap:wrap;justify-content:flex-start}
  .card-head h2 {font-size:15px;overflow-wrap:anywhere}
  .kpi-summary-actions {width:100%;justify-content:space-between}
  .plan-content {min-height:0;flex-wrap:wrap;gap:12px;padding:14px 4px}
  .plan-ring {width:126px;height:126px}
  .plan-ring strong {font-size:24px}
  .plan-details {min-width:0;flex:1 1 115px;gap:8px}
  .telephony-summary {grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .base-quality-charts,.base-quality-comparison,.base-quality-compare-pickers,
  .base-quality-compare-loading {grid-template-columns:minmax(0,1fr)!important}
  .base-quality-chart,.base-quality-compare-side {min-width:0;max-width:100%}
  .base-quality-picker {min-width:0;width:100%;flex:1 1 100%}
  .base-quality-scope-popup {width:min(100%,calc(100vw - 42px));max-width:100%}
  .funnel-row {grid-template-columns:minmax(0,1fr) auto;gap:5px 8px}
  .funnel-row .funnel-track {grid-column:1/-1;grid-row:2}
  .funnel-name {grid-column:1;grid-row:1}
  .funnel-value {grid-column:2;grid-row:1}
  .source-row {grid-template-columns:minmax(0,1fr) auto;gap:5px 8px}
  .source-row .source-track {grid-column:1/-1;grid-row:2}
  .source-name {grid-column:1;grid-row:1}
  .source-value {grid-column:2;grid-row:1}
  /* Wide financial tables remain accessible with local horizontal touch scrolling. */
  .table-wrap {min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;
    -webkit-overflow-scrolling:touch}
  .manager-table {min-width:640px}
  .app-dialog {width:calc(100vw - 16px);max-width:calc(100vw - 16px)}
  .app-dialog .dialog-card {
    width:100%;max-width:100%;
    max-height:calc(100dvh - 24px)!important;border-radius:15px
  }
  .app-dialog .dialog-head {padding:12px;gap:8px}
  .app-dialog .dialog-body {padding:12px;overscroll-behavior:contain}
  .app-dialog .dialog-actions {padding:10px 12px;flex-wrap:wrap}
  .app-dialog input,.app-dialog select {max-width:100%;min-width:0}
  .app-dialog .dialog-close {min-width:44px;min-height:44px}
  .dashboard-screen-list {min-width:0;overscroll-behavior-x:contain}
  .dashboard-screen-actions {flex:0 0 auto}
}
@media (max-width: 350px) {
  .kpi-summary-grid {grid-template-columns:minmax(0,1fr)!important}
  .telephony-summary {grid-template-columns:minmax(0,1fr)!important}
}


/* Mobile 2.0 / layout regression fixes:
 * Legacy dashboard uses flex-basis:880px on toolbar actions and absolute
 * pixel positioning for KPI tiles. They must be DOM-flow elements on phones.
 * This does not write/change the saved desktop layout. */
@media (max-width: 680px) {
  #dashboardToolbar {
    display:flex!important;flex-direction:column!important;
    align-items:stretch!important;justify-content:flex-start!important;
    gap:8px!important;height:auto!important;min-height:0!important;
    padding:10px!important;margin-bottom:9px!important;
  }
  #dashboardToolbar .toolbar-left {
    display:flex!important;align-items:center!important;
    flex:0 0 auto!important;width:100%!important;min-width:0;
    flex-wrap:wrap;gap:5px 8px;padding:0;
  }
  #dashboardToolbar .connection-badge {
    min-width:0;max-width:100%;min-height:30px;padding:5px 8px;
    white-space:normal;overflow-wrap:anywhere;font-size:11px;
  }
  #dashboardToolbar .updated-label {
    min-width:0;max-width:100%;white-space:normal;font-size:10px;
  }
  #dashboardToolbar .toolbar-actions {
    display:grid!important;grid-template-columns:repeat(6,minmax(0,1fr))!important;
    align-items:stretch!important;justify-content:stretch!important;
    flex:none!important;flex-basis:auto!important;flex-grow:0!important;
    flex-shrink:0!important;height:auto!important;min-height:0!important;
    min-width:0!important;width:100%!important;max-width:100%!important;
    gap:7px!important;padding:0;margin:0;
  }
  #dashboardToolbar .toolbar-actions > #globalPeriodFilter {
    grid-column:1/-1;width:100%!important;min-width:0;
    display:flex;align-items:stretch;gap:6px;flex-wrap:wrap;
  }
  #dashboardToolbar #globalPeriodFilter > .select-control {
    min-width:0;min-height:44px;flex:1 1 100%;
  }
  #dashboardToolbar .global-period-extra {
    width:100%;min-width:0;max-width:100%;gap:6px;
  }
  #dashboardToolbar .global-period-extra > .select-control {flex:1 1 115px;min-width:0}
  #dashboardToolbar .toolbar-actions > .select-control {
    grid-column:span 3;min-width:0;max-width:100%;width:100%;
    min-height:44px;padding:6px 8px;
  }
  #dashboardToolbar .toolbar-actions > .department-filter {
    grid-column:span 3!important;min-width:0;max-width:100%;width:100%;
    min-height:44px;padding:6px 8px;gap:5px;
  }
  #dashboardToolbar .department-filter-caption {display:none}
  #dashboardToolbar .department-filter-btn {min-width:0;max-width:100%;width:100%}
  #dashboardToolbar .department-filter-btn strong {min-width:0;overflow:hidden;text-overflow:ellipsis}
  #dashboardToolbar .toolbar-actions > .icon-btn {
    grid-column:span 2;width:44px;height:44px;min-height:44px;min-width:44px;
    flex:none!important;justify-self:center;
  }
  #dashboardToolbar .select-control select,
  #dashboardToolbar .select-control input {
    min-width:0!important;max-width:100%;width:100%;
    font-size:12px;
  }

  /* Override legacy fixed-position KPI workspace on mobile only. */
  [data-widget="kpi_summary"] {
    min-width:0!important;max-width:100%!important;height:auto!important;
    overflow:visible!important;
  }
  [data-widget="kpi_summary"] .kpi-summary-head {
    display:flex!important;flex-direction:column;align-items:stretch;
    gap:8px;max-width:100%;
  }
  [data-widget="kpi_summary"] .kpi-summary-head > div:first-child {min-width:0;max-width:100%}
  [data-widget="kpi_summary"] .kpi-summary-actions {
    flex:0 0 auto!important;width:100%!important;max-width:100%;
    min-width:0;display:flex!important;justify-content:space-between;
    align-items:center;gap:8px;flex-wrap:nowrap;
  }
  [data-widget="kpi_summary"] .kpi-source-switch {
    flex:1 1 0!important;width:auto!important;min-width:0;max-width:100%;
  }
  [data-widget="kpi_summary"] .kpi-source-switch button {min-width:0;flex:1 1 0}
  [data-widget="kpi_summary"] .kpi-summary-actions > .widget-settings-btn {
    flex:0 0 40px;min-width:40px;min-height:40px;
  }
  [data-widget="kpi_summary"] .kpi-summary-grid {
    display:grid!important;position:relative!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    align-items:stretch!important;justify-content:stretch;
    width:100%!important;max-width:100%;min-width:0;min-height:0!important;
    height:auto!important;overflow:visible!important;gap:8px!important;
  }
  [data-widget="kpi_summary"] .kpi-summary-grid > .kpi-card {
    position:relative!important;inset:auto!important;
    left:auto!important;right:auto!important;top:auto!important;bottom:auto!important;
    width:auto!important;max-width:100%!important;min-width:0!important;
    height:auto!important;min-height:95px!important;
    margin:0!important;transform:none!important;
    grid-column:auto!important;grid-row:auto!important;
    padding:11px!important;overflow:hidden!important;
    display:flex;flex-direction:column;justify-content:center;
    transition:none!important;
  }
  [data-widget="kpi_summary"] .kpi-summary-grid > .kpi-card > strong {
    font-size:clamp(16px,4.5vw,22px)!important;line-height:1.18;
    white-space:normal!important;overflow-wrap:anywhere!important;
    word-break:normal;max-width:100%;min-width:0;
  }
  [data-widget="kpi_summary"] .kpi-summary-grid > .kpi-card > small {
    max-width:100%;white-space:normal!important;overflow-wrap:anywhere;
  }
  [data-widget="kpi_summary"] .kpi-head {min-width:0;max-width:100%;gap:5px}
  [data-widget="kpi_summary"] .kpi-head > span:first-child {
    min-width:0;overflow-wrap:anywhere;white-space:normal;
  }
  [data-widget="kpi_summary"] .kpi-icon {flex:0 0 23px;min-width:23px}
  [data-widget="kpi_summary"] .kpi-card-drag-handle,
  [data-widget="kpi_summary"] .kpi-card-resize-handle {display:none!important}

  /* Dynamics: long heading, source switch, value and gear fit their own rows. */
  [data-widget="trend"] .trend-card-head {
    display:flex!important;flex-direction:column!important;
    align-items:stretch!important;justify-content:flex-start;
    width:100%;min-width:0;max-width:100%;gap:9px;
  }
  [data-widget="trend"] .trend-title-wrap {
    display:block;flex:0 1 auto!important;min-width:0!important;
    width:100%;max-width:100%;
  }
  [data-widget="trend"] .trend-title-wrap h2 {
    display:block!important;max-width:100%;min-width:0!important;
    white-space:normal!important;overflow-wrap:anywhere!important;
    word-break:normal;font-size:15px!important;line-height:1.35;
  }
  [data-widget="trend"] .trend-head-actions {
    display:grid!important;grid-template-columns:minmax(0,1fr) auto 40px;
    align-items:center!important;justify-content:stretch!important;
    flex:none!important;width:100%!important;max-width:100%;min-width:0!important;
    gap:6px!important;flex-wrap:nowrap;
  }
  [data-widget="trend"] .trend-source-switch {
    grid-column:1;display:flex!important;
    flex:1 1 0!important;width:100%!important;min-width:0!important;
    max-width:100%;box-sizing:border-box;
  }
  [data-widget="trend"] .trend-source-switch button {
    flex:1 1 0!important;min-width:0!important;padding:0 4px!important;
  }
  [data-widget="trend"] #trendTotal {
    grid-column:2;min-width:0!important;max-width:100%;
    font-size:12px!important;line-height:1.25;
    white-space:normal!important;overflow-wrap:anywhere;
    text-align:right;
  }
  [data-widget="trend"] #trendSettingsBtn {
    grid-column:3;justify-self:end;flex:0 0 auto!important;
    width:40px!important;min-width:40px!important;
    height:40px!important;min-height:40px!important;
  }
}
@media (max-width: 350px) {
  [data-widget="kpi_summary"] .kpi-summary-grid {
    grid-template-columns:minmax(0,1fr)!important;
  }
  [data-widget="trend"] .trend-head-actions {
    grid-template-columns:minmax(0,1fr) 40px!important;
  }
  [data-widget="trend"] #trendTotal {grid-column:1;grid-row:2;text-align:left}
  [data-widget="trend"] #trendSettingsBtn {grid-column:2;grid-row:1}
}


/* Mobile 2.0 filter bottom sheet: responsive presentation, desktop untouched. */
.mobile-filters-open,.mobile-filters-summary {display:none}
.mobile-filters-dialog:not([open]){display:none!important}
@media (max-width:680px){
  #dashboardToolbar{
    display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;
    gap:7px!important;padding:9px!important;align-items:center!important;
    height:auto!important;min-height:0!important;
  }
  #dashboardToolbar>.toolbar-left{
    grid-column:1/-1!important;grid-row:1;
    gap:5px 8px!important;min-width:0!important;
  }
  #dashboardToolbar>.mobile-filters-open{
    display:inline-flex!important;grid-column:1;grid-row:2;
    align-items:center;justify-content:center;gap:8px;
    border:1px solid color-mix(in srgb,var(--accent) 45%,var(--line));
    border-radius:11px;background:var(--accent-soft);color:var(--accent);
    min-width:0;min-height:44px;padding:0 13px;cursor:pointer;
    font:800 12px/1.3 inherit;
  }
  #dashboardToolbar>.mobile-filters-open svg{
    width:19px;height:19px;flex:0 0 19px;
  }
  #dashboardToolbar>.mobile-filters-open .mobile-filter-count{
    background:var(--accent);color:white;border-radius:999px;
    min-width:19px;height:19px;display:grid;place-items:center;font-size:10px
  }
  #dashboardToolbar>.mobile-filters-open .mobile-filter-count[hidden]{display:none}
  #dashboardToolbar>.toolbar-actions{
    grid-column:2;grid-row:2;
    display:flex!important;align-items:center!important;
    width:auto!important;max-width:none!important;min-width:0!important;
    gap:5px!important;flex:none!important;justify-content:flex-end!important;
  }
  #dashboardToolbar>.toolbar-actions>:not(.icon-btn){display:none!important}
  #dashboardToolbar>.toolbar-actions>.icon-btn{
    grid-column:auto!important;width:40px!important;min-width:40px!important;
    height:44px!important;min-height:44px!important;flex:0 0 40px!important;
    margin:0!important;
  }
  #dashboardToolbar>.mobile-filters-summary{
    display:block!important;grid-column:1/-1;grid-row:3;
    font-size:11px;line-height:1.35;min-width:0;max-width:100%;
    color:var(--muted);overflow-wrap:anywhere;padding:0 2px 1px;
  }
  body.mobile-filter-open {overflow:hidden!important}

  /* Native modal is in the top layer, never trapped by the embedded iframe's toolbar. */
  dialog.mobile-filters-dialog[open]{
    display:block!important;box-sizing:border-box;
    position:fixed!important;inset:auto 0 0 0!important;
    transform:none!important;left:0!important;right:0!important;top:auto!important;bottom:0!important;
    width:100vw!important;max-width:100vw!important;
    max-height:90dvh!important;height:auto!important;
    margin:0!important;padding:0!important;
    color:var(--text);background:var(--panel);
    border:1px solid var(--line);border-bottom:0;
    border-radius:22px 22px 0 0!important;
    box-shadow:0 -18px 60px #0003;
    overflow:hidden!important;z-index:9999;
  }
  dialog.mobile-filters-dialog::backdrop{
    background:rgba(18,13,28,.62);backdrop-filter:blur(3px);
  }
  .mobile-filter-shell{
    display:flex;flex-direction:column;
    height:min(90dvh,760px);max-height:90dvh;min-height:0;
  }
  .mobile-filter-header{
    flex:0 0 auto;display:flex;align-items:center;justify-content:space-between;gap:12px;
    padding:17px 16px 12px;border-bottom:1px solid var(--line);
  }
  .mobile-filter-eyebrow{display:block;font-size:10px;font-weight:750;color:var(--muted)}
  .mobile-filter-header h2{margin:3px 0 0;font-size:21px;line-height:1.2;color:var(--text)}
  .mobile-filter-close{
    flex:0 0 44px;width:44px;height:44px;display:grid;place-items:center;
    border:1px solid var(--line);border-radius:12px;
    background:var(--panel2);color:var(--text);font-size:24px;cursor:pointer
  }
  .mobile-filter-body{
    flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;padding:12px 16px 22px
  }
  .mobile-filter-section{padding:11px 0 16px;border-bottom:1px solid var(--line)}
  .mobile-filter-section:last-of-type{border-bottom:0}
  .mobile-filter-section h3{font-size:14px;margin:0 0 12px;color:var(--text)}
  .mobile-filter-field{display:flex;flex-direction:column;gap:6px;min-width:0;width:100%}
  .mobile-filter-field span{font-size:11px;font-weight:650;color:var(--muted)}
  .mobile-filter-field select,.mobile-filter-field input{
    display:block;min-width:0!important;width:100%!important;max-width:100%;
    min-height:45px!important;height:auto!important;
    box-sizing:border-box;padding:10px 11px;
    font:600 14px/1.35 inherit;border:1px solid var(--line);border-radius:11px;
    background:var(--panel2);color:var(--text)
  }
  .mobile-filter-dependent:not([hidden]){
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;margin-top:10px;
  }
  .mobile-filter-dependent[hidden]{display:none!important}
  .mobile-filter-all,.mobile-filter-department{
    display:flex;align-items:center;gap:11px;min-width:0;
    min-height:44px;padding:8px 10px;border-radius:10px;
    font-size:13px;font-weight:650;line-height:1.25;cursor:pointer
  }
  .mobile-filter-all{background:var(--accent-soft);color:var(--text)}
  .mobile-filter-all input,.mobile-filter-department input{
    width:19px;height:19px;flex:0 0 19px;accent-color:var(--accent);
  }
  .mobile-filter-departments{display:grid;gap:3px;margin-top:8px}
  .mobile-filter-department{background:var(--panel2);color:var(--text)}
  .mobile-filter-hint{font-size:12px;color:var(--muted);margin:6px 0}
  .mobile-filter-error{padding:10px;color:var(--danger,#c73838);font-size:12px}
  .mobile-filter-error[hidden]{display:none}
  .mobile-filter-footer{
    flex:0 0 auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.4fr);
    gap:10px;padding:12px 16px max(14px,env(safe-area-inset-bottom));
    background:var(--panel);border-top:1px solid var(--line)
  }
  .mobile-filter-footer button{
    min-height:48px;min-width:0;border-radius:12px;
    font:800 13px/1.3 inherit;cursor:pointer;padding:10px
  }
  .mobile-filter-reset{background:var(--panel2);border:1px solid var(--line);color:var(--text)}
  .mobile-filter-apply{background:var(--accent);border:1px solid var(--accent);color:#fff}
}
@media (max-width:350px){
  dialog.mobile-filters-dialog[open] {max-height:100dvh!important;border-radius:17px 17px 0 0!important}
  .mobile-filter-shell{height:94dvh;max-height:94dvh}
  .mobile-filter-dependent:not([hidden]){grid-template-columns:minmax(0,1fr)}
  #dashboardToolbar>.toolbar-actions>.icon-btn{
    width:36px!important;min-width:36px!important;flex-basis:36px!important
  }
}


/* Mobile 2.0 / compact single-line toolbar.
 * Fit the connection indicator, Filters and three action icons into one row.
 * The selected filter count stays on the button, without a separate summary row.
 * Desktop and the filters bottom sheet are unaffected. */
@media (max-width:680px) {
  #dashboardToolbar {
    display:flex!important;flex-flow:row nowrap!important;align-items:center!important;
    justify-content:flex-start!important;column-gap:6px!important;row-gap:0!important;
    width:100%!important;max-width:100%;min-width:0!important;
    height:auto!important;min-height:0!important;padding:7px 8px!important;
    box-sizing:border-box;
  }
  #dashboardToolbar > .toolbar-left {
    display:flex!important;flex:0 0 30px!important;order:0;
    width:30px!important;min-width:30px!important;max-width:30px!important;
    height:40px!important;min-height:0!important;
    align-items:center!important;justify-content:center!important;
    padding:0!important;margin:0!important;overflow:visible;
  }
  #dashboardToolbar .connection-badge {
    display:flex!important;justify-content:center!important;align-items:center!important;
    flex:0 0 30px!important;width:30px!important;max-width:30px!important;
    min-width:30px!important;height:40px!important;min-height:40px!important;
    padding:0!important;box-sizing:border-box;
  }
  #dashboardToolbar .connection-badge .status-dot {
    flex:0 0 8px!important;width:8px!important;height:8px!important;
  }
  #dashboardToolbar .connection-badge #connectionLabel,
  #dashboardToolbar .updated-label {display:none!important}
  #dashboardToolbar > .mobile-filters-open {
    display:inline-flex!important;flex:0 0 auto!important;order:1;
    width:auto!important;min-width:0!important;max-width:max-content!important;
    height:40px!important;min-height:40px!important;
    padding:0 10px!important;margin:0!important;
    white-space:nowrap!important;overflow:visible;
    align-items:center;justify-content:center;gap:6px!important;
    font-size:12px!important;line-height:1!important;
  }
  #dashboardToolbar > .mobile-filters-open svg {
    flex:0 0 17px!important;width:17px!important;height:17px!important;
  }
  #dashboardToolbar > .mobile-filters-open .mobile-filter-count {
    flex:0 0 17px!important;min-width:17px!important;height:17px!important;
    font-size:10px;
  }
  #dashboardToolbar > .mobile-filters-summary {display:none!important}
  #dashboardToolbar > .toolbar-actions {
    display:flex!important;flex:0 0 auto!important;flex-flow:row nowrap!important;
    order:2;align-items:center!important;justify-content:flex-end!important;
    width:auto!important;max-width:unset!important;min-width:0!important;
    height:40px!important;min-height:0!important;
    padding:0!important;margin:0 0 0 auto!important;
    gap:5px!important;overflow:visible!important;
  }
  #dashboardToolbar > .toolbar-actions > .icon-btn {
    display:grid!important;place-items:center!important;
    flex:0 0 40px!important;width:40px!important;min-width:40px!important;
    max-width:40px!important;height:40px!important;min-height:40px!important;
    padding:0!important;margin:0!important;
  }
}
@media (max-width:350px){
  #dashboardToolbar {column-gap:4px!important;padding:6px!important}
  #dashboardToolbar > .toolbar-left {
    flex-basis:26px!important;width:26px!important;min-width:26px!important;
    max-width:26px!important;
  }
  #dashboardToolbar .connection-badge {
    flex-basis:26px!important;width:26px!important;min-width:26px!important;
    max-width:26px!important;
  }
  #dashboardToolbar > .mobile-filters-open {
    padding:0 8px!important;gap:4px!important;font-size:11px!important;
  }
  #dashboardToolbar > .toolbar-actions {gap:3px!important}
  #dashboardToolbar > .toolbar-actions > .icon-btn {
    flex-basis:36px!important;width:36px!important;min-width:36px!important;
    max-width:36px!important;height:40px!important;min-height:40px!important;
  }
}


/* Mobile 2.0: keep the two-part toggle and settings gear together in the
 * Sales Margin and Telephony widget headers, even at 320px viewport widths.
 * Scope to these widgets and mobile widths: desktop layout is unchanged. */
@media (max-width:680px) {
  [data-widget="general_plan"] > .general-plan-head,
  [data-widget="telephony"] > .telephony-head {
    display:flex!important;flex-direction:column!important;
    align-items:stretch!important;justify-content:flex-start!important;
    gap:9px!important;min-width:0!important;max-width:100%;
  }
  [data-widget="general_plan"] > .general-plan-head > div:first-child,
  [data-widget="telephony"] > .telephony-head > div:first-child {
    min-width:0;max-width:100%;width:100%;
  }
  [data-widget="general_plan"] > .general-plan-head > .widget-head-actions,
  [data-widget="telephony"] > .telephony-head > .telephony-head-actions {
    display:flex!important;flex-flow:row nowrap!important;
    align-items:center!important;justify-content:space-between!important;
    align-self:stretch!important;gap:7px!important;
    flex:0 0 auto!important;width:100%!important;max-width:100%!important;
    min-width:0!important;margin:0!important;
  }
  [data-widget="general_plan"] .general-plan-head .financial-source-switch,
  [data-widget="telephony"] .telephony-head .telephony-period-switch {
    display:flex!important;flex:1 1 0!important;align-self:center!important;
    width:auto!important;max-width:100%!important;min-width:0!important;
    justify-content:stretch;box-sizing:border-box;
  }
  [data-widget="general_plan"] .general-plan-head .financial-source-switch button,
  [data-widget="telephony"] .telephony-head .telephony-period-switch button {
    flex:1 1 0!important;min-width:0!important;
    padding-inline:6px!important;white-space:nowrap!important;
    text-align:center;
  }
  [data-widget="general_plan"] #planSettingsQuickBtn,
  [data-widget="telephony"] #telephonySettingsBtn {
    display:grid!important;place-items:center!important;
    flex:0 0 40px!important;align-self:center!important;
    width:40px!important;min-width:40px!important;max-width:40px!important;
    height:40px!important;min-height:40px!important;
    margin:0!important;padding:0!important;
  }
}
@media (max-width:350px) {
  [data-widget="general_plan"] > .general-plan-head > .widget-head-actions,
  [data-widget="telephony"] > .telephony-head > .telephony-head-actions {
    gap:5px!important;
  }
  [data-widget="general_plan"] .general-plan-head .financial-source-switch button,
  [data-widget="telephony"] .telephony-head .telephony-period-switch button {
    padding-inline:4px!important;
  }
}


/* Mobile 2.0 — Managers: one full-width name and balanced KPI cells.
 * A 1180px desktop table wastes the visible width on its sticky 170px
 * name column. Render rows as readable two-column cards on phones instead.
 * All values and click handlers remain in the original table DOM. */
.mobile-manager-sort {display:none}
@media (max-width:680px) {
  [data-widget="managers"] .managers-table-wrap {
    display:block!important;width:100%!important;max-width:100%!important;
    min-width:0!important;overflow:visible!important;max-height:none!important;
    padding:0!important;border:0;
  }
  [data-widget="managers"] .mobile-manager-sort:not([hidden]) {
    display:flex;align-items:center;justify-content:space-between;
    gap:12px;min-width:0;padding:4px 0 11px;
    color:var(--muted);font-size:11px;font-weight:700;
  }
  [data-widget="managers"] .mobile-manager-sort select {
    width:min(62%,200px);min-width:0;max-width:100%;
    min-height:40px;padding:7px 10px;
    background:var(--panel2);color:var(--text);
    border:1px solid var(--line);border-radius:10px;
    font:700 12px/1.2 inherit;
  }
  [data-widget="managers"] #managerPerformanceTable,
  [data-widget="managers"] #managerPerformanceTable.company-breakdown-open,
  [data-widget="managers"] #managerPerformanceTable.deal-breakdown-open {
    display:block!important;width:100%!important;min-width:0!important;
    max-width:100%!important;table-layout:auto!important;
    border-collapse:separate!important;overflow:visible!important;
  }
  [data-widget="managers"] #managerTableHead {display:none!important}
  [data-widget="managers"] #managerBody {
    display:grid!important;grid-template-columns:minmax(0,1fr)!important;
    gap:10px!important;width:100%;min-width:0;max-width:100%;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row:not([hidden]) {
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:0!important;min-width:0;width:100%;max-width:100%;
    padding:6px!important;border:1px solid var(--line);
    border-radius:13px;background:var(--panel2);
    box-shadow:none;overflow:hidden;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row[hidden] {
    display:none!important;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row > td {
    display:flex!important;flex-direction:column!important;
    align-items:flex-start!important;justify-content:center!important;
    gap:5px!important;position:static!important;
    width:auto!important;max-width:100%!important;min-width:0!important;
    white-space:normal!important;word-break:normal;
    padding:10px 9px!important;margin:0!important;
    border:0!important;border-radius:0;background:transparent!important;
    text-align:left!important;font-size:12px!important;
    box-sizing:border-box;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row > td:first-child {
    grid-column:1/-1!important;flex-direction:row!important;
    align-items:center!important;justify-content:flex-start!important;
    padding:8px 9px 12px!important;margin:0 0 3px!important;
    border-bottom:1px solid var(--line)!important;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row > td:not(:first-child)::before {
    content:attr(data-mobile-label);
    display:block;max-width:100%;min-width:0;
    color:var(--muted);font-size:10px;line-height:1.25;font-weight:650;
    white-space:normal;overflow-wrap:anywhere;
  }
  [data-widget="managers"] #managerBody .manager-cell {
    display:flex;align-items:center;gap:9px;
    width:100%;min-width:0!important;max-width:100%;
  }
  [data-widget="managers"] #managerBody .manager-cell > span:last-child {
    display:block;flex:1 1 0;min-width:0;max-width:100%;
  }
  [data-widget="managers"] #managerBody .manager-cell strong {
    font-size:13px;line-height:1.3;white-space:normal!important;
    overflow-wrap:anywhere;
  }
  [data-widget="managers"] #managerBody .manager-cell small {
    margin-top:3px;font-size:10px;line-height:1.25;
    overflow-wrap:anywhere;white-space:normal!important;
  }
  [data-widget="managers"] #managerBody .manager-avatar {
    flex:0 0 32px;width:32px;height:32px;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row > td.num {
    font-variant-numeric:tabular-nums;overflow-wrap:anywhere;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row > td.num > strong {
    font-size:12px;line-height:1.3;white-space:normal;
    overflow-wrap:anywhere;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row > td .conversion-pill {
    min-width:0;max-width:100%;white-space:nowrap;
  }
  [data-widget="managers"] #managerBody > tr.manager-data-row > td.manager-deals-cell,
  [data-widget="managers"] #managerBody > tr.manager-data-row > td.manager-companies-cell {
    cursor:pointer;
  }
  [data-widget="managers"] #managerBody > tr.manager-department-group-row {
    display:block!important;width:100%!important;min-width:0;
    margin:8px 0 0!important;
  }
  [data-widget="managers"] #managerBody > tr.manager-department-group-row > td {
    display:block!important;position:static!important;width:100%!important;
    min-width:0!important;max-width:100%!important;
    padding:11px!important;border-radius:11px;
    white-space:normal!important;
  }
  [data-widget="managers"] #managerBody > tr.manager-department-group-row .manager-department-copy {
    min-width:0;max-width:100%;overflow-wrap:anywhere;
  }
  [data-widget="managers"] #managerBody > tr:not(.manager-data-row):not(.manager-department-group-row) {
    display:block!important;max-width:100%;min-width:0;
  }
  [data-widget="managers"] #managerBody > tr:not(.manager-data-row):not(.manager-department-group-row) > td {
    display:block!important;white-space:normal!important;
  }
}
