/*
  LIT/AMS Unified Header System
  Scope: visual layer only. This file standardizes topbar and page-header
  presentation without changing page data, form controls, IDs, or JS hooks.
*/

:root {
  --lit-header-surface: rgba(255, 255, 255, 0.92);
  --lit-header-bg: #f5f7fb;
  --lit-header-line: rgba(203, 213, 225, 0.74);
  --lit-header-text: #0f172a;
  --lit-header-muted: #475569;
  --lit-header-accent: #14b8a6;
  --lit-header-blue: #0ea5e9;
  --lit-header-danger: #ef4444;
  --lit-header-radius: 16px;
  --lit-header-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

.topbar {
  min-height: 72px;
  padding: 12px 24px;
  gap: 12px;
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid var(--lit-header-line);
  backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.74) inset;
}

.topbar .search {
  min-height: 42px;
  border-radius: 14px;
  border-color: rgba(203, 213, 225, 0.88);
  background: var(--lit-header-surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
}

.topbar .actions {
  gap: 10px;
  min-width: 0;
}

.topbar .input,
.topbar select.input,
.litcrm-workspace-switcher select.input {
  min-height: 42px;
  border-radius: 14px !important;
  border-color: rgba(203, 213, 225, 0.88);
  background-color: var(--lit-header-surface);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border-color: rgba(203, 213, 225, 0.82);
  background: var(--lit-header-surface);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.user-pill {
  min-height: 42px;
  padding: 4px 8px 4px 5px;
  border-radius: 999px;
  border-color: rgba(203, 213, 225, 0.82);
  background: var(--lit-header-surface);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.05);
}

.user-pill .avatar {
  width: 34px;
  height: 34px;
}

.user-pill .meta .name {
  color: var(--lit-header-text);
  font-size: 13px;
  font-weight: 800;
}

.user-pill .meta .role {
  color: var(--lit-header-muted);
  font-size: 11px;
}

.content {
  width: 100%;
  padding: 18px 24px 24px;
}

.content > .content {
  padding: 0;
}

.content > .page,
.content > [class$="-page"],
.content > .accounting-page,
.content > .hr-calendar-page,
.content > .service-page,
.content > .oh-shell,
.content > .content > .oh-shell {
  width: 100%;
  max-width: none;
  margin: 0;
}

.attendance-page,
.calendar-page,
.hr-calendar-page,
.service-page,
.oh-shell,
.commissions-dashboard-page {
  width: 100%;
  max-width: none;
  margin: 0;
}

body[data-page="hr_settings.php"] .accounting-shell,
body[data-page="hr_attendance.php"] .accounting-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.page-head,
.page-header,
.home-header,
.rules-header-card,
.ae-hero,
.eem-hero,
.cw-hero,
.accounting-hero,
.hr-calendar-hero,
.hre-header,
.hri-header,
.hrd-header,
.jr-hero,
.payouts-hero,
.settings-header-card,
.saas-hero,
.ssa-hero,
.sc-hero,
.aim-hero,
.el-hero,
.ses-hero,
.my-account-hero,
.web-profile-hero,
.company-owner-head,
.hrt-header,
.lb-admin-hero,
.service-hero,
.oh-hero,
.new-sale-head,
.chargebacks-head,
.statements-head,
.marketing-adspent-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 112px;
  margin: 0 0 18px;
  padding: 24px;
  border: 1px solid rgba(186, 230, 253, 0.72);
  border-radius: var(--lit-header-radius);
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.11), rgba(20, 184, 166, 0.08) 45%, rgba(255, 255, 255, 0.98)),
    #ffffff;
  box-shadow: var(--lit-header-shadow);
  overflow: hidden;
}

