/* v1.0.28 — responsive audit: unified typography, TV/desktop stability and true mobile flow */
:root {
  --audit-touch: 40px;
  --audit-mobile-gap: 10px;
  --audit-panel-pad: 14px;
}

*,*::before,*::after { box-sizing:border-box; }
button,input,select,textarea { font:inherit; }

.panel-header h2,
.analytics-team-head h2,
.ranking-card h2,
.settings-card h3,
.analytics-hero h2 {
  line-height:1.12;
  letter-spacing:-.02em;
}
.section-kicker,
.eyebrow {
  line-height:1.2;
  letter-spacing:.08em;
}
.small-btn,.primary-btn,.secondary-btn,.view-switcher-btn,.analytics-tab-btn {
  min-height:34px;
  line-height:1.1;
}
.team-table,
.analytics-table,
.history-table,
.ranking-row,
.ranking-metric-row,
.ranking-dynamics-row {
  font-variant-numeric:tabular-nums;
}

/* Intermediate desktop / laptop: preserve the 16:9 canvas but avoid clipped controls. */
@media (min-width:921px) and (max-height:820px) {
  .topbar { min-height:0 !important; }
  .global-sync-status { max-width:180px; }
  .settings-modal { max-height:94vh; }
}

/* TV: consistent viewing-distance hierarchy. */
html[data-responsive-layout="tv"] .section-kicker,
html[data-responsive-layout="tv"] .eyebrow {
  font-weight:850;
}
html[data-responsive-layout="tv"] .panel-header h2,
html[data-responsive-layout="tv"] .analytics-team-head h2 {
  font-weight:850;
}
html[data-responsive-layout="tv"] .team-table tbody td,
html[data-responsive-layout="tv"] .ranking-row {
  line-height:1.18;
}