.page-head > div:first-child,
.page-header > div:first-child,
.home-header > div:first-child,
.rules-header-card > div:first-child,
.ae-hero > div:first-child,
.eem-hero > div:first-child,
.cw-hero > div:first-child,
.accounting-hero > div:first-child,
.hr-calendar-hero > div:first-child,
.hre-header > div:first-child,
.hri-header > div:first-child,
.hrd-header > div:first-child,
.jr-hero > div:first-child,
.payouts-hero > div:first-child,
.settings-header-card > div:first-child,
.saas-hero > div:first-child,
.ssa-hero > div:first-child,
.sc-hero > div:first-child,
.aim-hero > div:first-child,
.el-hero > div:first-child,
.ses-hero > div:first-child,
.my-account-hero > div:first-child,
.web-profile-hero > div:first-child,
.company-owner-head > div:first-child,
.hrt-header-copy,
.lb-admin-hero-copy,
.service-hero > div:first-child,
.oh-hero > div:first-child,
.new-sale-head > div:first-child,
.chargebacks-head-copy,
.statements-head-copy,
.marketing-adspent-head > div:first-child {
  min-width: 0;
  max-width: 820px;
}

.page-head h1,
.page-header h1,
.page-head h2,
.page-header h2,
.home-title,
.rules-header-card h1,
.rules-header-card h2,
.ae-hero h1,
.eem-hero h1,
.cw-hero h1,
.accounting-hero h1,
.hr-calendar-hero h1,
.hre-header h1,
.hri-header h1,
.hrd-header h1,
.jr-hero h1,
.payouts-hero h1,
.settings-header-card h1,
.saas-hero h1,
.ssa-hero h1,
.sc-hero h1,
.aim-hero h1,
.el-hero h1,
.ses-hero h1,
.my-account-hero h1,
.web-profile-hero h1,
.company-owner-head h1,
.hrt-title,
.lb-admin-hero h1,
.service-hero h1,
.service-hero h2,
.oh-hero h1,
.new-sale-head h1,
.chargebacks-head h1,
.statements-head h1,
.marketing-adspent-head h1,
.page-header .page-title {
  margin: 0 0 8px;
  color: var(--lit-header-text);
  font-size: 32px;
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: 0;
}

.page-head .muted,
.page-header .muted,
.home-subtitle,
.rules-header-card .muted,
.ae-hero .muted,
.eem-hero .muted,
.cw-hero .muted,
.accounting-hero .muted,
.hr-calendar-hero .muted,
.hre-header .muted,
.hri-header .muted,
.hrd-header .muted,
.jr-hero .muted,
.payouts-hero .muted,
.settings-header-card .muted,
.saas-hero .muted,
.ssa-hero .muted,
.sc-hero .muted,
.aim-hero .muted,
.el-hero .muted,
.ses-hero .muted,
.my-account-hero .muted,
.web-profile-hero .muted,
.company-owner-head .muted,
.hrt-subtitle,
.lb-admin-hero p,
.service-hero .muted,
.oh-hero .oh-copy,
.new-sale-head .muted,
.chargebacks-head .muted,
.statements-head .muted,
.marketing-adspent-head .muted {
  margin: 0;
  max-width: 760px;
  color: var(--lit-header-muted);
  font-size: 15px;
  line-height: 1.5;
}

.hrt-kicker,
.lb-eyebrow {
  color: #0f766e;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.oh-shell {
  padding: 0;
  gap: 18px;
}

.oh-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.oh-hero .oh-kicker {
  grid-column: 1 / -1;
}

.oh-hero .oh-pill-row,
.oh-hero .oh-banner {
  justify-content: flex-end;
}

.hrt-header {
  color: var(--lit-header-text);
}

.hrt-header-actions {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}

.hrt-note {
  color: var(--lit-header-muted);
  font-size: 13px;
}