/* Mobile / narrow tablets: natural page flow instead of a scaled desktop canvas. */
@media (max-width:920px) {
  html,body {
    width:100%;
    min-width:0 !important;
    min-height:100%;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    -webkit-text-size-adjust:100%;
  }
  body { overscroll-behavior-y:contain; }

  html.v118-mobile-layout body .app-shell {
    padding:
      max(10px,env(safe-area-inset-top))
      max(10px,env(safe-area-inset-right))
      max(12px,env(safe-area-inset-bottom))
      max(10px,env(safe-area-inset-left)) !important;
    gap:var(--audit-mobile-gap) !important;
  }

  html.v118-mobile-layout .topbar {
    position:relative !important;
    top:auto !important;
    z-index:2;
    padding:8px;
    margin:-4px -4px 0;
    border:1px solid var(--panel-border);
    border-radius:14px;
    background:color-mix(in srgb,var(--bg) 93%,transparent);
    backdrop-filter:blur(18px);
  }

  html.v118-mobile-layout .kpi-grid {
    grid-template-columns:repeat(auto-fit,minmax(155px,1fr)) !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .kpi-card {
    min-height:0 !important;
    height:auto !important;
    padding:12px !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .kpi-top { align-items:flex-start; gap:8px; }
  html.v118-mobile-layout .kpi-label { line-height:1.18; }
  html.v118-mobile-layout .kpi-values { align-items:baseline; flex-wrap:wrap; gap:4px 7px; }

  html.v118-mobile-layout .lower-grid,
  html.v118-mobile-layout .side-panel-grid {
    grid-template-columns:minmax(0,1fr) !important;
    grid-template-rows:auto !important;
  }
  html.v118-mobile-layout .team-panel,
  html.v118-mobile-layout .events-panel,
  html.v118-mobile-layout .focus-card,
  html.v118-mobile-layout .goal-card,
  html.v118-mobile-layout .birthday-card,
  html.v118-mobile-layout .previous-leader-card {
    min-height:0 !important;
    height:auto !important;
    overflow:visible !important;
  }

  /* Main team table becomes readable realtor cards; no 860px horizontal table on phones. */
  html.v118-mobile-layout .team-panel .table-wrap {
    overflow:visible !important;
    padding:0 10px 12px !important;
  }
  html.v118-mobile-layout .team-table {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    border-spacing:0 !important;
  }
  html.v118-mobile-layout .team-table thead { display:none !important; }
  html.v118-mobile-layout .team-table tbody {
    display:grid !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .team-table tbody tr {
    position:relative;
    display:grid !important;
    grid-template-columns:34px repeat(2,minmax(0,1fr));
    gap:7px 8px;
    width:100% !important;
    min-height:0 !important;
    padding:10px !important;
    border:1px solid var(--panel-border);
    border-radius:13px;
    background:color-mix(in srgb,var(--panel-2) 91%,transparent);
  }
  html.v118-mobile-layout .team-table tbody td {
    display:flex !important;
    min-width:0 !important;
    width:auto !important;
    height:auto !important;
    padding:5px 6px !important;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    border:0 !important;
    text-align:right !important;
    white-space:normal !important;
  }
  html.v118-mobile-layout .team-table tbody td::before {
    content:attr(data-label);
    flex:0 1 auto;
    color:var(--muted);
    font-size:10px;
    font-weight:760;
    line-height:1.15;
    text-align:left;
  }
  html.v118-mobile-layout .team-table tbody td:first-child {
    grid-column:1;
    justify-content:center;
    padding:0 !important;
  }
  html.v118-mobile-layout .team-table tbody td:first-child::before,
  html.v118-mobile-layout .team-table tbody .name-cell::before { content:none; }
  html.v118-mobile-layout .team-table tbody .name-cell {
    grid-column:2 / 4;
    justify-content:flex-start;
    text-align:left !important;
    font-size:13px !important;
    font-weight:820;
    padding-left:0 !important;
  }
  html.v118-mobile-layout .team-table tbody td[data-metric-key] {
    grid-column:auto / span 1;
  }
  html.v118-mobile-layout .team-table .metric-value-wrap,
  html.v118-mobile-layout .team-table .deals-cell-content {
    min-width:0;
    max-width:100%;
    justify-content:flex-end;
  }
  html.v118-mobile-layout .team-table .team-total-row {
    background:color-mix(in srgb,var(--brand) 12%,var(--panel-2));
  }
  html.v118-mobile-layout .team-table .team-total-row .name-cell {
    grid-column:1 / 4;
    padding-left:6px !important;
  }
  html.v118-mobile-layout .team-table .team-total-row td:first-child { display:none !important; }

  /* Analytics navigation: one-line scrollable tabs with touch targets. */
  html.v118-mobile-layout .analytics-tabs {
    display:flex !important;
    overflow-x:auto !important;
    overflow-y:hidden !important;
    flex-wrap:nowrap !important;
    gap:5px !important;
    padding:5px !important;
    scrollbar-width:none;
    scroll-snap-type:x proximity;
  }
  html.v118-mobile-layout .analytics-tabs::-webkit-scrollbar { display:none; }
  html.v118-mobile-layout .analytics-tab-btn {
    flex:0 0 auto !important;
    min-width:auto !important;
    min-height:var(--audit-touch) !important;
    padding:0 13px !important;
    scroll-snap-align:start;
  }
  html.v118-mobile-layout .analytics-hero {
    border-radius:14px;
    gap:9px !important;
  }
  html.v118-mobile-layout .analytics-toolbar {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .analytics-metric-filter {
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:5px !important;
  }
  html.v118-mobile-layout .analytics-toolbar .text-input,
  html.v118-mobile-layout .analytics-toolbar button {
    min-height:var(--audit-touch);
  }
  html.v118-mobile-layout .analytics-summary-grid,
  html.v118-mobile-layout .agent-summary-grid,
  html.v118-mobile-layout .history-analytics-summary,
  html.v118-mobile-layout .signals-summary-grid,
  html.v118-mobile-layout .management-summary-grid,
  html.v118-mobile-layout .reports-summary-grid,
  html.v118-mobile-layout .ranking-summary-grid,
  html.v118-mobile-layout .compare-summary-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .ranking-layout,
  html.v118-mobile-layout .reports-layout,
  html.v118-mobile-layout .signals-layout,
  html.v118-mobile-layout .management-layout,
  html.v118-mobile-layout .agent-middle-grid,
  html.v118-mobile-layout .agent-bottom-grid {
    grid-template-columns:minmax(0,1fr) !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .ranking-card,
  html.v118-mobile-layout .reports-card,
  html.v118-mobile-layout .management-card {
    min-width:0 !important;
    width:100% !important;
  }

  /* Settings are a real mobile screen instead of a desktop modal squeezed into viewport. */
  .modal-backdrop {
    padding:0 !important;
    align-items:stretch !important;
  }
  .settings-modal {
    width:100vw !important;
    max-width:none !important;
    height:100dvh !important;
    max-height:none !important;
    border-radius:0 !important;
    display:grid !important;
    grid-template-rows:auto minmax(0,1fr) auto;
  }
  .settings-head {
    padding:max(12px,env(safe-area-inset-top)) 14px 10px !important;
  }
  .settings-body {
    min-height:0;
    overflow-y:auto !important;
    overflow-x:hidden !important;
    padding:10px !important;
  }
  .settings-footer {
    position:sticky;
    bottom:0;
    z-index:5;
    padding:10px max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left)) !important;
    background:var(--panel);
    border-top:1px solid var(--panel-border);
  }
  .settings-footer button,
  .settings-modal .small-btn,
  .settings-modal .primary-btn,
  .settings-modal .secondary-btn,
  .settings-modal .text-input {
    min-height:44px;
  }
  .two-col-settings,
  .service-grid,
  .theme-grid {
    grid-template-columns:minmax(0,1fr) !important;
  }
}

@media (max-width:560px) {
  :root { --audit-touch:44px; }

  html.v118-mobile-layout .topbar {
    grid-template-columns:minmax(0,1fr) auto auto !important;
    grid-template-areas:
      "brand clock actions"
      "period period period"
      "nav nav nav"
      "sync sync sync" !important;
  }
  html.v118-mobile-layout .top-actions { display:contents !important; }
  html.v118-mobile-layout .brand-block { grid-area:brand; min-width:0; }
  html.v118-mobile-layout .period-block { grid-area:period; overflow:visible; }
  html.v118-mobile-layout .view-switcher {
    grid-area:nav;
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }
  html.v118-mobile-layout .view-switcher-btn {
    min-height:42px;
    width:100%;
  }
  html.v118-mobile-layout .global-sync-status {
    grid-area:sync;
    max-width:none;
    width:100%;
    justify-content:center;
  }
  html.v118-mobile-layout .clock {
    grid-area:clock;
    align-self:center;
    font-size:16px !important;
  }
  html.v118-mobile-layout .action-drawer-wrap {
    grid-area:actions;
    align-self:center;
  }
  html.v118-mobile-layout .action-drawer-wrap.open .action-drawer {
    position:absolute;
    right:42px;
    z-index:90;
  }

  html.v118-mobile-layout .analytics-summary-grid,
  html.v118-mobile-layout .agent-summary-grid,
  html.v118-mobile-layout .history-analytics-summary,
  html.v118-mobile-layout .signals-summary-grid,
  html.v118-mobile-layout .management-summary-grid,
  html.v118-mobile-layout .reports-summary-grid,
  html.v118-mobile-layout .ranking-summary-grid,
  html.v118-mobile-layout .compare-summary-grid {
    grid-template-columns:minmax(0,1fr) !important;
  }

  html.v118-mobile-layout .team-table tbody tr {
    grid-template-columns:32px minmax(0,1fr);
  }
  html.v118-mobile-layout .team-table tbody .name-cell {
    grid-column:2;
  }
  html.v118-mobile-layout .team-table tbody td[data-metric-key] {
    grid-column:1 / 3;
  }
  html.v118-mobile-layout .team-table .team-total-row .name-cell {
    grid-column:1 / 3;
  }

  html.v118-mobile-layout .ranking-row {
    grid-template-columns:28px minmax(0,1fr) auto !important;
    gap:7px !important;
  }
  html.v118-mobile-layout .ranking-row > b {
    justify-self:end;
    text-align:right;
  }

  .ranking-snapshot-head {
    flex-direction:column;
    align-items:flex-start !important;
    gap:8px !important;
  }
  .ranking-snapshot-metric { justify-items:start !important; }

  .settings-page-choice { min-height:92px; }
}

@media (max-width:380px) {
  html.v118-mobile-layout .kpi-grid { grid-template-columns:minmax(0,1fr) !important; }
  html.v118-mobile-layout .brand-mark { width:34px !important; height:34px !important; }
  html.v118-mobile-layout .brand-title,
  html.v118-mobile-layout .brand-subtitle {
    max-width:175px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
}


/* v1.0.29 — mobile stabilization */
@media (max-width:920px) {
  html,body { touch-action:pan-x pan-y; }
  html.v118-mobile-layout .topbar,
  html.v118-mobile-layout .analytics-tabs {
    position:relative !important;
    top:auto !important;
    inset:auto !important;
  }
  html.v118-mobile-layout .topbar {
    backdrop-filter:none !important;
    -webkit-backdrop-filter:none !important;
  }
  html.v118-mobile-layout .analytics-tabs { z-index:1 !important; }
  html.v118-mobile-layout .app-shell,
  html.v118-mobile-layout .dashboard,
  html.v118-mobile-layout .analytics-dashboard,
  html.v118-mobile-layout .panel,
  html.v118-mobile-layout .kpi-card,
  html.v118-mobile-layout .analytics-hero,
  html.v118-mobile-layout .analytics-tab-panel {
    max-width:100% !important;
  }
  html.v118-mobile-layout input,
  html.v118-mobile-layout select,
  html.v118-mobile-layout textarea {
    font-size:16px !important;
  }
}
html.pwa-standalone,
html.pwa-standalone body {
  min-height:100dvh;
  background:var(--bg);
}
html.pwa-standalone body .app-shell {
  padding-top:max(10px,env(safe-area-inset-top)) !important;
  padding-bottom:max(12px,env(safe-area-inset-bottom)) !important;
}


/* v1.0.30 — mobile document flow: no viewport recentering, no KPI overlap */
@media (max-width:920px) {
  html {
    width:100% !important;
    height:auto !important;
    min-height:100% !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    scroll-behavior:auto !important;
    scroll-snap-type:none !important;
  }
  body,
  html.v118-mobile-layout body,
  html.pwa-standalone body {
    position:static !important;
    display:block !important;
    width:100% !important;
    height:auto !important;
    min-height:100dvh !important;
    margin:0 !important;
    overflow-x:hidden !important;
    overflow-y:visible !important;
    align-items:initial !important;
    justify-content:initial !important;
    place-items:initial !important;
    scroll-snap-type:none !important;
    overscroll-behavior-y:auto !important;
  }
  html.v118-mobile-layout body .app-shell,
  html.pwa-standalone.v118-mobile-layout body .app-shell {
    position:relative !important;
    inset:auto !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    height:auto !important;
    min-height:100dvh !important;
    max-height:none !important;
    margin:0 !important;
    overflow:visible !important;
    transform:none !important;
    transform-origin:0 0 !important;
    zoom:1 !important;
    will-change:auto !important;
  }
  html.v118-mobile-layout .dashboard,
  html.v118-mobile-layout #mainDashboard {
    position:relative !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    justify-content:flex-start !important;
    width:100% !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    overflow:visible !important;
  }
  html.v118-mobile-layout .kpi-grid {
    position:relative !important;
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    grid-auto-flow:row !important;
    grid-auto-rows:max-content !important;
    align-items:stretch !important;
    align-content:start !important;
    width:100% !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    overflow:visible !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .kpi-card {
    position:relative !important;
    display:flex !important;
    flex-direction:column !important;
    justify-content:space-between !important;
    align-items:stretch !important;
    align-self:stretch !important;
    width:auto !important;
    min-width:0 !important;
    height:auto !important;
    min-height:126px !important;
    max-height:none !important;
    padding:11px 11px 10px !important;
    overflow:hidden !important;
    gap:8px !important;
  }
  html.v118-mobile-layout .kpi-card > * {
    position:relative !important;
    min-width:0 !important;
    max-width:100% !important;
  }
  html.v118-mobile-layout .kpi-top,
  html.v118-mobile-layout .kpi-values {
    width:100% !important;
    min-width:0 !important;
  }
  html.v118-mobile-layout .kpi-top {
    display:flex !important;
    align-items:flex-start !important;
    justify-content:space-between !important;
    gap:6px !important;
  }
  html.v118-mobile-layout .kpi-label {
    min-width:0 !important;
    font-size:11px !important;
    line-height:1.15 !important;
    overflow-wrap:anywhere;
  }
  html.v118-mobile-layout .kpi-percent {
    flex:0 0 auto !important;
    font-size:18px !important;
    line-height:1 !important;
  }
  html.v118-mobile-layout .kpi-values {
    display:flex !important;
    flex-wrap:wrap !important;
    align-items:baseline !important;
    gap:3px 6px !important;
  }
  html.v118-mobile-layout .kpi-main {
    min-width:0 !important;
    max-width:100% !important;
    font-size:clamp(17px,4.6vw,22px) !important;
    line-height:1.08 !important;
    white-space:normal !important;
    overflow-wrap:anywhere !important;
  }
  html.v118-mobile-layout .kpi-plan {
    flex:0 1 auto !important;
    font-size:10px !important;
    line-height:1.15 !important;
    white-space:normal !important;
  }
  html.v118-mobile-layout .progress-track {
    width:100% !important;
    max-width:100% !important;
  }
  html.v118-mobile-layout .kpi-hint {
    min-height:0 !important;
    margin-top:5px !important;
    font-size:9px !important;
    line-height:1.2 !important;
    white-space:normal !important;
    overflow:visible !important;
  }
}

@media (max-width:360px) {
  html.v118-mobile-layout .kpi-grid {
    grid-template-columns:minmax(0,1fr) !important;
  }
  html.v118-mobile-layout .kpi-card {
    min-height:116px !important;
  }
}


/* v1.0.31 — iPhone safe area and stable realtor cards */
html.pwa-standalone body {
  padding-top:env(safe-area-inset-top) !important;
  padding-left:env(safe-area-inset-left) !important;
  padding-right:env(safe-area-inset-right) !important;
  padding-bottom:env(safe-area-inset-bottom) !important;
}
html.pwa-standalone.v118-mobile-layout body .app-shell {
  min-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)) !important;
  padding-top:12px !important;
  padding-left:10px !important;
  padding-right:10px !important;
  padding-bottom:12px !important;
}

@media (max-width:560px) {
  html.v118-mobile-layout .team-panel {
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    overflow:visible !important;
  }
  html.v118-mobile-layout .team-panel .table-wrap {
    display:block !important;
    width:100% !important;
    height:auto !important;
    max-height:none !important;
    overflow:visible !important;
    padding:0 10px 12px !important;
  }
  html.v118-mobile-layout .team-table {
    display:block !important;
    width:100% !important;
    min-width:0 !important;
    height:auto !important;
    table-layout:auto !important;
    border-collapse:separate !important;
    border-spacing:0 !important;
  }
  html.v118-mobile-layout .team-table thead {
    display:none !important;
  }
  html.v118-mobile-layout .team-table tbody {
    display:flex !important;
    flex-direction:column !important;
    width:100% !important;
    height:auto !important;
    gap:10px !important;
  }
  html.v118-mobile-layout .team-table tbody tr,
  html.v118-mobile-layout .team-table tbody tr[data-member-id],
  html.v118-mobile-layout .team-table tbody tr.team-total-row {
    position:relative !important;
    inset:auto !important;
    display:grid !important;
    grid-template-columns:40px minmax(0,1fr) !important;
    grid-auto-flow:row !important;
    grid-auto-rows:auto !important;
    align-items:center !important;
    align-content:start !important;
    width:100% !important;
    min-width:0 !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    margin:0 !important;
    padding:10px !important;
    gap:5px 8px !important;
    overflow:hidden !important;
    transform:none !important;
    border:1px solid var(--panel-border) !important;
    border-radius:14px !important;
    background:color-mix(in srgb,var(--panel-2) 94%,transparent) !important;
  }
  html.v118-mobile-layout .team-table tbody tr > td {
    position:relative !important;
    inset:auto !important;
    float:none !important;
    display:flex !important;
    width:auto !important;
    min-width:0 !important;
    max-width:100% !important;
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    margin:0 !important;
    padding:6px 4px !important;
    border:0 !important;
    transform:none !important;
    overflow:visible !important;
    opacity:1 !important;
    white-space:normal !important;
    line-height:1.2 !important;
  }
  html.v118-mobile-layout .team-table tbody tr > td:first-child {
    grid-column:1 !important;
    grid-row:1 !important;
    align-items:center !important;
    justify-content:center !important;
    align-self:center !important;
    min-height:34px !important;
    padding:0 !important;
    border:1px solid color-mix(in srgb,var(--brand) 46%,var(--panel-border)) !important;
    border-radius:10px !important;
    background:color-mix(in srgb,var(--brand) 10%,transparent) !important;
    color:var(--brand) !important;
    font-weight:800 !important;
  }
  html.v118-mobile-layout .team-table tbody tr > .name-cell {
    grid-column:2 !important;
    grid-row:1 !important;
    align-items:center !important;
    justify-content:flex-start !important;
    gap:6px !important;
    padding:6px 0 !important;
    text-align:left !important;
    font-size:14px !important;
    font-weight:820 !important;
    color:var(--text) !important;
  }
  html.v118-mobile-layout .team-table tbody tr > td[data-metric-key] {
    grid-column:1 / -1 !important;
    grid-row:auto !important;
    display:grid !important;
    grid-template-columns:minmax(92px,42%) minmax(0,1fr) !important;
    align-items:center !important;
    column-gap:8px !important;
    min-height:32px !important;
    padding:5px 4px !important;
    border-top:1px solid color-mix(in srgb,var(--panel-border) 70%,transparent) !important;
    text-align:right !important;
  }
  html.v118-mobile-layout .team-table tbody tr > td[data-metric-key]::before {
    content:attr(data-label) !important;
    position:static !important;
    display:block !important;
    min-width:0 !important;
    color:var(--muted) !important;
    font-size:10px !important;
    font-weight:760 !important;
    line-height:1.15 !important;
    text-align:left !important;
    white-space:normal !important;
  }
  html.v118-mobile-layout .team-table tbody td[data-metric-key] > *,
  html.v118-mobile-layout .team-table .metric-value-wrap,
  html.v118-mobile-layout .team-table .deals-cell-content,
  html.v118-mobile-layout .team-table .deals-total-line {
    position:static !important;
    inset:auto !important;
    float:none !important;
    display:flex !important;
    align-items:center !important;
    justify-content:flex-end !important;
    flex-wrap:wrap !important;
    min-width:0 !important;
    max-width:100% !important;
    width:auto !important;
    height:auto !important;
    min-height:0 !important;
    margin:0 !important;
    padding:0 !important;
    gap:3px !important;
    transform:none !important;
    white-space:normal !important;
    text-align:right !important;
  }
  html.v118-mobile-layout .team-table td[data-metric-key] strong,
  html.v118-mobile-layout .team-table td[data-metric-key] .plan,
  html.v118-mobile-layout .team-table td[data-metric-key] .pace-pill {
    position:static !important;
    inset:auto !important;
    transform:none !important;
    white-space:nowrap !important;
    line-height:1.15 !important;
  }
  html.v118-mobile-layout .team-table .deals-breakdown,
  html.v118-mobile-layout .team-table .deal-breakdown,
  html.v118-mobile-layout .team-table [class*="deals-breakdown"] {
    width:100% !important;
    justify-content:flex-end !important;
    font-size:8px !important;
    line-height:1.15 !important;
  }
  html.v118-mobile-layout .team-table tbody tr.team-total-row > td:first-child {
    display:none !important;
  }
  html.v118-mobile-layout .team-table tbody tr.team-total-row > .name-cell {
    grid-column:1 / -1 !important;
    grid-row:1 !important;
    padding:6px 4px !important;
  }
}


/* v1.0.32 — one native iOS scroll container */
@media (max-width:920px) {
  html,
  html.v118-mobile-layout,
  html.pwa-standalone {
    width:100% !important;
    height:100% !important;
    min-height:100% !important;
    overflow:hidden !important;
    overscroll-behavior:none !important;
    scroll-snap-type:none !important;
    touch-action:auto !important;
  }

  body,
  html.v118-mobile-layout body,
  html.pwa-standalone body,
  html.pwa-standalone.v118-mobile-layout body {
    position:relative !important;
    inset:auto !important;
    display:block !important;
    box-sizing:border-box !important;
    width:100% !important;
    height:100% !important;
    min-height:100% !important;
    max-height:none !important;
    margin:0 !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior-x:none !important;
    overscroll-behavior-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    scroll-behavior:auto !important;
    scroll-snap-type:none !important;
    touch-action:auto !important;
  }

  html.v118-mobile-layout body .app-shell,
  html.pwa-standalone.v118-mobile-layout body .app-shell {
    position:relative !important;
    width:100% !important;
    height:auto !important;
    min-height:100% !important;
    max-height:none !important;
    overflow:visible !important;
    overscroll-behavior:unset !important;
    touch-action:auto !important;
  }

  html.v118-mobile-layout .dashboard,
  html.v118-mobile-layout .analytics-dashboard,
  html.v118-mobile-layout .lower-grid,
  html.v118-mobile-layout .team-panel,
  html.v118-mobile-layout .side-panel-grid {
    height:auto !important;
    max-height:none !important;
    overflow-y:visible !important;
    overscroll-behavior:unset !important;
  }

  html.v118-mobile-layout .analytics-tabs {
    touch-action:pan-x !important;
  }

  html.v118-mobile-layout .settings-body {
    -webkit-overflow-scrolling:touch !important;
    touch-action:pan-y !important;
  }
}


/* v1.0.33 — mobile team alignment and compact action menu */
@media (max-width:560px) {
  /* The action drawer on phone contains only Refresh + Settings. */
  html.v118-mobile-layout #fullscreenBtn,
  html.v118-mobile-layout #installAppBtn {
    display:none !important;
  }
  html.v118-mobile-layout .action-drawer-wrap.open .action-drawer {
    width:78px !important;
    max-width:78px !important;
    gap:6px !important;
    overflow:visible !important;
  }
  html.v118-mobile-layout #settingsBtn,
  html.v118-mobile-layout #refreshBtn {
    display:grid !important;
    visibility:visible !important;
    opacity:1 !important;
    flex:0 0 36px !important;
  }

  /* More breathing room between rank and realtor name. */
  html.v118-mobile-layout .team-table tbody tr,
  html.v118-mobile-layout .team-table tbody tr[data-member-id] {
    grid-template-columns:52px minmax(0,1fr) !important;
    column-gap:10px !important;
  }
  html.v118-mobile-layout .team-table tbody tr > td:first-child {
    width:38px !important;
    min-width:38px !important;
    max-width:38px !important;
    justify-self:start !important;
  }
  html.v118-mobile-layout .team-table tbody tr > .name-cell {
    padding-left:6px !important;
    min-width:0 !important;
  }
  html.v118-mobile-layout .team-table .team-member-name-text {
    display:block !important;
    min-width:0 !important;
    max-width:100% !important;
    overflow:hidden !important;
    text-overflow:ellipsis !important;
    white-space:nowrap !important;
  }

  /* Every metric uses the same label-left / value-right alignment. */
  html.v118-mobile-layout .team-table tbody tr > td[data-metric-key] {
    grid-template-columns:minmax(92px,42%) minmax(0,1fr) !important;
  }
  html.v118-mobile-layout .team-table tbody tr > td[data-metric-key] > * {
    grid-column:2 !important;
    justify-self:end !important;
    margin-left:auto !important;
    text-align:right !important;
  }
  html.v118-mobile-layout .team-table .metric-value-wrap,
  html.v118-mobile-layout .team-table .deals-total-line {
    display:inline-flex !important;
    width:max-content !important;
    min-width:0 !important;
    max-width:100% !important;
    flex:0 0 auto !important;
    align-self:center !important;
    justify-self:end !important;
    justify-content:flex-end !important;
    margin-left:auto !important;
  }

  /* Completion oval hugs only the fact/plan text. */
  html.v118-mobile-layout .team-table .metric-complete-pill {
    display:inline-flex !important;
    width:max-content !important;
    min-width:0 !important;
    max-width:100% !important;
    flex:0 0 auto !important;
    align-self:center !important;
    justify-self:end !important;
    margin-left:auto !important;
    padding:4px 8px !important;
  }

  /* Deals keeps the breakdown below, but fact/plan itself is aligned right like every other metric. */
  html.v118-mobile-layout .team-table .deals-cell-content {
    display:grid !important;
    grid-template-columns:minmax(0,1fr) !important;
    justify-items:end !important;
    align-items:center !important;
    justify-self:stretch !important;
    width:100% !important;
    max-width:100% !important;
    margin:0 !important;
  }
  html.v118-mobile-layout .team-table .deals-cell-content .deals-total-line {
    justify-self:end !important;
    margin-left:auto !important;
  }
  html.v118-mobile-layout .team-table .deals-breakdown {
    justify-self:end !important;
    justify-content:flex-end !important;
    width:auto !important;
    max-width:100% !important;
    margin-left:auto !important;
  }

  /* Installation hint is shown only while the password gate is visible. */
  .mobile-install-hint {
    position:fixed;
    left:max(12px,env(safe-area-inset-left));
    right:max(12px,env(safe-area-inset-right));
    bottom:max(14px,env(safe-area-inset-bottom));
    z-index:140;
    display:grid;
    gap:4px;
    padding:12px 38px 12px 14px;
    border:1px solid color-mix(in srgb,var(--brand) 42%,var(--panel-border));
    border-radius:14px;
    background:color-mix(in srgb,var(--panel-2) 96%,#07111d);
    box-shadow:0 16px 44px rgba(0,0,0,.38);
    color:var(--text);
    text-align:left;
  }
  .mobile-install-hint[hidden] { display:none !important; }
  .mobile-install-hint strong {
    font-size:13px;
    line-height:1.2;
  }
  .mobile-install-hint span {
    color:var(--muted);
    font-size:11px;
    line-height:1.35;
  }
  .mobile-install-hint-close {
    position:absolute;
    top:5px;
    right:7px;
    width:28px;
    height:28px;
    display:grid;
    place-items:center;
    border:0;
    background:transparent;
    color:var(--muted);
    font-size:22px;
    line-height:1;
  }
}


/* v1.0.34 — preserve mobile baseline; refine team spacing/pills/install hint */
@media (max-width:560px) {
  /* Keep number separate, but return the realtor name a little to the left. */
  html.v118-mobile-layout .team-table tbody tr,
  html.v118-mobile-layout .team-table tbody tr[data-member-id] {
    grid-template-columns:44px minmax(0,1fr) !important;
    column-gap:8px !important;
  }
  html.v118-mobile-layout .team-table tbody tr > td:first-child {
    width:36px !important;
    min-width:36px !important;
    max-width:36px !important;
  }
  html.v118-mobile-layout .team-table tbody tr > .name-cell {
    padding-left:2px !important;
  }

  /* Give fact/plan more horizontal room and keep every value aligned right. */
  html.v118-mobile-layout .team-table tbody tr > td[data-metric-key] {
    grid-template-columns:minmax(78px,34%) minmax(0,1fr) !important;
    column-gap:8px !important;
  }

  /* Completed value oval must fit the complete fact/plan text, never crop it. */
  html.v118-mobile-layout .team-table .metric-complete-pill,
  html.v118-mobile-layout .team-table .deals-total-line.metric-complete-pill {
    display:inline-flex !important;
    box-sizing:border-box !important;
    width:fit-content !important;
    min-width:max-content !important;
    max-width:none !important;
    flex:0 0 auto !important;
    align-items:baseline !important;
    justify-content:center !important;
    justify-self:end !important;
    margin-left:auto !important;
    padding:4px 10px !important;
    overflow:visible !important;
    white-space:nowrap !important;
    line-height:1.15 !important;
  }
  html.v118-mobile-layout .team-table .metric-complete-pill strong,
  html.v118-mobile-layout .team-table .metric-complete-pill .plan,
  html.v118-mobile-layout .team-table .deals-total-line.metric-complete-pill strong,
  html.v118-mobile-layout .team-table .deals-total-line.metric-complete-pill .plan {
    display:inline !important;
    flex:0 0 auto !important;
    min-width:max-content !important;
    white-space:nowrap !important;
    overflow:visible !important;
  }

  /* Fact/plan in Deals follows the exact same right edge as other metrics. */
  html.v118-mobile-layout .team-table .deals-cell-content {
    justify-self:end !important;
    width:auto !important;
    max-width:100% !important;
  }
  html.v118-mobile-layout .team-table .deals-cell-content .deals-total-line {
    justify-self:end !important;
    margin-left:auto !important;
  }

  /* Installation hint is visible by default on the mobile password gate.
     JS only hides it when already installed or when user closes it. */
  #siteAccessGate .mobile-install-hint {
    display:grid !important;
  }
  #siteAccessGate .mobile-install-hint.is-pwa-hidden,
  #siteAccessGate .mobile-install-hint.is-dismissed {
    display:none !important;
  }
}
@media (display-mode:standalone) {
  #siteAccessGate .mobile-install-hint {
    display:none !important;
  }
}


/* v1.0.35 — all completed mobile metrics use the Deals pill geometry */
@media (max-width:560px) {
  html.v118-mobile-layout .team-table tbody td[data-metric-key] > .metric-value-wrap.metric-complete-pill,
  html.v118-mobile-layout .team-table tbody td[data-metric-key] .deals-total-line.metric-complete-pill {
    display:inline-flex !important;
    box-sizing:border-box !important;
    width:fit-content !important;
    min-width:max-content !important;
    max-width:none !important;
    min-height:34px !important;
    height:auto !important;
    flex:0 0 auto !important;
    align-items:center !important;
    justify-content:center !important;
    justify-self:end !important;
    margin:0 0 0 auto !important;
    padding:5px 12px !important;
    gap:3px !important;
    border-radius:999px !important;
    overflow:visible !important;
    white-space:nowrap !important;
    line-height:1.1 !important;
  }

  html.v118-mobile-layout .team-table tbody td[data-metric-key] > .metric-value-wrap.metric-complete-pill strong,
  html.v118-mobile-layout .team-table tbody td[data-metric-key] > .metric-value-wrap.metric-complete-pill .plan,
  html.v118-mobile-layout .team-table tbody td[data-metric-key] .deals-total-line.metric-complete-pill strong,
  html.v118-mobile-layout .team-table tbody td[data-metric-key] .deals-total-line.metric-complete-pill .plan {
    display:inline-block !important;
    min-width:0 !important;
    flex:0 0 auto !important;
    margin:0 !important;
    padding:0 !important;
    line-height:1.1 !important;
    white-space:nowrap !important;
    overflow:visible !important;
  }
}