.company-owner-head-actions,
.lb-admin-hero-actions,
.service-hero-actions,
.page-head > :last-child,
.page-header > :last-child {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.new-sale-head h1,
.chargebacks-head h1,
.statements-head h1,
.marketing-adspent-head h1 {
  margin: 0 0 8px;
}

.chargebacks-head,
.statements-head {
  align-items: stretch;
}

.chargebacks-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.chargebacks-head-copy {
  display: grid;
  gap: 16px;
}

.chargebacks-head-filters {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.chargebacks-head-filters .cb31-filter-bar {
  margin: 0;
  max-width: 100%;
}

.chargebacks-head .cb31-filter-field {
  width: min(260px, 100%);
}

.chargebacks-head-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
}

.statements-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.statements-head-actions {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.statements-head-kpis {
  grid-column: 1 / -1;
  display: grid !important;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.statements-head-kpis .kpi {
  min-height: 86px;
  margin: 0;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: none;
}

.statements-head-kpis .statements-kpi-wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.commissions-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.commissions-page-main {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 920px;
  display: grid;
  gap: 14px;
}

.commissions-page-copy {
  min-width: 0;
}

.commissions-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  width: 100%;
}

.commissions-head-actions .commissions-filter-wrap,
.commissions-head-actions .commissions-filter-control {
  display: grid;
  gap: 5px;
}

.commissions-head-actions .input {
  min-height: 42px;
}

.commissions-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.commissions-toolbar [data-commissions-export-btn] {
  white-space: nowrap;
}

.commissions-legend-toggle {
  display: block !important;
  margin: 0;
  position: relative;
}

.commissions-legend-toggle > summary {
  width: fit-content;
  cursor: pointer;
  list-style: none;
}

.commissions-legend-toggle > summary::-webkit-details-marker {
  display: none;
}

.commissions-legend-toggle .commissions-legend-card {
  margin: 12px 0 0;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: none;
}

.marketing-adspent-head .badge,
.page-header .badge {
  background: rgba(255, 255, 255, 0.86);
}

.company-owner-filter-field label {
  color: #475569;
}

.company-owner-filter-field .input,
.company-owner-head .input {
  min-height: 44px;
  min-width: 92px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}

body[data-page="appointmentsetter.php"] .page-head {
  align-items: stretch;
}

body[data-page="appointmentsetter.php"] .page-head > div:first-child {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.as-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  align-items: stretch;
  gap: 10px;
}

body[data-page="appointmentsetter.php"] .page-head > .as-summary-grid {
  display: grid;
}

.as-summary-card {
  min-width: 0;
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  box-shadow: none;
  background: rgba(255, 255, 255, 0.82);
}

.as-summary-value {
  font-size: 26px;
}

body[data-page="salespipeline.php"] .pipeline-page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 108px;
  margin-bottom: 14px;
  padding: 24px;
  border: 1px solid rgba(186, 230, 253, 0.72);
  border-radius: var(--lit-header-radius);
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.10), rgba(255, 255, 255, 0.96) 58%),
    #ffffff;
  box-shadow: var(--lit-header-shadow);
}

body[data-page="salespipeline.php"] .pipeline-page-hero h1 {
  margin: 0 0 7px;
  color: var(--lit-header-text);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 900;
}

body[data-page="salespipeline.php"] .pipeline-bucket-card {
  padding: 14px;
  border-radius: var(--lit-header-radius);
}

body[data-page="salespipeline.php"] .btn-tab.active {
  border-color: rgba(239, 68, 68, 0.42);
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.12);
}

body[data-page="salespipeline.php"] .btn-tab.active:hover,
body[data-page="salespipeline.php"] .btn-tab.active:focus-visible {
  background: #fee2e2;
}

body[data-page="leaderboards/leaderadmin.php"] .lb-admin-hero,
body[data-page="leaderboards/campaignperformance.php"] .lb-admin-hero {
  min-height: 150px;
}