/* v1.0.36 — unified large-display / TV visual system.
   Full-HD-class viewports at browser zoom 100% become readable from distance.
   Mobile rules below remain untouched because this profile is activated by JS only. */
html[data-responsive-layout="tv"] {
  --tv-kicker: clamp(11px, .62vw, 13px);
  --tv-caption: clamp(12px, .68vw, 14px);
  --tv-body: clamp(15px, .82vw, 17px);
  --tv-body-strong: clamp(16px, .88vw, 18px);
  --tv-heading: clamp(19px, 1.05vw, 22px);
  --tv-value: clamp(17px, .94vw, 20px);
}

/* Shared semantic hierarchy: same meaning = same typography. */
html[data-responsive-layout="tv"] .section-kicker,
html[data-responsive-layout="tv"] .eyebrow {
  font-size:var(--tv-kicker) !important;
  line-height:1.15 !important;
  letter-spacing:.08em !important;
  font-weight:850 !important;
}

html[data-responsive-layout="tv"] .panel-header h2,
html[data-responsive-layout="tv"] .analytics-team-head h2,
html[data-responsive-layout="tv"] .analytics-hero h2,
html[data-responsive-layout="tv"] .planner-card-head h2,
html[data-responsive-layout="tv"] .planner-hero h2,
html[data-responsive-layout="tv"] .planner-account-panel h2 {
  font-size:var(--tv-heading) !important;
  line-height:1.08 !important;
  font-weight:850 !important;
  letter-spacing:-.025em !important;
}