@media (max-width: 980px) {
  .topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .topbar .search {
    flex-basis: 100%;
  }

  .topbar .actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .page-head,
  .page-header,
  .home-header,
  .rules-header-card,
  .ae-hero,
  .eem-hero,
  .cw-hero,
  .accounting-hero,
  .hr-calendar-hero,
  .hre-header,
  .hri-header,
  .hrd-header,
  .jr-hero,
  .payouts-hero,
  .settings-header-card,
  .saas-hero,
  .ssa-hero,
  .sc-hero,
  .aim-hero,
  .el-hero,
  .ses-hero,
  .my-account-hero,
  .web-profile-hero,
  .company-owner-head,
  .hrt-header,
  .lb-admin-hero,
  .service-hero,
  .oh-hero,
  .new-sale-head,
  .chargebacks-head,
  .statements-head,
  .marketing-adspent-head,
  body[data-page="salespipeline.php"] .pipeline-page-hero {
    align-items: flex-start;
    flex-direction: column;
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 20px;
  }

  .page-head h1,
  .page-header h1,
  .page-head h2,
  .page-header h2,
  .home-title,
  .company-owner-head h1,
  .hrt-title,
  .lb-admin-hero h1,
  .service-hero h1,
  .service-hero h2,
  .oh-hero h1,
  .new-sale-head h1,
  .chargebacks-head h1,
  .statements-head h1,
  .marketing-adspent-head h1,
  .page-header .page-title,
  body[data-page="salespipeline.php"] .pipeline-page-hero h1 {
    font-size: 28px;
  }

  .chargebacks-head,
  .statements-head {
    grid-template-columns: 1fr;
  }

  .commissions-page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .commissions-head-actions,
  .statements-head-actions,
  .chargebacks-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .commissions-head-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .commissions-toolbar {
    justify-content: flex-start;
    margin-left: 0;
  }

  .statements-head-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statements-head-kpis .kpi {
    grid-column: span 1 !important;
  }

  .statements-head-kpis .statements-kpi-wide {
    grid-column: 1 / -1 !important;
  }

  .as-summary-grid {
    width: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .content {
    padding: 16px;
  }

  .as-summary-grid {
    grid-template-columns: 1fr;
  }

  .statements-head-kpis {
    grid-template-columns: 1fr;
  }
}

/* V5 completion pass: align the modules that still had page-local shells or
   old white headers so every page starts from the same left/top rhythm. */
body[data-page="system_settings_email_settings.php"] .ses-shell,
body[data-page="email_editor.php"] .eem-shell,
body[data-page="automate_emails.php"] .ae-shell,
body[data-page="system_settings_email_logs.php"] .el-shell,
body[data-page="system_settings_email_advanced_imap.php"] .aim-shell,
body[data-page^="onboarding/"] .oh-shell,
body[data-page^="onboarding/"] .lc-shell,
body[data-page="enterprise_relationships.php"] .company-owner-page,
body[data-page="company_hierarchy_graph.php"] .company-owner-page,
body[data-page="subscription.php"] .saas-shell {
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  gap: 18px !important;
}

body[data-page="system_settings_email_settings.php"] .ses-hero,
body[data-page="email_editor.php"] .eem-hero,
body[data-page="automate_emails.php"] .ae-hero,
body[data-page="system_settings_email_logs.php"] .el-hero,
body[data-page="system_settings_email_advanced_imap.php"] .aim-hero,
body[data-page^="onboarding/"] .oh-hero,
body[data-page^="onboarding/"] .lc-hero,
body[data-page="subscription.php"] .saas-hero,
body[data-page="enterprise_relationships.php"] .company-owner-head,
body[data-page="company_hierarchy_graph.php"] .company-owner-head {
  position: relative !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
  min-height: 128px !important;
  margin: 0 0 18px !important;
  padding: 24px !important;
  border: 1px solid rgba(186, 230, 253, .72) !important;
  border-radius: 18px !important;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, .11), rgba(20, 184, 166, .08) 45%, rgba(255, 255, 255, .98)),
    #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07) !important;
  overflow: hidden !important;
}

body[data-page="system_settings_email_settings.php"] .ses-hero > div:first-child,
body[data-page="email_editor.php"] .eem-hero > div:first-child,
body[data-page="automate_emails.php"] .ae-hero > div:first-child,
body[data-page="system_settings_email_logs.php"] .el-hero > div:first-child,
body[data-page="system_settings_email_advanced_imap.php"] .aim-hero > div:first-child,
body[data-page^="onboarding/"] .oh-hero > div:first-child,
body[data-page^="onboarding/"] .lc-hero > div:first-child,
body[data-page="subscription.php"] .saas-hero > div:first-child,
body[data-page="enterprise_relationships.php"] .company-owner-head > div:first-child,
body[data-page="company_hierarchy_graph.php"] .company-owner-head > div:first-child {
  min-width: 0 !important;
  max-width: 820px !important;
}