html[data-responsive-layout="tv"] .view-switcher-btn,
html[data-responsive-layout="tv"] .analytics-tab-btn {
  font-size:clamp(11px,.62vw,13px) !important;
  min-height:38px !important;
  padding-inline:12px !important;
}

html[data-responsive-layout="tv"] .brand-title {
  font-size:clamp(12px,.67vw,14px) !important;
}
html[data-responsive-layout="tv"] .brand-subtitle {
  font-size:clamp(22px,1.22vw,26px) !important;
}
html[data-responsive-layout="tv"] .period-block strong {
  font-size:clamp(20px,1.08vw,23px) !important;
}
html[data-responsive-layout="tv"] .clock {
  font-size:clamp(22px,1.15vw,25px) !important;
}

/* Keep the five KPI cards as the visual reference: equal geometry and only modest text adjustment. */
html[data-responsive-layout="tv"] .kpi-grid {
  grid-template-columns:repeat(5,minmax(0,1fr)) !important;
  align-items:stretch !important;
}
html[data-responsive-layout="tv"] .kpi-card {
  height:100% !important;
  min-height:0 !important;
}
html[data-responsive-layout="tv"] .kpi-label {
  font-size:clamp(13px,.72vw,15px) !important;
}
html[data-responsive-layout="tv"] .kpi-plan,
html[data-responsive-layout="tv"] .kpi-hint {
  font-size:clamp(11px,.62vw,13px) !important;
}