body[data-page="system_settings_email_settings.php"] .ses-hero h1,
body[data-page="email_editor.php"] .eem-hero h1,
body[data-page="automate_emails.php"] .ae-hero h1,
body[data-page="system_settings_email_logs.php"] .el-hero h1,
body[data-page="system_settings_email_advanced_imap.php"] .aim-hero h1,
body[data-page^="onboarding/"] .oh-hero h1,
body[data-page^="onboarding/"] .lc-hero h1,
body[data-page="subscription.php"] .saas-hero h1,
body[data-page="enterprise_relationships.php"] .company-owner-head h1,
body[data-page="company_hierarchy_graph.php"] .company-owner-head h1 {
  margin: 0 0 8px !important;
  color: #0f172a !important;
  font-size: 32px !important;
  line-height: 1.08 !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
}

body[data-page="system_settings_email_settings.php"] .ses-hero p,
body[data-page="email_editor.php"] .eem-hero p,
body[data-page="automate_emails.php"] .ae-hero p,
body[data-page="system_settings_email_logs.php"] .el-hero p,
body[data-page="system_settings_email_advanced_imap.php"] .aim-hero p,
body[data-page^="onboarding/"] .oh-hero p,
body[data-page^="onboarding/"] .lc-hero p,
body[data-page="subscription.php"] .saas-hero p,
body[data-page="enterprise_relationships.php"] .company-owner-head p,
body[data-page="company_hierarchy_graph.php"] .company-owner-head p {
  color: #475569 !important;
  max-width: 820px !important;
}

@media (max-width: 980px) {
  body[data-page="system_settings_email_settings.php"] .ses-hero,
  body[data-page="email_editor.php"] .eem-hero,
  body[data-page="automate_emails.php"] .ae-hero,
  body[data-page="system_settings_email_logs.php"] .el-hero,
  body[data-page="system_settings_email_advanced_imap.php"] .aim-hero,
  body[data-page^="onboarding/"] .oh-hero,
  body[data-page^="onboarding/"] .lc-hero,
  body[data-page="subscription.php"] .saas-hero,
  body[data-page="enterprise_relationships.php"] .company-owner-head,
  body[data-page="company_hierarchy_graph.php"] .company-owner-head {
    align-items: flex-start !important;
    flex-direction: column !important;
    min-height: 0 !important;
    padding: 20px !important;
  }
}

/* Agent commissions is intentionally not a generic .page-head.
   Its controls are live JS/API hooks, so the template owns a compact,
   source-scoped header instead of inheriting the global hero layout. */