/* Main team table: this is the primary TV-reading surface. */
html[data-responsive-layout="tv"] .team-panel .panel-header {
  padding:15px 18px 11px !important;
}
html[data-responsive-layout="tv"] .team-panel .table-wrap {
  padding:0 11px 12px !important;
}
html[data-responsive-layout="tv"] .team-table {
  border-spacing:0 6px !important;
  font-size:var(--tv-body) !important;
  line-height:1.16 !important;
}
html[data-responsive-layout="tv"] .team-table thead th {
  font-size:clamp(11px,.62vw,13px) !important;
  padding:0 6px 5px !important;
  line-height:1.12 !important;
  letter-spacing:.055em !important;
}
html[data-responsive-layout="tv"] .team-table .rank-col {
  width:44px !important;
}
html[data-responsive-layout="tv"] .team-table .name-col {
  width:clamp(180px,10.6vw,215px) !important;
}
html[data-responsive-layout="tv"] .team-table thead th:nth-child(3),
html[data-responsive-layout="tv"] .team-table tbody td:nth-child(3) {
  width:var(--revenue-col-width,250px) !important;
  min-width:var(--revenue-col-width,250px) !important;
}
html[data-responsive-layout="tv"] .team-table tbody td {
  padding:9px 6px !important;
  font-size:var(--tv-body) !important;
  line-height:1.15 !important;
}
html[data-responsive-layout="tv"] .team-table tbody .name-cell,
html[data-responsive-layout="tv"] .team-table .team-member-name-text {
  font-size:var(--tv-body-strong) !important;
  font-weight:780 !important;
  letter-spacing:-.015em !important;
}
html[data-responsive-layout="tv"] .team-table .ratio,
html[data-responsive-layout="tv"] .team-table .ratio strong,
html[data-responsive-layout="tv"] .team-table .rev-cell strong,
html[data-responsive-layout="tv"] .team-table .metric-value-wrap,
html[data-responsive-layout="tv"] .team-table .deals-total-line {
  font-size:var(--tv-body) !important;
  font-weight:760 !important;
}
html[data-responsive-layout="tv"] .team-table .ratio .plan,
html[data-responsive-layout="tv"] .team-table .metric-value-wrap .plan,
html[data-responsive-layout="tv"] .team-table .deals-total-line .plan {
  font-size:clamp(12px,.7vw,14px) !important;
  font-weight:650 !important;
}
html[data-responsive-layout="tv"] .team-table tbody td:first-child {
  font-size:clamp(12px,.7vw,14px) !important;
  font-weight:800 !important;
}
html[data-responsive-layout="tv"] .pace-pill {
  min-width:48px !important;
  padding:5px 9px !important;
  font-size:clamp(13px,.73vw,15px) !important;
}
html[data-responsive-layout="tv"] .deals-breakdown {
  font-size:clamp(9px,.52vw,11px) !important;
  line-height:1.1 !important;
}

/* Right-side information cards use the same hierarchy as the team panel. */
html[data-responsive-layout="tv"] .side-panel-grid {
  grid-template-rows:minmax(0,1fr) 156px 156px !important;
  gap:12px !important;
}
html[data-responsive-layout="tv"] .events-list {
  padding:8px 15px 15px !important;
  gap:9px !important;
}
html[data-responsive-layout="tv"] .event-item {
  grid-template-columns:88px minmax(0,1fr) auto !important;
  gap:12px !important;
  padding:11px 12px !important;
}
html[data-responsive-layout="tv"] .event-time,
html[data-responsive-layout="tv"] .event-title {
  font-size:clamp(14px,.78vw,16px) !important;
  line-height:1.15 !important;
}
html[data-responsive-layout="tv"] .event-note,
html[data-responsive-layout="tv"] .event-day {
  font-size:clamp(11px,.62vw,13px) !important;
}
html[data-responsive-layout="tv"] .empty-state {
  font-size:clamp(13px,.74vw,15px) !important;
  line-height:1.35 !important;
}
html[data-responsive-layout="tv"] .accent-panel h3 {
  font-size:clamp(18px,1vw,21px) !important;
  line-height:1.12 !important;
}
html[data-responsive-layout="tv"] .focus-card p,
html[data-responsive-layout="tv"] .goal-card p {
  font-size:clamp(17px,.94vw,20px) !important;
  line-height:1.2 !important;
}
html[data-responsive-layout="tv"] .birthday-name,
html[data-responsive-layout="tv"] .previous-leader-name {
  font-size:clamp(19px,1.05vw,22px) !important;
  line-height:1.1 !important;
}
html[data-responsive-layout="tv"] .birthday-date {
  font-size:clamp(14px,.78vw,16px) !important;
}
html[data-responsive-layout="tv"] .birthday-countdown,
html[data-responsive-layout="tv"] .birthday-empty,
html[data-responsive-layout="tv"] .previous-leader-percent {
  font-size:clamp(12px,.69vw,14px) !important;
  line-height:1.35 !important;
}
html[data-responsive-layout="tv"] .previous-leader-value {
  font-size:clamp(25px,1.38vw,30px) !important;
}

/* Analytics: preserve layout, raise the same semantic text classes to TV legibility. */
html[data-responsive-layout="tv"] .analytics-table,
html[data-responsive-layout="tv"] .history-data-table,
html[data-responsive-layout="tv"] .compare-table {
  font-size:clamp(13px,.75vw,15px) !important;
}
html[data-responsive-layout="tv"] .analytics-table thead th,
html[data-responsive-layout="tv"] .history-data-table thead th,
html[data-responsive-layout="tv"] .compare-table thead th {
  font-size:clamp(10px,.6vw,12px) !important;
}
html[data-responsive-layout="tv"] .analytics-table tbody td,
html[data-responsive-layout="tv"] .history-data-table tbody td,
html[data-responsive-layout="tv"] .compare-table tbody td {
  padding-top:8px !important;
  padding-bottom:8px !important;
}

/* Planner: cards and tasks follow the same body/caption scale as the dashboard. */
html[data-responsive-layout="tv"] .planner-summary-card span,
html[data-responsive-layout="tv"] .planner-subject-field > span,
html[data-responsive-layout="tv"] .planner-field > span {
  font-size:var(--tv-caption) !important;
}
html[data-responsive-layout="tv"] .planner-summary-card strong {
  font-size:clamp(30px,1.7vw,36px) !important;
}
html[data-responsive-layout="tv"] .planner-summary-card small,
html[data-responsive-layout="tv"] .planner-metric-row small,
html[data-responsive-layout="tv"] .planner-user-row small,
html[data-responsive-layout="tv"] .planner-task-description,
html[data-responsive-layout="tv"] .planner-task-meta,
html[data-responsive-layout="tv"] .planner-inline-status {
  font-size:var(--tv-caption) !important;
  line-height:1.3 !important;
}
html[data-responsive-layout="tv"] .planner-metric-row strong,
html[data-responsive-layout="tv"] .planner-user-row strong,
html[data-responsive-layout="tv"] .planner-task-head h3 {
  font-size:var(--tv-body) !important;
  line-height:1.18 !important;
}
html[data-responsive-layout="tv"] .planner-metric-row > span,
html[data-responsive-layout="tv"] .planner-checkin-state,
html[data-responsive-layout="tv"] .planner-priority,
html[data-responsive-layout="tv"] .planner-task-section {
  font-size:clamp(11px,.64vw,13px) !important;
}
html[data-responsive-layout="tv"] .planner-metric-row,
html[data-responsive-layout="tv"] .planner-task-item,
html[data-responsive-layout="tv"] .planner-user-row {
  padding:11px 12px !important;
}


/* v1.0.37 — unified visual language across Dashboard / Analytics / Planner / Settings.
   One semantic role always uses one size. TV only scales the same hierarchy up. */
:root {
  --type-kicker:10px;
  --type-caption:11px;
  --type-body:13px;
  --type-body-strong:14px;
  --type-title:17px;
  --type-card-title:16px;
  --type-value:22px;
  --block-radius:18px;
  --block-pad-x:15px;
  --block-pad-y:14px;
}

html[data-responsive-layout="tv"] {
  --type-kicker:12px;
  --type-caption:13px;
  --type-body:16px;
  --type-body-strong:17px;
  --type-title:21px;
  --type-card-title:19px;
  --type-value:27px;
  --block-radius:18px;
  --block-pad-x:17px;
  --block-pad-y:15px;
}

/* 1. Small uppercase context labels. */
.section-kicker,
.eyebrow,
.planner-task-section,
.planner-priority,
.analytics-metric-filter > span,
.planner-field > span,
.planner-subject-field > span {
  font-size:var(--type-kicker) !important;
  line-height:1.18 !important;
  letter-spacing:.08em !important;
  font-weight:820 !important;
}

/* 2. Every section/block title uses exactly the same visual level. */
.panel-header h2,
.analytics-team-head h2,
.analytics-hero h2,
.ranking-card h2,
.reports-card h2,
.signals-list-card h2,
.management-card h2,
.planner-hero h2,
.planner-card-head h2,
.planner-account-panel h2,
.settings-head h2,
.code-modal h2 {
  font-size:var(--type-title) !important;
  line-height:1.1 !important;
  letter-spacing:-.025em !important;
  font-weight:850 !important;
}

/* 3. Card headline: Focus / Goal / Birthday / Previous leader are one family. */
.focus-card h3,
.goal-card h3,
.birthday-name,
.previous-leader-name {
  font-size:var(--type-card-title) !important;
  line-height:1.12 !important;
  letter-spacing:-.02em !important;
  font-weight:830 !important;
  margin-top:7px !important;
  margin-bottom:6px !important;
}

/* 4. Main explanatory/body text is identical everywhere. */
.focus-card p,
.goal-card p,
.event-title,
.planner-hero p,
.planner-card-head p,
.planner-account-panel p,
.planner-task-description,
.planner-metric-row strong,
.planner-user-row strong,
.planner-task-head h3,
.analytics-table tbody td,
.history-data-table tbody td,
.compare-table tbody td {
  font-size:var(--type-body) !important;
  line-height:1.3 !important;
}

/* Focus and Goal must no longer carry old one-off oversized/bold typography. */
.focus-card p,
.goal-card p {
  font-weight:700 !important;
  letter-spacing:0 !important;
  margin:0 !important;
}

/* 5. Secondary/supporting text is one size. */
.kpi-plan,
.kpi-hint,
.event-note,
.event-day,
.birthday-date,
.birthday-countdown,
.birthday-empty,
.previous-leader-percent,
.planner-summary-card span,
.planner-summary-card small,
.planner-metric-row small,
.planner-user-row small,
.planner-task-meta,
.planner-inline-status,
.field-label,
.field-note,
.history-status,
.history-note,
.history-month-label {
  font-size:var(--type-caption) !important;
  line-height:1.32 !important;
}

/* 6. Big numeric values keep one value scale. */
.previous-leader-value,
.planner-summary-card strong {
  font-size:var(--type-value) !important;
  line-height:1 !important;
  font-weight:850 !important;
}

/* Main dashboard right rail: explicit equal geometry for equivalent cards. */
@media (min-width:921px) {
  .side-panel-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    grid-template-rows:minmax(0,1fr) 150px 150px !important;
    gap:12px !important;
  }
  html[data-responsive-layout="tv"] .side-panel-grid {
    grid-template-rows:minmax(0,1fr) 160px 160px !important;
  }

  .events-panel {
    grid-column:1 / -1 !important;
    grid-row:1 !important;
  }
  .focus-card {
    grid-column:1 !important;
    grid-row:2 !important;
  }
  .goal-card {
    grid-column:2 !important;
    grid-row:2 !important;
  }
  .birthday-card {
    grid-column:1 !important;
    grid-row:3 !important;
  }
  .previous-leader-card {
    grid-column:2 !important;
    grid-row:3 !important;
  }

  .focus-card,
  .goal-card,
  .birthday-card,
  .previous-leader-card {
    width:100% !important;
    height:100% !important;
    min-width:0 !important;
    min-height:0 !important;
    padding:var(--block-pad-y) var(--block-pad-x) !important;
    border-radius:var(--block-radius) !important;
    overflow:hidden !important;
  }
}

/* Same padding/radius language for the main families of content cards. */
.kpi-card,
.panel,
.planner-summary-card,
.planner-metrics-card,
.planner-users-panel,
.planner-task-item,
.ranking-card,
.reports-card,
.signals-list-card,
.management-card,
.settings-card {
  border-radius:var(--block-radius);
}

.planner-metrics-card,
.planner-users-panel,
.planner-summary-card,
.settings-card {
  padding:var(--block-pad-y) var(--block-pad-x) !important;
}

/* Tables use one data-text hierarchy. */
@media (min-width:921px) {
  .team-table {
    font-size:var(--type-body) !important;
  }
  .team-table thead th,
  .analytics-table thead th,
  .history-data-table thead th,
  .compare-table thead th {
    font-size:var(--type-kicker) !important;
    line-height:1.15 !important;
  }
  .team-table tbody td {
    font-size:var(--type-body) !important;
    line-height:1.2 !important;
  }
  .team-table tbody .name-cell,
  .team-table .team-member-name-text {
    font-size:var(--type-body-strong) !important;
    font-weight:780 !important;
  }
  .team-table .ratio .plan,
  .team-table .metric-value-wrap .plan,
  .team-table .deals-total-line .plan {
    font-size:var(--type-caption) !important;
  }
}

/* Navigation/buttons share the same caption scale instead of per-section sizes. */
.view-switcher-btn,
.analytics-tab-btn,
.small-btn,
.secondary-btn,
.primary-btn {
  font-size:var(--type-caption) !important;
}

/* Mobile keeps its proven card layout, but still inherits the semantic typography where safe. */
@media (max-width:920px) {
  :root {
    --type-kicker:10px;
    --type-caption:11px;
    --type-body:13px;
    --type-body-strong:14px;
    --type-title:18px;
    --type-card-title:17px;
    --type-value:24px;
  }
}


/* v1.0.38 — stable KPI headings.
   Do not let the legacy --font-scale layer make KPI titles jump during rerenders. */
@media (min-width:921px) {
  .kpi-grid .kpi-label {
    font-size:clamp(13px,.72vw,15px) !important;
    line-height:1.15 !important;
    font-weight:700 !important;
    transition:none !important;
    animation:none !important;
  }
}


/* v1.0.39 — KPI render must be visually atomic. */
.kpi-grid .kpi-card,
.kpi-grid .kpi-card *{
  transition-property:none !important;
}
@media (min-width:921px){
  .kpi-grid .kpi-label{
    font-size:clamp(13px,.72vw,15px) !important;
    line-height:1.15 !important;
    font-weight:700 !important;
  }
}


/* v1.0.40 — adaptive capsules.
   Inner space scales with the actual text size, including Visual Editor overrides. */
:root{
  --capsule-pad-x:.36;
  --capsule-pad-y:.24;
  --capsule-gap:.20;
}