body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-page-head-compact {
  box-sizing: border-box !important;
  position: relative !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-start !important;
  align-content: flex-start !important;
  justify-content: space-between !important;
  gap: 20px !important;
  width: 100% !important;
  min-height: 0 !important;
  min-block-size: 0 !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 0 18px !important;
  padding: 24px !important;
  overflow: visible !important;
  border: 1px solid rgba(186, 230, 253, .72) !important;
  border-radius: 22px !important;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, .11), rgba(20, 184, 166, .08) 45%, rgba(255, 255, 255, .98)),
    #ffffff !important;
  box-shadow: 0 20px 54px rgba(15, 23, 42, .08) !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-page-head-compact > * {
  position: static !important;
  inset: auto !important;
  transform: none !important;
  align-self: flex-start !important;
  grid-area: auto !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-page-main {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  max-width: 920px !important;
  display: grid !important;
  gap: 14px !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-head-actions {
  display: flex !important;
  align-items: end !important;
  justify-content: flex-start !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 780px !important;
  min-width: 0 !important;
  margin: 0 !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-filter-control,
body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-filter-wrap {
  flex: 0 1 240px !important;
  width: auto !important;
  max-width: 320px !important;
  min-width: 180px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  margin: 0 !important;
  position: static !important;
  transform: none !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage #agentPickerWrap {
  flex: 0 1 320px !important;
  max-width: 360px !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-head-actions .input,
body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-head-actions input,
body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-head-actions select {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, .9) !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-toolbar {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: 260px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  flex-wrap: nowrap !important;
  gap: 10px !important;
  margin: 0 0 0 auto !important;
  min-width: 0 !important;
  position: static !important;
  transform: none !important;
}

body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-toolbar [data-commissions-export-btn],
body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-legend-toggle > summary {
  height: 44px !important;
  min-height: 44px !important;
  padding: 0 18px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}

@media (max-width: 980px) {
  body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-page-head-compact {
    flex-direction: column !important;
    align-items: stretch !important;
  }

  body[data-page="agent_commissions.php"] #agentCommissionsPage .commissions-toolbar {
    align-items: flex-start !important;
    margin-left: 0 !important;
  }
}

/* ---- Company event ticker -------------------------------------------------
   Fixed width, always present. An element that appears and disappears drags
   every icon beside it left and right, and people locate those icons by
   position, not by reading them. */
.topbar .search { flex: 0 0 340px; width: 340px; max-width: 340px; height: 46px; }

.litcrm-ticker {
  flex: 0 0 420px; width: 420px;
  display: flex; align-items: center;
  /* Same height as .topbar .search above — change the two together. */
  height: 46px; padding: 0 16px;
  border-radius: 14px;
  border: 1px solid rgba(203, 213, 225, 0.88);
  background: var(--lit-header-surface, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.045);
  text-decoration: none; color: inherit; overflow: hidden;
}
.litcrm-ticker:hover { border-color: var(--primary, #2bb59b); }

.litcrm-ticker-mask {
  position: relative; display: block;
  width: 100%; overflow: hidden; white-space: nowrap;
}

/* Quiet, so an empty week does not draw the eye. */
.litcrm-ticker-none {
  font-size: 15px; color: var(--muted, #6b7280);
}

.litcrm-ticker-track {
  display: inline-flex; align-items: center; gap: 40px;
  white-space: nowrap; will-change: transform;
}
/* One pass: in from the right, out to the left, repeat. Works the same for a
   three-word event and a full sentence. */
.litcrm-ticker-track.is-scrolling {
  animation-name: litcrm-ticker-pass;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
@keyframes litcrm-ticker-pass {
  from { transform: translateX(100%); }
  to   { transform: translateX(-100%); }
}
.litcrm-ticker:hover .litcrm-ticker-track { animation-play-state: paused; }

.litcrm-ticker-item {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 15px; color: var(--text, #111827);
}
.litcrm-ticker-item strong { font-weight: 700; }
.litcrm-ticker-dot { font-size: 16px; line-height: 1; }

/* Motion is the delivery, not the message. */
@media (prefers-reduced-motion: reduce) {
  .litcrm-ticker-track.is-scrolling { animation: none; transform: none; }
}

/* ---- Workspace switcher, folded away --------------------------------------
   Kept in the DOM so nothing that reads it breaks; just not taking up the
   middle of the header for a control this company never touches. */
.litcrm-workspace-shell.is-collapsed {
  display: none;
}
.litcrm-workspace-shell.is-open {
  display: flex;
}
.litcrm-workspace-toggle {
  margin-left: 8px; padding: 2px 7px;
  font-size: 11px; line-height: 1.4; cursor: pointer;
  color: var(--muted, #6b7280);
  background: transparent;
  border: 1px solid rgba(203, 213, 225, 0.9);
  border-radius: 999px;
}
.litcrm-workspace-toggle:hover {
  color: var(--text, #111827); border-color: var(--primary, #2bb59b);
}
.litcrm-workspace-toggle[aria-expanded="true"] { transform: rotate(180deg); }

/* Narrow screens: the ticker is the first thing that can go. */
@media (max-width: 1180px) {
  .litcrm-ticker { display: none; }
  .topbar .search { flex: 1 1 auto; width: auto; max-width: none; }
}


/* [2026-08-30] Does the office close on this day?
   The ticker is seen by everyone in the company, and a holiday title on its own
   does not answer the only question an employee has about it. The tag rides
   beside the title so nobody has to ask. */
.litcrm-ticker-tag {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  background: #dcfce7;
  color: #166534;
}
/* A working day is the quieter of the two: it is the normal state, and only the
   closure needs to catch the eye. */
.litcrm-ticker-tag.is-working {
  background: rgba(100, 116, 139, 0.22);
  color: inherit;
  opacity: 0.75;
}