/* Content-sized pills/chips/badges: always keep breathing room around text. */
:is(
  .metric-complete-pill,
  .pace-pill,
  .snapshot-pill,
  .event-day,
  .analytics-forecast-pill,
  .analytics-status-pill,
  .funnel-conversion-pill,
  .signals-count-pill,
  .agent-insight-chip,
  .compare-agent-chip,
  .team-new-badge,
  .history-source-badge,
  .history-current-badge,
  .history-signal-badge,
  .ranking-new-badge,
  .management-priority-badge,
  .metric-header-pill,
  .signal-priority-badge,
  .signal-state-badge,
  .planner-mentee-chip,
  .v126-month-badge
){
  box-sizing:border-box !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  width:fit-content !important;
  min-width:max-content !important;
  max-width:100% !important;
  height:auto !important;
  min-height:calc(var(--capsule-text-unit,1em) * (1.15 + (2 * var(--capsule-pad-y)))) !important;
  padding-block:calc(var(--capsule-text-unit,1em) * var(--capsule-pad-y)) !important;
  padding-inline:calc(var(--capsule-text-unit,1em) * var(--capsule-pad-x)) !important;
  gap:calc(var(--capsule-text-unit,1em) * var(--capsule-gap)) !important;
  border-radius:999px !important;
  line-height:1.15 !important;
  white-space:nowrap !important;
  overflow:visible !important;
  text-overflow:clip !important;
  vertical-align:middle;
}

/* Status capsules may intentionally fill an available row; keep their width rule,
   but make the internal breathing room scale with typography too. */
:is(
  .global-sync-status,
  .planner-inline-status,
  .planner-user-status,
  .agent-profile-status,
  .agent-summary-status,
  .analytics-load-status,
  .compare-selection-status,
  .history-status,
  .service-pill
){
  box-sizing:border-box !important;
  height:auto !important;
  min-height:calc(var(--capsule-text-unit,1em) * (1.15 + (2 * var(--capsule-pad-y)))) !important;
  padding-block:calc(var(--capsule-text-unit,1em) * var(--capsule-pad-y)) !important;
  padding-inline:calc(var(--capsule-text-unit,1em) * var(--capsule-pad-x)) !important;
  gap:calc(var(--capsule-text-unit,1em) * var(--capsule-gap)) !important;
  border-radius:999px !important;
  line-height:1.15 !important;
}

/* Fact / plan capsules contain nested text nodes; never allow either side to collapse. */
.metric-complete-pill > *,
.deals-total-line.metric-complete-pill > *{
  flex:0 0 auto !important;
  min-width:max-content !important;
  white-space:nowrap !important;
  overflow:visible !important;
}

/* Mobile had older fixed-pixel geometry. Override it with the same scalable system. */
@media(max-width:560px){
  html.v118-mobile-layout .team-table tbody td[data-metric-key] > .metric-value-wrap.metric-complete-pill,
  html.v118-mobile-layout .team-table tbody td[data-metric-key] .deals-total-line.metric-complete-pill,
  html.v118-mobile-layout .team-table .metric-complete-pill,
  html.v118-mobile-layout .team-table .deals-total-line.metric-complete-pill{
    width:fit-content !important;
    min-width:max-content !important;
    max-width:none !important;
    height:auto !important;
    min-height:calc(var(--capsule-text-unit,1em) * (1.15 + (2 * var(--capsule-pad-y)))) !important;
    padding-block:var(--capsule-pad-y) !important;
    padding-inline:var(--capsule-pad-x) !important;
    gap:var(--capsule-gap) !important;
    border-radius:999px !important;
    line-height:1.15 !important;
    overflow:visible !important;
    white-space:nowrap !important;
  }
}

/* Large-screen readability: slightly more horizontal air without changing text size. */
@media(min-width:921px){
  html[data-visual-profile-active="large"]{
    --capsule-pad-x:.38;
    --capsule-pad-y:.25;
  }
}


/* v1.0.41 — team table geometry after visual-editor scaling. */
.team-table[data-dynamic-metrics="1"] .metric-complete-pill{
  --capsule-pad-x:.28;
  --capsule-pad-y:.22;
}

/* Revenue and Advertising carry the longest number strings.
   Give them real column width; all other metric columns share the remainder. */
@media(min-width:921px){
  .team-table[data-dynamic-metrics="1"] th[data-metric-key="revenue"],
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="revenue"]{
    width:var(--revenue-col-width,220px) !important;
    min-width:var(--revenue-col-width,220px) !important;
  }
  .team-table[data-dynamic-metrics="1"] th[data-metric-key="advertising"],
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="advertising"]{
    width:var(--advertising-col-width,150px) !important;
    min-width:var(--advertising-col-width,150px) !important;
  }

  /* A value is never allowed to paint over the neighbouring metric column. */
  .team-table[data-dynamic-metrics="1"] tbody td[data-metric-key]{
    position:relative;
    overflow:hidden !important;
    text-overflow:clip !important;
    padding-inline:4px !important;
  }
  .team-table[data-dynamic-metrics="1"] tbody td[data-metric-key] > .metric-value-wrap,
  .team-table[data-dynamic-metrics="1"] tbody td[data-metric-key] .deals-cell-content{
    max-width:100% !important;
  }
  .team-table[data-dynamic-metrics="1"] tbody td[data-metric-key] > .metric-value-wrap{
    width:fit-content;
    margin-inline:auto;
  }

  /* Long currency cells keep fact/plan together, but may tighten slightly before clipping. */
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="revenue"] .metric-value-wrap,
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="advertising"] .metric-value-wrap{
    letter-spacing:-.025em;
  }
}

/* Mobile remains card-based; no desktop column widths leak into it. */
@media(max-width:920px){
  .team-table[data-dynamic-metrics="1"] th[data-metric-key="revenue"],
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="revenue"],
  .team-table[data-dynamic-metrics="1"] th[data-metric-key="advertising"],
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="advertising"]{
    width:auto !important;
    min-width:0 !important;
  }
}


/* v1.0.42 — keep capsule border away from the clipped cell edge. */
@media(min-width:921px){
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="revenue"] > .metric-value-wrap.metric-complete-pill,
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="advertising"] > .metric-value-wrap.metric-complete-pill{
    max-width:calc(100% - 8px) !important;
    margin-inline:auto !important;
  }
  .team-table[data-dynamic-metrics="1"] .team-total-row td[data-metric-key="revenue"] > .metric-value-wrap{
    max-width:calc(100% - 8px) !important;
    margin-inline:auto !important;
  }
}


/* v1.0.43 — authoritative wide currency columns. */
@media(min-width:921px){
  html[data-responsive-layout="tv"] .team-table[data-dynamic-metrics="1"] th[data-metric-key="revenue"],
  html[data-responsive-layout="tv"] .team-table[data-dynamic-metrics="1"] td[data-metric-key="revenue"],
  html[data-responsive-layout="desktop"] .team-table[data-dynamic-metrics="1"] th[data-metric-key="revenue"],
  html[data-responsive-layout="desktop"] .team-table[data-dynamic-metrics="1"] td[data-metric-key="revenue"]{
    width:var(--revenue-col-width,250px) !important;
    min-width:var(--revenue-col-width,250px) !important;
    max-width:none !important;
  }

  html[data-responsive-layout="tv"] .team-table[data-dynamic-metrics="1"] th[data-metric-key="advertising"],
  html[data-responsive-layout="tv"] .team-table[data-dynamic-metrics="1"] td[data-metric-key="advertising"],
  html[data-responsive-layout="desktop"] .team-table[data-dynamic-metrics="1"] th[data-metric-key="advertising"],
  html[data-responsive-layout="desktop"] .team-table[data-dynamic-metrics="1"] td[data-metric-key="advertising"]{
    width:var(--advertising-col-width,155px) !important;
    min-width:var(--advertising-col-width,155px) !important;
    max-width:none !important;
  }

  .team-table[data-dynamic-metrics="1"] tbody td[data-metric-key="revenue"],
  .team-table[data-dynamic-metrics="1"] tbody td[data-metric-key="advertising"]{
    overflow:visible !important;
    padding-inline:7px !important;
  }

  .team-table[data-dynamic-metrics="1"] td[data-metric-key="revenue"] > .metric-value-wrap,
  .team-table[data-dynamic-metrics="1"] td[data-metric-key="advertising"] > .metric-value-wrap{
    max-width:none !important;
    overflow:visible !important;
  }
}
