/* iMarket Reporting Restyle
   Loaded after imarket-tokens.css and after all existing stylesheets.
   All rules scoped under body.ims-restyle so pages can be switched on one at a time.
   When an old rule fights here, remove/narrow it in the original file rather than
   escalating specificity with !important.
*/

html#doc {
    background-color: var(--ims-navy);
}

/* --- Foundation: Typography -------------------------------------------- */
body.ims-restyle {
  font-family: var(--ims-font-ui);
}


/* =========================================================================
   §4 + §7  FRAME: header band, logo badge, sidebar, nav, drawer
   ========================================================================= */

/* --- 1. Header band ------------------------------------------------------- */

body.ims-restyle header#header {
  position: static;
  background: var(--ims-navy);
  background: var(--ims-gradient); 
  height: var(--ims-header-h);    /* 84px */
  border-bottom: none;
  box-shadow: var(--ims-hairline-on-navy);
}


body.ims-restyle #container-masthead {
  position: static;
  width: 100%;
  height: 100%;
}

body.ims-restyle #masthead {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0;
  overflow: visible;
  position: static;
}

/* Old red diagonal accent — retired */
body.ims-restyle .ims-branding-corner-accent { /* display: none; */ }

/* Default company icon image — hidden; SVG badge takes its place */
body.ims-restyle img.default-imarket-logo,
body.ims-restyle #masthead img.default-imarket-logo { display: none; }


/* --- 2. Logo badge + tagline ---------------------------------------------- */

/* h1 is the flex row that holds the subtitle (badge+tagline) + client name */
body.ims-restyle h1.primary-heading {
  order: 1;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 20px 0 0;
  font-family: var(--ims-font-ui);
  font-size: 24px;
  font-weight: 600;
  color: var(--ims-on-navy-strong);
  line-height: 1.25;
  max-width: none;
  vertical-align: unset;
  gap: 20px;
}

/* Subtitle: column-flex container 272px wide so badge + tagline sit above sidebar */
body.ims-restyle h1.primary-heading span.subtitle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 7px;
  width: var(--ims-sidebar-w);    /* 272px */
  flex-shrink: 0;
  align-self: stretch;
  padding: 10px 16px 10px 0;
  /* Tagline typography — these styles apply to the "Next Level Dashboard" text node */
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--ims-on-navy-label);
  text-transform: uppercase;
  line-height: 1;
}

/* White badge - removed... we're going white logo instead * /
body.ims-restyle h1.primary-heading span.subtitle span.imarket-logo {
  position: relative;
  background: #fff;
  border-radius: var(--ims-radius-badge);  /* 8px * /
  padding: 9px 14px 9px 26px;
  box-shadow: 0 1px 3px rgba(22, 26, 74, 0.14),
              0 4px 16px -4px rgba(22, 26, 74, 0.26);
  display: flex;
  align-items: center;
  overflow: hidden;         /* clips notch pseudo to badge border-radius * /
  height: auto;
  width: auto;
  text-indent: 0;
  white-space: normal;
  font-size: 0;             /* hides "iMarket Solutions" text node * /
  line-height: 0;
}

/* Red right-triangle notch clipped into badge's left edge * /
body.ims-restyle h1.primary-heading span.subtitle span.imarket-logo::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 15px;
  height: 100%;
  background: var(--ims-red);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

/* Logo SVG at ~176px */
body.ims-restyle h1.primary-heading span.subtitle span.imarket-logo svg {
  width: 176px;
  height: auto;
  display: block;
  flex-shrink: 0;
}
body.ims-restyle h1.primary-heading span.subtitle span.imarket-logo svg path {
  fill: #ffffff;
}


/* --- 3. Logout nav -------------------------------------------------------- */

body.ims-restyle #masthead #util-navigation {
  order: 2;
  display: flex;
  align-items: center;
  margin: 0;
  float: none;
  vertical-align: unset;
  flex-shrink: 0;
}

body.ims-restyle #util-navigation a {
  display: flex;
  align-items: center;
  min-height: var(--ims-touch);
  padding: 0 20px;
  text-decoration: none;
  color: var(--ims-on-navy);
}

body.ims-restyle #util-navigation span.util-nav-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ims-on-navy);
  padding: 0;
  width: auto;
  text-align: left;
}

body.ims-restyle #util-navigation span.button {
  display: flex;
  align-items: center;
  gap: 6px;
}

body.ims-restyle #util-navigation svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
  color: var(--ims-on-navy);
  display:none;
}


/* --- 4. Two-column layout ------------------------------------------------- */

body.ims-restyle #container-main {
  display: flex;
  margin-top: 0;
  min-height: calc(100vh - var(--ims-header-h) - 34px);
}


/* --- 5. Sidebar (desktop ≥1026px) ---------------------------------------- */

body.ims-restyle #container-primary-navigation {
  width: var(--ims-sidebar-w);
  flex-shrink: 0;
  background: var(--ims-navy);
  position: relative;
}

/* Remove the old background-patch pseudo-elements */
body.ims-restyle #container-primary-navigation::before,
body.ims-restyle #container-primary-navigation::after {
  display: none;
}

body.ims-restyle #primary-navigation {
  background: var(--ims-navy);
  padding: 16px 0 100px;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: none;
}

/* Sidebar's duplicate h1 — hidden on desktop, shown in drawer on mobile */
body.ims-restyle #primary-navigation > h1.primary-heading {
  display: none;
}


/* --- 6. Client selector panel --------------------------------------------- */

body.ims-restyle #select-project-nav {
  margin: 0 12px 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--ims-radius-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-size: var(--ims-fs-body);
}

body.ims-restyle .blue-bar#select-client-project-form-container {
  background: none;
  padding: 0;
  margin: 0;
  box-shadow: none;
  border-radius: 0;
  font-size: inherit;
}

body.ims-restyle #select-client-project-form-container fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

/* "Select a Client" label and other form labels in the panel */
body.ims-restyle #select-project-nav label {
  font-size: var(--ims-fs-label);
  font-weight: 600;
  letter-spacing: var(--ims-tracking-label);
  text-transform: uppercase;
  color: var(--ims-on-navy-label);
  display: block;
  margin-bottom: 6px;
}

body.ims-restyle #select-project-nav label[for="toggleallclient_"] {text-align:right;}
body.ims-restyle #select-project-nav input[name="toggle-all-client"] {display:none;}


/* Nav-panel ul resets (not to be confused with nav ul) */
body.ims-restyle #select-project-nav > div > form fieldset ul {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
}

/* Override li styles inherited from nav rules */
body.ims-restyle #select-project-nav li {
  border-top: none !important;
  min-height: auto !important;
  font-size: var(--ims-fs-body) !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: #fff;
  overflow: visible !important;
}

/* Client dropdown */
body.ims-restyle #dashboard_current_client_id_multi_project {
  width: 100%;
  height: var(--ims-touch);
  border-radius: var(--ims-radius-field);
  background-color: var(--ims-navy-field);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: var(--ims-fs-body);
  font-family: var(--ims-font-ui);
  padding: 0 10px;
  -webkit-appearance: none;
  appearance: none;
}

/* Explicit focus state — prevents Mac browsers from reverting to system
   appearance (light background) while white text colour is still active */
body.ims-restyle #dashboard_current_client_id_multi_project:focus {
  background-color: var(--ims-navy-field);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.55);
  outline: none;
}

/* Option text — the native OS dropdown list on Windows inherits the select's
   colour; force black-on-white so options are always readable regardless of OS */
body.ims-restyle #dashboard_current_client_id_multi_project option {
  background-color: #ffffff;
  color: #000000;
}

/* Project checkboxes */
body.ims-restyle #dashboard_current_project_id {
  margin: 8px 0 4px;
}

body.ims-restyle #dashboard_current_project_id li {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 32px !important;
  color: #fff;
}

body.ims-restyle #dashboard_current_project_id li label {
  color: #fff;
  font-size: var(--ims-fs-body);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  display: inline;
  margin-bottom: 0;
}

body.ims-restyle #dashboard_current_project_id input[type="checkbox"] {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--ims-blue);
}

/* GO button — primary red */
body.ims-restyle #select-client-project-form button.action-button {
  display: block;
  margin-left: auto;
  margin-top: 10px;
  background: var(--ims-red);
  color: #fff;
  border: none;
  border-radius: var(--ims-radius-control);
  height: var(--ims-touch);
  padding: 0 20px;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: var(--ims-fs-body);
  font-family: var(--ims-font-ui);
  cursor: pointer;
}

/* Admin "+" ghost button on navy */
body.ims-restyle #admin-client-projects-options {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 13px;
  cursor: pointer;
  margin-left: 6px;
}


/* --- 7. Nav items --------------------------------------------------------- */

/* Single-color icons via currentColor */
body.ims-restyle #primary-navigation li a svg,
body.ims-restyle #primary-navigation li a svg * {
  fill: currentColor;
}

body.ims-restyle #primary-navigation ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

body.ims-restyle #primary-navigation ul li.nav-level-1 {
  border-top: none;
  min-height: var(--ims-touch);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
  color: var(--ims-on-navy);
  position: relative;
}

body.ims-restyle #primary-navigation ul li.nav-level-1 a {
  display: flex;
  align-items: center;
  min-height: var(--ims-touch);
  padding: 10px 16px;
  gap: 10px;
  color: var(--ims-on-navy);
  text-decoration: none;
  background: none;
  position: relative;
}

body.ims-restyle #primary-navigation ul li.nav-level-1 a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ims-on-navy-strong);
}

/* Icon: static position (overrides existing absolute), single-color */
body.ims-restyle #primary-navigation ul li.nav-level-1 a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--ims-on-navy-icon);
  position: static;
  margin: 0;
  vertical-align: unset;
  display: block;
}

/* span label — override existing padding-left that accommodated absolute icon */
body.ims-restyle #primary-navigation ul li.nav-level-1.contains-0 a span,
body.ims-restyle #primary-navigation ul li.nav-level-2 a span {
  padding: 0;
  line-height: inherit;
}

/* Level-2 sub-nav items */
body.ims-restyle #primary-navigation ul li.nav-level-2 {
  min-height: var(--ims-touch);
/*  font-size: 15px; */
  color: var(--ims-on-navy);
  line-height: normal;
}

body.ims-restyle #primary-navigation ul li.nav-level-2 a {
  display: flex;
  align-items: center;
  min-height: var(--ims-touch);
/*  padding: 8px 16px 8px 46px; */
  gap: 8px;
  color: var(--ims-on-navy);
  text-decoration: none;
  background: none;
}

body.ims-restyle #primary-navigation ul li.nav-level-2 a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ims-on-navy-strong);
}

/* Remove old ::after separator lines */
body.ims-restyle #primary-navigation ul li.nav-level-1::after {
  display: none;
}
body.ims-restyle #primary-navigation ul li.nav-level-1.active-submenu > a::after {
  display: none;
}

/* Expand-nav chevron button */
body.ims-restyle .expand-nav {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  cursor: pointer;
  height: 44px;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
}

body.ims-restyle span.nav-expand {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

body.ims-restyle span.nav-expand::before,
body.ims-restyle span.nav-expand::after {
  background-color: var(--ims-on-navy);
}


/* --- 8. Active nav — angled tab ------------------------------------------ */

body.ims-restyle #primary-navigation li.nav-level-1.current > a,
body.ims-restyle #primary-navigation li.nav-level-2.current > a {
  background: var(--ims-page);
  color: var(--ims-navy);
  font-weight: 600;
  /* 20° angled left edge; tab runs to right edge */
  clip-path: polygon(16px 0, 100% 0, 100% 100%, 0 100%);
  padding-left: 28px;    /* 16px clipped + 12px visual left margin */
  margin: 0;
}

body.ims-restyle #primary-navigation li.nav-level-1.current > a:hover,
body.ims-restyle #primary-navigation li.nav-level-2.current > a:hover {
  background: var(--ims-page);
  color: var(--ims-navy);
}

body.ims-restyle #primary-navigation li.nav-level-1.current > a svg,
body.ims-restyle #primary-navigation li.nav-level-2.current > a svg {
  color: var(--ims-red);
}


/* --- 9. Beta section label ------------------------------------------------ */

/* li with a sub-ul (the Beta/internal section) gets a top rule and label styling */
body.ims-restyle #primary-navigation ul li.nav-level-1:has(> ul) {
  margin-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

body.ims-restyle #primary-navigation ul li.nav-level-1:has(> ul) > a span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #B9BEF0;
}


/* --- 10. Content area ----------------------------------------------------- */

body.ims-restyle #container-content {
  flex: 1;
  min-width: 0;
  padding: 36px 40px 56px;
  background: var(--ims-page);
  display: block;
  width: auto;
  vertical-align: unset;
}


/* --- 11. Hamburger (#toggle-navigation) — hidden on desktop -------------- */

body.ims-restyle #toggle-navigation {
  height: 0;
  width: 0;
  overflow: hidden;
}


/* =========================================================================
   §7  RESPONSIVE: ≤1025px sidebar collapses to off-canvas drawer
   ========================================================================= */

@media (max-width: 1025px) {

  /* Show hamburger button — fixed over header at top-left.
     NOTE: .js is on <html>, not <body>, so it must come BEFORE body in the selector. */
  .js body.ims-restyle #toggle-navigation {
    position: fixed;
    top: 0;
    left: 0;
    height: var(--ims-header-h);
    width: var(--ims-touch);
    min-width: var(--ims-touch);
    background: none;
    background-image: none;
    border-radius: 0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    z-index: 950;
  }

  .js body.ims-restyle #toggle-navigation a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ims-touch);
    height: var(--ims-touch);
    padding: 0;
    font-size: 0;        /* visually hide "Menu" text; screen-readers still read it */
    color: var(--ims-on-navy);
    line-height: 1;
    position: relative;
  }

  /* Three hamburger lines */
  .js body.ims-restyle #toggle-navigation a::before,
  .js body.ims-restyle #toggle-navigation a::after,
  .js body.ims-restyle #toggle-navigation::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 2px;
    background-color: #fff;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
    transition: transform 0.28s ease, opacity 0.28s ease, top 0.28s ease, bottom 0.28s ease;
  }
  .js body.ims-restyle #toggle-navigation a::before { top: calc(50% - 7px); }
  .js body.ims-restyle #toggle-navigation a::after  { bottom: calc(50% - 7px); }
  .js body.ims-restyle #toggle-navigation::before   { top: 50%; margin-top: -1px; }

  /* X state when drawer is open.
     .js is on <html>, .active-navigation is on <body> — they cannot be on the same element. */
  .js body.ims-restyle.active-navigation #toggle-navigation {
    background: none;
    background-image: none;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--ims-touch);
    height: var(--ims-header-h);
  }
  .js body.ims-restyle.active-navigation #toggle-navigation a::before {
    top: calc(50% - 1px);
    transform: translateX(-50%) rotate(45deg);
  }
  .js body.ims-restyle.active-navigation #toggle-navigation a::after {
    bottom: calc(50% - 1px);
    transform: translateX(-50%) rotate(-45deg);
  }
  .js body.ims-restyle.active-navigation #toggle-navigation::before {
    opacity: 0;
  }

  /* Push masthead content right so it clears the hamburger */
  body.ims-restyle #container-masthead {
    padding-left: var(--ims-touch);
  }

  /* Sidebar becomes off-canvas drawer (322px panel) */
  body.ims-restyle #container-primary-navigation {
    position: fixed;
    top: 0;
    left: -322px;
    width: 322px;
    height: 100%;
    z-index: 900;
    transition: left 0.28s ease;
    background: var(--ims-navy);
  }

  body.ims-restyle.active-navigation #container-primary-navigation {
    left: 0;
  }

  /* Scrim behind drawer */
  body.ims-restyle.active-navigation::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(11, 14, 51, 0.6);
    z-index: 898;
    pointer-events: none;
  }

  /* Show drawer header (the sidebar's duplicate h1 with logo) */
  body.ims-restyle #primary-navigation > h1.primary-heading {
    display: flex;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--ims-on-navy);
    gap: 12px;
    flex: none;
    order: 0;              /* don't let the masthead order:1 push this down */
    min-height: auto;
  }

  /* In the drawer, subtitle/badge is compact */
  body.ims-restyle #primary-navigation > h1.primary-heading span.subtitle {
    width: auto;
    padding: 0;
    align-self: auto;
  }

  /* In the drawer, make badge a bit smaller */
  body.ims-restyle #primary-navigation > h1.primary-heading span.subtitle span.imarket-logo svg {
    width: 120px;
  }

  /* Content area fills remaining width (sidebar is now out of flow) */
  body.ims-restyle #container-content {
    padding: 24px 24px 40px;
  }

  /* Subnav: keep mobile max-height collapse behavior working */
  body.ims-restyle #primary-navigation ul li.nav-level-1 ul {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }
  body.ims-restyle #primary-navigation ul li.nav-level-1 ul.active {
    max-height: none;
  }
}


/* ≤570px: compact two-row phone header */
@media (max-width: 570px) {

  body.ims-restyle header#header {
    height: auto;
  }

  body.ims-restyle #masthead {
    flex-wrap: wrap;
    height: auto;
  }

  body.ims-restyle #container-masthead {
    padding-left: var(--ims-touch);
  }

  body.ims-restyle h1.primary-heading {
    /* First row: badge only (64px) */
    font-size: 15px;
    gap: 8px;
    padding: 0 10px 0 0;
    flex-wrap: wrap;
  }

  body.ims-restyle h1.primary-heading span.subtitle {
    width: auto;
    padding: 10px 0;
    align-self: auto;
  }

  body.ims-restyle h1.primary-heading span.subtitle span.imarket-logo svg {
    width: 136px;
  }

  /* Client name drops to its own row (40px) */
  body.ims-restyle h1.primary-heading > span:not(.subtitle),
  body.ims-restyle h1.primary-heading > .project-list {
    width: 100%;
    padding: 0 10px 8px;
    font-size: 14px;
  }

  body.ims-restyle #container-main {
    margin-top: 0;
  }

  body.ims-restyle #container-content {
    padding: 16px 16px 32px;
  }
}


/* =========================================================================
   §5.1  BUTTONS
   Default .action-button → secondary (navy outline).
   Primary red only for Show/SHOW and GO (GO already handled in §4).
   Destructive/utility → text link.
   ========================================================================= */

/* --- Secondary (default for all .action-button) -------------------------- */
body.ims-restyle input.action-button,
body.ims-restyle .action-button,
body.ims-restyle input.vue-action-button,
body.ims-restyle .vue-action-button {
  background: transparent;
  border: 1.5px solid var(--ims-navy);
  border-radius: var(--ims-radius-control);
  color: var(--ims-navy);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  height: var(--ims-touch);
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  text-shadow: none;
  box-shadow: none;
}

body.ims-restyle input.action-button:hover,
body.ims-restyle .action-button:hover,
body.ims-restyle input.vue-action-button:hover,
body.ims-restyle .vue-action-button:hover {
  background: var(--ims-navy);
  border-color: var(--ims-navy);
  color: #fff;
  text-shadow: none;
}

/* Selected/active state → filled navy */
body.ims-restyle .action-button.selected,
body.ims-restyle input.action-button.selected,
body.ims-restyle .selected .action-button,
body.ims-restyle .selected input.action-button {
  background: var(--ims-navy);
  border-color: var(--ims-navy);
  color: #fff;
  cursor: default;
}

/* --- Primary red — Show / SHOW ------------------------------------------ */
body.ims-restyle .action-button.show-report-button,
body.ims-restyle input.action-button.show-report-button,
body.ims-restyle .show-report-button {
  background: var(--ims-red);
  border-color: var(--ims-red);
  color: #fff;
}

body.ims-restyle .action-button.show-report-button:hover,
body.ims-restyle input.action-button.show-report-button:hover,
body.ims-restyle .show-report-button:hover {
  background: #b5151b;
  border-color: #b5151b;
  color: #fff;
}

/* --- Destructive/utility — text link ------------------------------------- */
body.ims-restyle span.refresh-data.action-button,
body.ims-restyle .action-button.refresh-data {
  background: transparent;
  border: none;
  color: var(--ims-ink-2);
  font-weight: 400;
  letter-spacing: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  height: auto;
  padding: 0;
  display: inline;
  cursor: pointer;
}

body.ims-restyle span.refresh-data.action-button:hover,
body.ims-restyle .action-button.refresh-data:hover {
  background: transparent;
  border: none;
  color: var(--ims-navy-ink);
}

/* Set as My Homepage inherits secondary; compact padding suits the title row */
body.ims-restyle .nl-heading-home.action-button {
  gap: 8px;
  padding: 0 16px;
}

/* SVG icons inherit the button's text color (overrides imarket_v2.css `.action-button svg path { fill:#fff }`) */
body.ims-restyle .action-button svg path {
  fill: currentColor;
}


/* =========================================================================
   §5.2  HELP CHIPS
   ========================================================================= */

/* SVG data URIs shared by helpers below */
/* help-circle: a circle with ? and dot (20px, navy) */

body.ims-restyle .help-container .help-link,
body.ims-restyle .help-container span.reporting_help.help-link,
body.ims-restyle #heading-container .help-link,
body.ims-restyle span.reporting_help.help-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--ims-touch);
  padding: 0 16px;
  background: var(--ims-blue-soft);
  border-radius: var(--ims-radius-control);
  color: var(--ims-navy);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  margin-left: 0;
  position: static;
  float: none;
}

body.ims-restyle .help-container .help-link:hover,
body.ims-restyle span.reporting_help.help-link:hover {
  background: #d2e4f6;
  color: var(--ims-navy);
}

/* Help-circle icon via ::before — replaces the existing red "?" badge */
body.ims-restyle .help-container .help-link::before,
body.ims-restyle #heading-container .help-link::before,
body.ims-restyle span.reporting_help.help-link::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='12' cy='12' r='10' stroke='%232E3393' stroke-width='2'/%3E%3Cpath d='M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3' stroke='%232E3393' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cline x1='12' y1='17' x2='12.01' y2='17' stroke='%232E3393' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  background-color: transparent;
  position: static;
  top: auto;
  left: auto;
  border-radius: 0;
  font-size: 0;
  line-height: 0;
  color: transparent;
}


/* =========================================================================
   §5.3  FIELDS AND DATE CONTROL
   ========================================================================= */

/* --- 4px radius for all reporting form fields ----------------------------- */

/* Chevron URI reused across selects + date trigger */
/* navy down-chevron */

body.ims-restyle form fieldset select,
body.ims-restyle form fieldset input[type="text"],
body.ims-restyle form fieldset input[type="search"],
body.ims-restyle form fieldset input[type="number"] {
  height: var(--ims-touch);
  border-radius: var(--ims-radius-field);
  border: 1px solid var(--ims-field-border);
  background-color: #fff;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
  padding: 0 32px 0 12px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232E3393' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 10px) center;
  background-size: 12px 8px;
}

body.ims-restyle form fieldset input[type="text"],
body.ims-restyle form fieldset input[type="search"],
body.ims-restyle form fieldset input[type="number"] {
  background-image: none;  /* text inputs don't get the chevron */
  padding-right: 12px;
}

/* Date-selector selects specifically */
body.ims-restyle select.select-date {
  height: var(--ims-touch);
  border-radius: var(--ims-radius-field);
  border: 1px solid var(--ims-field-border);
  background-color: #fff;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
  font-weight: 400;
  padding: 0 32px 0 12px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232E3393' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 10px) center;
  background-size: 12px 8px;
  display: block;
  width: 100%;
  margin-top: 12px;
  cursor: pointer;
}

/* Date trigger buttons (#current-date-info etc.) → field style */
body.ims-restyle #current-date-info,
body.ims-restyle #current-forms-info,
body.ims-restyle #current-channel-info,
body.ims-restyle #current-verticals-info,
body.ims-restyle #current-segments-info,
body.ims-restyle #current-is-lead-info {
  display: inline-flex;
  align-items: center;
  height: var(--ims-touch);
  min-width: 160px;
  width: auto;
  border: 1px solid var(--ims-field-border);
  border-radius: var(--ims-radius-field);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232E3393' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 10px) center;
  background-size: 12px 8px;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
  padding: 0 32px 0 12px;
  margin-right: 8px;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
}

/* 12 Month Overview → secondary button */
body.ims-restyle .reporting-actions a.date-style-nav-item,
body.ims-restyle a.date-style-nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ims-touch);
  padding: 0 16px;
  background: transparent;
  background-image: none;
  border: 1.5px solid var(--ims-navy);
  border-radius: var(--ims-radius-control);
  color: var(--ims-navy);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  width: auto;
  margin-right: 0;
}

body.ims-restyle .reporting-actions a.date-style-nav-item:hover,
body.ims-restyle a.date-style-nav-item:hover {
  background: var(--ims-navy);
  color: #fff;
}

/* Chevron after "12 Month Overview" label */
body.ims-restyle .reporting-actions a.date-style-nav-item::after,
body.ims-restyle a.date-style-nav-item::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232E3393' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
  transition: background-image 0.15s;
}

body.ims-restyle a.date-style-nav-item:hover::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
}

/* Light date popover */
body.ims-restyle #date-selector,
body.ims-restyle #forms-selector,
body.ims-restyle #filters-selector,
body.ims-restyle #verticals-selector,
body.ims-restyle #segments-selector,
body.ims-restyle #is-lead-selector {
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-popover);
  border: 1px solid var(--ims-border);
  background-color: #fff;
}

/* Show button inside popover — primary red (overrides generic .action-button) */
body.ims-restyle #date-selector .action-button.show-report-button,
body.ims-restyle #date-selector .show-report-button,
body.ims-restyle #filters-selector .action-button.show-report-button,
body.ims-restyle #filters-selector .show-report-button,
body.ims-restyle #forms-selector .action-button.show-report-button,
body.ims-restyle #forms-selector .show-report-button,
body.ims-restyle #verticals-selector .show-report-button,
body.ims-restyle #segments-selector .show-report-button,
body.ims-restyle #is-lead-selector .show-report-button {
  background: var(--ims-red);
  border-color: var(--ims-red);
  color: #fff;
  display: block;
  margin: 12px auto 0;
  width: 100px;
}

/* Show button that isn't .show-report-button (the Show inside selectors) */
body.ims-restyle #date-selector .action-button:not(.show-report-button),
body.ims-restyle #filters-selector .action-button:not(.show-report-button),
body.ims-restyle #forms-selector .action-button:not(.show-report-button),
body.ims-restyle #verticals-selector .action-button:not(.show-report-button),
body.ims-restyle #segments-selector .action-button:not(.show-report-button),
body.ims-restyle #is-lead-selector .action-button:not(.show-report-button) {
  background: var(--ims-red);
  border-color: var(--ims-red);
  color: #fff;
  display: block;
  margin: 12px auto 0;
  width: 100px;
}


/* =========================================================================
   §5.4  SEGMENTED SWITCHES
   Connected group: 1.5px navy border, radius 12px, overflow hidden.
   Selected: navy fill, white text, checkmark ::before.
   ========================================================================= */

/* Shared checkmark URI */
/* white checkmark SVG for selected segments */

/* --- Time-frame switch (ul.time-frames) ---------------------------------- */

body.ims-restyle ul.time-frames {
  display: inline-flex;
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1.5px solid var(--ims-navy);
  border-radius: var(--ims-radius-control);
  overflow: hidden;
  height: var(--ims-touch);
  line-height: 1;
}

body.ims-restyle ul.time-frames li {
  display: flex;
  margin: 0;
  font-size: var(--ims-fs-body);
  font-weight: 400;
  height: 100%;
}

body.ims-restyle ul.time-frames li + li {
  border-left: 1.5px solid var(--ims-navy);
}

body.ims-restyle ul.time-frames li span.time-frame {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 14px;
  height: 100%;
  color: var(--ims-navy);
  cursor: pointer;
  border-radius: 0;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  font-weight: 400;
  white-space: nowrap;
}

body.ims-restyle ul.time-frames li span.time-frame:hover {
  background: rgba(46, 51, 147, 0.08);
}

/* Selected segment */
body.ims-restyle ul.time-frames li span.time-frame.strong {
  background: var(--ims-navy);
  color: #fff;
  font-weight: 600;
}

/* Checkmark before selected label */
body.ims-restyle ul.time-frames li span.time-frame.strong::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13'%3E%3Cpath d='M2 7l3 3 6-6' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}


/* --- AND/OR query-builder switch (.btn-group.group-conditions) ----------- */

body.ims-restyle .btn-group.group-conditions {
  display: inline-flex;
  border: 1.5px solid var(--ims-navy);
  border-radius: var(--ims-radius-control);
  overflow: hidden;
  height: var(--ims-touch);
  background: #fff;
}

body.ims-restyle .btn-group.group-conditions > label.btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  color: #5A5F99;
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0 14px;
  height: 100%;
  font-family: var(--ims-font-ui);
/*  font-size: var(--ims-fs-body); */
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  line-height: 1;
}

body.ims-restyle .btn-group.group-conditions > label.btn + label.btn {
  border-left: 1.5px solid var(--ims-navy);
}

body.ims-restyle .btn-group.group-conditions > label.btn:hover {
  background: rgba(46, 51, 147, 0.08);
  color: var(--ims-navy);
}

/* Selected (active) segment */
body.ims-restyle .btn-group.group-conditions > label.btn.active,
body.ims-restyle .btn-group.group-conditions > label.btn-primary.active {
  background: var(--ims-navy);
  color: #fff;
}

/* Checkmark */
body.ims-restyle .btn-group.group-conditions > label.btn.active::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13'%3E%3Cpath d='M2 7l3 3 6-6' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}


/* --- Query builder container + buttons ----------------------------------- */

/* Align Add Rule, Add Group, Delete in a single flex row */
body.ims-restyle .query-builder .group-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

body.ims-restyle #query-builder .rules-group-container {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
}

/* Add rule / Add group → secondary buttons */
body.ims-restyle .query-builder .group-actions .btn-xs,
body.ims-restyle .query-builder .btn-xs.btn-success,
body.ims-restyle button.column-filter-button {
  background: transparent;
  border: 1.5px solid var(--ims-navy);
  border-color: var(--ims-navy);
  color: var(--ims-navy);
  border-radius: var(--ims-radius-control);
  font-family: var(--ims-font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
  min-height: var(--ims-touch);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

body.ims-restyle .query-builder .group-actions .btn-xs:hover,
body.ims-restyle .query-builder .btn-xs.btn-success:hover {
  background: var(--ims-navy);
  color: #fff;
}

/* SHOW (query builder) → primary red */
body.ims-restyle .query-builder .group-actions .show-report-button,
body.ims-restyle .query-builder button.show-report-button,
body.ims-restyle .group-actions button.show-report-button {
  background: var(--ims-red);
  border-color: var(--ims-red);
  color: #fff;
}

body.ims-restyle .query-builder .group-actions .show-report-button:hover,
body.ims-restyle .group-actions button.show-report-button:hover {
  background: #b5151b;
  border-color: #b5151b;
}

/* Delete → text link */
body.ims-restyle .query-builder .btn-xs.btn-danger,
body.ims-restyle .query-builder .rule-container .btn-xs.btn-danger,
body.ims-restyle .query-builder .rules-group-header .btn-xs.btn-danger {
  background: transparent;
  border: none;
  color: var(--ims-ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: var(--ims-fs-small);
  font-weight: 400;
  min-height: var(--ims-touch);
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
}

body.ims-restyle .query-builder .btn-xs.btn-danger:hover {
  background: transparent;
  color: var(--ims-navy-ink);
  border: none;
}

/* Rule-row fields → 4px */
body.ims-restyle .query-builder .rule-value-container select,
body.ims-restyle .query-builder .rule-value-container input[type="text"],
body.ims-restyle .query-builder .rule-value-container input[type="number"],
body.ims-restyle .query-builder .form-control {
  height: var(--ims-touch);
  border-radius: var(--ims-radius-field);
  border: 1px solid var(--ims-field-border);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
  background: #fff;
  padding: 0 10px;
}

/* Glyphicons: hide them (they depend on a font file not loaded) */
body.ims-restyle .query-builder .glyphicon {
  display: none;
}


/* --- Call Diagnostic Report / button presets ----------------------------- */

body.ims-restyle #button-presets-container .button-preset-btn,
body.ims-restyle #button-presets-container .btn-xs {
  background: transparent;
  border: 1.5px solid var(--ims-navy);
  color: var(--ims-navy);
  border-radius: var(--ims-radius-control);
  height: var(--ims-touch);
  padding: 0 16px;
  font-family: var(--ims-font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

body.ims-restyle #button-presets-container .button-preset-btn.preset-active {
  background: var(--ims-navy);
  color: #fff;
}

body.ims-restyle #button-presets-container .button-preset-btn.preset-active::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  margin-right: 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13'%3E%3Cpath d='M2 7l3 3 6-6' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
}


/* --- Scorecard presets (.sr-preset) -------------------------------------- */

/* Flex container eliminates whitespace gaps between inline-flex button siblings */
body.ims-restyle .sr-presets {
  display: inline-flex;
}

body.ims-restyle .sr-preset {
  background: transparent;
  border: 1.5px solid var(--ims-navy);
  color: var(--ims-navy);
  border-radius: 0;
  padding: 0 14px;
  height: var(--ims-touch);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  font-weight: 600;
  letter-spacing: 0.04em;
  margin: 0;
}

/* Round ends of the connected preset group */
body.ims-restyle .sr-filters__row .sr-preset:first-of-type {
  border-radius: var(--ims-radius-control) 0 0 var(--ims-radius-control);
}
body.ims-restyle .sr-filters__row .sr-preset:last-of-type {
  border-radius: 0 var(--ims-radius-control) var(--ims-radius-control) 0;
}
body.ims-restyle .sr-filters__row .sr-preset + .sr-preset {
  border-left: none;
}

body.ims-restyle .sr-preset.is-active {
  background: var(--ims-navy);
  color: #fff;
}

body.ims-restyle .sr-preset.is-active::before {
  content: '';
  display: inline-block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 13 13'%3E%3Cpath d='M2 7l3 3 6-6' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}


/* ===================================================================
   §5.6 DataTables — Paid Search & Conversions
   =================================================================== */

/* Panel wrapper: white card with border-radius.
   overflow: clip (not hidden) clips panel corners without creating a
   scroll container — position: sticky in the inner dataTables_wrapper
   still works. */
body.ims-restyle .report-table,
body.ims-restyle .leads-table {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  overflow: clip;
}

/* Inner scroll container: override themeroller's overflow-x: scroll / overflow-y: hidden. */
body.ims-restyle .dataTables_wrapper {
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Separate borders so position: sticky td/th keep their border lines */
body.ims-restyle .dataTables_wrapper table {
  border-collapse: separate;
  border-spacing: 0;
}

/* Header band: solid navy, uppercase instrument labels */
body.ims-restyle .dataTables_wrapper table thead th {
  background: var(--ims-navy) !important;
  color: #DDE0FA !important;
  font-family: var(--ims-font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: var(--ims-tracking-table-head);
  text-transform: uppercase;
  padding: 10px 10px;
  border-bottom: none !important;
  white-space: nowrap;
}

/* Neutralize jQuery UI th wrapper classes (Conversions uses bJQueryUI) */
body.ims-restyle .dataTables_wrapper table thead th.ui-state-default {
  border: none !important;
  border-radius: 0 !important;
}

/* Sorted column: slightly deeper navy */
body.ims-restyle .dataTables_wrapper table thead th.sorting_asc,
body.ims-restyle .dataTables_wrapper table thead th.sorting_desc {
  background: var(--ims-navy-deep) !important;
  color: #fff !important;
}

/* Hide jQuery UI sprite-based sort icons */
body.ims-restyle .dataTables_wrapper table thead th .DataTables_sort_icon,
body.ims-restyle .dataTables_wrapper table thead th span.ui-icon {
  display: none !important;
}

/* CSS sort indicators via ::after on the th */
body.ims-restyle .dataTables_wrapper table thead th.sorting::after,
body.ims-restyle .dataTables_wrapper table thead th.sorting_asc::after,
body.ims-restyle .dataTables_wrapper table thead th.sorting_desc::after {
  display: inline-block;
  margin-left: 5px;
  font-size: 9px;
  color: var(--ims-sort-indicator);
  vertical-align: middle;
  line-height: 1;
}

body.ims-restyle .dataTables_wrapper table thead th.sorting::after {
  content: '\2195';
  opacity: 0.55;
}

body.ims-restyle .dataTables_wrapper table thead th.sorting_asc::after {
  content: '\2191';
  opacity: 1;
}

body.ims-restyle .dataTables_wrapper table thead th.sorting_desc::after {
  content: '\2193';
  opacity: 1;
}

/* Body cells */
body.ims-restyle .dataTables_wrapper table tbody td {
  position: relative;
  z-index: 0;
  font-size: var(--ims-fs-body);
  padding: 9px 10px;
  border-bottom: 1px solid var(--ims-rule) !important;
  border-top: none !important;
  vertical-align: middle;
}

body.ims-restyle .dataTables_wrapper table tbody tr:last-child td {
  border-bottom: none !important;
}

/* No hover highlight (spec §5.6) */
body.ims-restyle .dataTables_wrapper table tbody tr:hover td,
body.ims-restyle .dataTables_wrapper table tbody tr.odd:hover td,
body.ims-restyle .dataTables_wrapper table tbody tr.even:hover td {
  background-color: transparent !important;
}

/* No zebra stripes */
body.ims-restyle .dataTables_wrapper table.stripe tbody tr.odd td,
body.ims-restyle .dataTables_wrapper table.display tbody tr.odd td {
  background-color: transparent !important;
}

/* Numeric columns: right-align, tabular nums, no-wrap */
body.ims-restyle .dataTables_wrapper table thead th.dt-num,
body.ims-restyle .dataTables_wrapper table tbody td.dt-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Wrap columns: allow long text to wrap */
body.ims-restyle .dataTables_wrapper table thead th.dt-wrap,
body.ims-restyle .dataTables_wrapper table tbody td.dt-wrap {
  white-space: normal;
  min-width: 140px;
}

/* Search field */
body.ims-restyle .dataTables_filter label {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-label);
  font-weight: 600;
  letter-spacing: var(--ims-tracking-label);
  text-transform: uppercase;
  color: var(--ims-ink-label);
}

body.ims-restyle .dataTables_filter input[type=search] {
  border: 1px solid var(--ims-field-border);
  border-radius: var(--ims-radius-field);
  padding: 6px 10px;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
}

body.ims-restyle .dataTables_filter input[type=search]:focus {
  outline: 2px solid var(--ims-blue);
  outline-offset: 1px;
  border-color: var(--ims-blue);
}

/* Swipe hint: hidden by default, shown at ≤570px */
body.ims-restyle .ims-swipe-hint {
  display: none;
  font-size: var(--ims-fs-label);
  color: var(--ims-ink-2);
  text-align: center;
  margin: var(--ims-space-2) 0 0;
  padding: 0 var(--ims-space-4);
}

@media (max-width: 570px) {
  body.ims-restyle .ims-swipe-hint {
    display: block;
  }

  /* Sticky first column on phone */
  body.ims-restyle .dataTables_wrapper table thead th:first-child,
  body.ims-restyle .dataTables_wrapper table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--ims-surface);
    box-shadow: 2px 0 4px rgba(22, 26, 74, 0.08);
  }

  body.ims-restyle .dataTables_wrapper table thead th:first-child {
    background: var(--ims-navy);
    z-index: 3;
  }
}


/* ===================================================================
   JS sticky header clone (imarket-sticky.js)
   A <div id="ims-sticky-{id}" class="ims-sticky-thead"> is appended
   to <body> and shown/hidden via .is-visible as the user scrolls.
   =================================================================== */
body.ims-restyle .ims-sticky-thead {
  position: fixed;
  top: 0;
  z-index: 200;
  overflow: hidden;
  display: none;
  pointer-events: none;
}

body.ims-restyle .ims-sticky-thead.is-visible {
  display: block;
  pointer-events: auto;
}

body.ims-restyle .ims-sticky-thead table {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
  padding: 0;
}

/* Mirror all thead th styles from §5.6 so the clone matches the live header */
body.ims-restyle .ims-sticky-thead table thead th {
  background: var(--ims-navy) !important;
  color: #DDE0FA !important;
  font-family: var(--ims-font-ui);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: var(--ims-tracking-table-head);
  text-transform: uppercase;
  padding: 10px 10px;
  border-bottom: none !important;
  white-space: nowrap;
}

body.ims-restyle .ims-sticky-thead table thead th.ui-state-default {
  border: none !important;
  border-radius: 0 !important;
}

body.ims-restyle .ims-sticky-thead table thead th.sorting_asc,
body.ims-restyle .ims-sticky-thead table thead th.sorting_desc {
  background: var(--ims-navy-deep) !important;
  color: #fff !important;
}

body.ims-restyle .ims-sticky-thead table thead th .DataTables_sort_icon,
body.ims-restyle .ims-sticky-thead table thead th span.ui-icon {
  display: none !important;
}

body.ims-restyle .ims-sticky-thead table thead th.sorting::after,
body.ims-restyle .ims-sticky-thead table thead th.sorting_asc::after,
body.ims-restyle .ims-sticky-thead table thead th.sorting_desc::after {
  display: inline-block;
  margin-left: 5px;
  font-size: 9px;
  color: var(--ims-sort-indicator);
  vertical-align: middle;
  line-height: 1;
}

body.ims-restyle .ims-sticky-thead table thead th.sorting::after {
  content: '\2195';
  opacity: 0.55;
}

body.ims-restyle .ims-sticky-thead table thead th.sorting_asc::after {
  content: '\2191';
  opacity: 1;
}

body.ims-restyle .ims-sticky-thead table thead th.sorting_desc::after {
  content: '\2193';
  opacity: 1;
}

/* At phone width the first column is also sticky-left inside the clone */
@media (max-width: 570px) {
  body.ims-restyle .ims-sticky-thead table thead th:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--ims-navy) !important;
  }
}


/* ===================================================================
   §5.7 Year-over-year table
   =================================================================== */

/* Panel wrapper: same card treatment; override existing overflow-x: auto */
body.ims-restyle .yoy-list {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  overflow: clip;
}

/* Inner scroll container (added in year_over_year_leads.php) */
body.ims-restyle .yoy-list .ims-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Separate borders for sticky */
body.ims-restyle .yoy-list table.index {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

/* Two-row thead: first row brand navy */
body.ims-restyle .yoy-list table.index thead tr:first-child th {
  background: var(--ims-navy);
  color: #DDE0FA;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: var(--ims-tracking-table-head);
  text-transform: uppercase;
  padding: 10px 10px;
  border-bottom: none;
  white-space: nowrap;
}

/* Second header row: navy-deep for sub-metric labels */
body.ims-restyle .yoy-list table.index thead tr:nth-child(2) th {
  background: var(--ims-navy-deep);
  color: #BFE6F7;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--ims-tracking-table-head);
  text-transform: uppercase;
  padding: 8px 10px;
  border-bottom: none;
  white-space: nowrap;
  text-align: right;
}

/* Body cells */
body.ims-restyle .yoy-list table.index tbody td {
  font-size: var(--ims-fs-body);
  padding: 6px 8px;
  border-bottom: none;
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
}

/* Channel/numeric cells: right-align (override center from reporting_v2.css) */
body.ims-restyle .yoy-list table.index tbody td:not(.row-year):not(.row-month):not(.row-location) {
  text-align: right;
}

/* Location column is hidden in reporting_v2.css; keep it hidden in the sticky clone too */
body.ims-restyle .ims-sticky-thead .row-location {
  display: none;
}

/* Year / Month label columns: left-align, no-wrap */
body.ims-restyle .yoy-list table.index thead th.row-year,
body.ims-restyle .yoy-list table.index thead th.row-month,
body.ims-restyle .yoy-list table.index tbody td.row-year,
body.ims-restyle .yoy-list table.index tbody td.row-month {
  text-align: left;
  white-space: nowrap;
  padding-right: 16px;
}

/* Pair separator: 2px rule under the y2 row */
body.ims-restyle .yoy-list tr.pair-start + tr td {
  border-bottom: 2px solid #D5DAEA !important;
}

/* Remove 20px top-padding on pair-start (replaced by bottom border on y2 row) */
body.ims-restyle .yoy-list tr.pair-start td {
  padding-top: 6px !important;
}

/* Remove hover (override !important from reporting_v2.css) */
body.ims-restyle .yoy-list tr:hover,
body.ims-restyle .yoy-list tr:hover td {
  background-color: transparent !important;
}

/* YoY better cells: soft green tint + text */
body.ims-restyle .yoy-list td.green-cell {
  background-color: var(--ims-yoy-better-bg) !important;
  color: var(--ims-yoy-better-text) !important;
  font-weight: 600;
}

/* YoY worse cells: soft red tint + text */
body.ims-restyle .yoy-list td.red-cell {
  background-color: var(--ims-yoy-worse-bg) !important;
  color: var(--ims-yoy-worse-text) !important;
  font-weight: 600;
}

/* Arrow pseudo-elements (before the value):
   Leads columns: green (better) = ▲, red (worse) = ▼
   CPL columns:   green (better) = ▼ (cost went down), red (worse) = ▲ */
body.ims-restyle .yoy-list td.green-cell:not(.row-cpl)::before,
body.ims-restyle .yoy-list td.red-cell.row-cpl::before {
  content: "\25B2\00A0";
  font-size: 0.75em;
  vertical-align: middle;
}

body.ims-restyle .yoy-list td.red-cell:not(.row-cpl)::before,
body.ims-restyle .yoy-list td.green-cell.row-cpl::before {
  content: "\25BC\00A0";
  font-size: 0.75em;
  vertical-align: middle;
}

/* Sticky Year and Month columns on phone */
@media (max-width: 570px) {
  body.ims-restyle .yoy-list table.index thead th.row-year,
  body.ims-restyle .yoy-list table.index tbody td.row-year {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--ims-surface);
    box-shadow: 1px 0 0 var(--ims-rule);
  }

  body.ims-restyle .yoy-list table.index thead th.row-year {
    background: var(--ims-navy);
    z-index: 3;
  }

  body.ims-restyle .yoy-list table.index thead th.row-month,
  body.ims-restyle .yoy-list table.index tbody td.row-month {
    position: sticky;
    left: 44px;
    z-index: 2;
    background: var(--ims-surface);
    box-shadow: 1px 0 0 var(--ims-rule);
  }

  body.ims-restyle .yoy-list table.index thead th.row-month {
    background: var(--ims-navy);
    z-index: 3;
  }
}


/* =========================================================================
   §5.8  HELP MODALS (jQuery UI dialog)
   .ui-dialog gets the ims-dialog classes via cd.util.2.js — both are targeted
   here so CSS works whether or not the helper ran.
   ========================================================================= */

/* --- Container ------------------------------------------------------------ */
body.ims-restyle .ui-dialog,
body.ims-restyle .ims-dialog {
  border-radius: var(--ims-radius-panel);
  overflow: hidden;
  border: none;
  padding: 0;
  box-shadow: 0 8px 32px -8px rgba(22, 26, 74, 0.45), 0 2px 8px rgba(22, 26, 74, 0.12);
  font-family: var(--ims-font-ui);
}

/* --- Title bar ------------------------------------------------------------ */
body.ims-restyle .ui-dialog .ui-dialog-titlebar,
body.ims-restyle .ims-dialog .ims-dialog-titlebar {
  background: var(--ims-gradient-strip);
  border: none;
  border-radius: 0;
  padding: 14px 56px 14px 20px;
  cursor: default;
}

body.ims-restyle .ui-draggable .ui-dialog-titlebar {
  cursor: move;
}

body.ims-restyle .ui-dialog .ui-dialog-title {
  color: #ffffff;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body-lg);
  font-weight: 600;
  line-height: 1.3;
  float: none;
  margin: 0;
}

/* --- Close button --------------------------------------------------------- */
body.ims-restyle .ui-dialog .ui-dialog-titlebar-close,
body.ims-restyle .ims-dialog-titlebar-close {
  position: absolute !important;
  top: 50% !important;
  right: 10px !important;
  transform: translateY(-50%);
  width: 36px !important;
  height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: rgba(255, 255, 255, 0.18) !important;
  background-image: none !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  border-radius: 50% !important;
  cursor: pointer;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

body.ims-restyle .ui-dialog .ui-dialog-titlebar-close:hover,
body.ims-restyle .ui-dialog .ui-dialog-titlebar-close:focus,
body.ims-restyle .ims-dialog-titlebar-close:hover,
body.ims-restyle .ims-dialog-titlebar-close:focus {
  background-color: rgba(255, 255, 255, 0.32) !important;
  outline: none;
}

/* Hide the jQuery UI sprite icon; show a plain × */
body.ims-restyle .ui-dialog .ui-dialog-titlebar-close .ui-icon,
body.ims-restyle .ims-dialog-titlebar-close .ui-icon {
  background-image: none !important;
  overflow: hidden;
  font-size: 0;
}

body.ims-restyle .ui-dialog .ui-dialog-titlebar-close::after,
body.ims-restyle .ims-dialog-titlebar-close::after {
  content: '×' !important;
  display: block !important;
  color: #ffffff;
  font-size: 26px;
  font-weight: 100;
  line-height: 1;
  font-family: var(--ims-font-ui);
  top: 2px;
  right: 9px;
}

/* --- Content area --------------------------------------------------------- */
body.ims-restyle .ui-dialog .ui-dialog-content,
body.ims-restyle .ims-dialog .ims-dialog-content {
  background-color: var(--ims-surface) !important;
  padding: 20px 24px !important;
  color: var(--ims-navy-ink);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
}

/* --- Help modal interior -------------------------------------------------- */

/* Section heading */
body.ims-restyle #help-modal .help-modal-heading {
  border-bottom: 1px solid var(--ims-border);
  margin: 4px 0 16px;
  padding-bottom: 8px;
  text-align: left;
}

body.ims-restyle #help-modal h2 {
  color: var(--ims-red);
  font-size: var(--ims-fs-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ims-tracking-label);
  margin: 0 0 4px;
  padding: 0;
}

body.ims-restyle #help-modal h3 {
  color: var(--ims-ink-2);
  font-size: 13px;
  font-weight: 400;
  font-style: normal;
  margin: 0;
}

/* Content rows */
body.ims-restyle #help-modal .help-modal-content {
  padding: 0 0 8px;
}

/* Icon rows — tint existing PNGs to navy via mask-image on ::before */
body.ims-restyle #help-modal p {
  background-image: none;
  position: relative;
  padding: 2px 0 2px 36px;
  margin: 0 0 12px;
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
}

body.ims-restyle #help-modal p::before {
  content: '';
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  background-color: var(--ims-navy);
  -webkit-mask-image: url('/assets/images/reporting/icon-help.png');
  mask-image: url('/assets/images/reporting/icon-help.png');
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-position: center;
  mask-position: center;
}

/* Per-metric icon overrides */
body.ims-restyle #help-modal p.lead-yes-no::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-lead-yes-no.png');
  mask-image: url('/assets/images/reporting/icon-lead-yes-no.png');
}
body.ims-restyle #help-modal p.date-time::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-date-time.png');
  mask-image: url('/assets/images/reporting/icon-date-time.png');
}
body.ims-restyle #help-modal p.phone-calls::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-phone-calls.png');
  mask-image: url('/assets/images/reporting/icon-phone-calls.png');
}
body.ims-restyle #help-modal p.length-of-call::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-length-of-call.png');
  mask-image: url('/assets/images/reporting/icon-length-of-call.png');
}
body.ims-restyle #help-modal p.channel::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-channel.png');
  mask-image: url('/assets/images/reporting/icon-channel.png');
}
body.ims-restyle #help-modal p.details::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-details.png');
  mask-image: url('/assets/images/reporting/icon-details.png');
}
body.ims-restyle #help-modal p.name-email-phone::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-name-email-phone.png');
  mask-image: url('/assets/images/reporting/icon-name-email-phone.png');
}
body.ims-restyle #help-modal p.form-name::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-form-name.png');
  mask-image: url('/assets/images/reporting/icon-form-name.png');
}
body.ims-restyle #help-modal p.leads::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-leads.png');
  mask-image: url('/assets/images/reporting/icon-leads.png');
}
body.ims-restyle #help-modal p.forms-completed::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-forms-completed.png');
  mask-image: url('/assets/images/reporting/icon-forms-completed.png');
}
body.ims-restyle #help-modal p.total-spend::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-total-spend.png');
  mask-image: url('/assets/images/reporting/icon-total-spend.png');
}
body.ims-restyle #help-modal p.cost-per-lead::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-cost-per-lead.png');
  mask-image: url('/assets/images/reporting/icon-cost-per-lead.png');
}
body.ims-restyle #help-modal p.impressions::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-impressions.png');
  mask-image: url('/assets/images/reporting/icon-impressions.png');
}
body.ims-restyle #help-modal p.conversion-rate::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-conversion-rate.png');
  mask-image: url('/assets/images/reporting/icon-conversion-rate.png');
}
body.ims-restyle #help-modal p.clicks::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-clicks.png');
  mask-image: url('/assets/images/reporting/icon-clicks.png');
}
body.ims-restyle #help-modal p.average-cost-per-click::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-average-cost-per-click.png');
  mask-image: url('/assets/images/reporting/icon-average-cost-per-click.png');
}
body.ims-restyle #help-modal p.click-thru-rate::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-click-thru-rate.png');
  mask-image: url('/assets/images/reporting/icon-click-thru-rate.png');
}
body.ims-restyle #help-modal p.cost::before {
  -webkit-mask-image: url('/assets/images/reporting/icon-cost.png');
  mask-image: url('/assets/images/reporting/icon-cost.png');
}
body.ims-restyle #help-modal p.indent::before {
  -webkit-mask-image: none;
  mask-image: none;
  background-color: transparent;
}

/* Term labels — bold navy ink */
body.ims-restyle #help-modal p span {
  font-weight: 700;
  color: var(--ims-navy-ink);
}


/* =========================================================================
   §6  STORY BAND
   "Layout E" — Total Spend → Qualified Leads → Spend per Lead
   PPC variant (.ims-story--ppc): 5-col band + delivery cards + channels
   Conv variant (.ims-story--conv): 2-col band + channels + pie sibling
   ========================================================================= */

/* --- Outer section -------------------------------------------------------- */
body.ims-restyle .ims-story {
  margin-bottom: 24px;
}

/* Flex row wrapper used in reporting_blue_boxes.php (story + pie side by side) */
body.ims-restyle .ims-story-row {
  display: flex;
  align-items: stretch;
  gap: 16px;
  flex-wrap: wrap;
}

body.ims-restyle .ims-story-row .ims-story {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}

body.ims-restyle .ims-story__pie {
  flex: 0 0 450px;
  min-width: 0;
}

/* --- Band: gradient panel ------------------------------------------------- */
body.ims-restyle .ims-story__band {
  background: var(--ims-gradient);
  box-shadow: var(--ims-shadow-band);
  border-radius: var(--ims-radius-panel);
  color: #fff;
  overflow: hidden;
}

/* PPC: 5-column grid (spend | arrow | leads | arrow | cpl) */
body.ims-restyle .ims-story--ppc .ims-story__band {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) 56px minmax(0,0.8fr) 56px minmax(0,1fr);
  grid-template-rows: 1fr auto;
}

/* Conv: 2-column equal grid (leads | cpl) */
body.ims-restyle .ims-story--conv .ims-story__band {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr auto;
}

/* --- Shared label style --------------------------------------------------- */
body.ims-restyle .ims-story__label {
  font-size: var(--ims-fs-label);
  font-weight: 600;
  letter-spacing: var(--ims-tracking-label);
  text-transform: uppercase;
  color: var(--ims-on-gradient-label);
  line-height: 1;
}

/* --- Shared note style ---------------------------------------------------- */
body.ims-restyle .ims-story__note {
  font-size: 13px;
  color: var(--ims-on-gradient-label);
  font-weight: 400;
  line-height: 1.3;
  display: block;
  margin-top: 4px;
}

/* --- PPC: spend segment (col 1, spans both grid rows) -------------------- */
body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__spend {
  grid-column: 1;
  grid-row: 1 / 3;
  background: var(--ims-spend-segment);
  border-right: 1px solid rgba(255,255,255,0.15);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 24px 28px;
}

body.ims-restyle .ims-story__spend .ims-story__value {
  font-size: 58px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  display: block;
}

/* --- PPC: arrows (cols 2 and 4) ------------------------------------------ */
body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  grid-row: 1;
  color: var(--ims-blue-on-navy);
  font-size: 28px;
  line-height: 1;
  font-weight: 300;
}

body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__arrow:first-of-type {
  grid-column: 2;
}

body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__arrow:last-of-type {
  grid-column: 4;
}

body.ims-restyle .ims-story__arrow::after {
  content: '\2192';
}

/* --- Key cells (Qualified Leads, Spend per Lead) -------------------------- */
body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__key {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 24px 20px 18px;
}

body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__key:first-of-type {
  grid-column: 3;
}

body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__key:last-of-type {
  grid-column: 5;
}

/* Conv keys (cols 1 and 2) */
body.ims-restyle .ims-story--conv .ims-story__band > .ims-story__key {
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 24px 28px 18px;
}

body.ims-restyle .ims-story--conv .ims-story__band > .ims-story__key:first-of-type {
  grid-column: 1;
  border-right: 1px solid rgba(255,255,255,0.15);
}

body.ims-restyle .ims-story--conv .ims-story__band > .ims-story__key:last-of-type {
  grid-column: 2;
}

/* Key result value: 80px/700 */
body.ims-restyle .ims-story__key .ims-story__value {
  font-size: var(--ims-fs-key-result);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  display: block;
}

/* --- Secondary row: demoted metrics -------------------------------------- */
body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__secondary {
  grid-column: 2 / 6;
  grid-row: 2;
  border-top: 1px solid rgba(255,255,255,0.2);
  display: flex;
}

body.ims-restyle .ims-story--conv .ims-story__band > .ims-story__secondary {
  grid-column: 1 / 3;
  grid-row: 2;
  border-top: 1px solid rgba(255,255,255,0.2);
  display: flex;
}

body.ims-restyle .ims-story__secondary .ims-story__minor {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 12px 20px;
}

body.ims-restyle .ims-story--conv .ims-story__secondary .ims-story__minor {
  padding: 12px 28px;
}

body.ims-restyle .ims-story__secondary .ims-story__minor + .ims-story__minor {
  border-left: 1px solid rgba(255,255,255,0.12);
}

/* Secondary labels inline (smaller, less tracking) */
body.ims-restyle .ims-story__secondary .ims-story__label {
  font-size: 11px;
  letter-spacing: 0.1em;
  display: inline;
}

/* Secondary values: 32px/600 */
body.ims-restyle .ims-story__secondary .ims-story__minor .report-value {
  font-size: var(--ims-fs-key-secondary);
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #fff;
  display: inline;
}

/* Note inside secondary minor: forces to new line via full width */
body.ims-restyle .ims-story__secondary .ims-story__note {
  width: 100%;
  margin-top: 2px;
  font-size: 12px;
}

/* --- Below-band row ------------------------------------------------------- */
/* Same column grid as the band so delivery sits under Total Spend and
   channels sit under Qualified Leads + Spend per Lead.                      */
body.ims-restyle .ims-story--ppc .ims-story__below {
  display: grid;
  grid-template-columns: minmax(0,1.15fr) 56px minmax(0,0.8fr) 56px minmax(0,1fr);
  align-items: start;
  margin-top: 16px;
}

body.ims-restyle .ims-story__delivery {
  grid-column: 1;
  display: flex;
  flex-direction: row;   /* 3 cards side by side on desktop */
  gap: 8px;
}

body.ims-restyle .ims-story--ppc .ims-story__channels {
  grid-column: 3 / 6;   /* Qualified Leads col through Spend per Lead col */
}

/* Conv: below is just the channels panel */
body.ims-restyle .ims-story--conv .ims-story__below {
  margin-top: 16px;
}

/* --- Metric cards (delivery: Impressions, Clicks, Conversion Rate) -------- */
body.ims-restyle .ims-metric-card {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

body.ims-restyle .ims-metric-card__label {
  font-size: var(--ims-fs-label);
  font-weight: 600;
  letter-spacing: var(--ims-tracking-label);
  text-transform: uppercase;
  color: var(--ims-ink-label);
  line-height: 1;
}

body.ims-restyle .ims-metric-card__value {
  font-size: var(--ims-fs-instrument);
  font-weight: 300;
  line-height: 1.1;
  color: var(--ims-navy-ink);
  font-variant-numeric: tabular-nums;
  display: block;
}

body.ims-restyle .ims-metric-card__detail {
  font-size: 12px;
  color: var(--ims-ink-2);
  line-height: 1.4;
}

/* --- Channels panel ------------------------------------------------------- */
body.ims-restyle .ims-story__channels {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  padding: 4px 20px;
}

body.ims-restyle .ims-story__channels .lead-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--ims-rule);
}

body.ims-restyle .ims-story__channels .lead-item:last-child {
  border-bottom: none;
}

body.ims-restyle .ims-story__channels .ims-story__label {
  color: var(--ims-ink-label);
  flex: 0 0 80px;
  font-size: var(--ims-fs-body-lg);  /* 16px — a bit larger than body */
  font-weight: 500;
  line-height: 1.2;
}

/* Channel counts: leads first (larger/bold), then conversions (secondary) */
body.ims-restyle .ims-story__ch-counts {
  display: flex;
  gap: 20px;
  align-items: baseline;
  flex-wrap: wrap;
}

body.ims-restyle .ims-story__ch-leads {
  font-size: 16px;
  font-weight: 700;
  color: var(--ims-navy-ink);
  font-variant-numeric: tabular-nums;
}

body.ims-restyle .ims-story__ch-conv {
  font-size: var(--ims-fs-small);  /* 13.5px — clearly secondary */
  color: var(--ims-ink-2);
  font-variant-numeric: tabular-nums;
}

/* --- Pie panel (conv, sibling of .ims-story) ------------------------------ */
body.ims-restyle .ims-story-row .ims-story__pie {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  padding: 16px;
  min-height: 260px;
}

body.ims-restyle .ims-story-row .ims-story__pie .report-heading {
  font-size: var(--ims-fs-label);
  font-weight: 600;
  letter-spacing: var(--ims-tracking-label);
  text-transform: uppercase;
  color: var(--ims-ink-label) !important;
  margin-bottom: 8px;
  display: block;
}

/* Neutralise old .report-block / .large-block styles inside the pie panel */
body.ims-restyle .ims-story__pie .report-block {
  background: none !important;
  box-shadow: none !important;
  border: none !important;
  padding: 0 !important;
}


/* =========================================================================
   §6  STORY BAND — RESPONSIVE
   ========================================================================= */

/* --- Tablet (≤1025px) ---------------------------------------------------- */
@media (max-width: 1025px) {

  /* Reduce key result sizes */
  body.ims-restyle .ims-story__key .ims-story__value {
    font-size: 62px;
  }

  body.ims-restyle .ims-story__spend .ims-story__value {
    font-size: 40px;
  }

  /* Narrower arrow columns */
  body.ims-restyle .ims-story--ppc .ims-story__band {
    grid-template-columns: minmax(0,1.15fr) 44px minmax(0,0.8fr) 44px minmax(0,1fr);
  }

  body.ims-restyle .ims-story__spend {
    padding: 20px 20px;
  }

  body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__key,
  body.ims-restyle .ims-story--conv .ims-story__band > .ims-story__key {
    padding: 20px 16px 14px;
  }

  /* Below: revert to flex so delivery (left) + channels (right) sit side by side */
  body.ims-restyle .ims-story--ppc .ims-story__below {
    display: flex;
    align-items: stretch;
    gap: 16px;
  }

  body.ims-restyle .ims-story__delivery {
    flex: 0 0 auto;
    min-width: 180px;
  }

  body.ims-restyle .ims-story--ppc .ims-story__channels {
    flex: 1;
  }

  /* Delivery: stack rows in one panel instead of three separate cards */
  body.ims-restyle .ims-story__delivery {
    flex-direction: column;
    gap: 0;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card {
    border-radius: 0;
    border-bottom: 1px solid var(--ims-border);
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    flex: 0 0 auto;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card:first-child {
    border-radius: var(--ims-radius-panel) var(--ims-radius-panel) 0 0;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card:last-child {
    border-radius: 0 0 var(--ims-radius-panel) var(--ims-radius-panel);
    border-bottom: none;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card__label {
    flex: 0 0 120px;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card__value {
    font-size: 24px;
    font-weight: 400;
  }

  /* Conv: pie panel drops below on tablet */
  body.ims-restyle .ims-story-row {
    flex-wrap: wrap;
  }

  body.ims-restyle .ims-story-row .ims-story__pie {
    flex: 0 0 100%;
    min-height: 220px;
  }
}

/* --- Phone (≤570px) ------------------------------------------------------ */
@media (max-width: 570px) {

  /* PPC band: 2-col grid (spend spans both cols row 1; keys side by side row 2; secondary row 3) */
  body.ims-restyle .ims-story--ppc .ims-story__band {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }

  body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__spend {
    grid-column: 1 / 3;
    grid-row: 1;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.15);
    padding: 18px 16px;
  }

  body.ims-restyle .ims-story__spend .ims-story__value {
    font-size: 46px;
  }

  body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__arrow {
    display: none;
  }

  body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__key:first-of-type {
    grid-column: 1;
    grid-row: 2;
    border-right: 1px solid rgba(255,255,255,0.15);
    padding: 14px 12px 10px;
  }

  body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__key:last-of-type {
    grid-column: 2;
    grid-row: 2;
    padding: 14px 12px 10px;
  }

  body.ims-restyle .ims-story--ppc .ims-story__band > .ims-story__secondary {
    grid-column: 1 / 3;
    grid-row: 3;
  }

  /* Conv band: 2-col grid (keys row 1; secondary row 2) — already set for desktop, just reduce padding */
  body.ims-restyle .ims-story--conv .ims-story__band > .ims-story__key {
    padding: 16px 14px 12px;
  }

  /* Key result values: 58px on phone */
  body.ims-restyle .ims-story__key .ims-story__value {
    font-size: 58px;
  }

  /* Secondary minors: smaller */
  body.ims-restyle .ims-story__secondary .ims-story__minor .report-value {
    font-size: 26px;
  }

  body.ims-restyle .ims-story__secondary .ims-story__minor {
    padding: 10px 14px;
  }

  /* Below: stack delivery above channels */
  body.ims-restyle .ims-story--ppc .ims-story__below {
    display: flex;
    flex-direction: column;
  }

  /* Delivery: horizontal row of 3 compact cards on phone */
  body.ims-restyle .ims-story__delivery {
    flex-direction: row;
    gap: 8px;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card {
    flex: 1;
    padding: 10px 8px;
    border-radius: var(--ims-radius-panel);
    border-bottom: 1px solid var(--ims-border);
    flex-direction: column;
    gap: 2px;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card__label {
    flex: unset;
    font-size: 10px;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card__value {
    font-size: 20px;
    font-weight: 400;
  }

  body.ims-restyle .ims-story__delivery .ims-metric-card__detail {
    display: none;
  }

  /* Channels: compact rows on phone */
  body.ims-restyle .ims-story__channels .lead-item {
    gap: 8px;
    padding: 10px 0;
    flex-wrap: wrap;
  }

  body.ims-restyle .ims-story__channels .ims-story__label {
    flex: 0 0 60px;
    font-size: var(--ims-fs-body);  /* back to 15px on phone */
    font-weight: 500;
  }

  body.ims-restyle .ims-story__ch-leads {
    font-size: 16px;
  }

  body.ims-restyle .ims-story__ch-conv {
    font-size: 12px;
  }

  body.ims-restyle .ims-story__ch-counts {
    gap: 10px;
    flex: 1;
  }

  /* Conv row: story + pie stack vertically */
  body.ims-restyle .ims-story-row .ims-story,
  body.ims-restyle .ims-story-row .ims-story__pie {
    flex: 0 0 100%;
  }
}


/* =========================================================================
   §8  LEGACY REPORT BLOCKS
   Applies to: Campaigns, Campaign, SEO, Email, Live Chat, Reputation, LSA, Social
   Overrides product_lead_reporting.css under body.ims-restyle.
   HTML structure is untouched; only colours, backgrounds, and typography change.
   ========================================================================= */

/* --- Container: add gap between columns ---------------------------------- */

body.ims-restyle #report-blocks {
  gap: var(--ims-space-4);
}

/* --- Large block: white card replacing blue gradient --------------------- */

body.ims-restyle #report-blocks .report-block.large-block {
  background-image: none;
  background-color: var(--ims-surface);
  border: 1px solid var(--ims-border);
  box-shadow: var(--ims-shadow-card);
  border-radius: var(--ims-radius-panel);
  color: var(--ims-navy-ink);
}

body.ims-restyle #report-blocks .report-block.large-block .report-heading {
  color: var(--ims-ink-label);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ims-tracking-label);
  line-height: 1.3;
  padding: 16px 16px 8px;
}

body.ims-restyle #report-blocks .report-block.large-block > .report-value {
  color: var(--ims-navy-ink);
}

body.ims-restyle #report-blocks .report-block.large-block.leads > .report-value,
body.ims-restyle #report-blocks .report-block.large-block .report-value.large-metric {
  color: var(--ims-navy-ink);
}

body.ims-restyle #report-blocks .report-block.large-block.cost > .report-value {
  color: var(--ims-navy-ink);
}

body.ims-restyle #report-blocks .report-block.large-block > .report-detail {
  color: var(--ims-ink-2);
}

body.ims-restyle #report-blocks .report-block.large-block .report-subheading {
  color: var(--ims-ink-2);
}

/* Separator rules: match new surface */
body.ims-restyle #report-blocks .report-block.large-block .separator::after,
body.ims-restyle #report-blocks .report-block.large-block .separator-med::after {
  background-color: var(--ims-rule);
}

/* Benchmark area inside large block */
body.ims-restyle #report-blocks .report-block.large-block .benchmark-values {
  border-top-color: var(--ims-rule);
  color: var(--ims-ink-2);
}

body.ims-restyle .large-block a {
  color: var(--ims-blue);
}

body.ims-restyle .large-block a:hover,
body.ims-restyle .large-block a:active {
  color: var(--ims-navy);
}

/* --- Lead items: strip PNG icons, clean dividers ------------------------- */

body.ims-restyle .large-block .lead-item {
  background-image: none;
  padding-left: 16px;
  border-top-color: var(--ims-rule);
  color: var(--ims-navy-ink);
  font-family: var(--ims-font-ui);
}

body.ims-restyle .large-block .lead-item.forms,
body.ims-restyle .large-block .lead-item.phone-calls,
body.ims-restyle .large-block .lead-item.conv {
  background-image: none;
}

body.ims-restyle .large-block .lead-item.cpl .report-value {
  background-image: none;
}

body.ims-restyle .large-block .lead-item .report-value {
  color: var(--ims-navy-ink);
}

/* Old :first-of-type top-separator pseudo-element */
body.ims-restyle .large-block .lead-item-link::before,
body.ims-restyle .large-block .lead-item:first-of-type::before {
  background-color: var(--ims-rule);
  height: 1px;
}

body.ims-restyle .large-block .lead-item-link {
  color: var(--ims-blue);
}

body.ims-restyle .large-block .lead-item-link a {
  background-image: none;
  padding-right: 0;
  color: var(--ims-blue);
}

/* --- Small block: white card with navy label header ---------------------- */

body.ims-restyle #report-blocks .report-block.small-block {
  background-color: var(--ims-surface);
  border: 1px solid var(--ims-border);
  box-shadow: var(--ims-shadow-card);
  border-radius: var(--ims-radius-panel);
  overflow: hidden;         /* clips header corners to panel radius */
  color: var(--ims-navy-ink);
}

body.ims-restyle #report-blocks .report-block.small-block .report-heading {
  background-color: var(--ims-navy);
  color: var(--ims-on-navy-strong);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ims-tracking-label);
  line-height: var(--ims-touch);  /* 44px */
  border-radius: 0;
}

/* Hide the PNG icon :before in the small-block heading */
body.ims-restyle #report-blocks .report-block.small-block .report-heading::before {
  display: none;
}

body.ims-restyle #report-blocks .report-block.small-block .report-value {
  color: var(--ims-navy-ink);
  font-family: var(--ims-font-ui);
  font-weight: 400;
}

body.ims-restyle #report-blocks .report-block.small-block .report-value .benchmark-values {
  color: var(--ims-ink-2);
  border-top-color: var(--ims-rule);
}

/* Benchmark icons: hide PNG; colour conveys status via text */
body.ims-restyle #report-blocks .report-block.small-block .report-value .benchmark-icon {
  display: none;
}

/* --- YOY change badges (SEO, LSA, Social) -------------------------------- */

body.ims-restyle #report-blocks .p-change-yoy {
  background: var(--ims-neutral-pill-bg);
  color: var(--ims-ink-2);
  border-radius: var(--ims-radius-field);
  font-size: var(--ims-fs-small);
}

body.ims-restyle #report-blocks .p-change-yoy span.positive-change {
  color: var(--ims-yoy-better-text);
}

body.ims-restyle #report-blocks .p-change-yoy span.negative-change {
  color: var(--ims-yoy-worse-text);
}

body.ims-restyle #report-blocks .p-change-yoy span::after {
  color: var(--ims-ink-2);
}

/* Inline variant inside lead items */
body.ims-restyle #report-blocks .large-block .lead-item .p-change-yoy {
  background: none;
}

/* --- Plain table.index headers (LSA, Social, Reputation, Email, Chat) ---- */

body.ims-restyle table.index,
body.ims-restyle .report-table table {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
}

body.ims-restyle table.index thead th,
body.ims-restyle .report-table table thead th {
  background-color: var(--ims-navy);
  color: var(--ims-on-navy-strong);
  letter-spacing: var(--ims-tracking-table-head);
  font-weight: 600;
  font-size: var(--ims-fs-label);
  text-transform: uppercase;
}

body.ims-restyle table.index thead th:first-child,
body.ims-restyle .report-table table thead th:first-child {
  border-radius: var(--ims-radius-panel) 0 0 0;
}

body.ims-restyle table.index thead th:last-child,
body.ims-restyle .report-table table thead th:last-child {
  border-radius: 0 var(--ims-radius-panel) 0 0;
}

body.ims-restyle table.index tbody tr:nth-child(even),
body.ims-restyle .report-table table tbody tr:nth-child(even) {
  background-color: var(--ims-page);
}

body.ims-restyle table.index tbody tr:hover,
body.ims-restyle .report-table table tbody tr:hover {
  background-color: var(--ims-blue-soft);
}

/* --- Live Chat: form submit button --------------------------------------- */

body.ims-restyle #view-project-apex-chat input[type="submit"],
body.ims-restyle #view-project-apex-chat button[type="submit"] {
  background: var(--ims-red);
  color: #ffffff;
  border: none;
  border-radius: var(--ims-radius-control);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  font-weight: 600;
  padding: 10px 24px;
  cursor: pointer;
  min-height: var(--ims-touch);
}

body.ims-restyle #view-project-apex-chat input[type="submit"]:hover,
body.ims-restyle #view-project-apex-chat button[type="submit"]:hover {
  background: #b5151b;
}


/* =========================================================================
   §9  ACCOUNT SCORECARD  (change map §H)
   All rules scoped to body.ims-restyle. scorecard_reporting.css provides
   layout; these rules add colour, typography and status styling on top.
   ========================================================================= */

/* --- Nav tabs ------------------------------------------------------------- */

body.ims-restyle .imarket-reporting-nav__brand {
  display: none;
}

body.ims-restyle .imarket-reporting-nav li a,
body.ims-restyle .imarket-reporting-nav li span {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-ink-2);
  padding: 10px 14px;
  border-bottom: 3px solid transparent;
  text-decoration: none;
}

body.ims-restyle .imarket-reporting-nav li.active a {
  background-color: transparent;
  color: var(--ims-navy);
  font-weight: 600;
  border-bottom-color: var(--ims-navy);
}

body.ims-restyle .imarket-reporting-nav li a:hover {
  color: var(--ims-navy);
  background-color: transparent;
}

body.ims-restyle .imarket-reporting-nav li.disabled span {
  color: var(--ims-neutral-outline);
}

/* --- Data-through line ---------------------------------------------------- */

body.ims-restyle .sr-topbar__data-through {
  font-size: var(--ims-fs-small);
  color: var(--ims-ink-2);
  text-align: right;
}

/* --- Project header ------------------------------------------------------- */

body.ims-restyle #sr-header .sr-header__title h2 {
  font-family: var(--ims-font-display);
  font-size: var(--ims-fs-h2);
  font-weight: 400;
  color: var(--ims-navy-ink);
  margin: 0 10px 0 0;
}

body.ims-restyle .sr-header__meta {
  font-size: var(--ims-fs-small);
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-range-summary {
  font-size: var(--ims-fs-small);
  color: var(--ims-ink-2);
  margin: 2px 0 12px;
}

/* --- Status badges (sr-badge) — header + channel table ------------------- */

body.ims-restyle .sr-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: var(--ims-fs-label);
  font-weight: 600;
  font-family: var(--ims-font-ui);
  background-color: var(--ims-neutral-pill-bg);
  color: var(--ims-navy-ink);
  border: none;
  vertical-align: middle;
}

body.ims-restyle .sr-badge--on_target {
  background-color: var(--ims-status-good);
  color: #ffffff;
}

body.ims-restyle .sr-badge--off_target {
  background-color: var(--ims-status-warn);
  color: var(--ims-status-warn-ink);
}

body.ims-restyle .sr-badge--red_flag {
  background-color: var(--ims-status-bad);
  color: #ffffff;
}

body.ims-restyle .sr-badge--inactive {
  background-color: transparent;
  color: var(--ims-ink-2);
  border: 1px solid var(--ims-neutral-outline);
}

/* --- In-value target pills (sr-target) ----------------------------------- */

body.ims-restyle .sr-target {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: var(--ims-fs-label);
  font-weight: 600;
  font-family: var(--ims-font-ui);
  vertical-align: middle;
  background-color: var(--ims-neutral-pill-bg);
  color: var(--ims-ink-2);
  border: none;
}

body.ims-restyle .sr-target--on_target {
  background-color: var(--ims-status-good);
  color: #ffffff;
}

body.ims-restyle .sr-target--off_target {
  background-color: var(--ims-status-warn);
  color: var(--ims-status-warn-ink);
}

body.ims-restyle .sr-target--red_flag {
  background-color: var(--ims-status-bad);
  color: #ffffff;
}

/* --- Filter bar ----------------------------------------------------------- */

body.ims-restyle .sr-filters__row--report {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  padding: 10px 16px;
}

body.ims-restyle .sr-filters__heading {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ims-tracking-label);
  color: var(--ims-ink-label);
}

body.ims-restyle .sr-filters__note {
  font-size: var(--ims-fs-small);
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-filter__label {
  font-size: var(--ims-fs-small);
  color: var(--ims-ink-2);
  margin-right: 4px;
}

body.ims-restyle #sr-filters select {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
  border: 1px solid var(--ims-field-border);
  border-radius: var(--ims-radius-field);
  padding: 4px 8px;
  background: var(--ims-surface);
}

body.ims-restyle .sr-clear {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-ink-2);
  cursor: pointer;
  text-decoration: underline;
  min-height: auto;
}

body.ims-restyle .sr-clear:hover {
  color: var(--ims-navy);
}

/* --- Metric rows ---------------------------------------------------------- */

body.ims-restyle .sr-metric-row {
  gap: 16px;
  margin: 16px 0;
}

body.ims-restyle .sr-metric-group {
  gap: 16px;
}

/* --- Metric boxes --------------------------------------------------------- */

body.ims-restyle .sr-metric-box {
  position: relative;
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  padding: 16px;
  overflow: hidden;
}

body.ims-restyle .sr-metric-box__label {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ims-tracking-label);
  color: var(--ims-ink-label);
  margin-bottom: 8px;
  padding-right: 28px;  /* reserve space for the absolute-positioned help icon */
}

body.ims-restyle .sr-metric-box__value {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-instrument);
  font-weight: 300;
  color: var(--ims-navy-ink);
  margin: 0 0 4px;
  line-height: 1.1;
}

body.ims-restyle .sr-metric-box__change {
  font-size: var(--ims-fs-small);
  line-height: 1.4;
}

body.ims-restyle .sr-metric-box .sr-change--good {
  color: var(--ims-status-good-text);
}

body.ims-restyle .sr-metric-box .sr-change--bad {
  color: var(--ims-status-bad-text);
}

body.ims-restyle .sr-metric-box .sr-change--neutral {
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-metric-box__change .sr-change__compare {
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-metric-box__sub {
  font-size: var(--ims-fs-small);
  color: var(--ims-ink-2);
  margin-top: 4px;
}

/* Card status variants: 5px coloured top bar */
body.ims-restyle .sr-metric-box--on_target {
  border-top: 5px solid var(--ims-status-good);
  padding-top: 11px;  /* compensate so internal spacing stays 16px */
}

body.ims-restyle .sr-metric-box--off_target {
  border-top: 5px solid var(--ims-status-warn-edge);
  padding-top: 11px;
  background: var(--ims-status-warn-tint);
}

body.ims-restyle .sr-metric-box--red_flag {
  border-top: 5px solid var(--ims-status-bad);
  border-left: 1px solid #F3C4C4;
  border-right: 1px solid #F3C4C4;
  border-bottom: 1px solid #F3C4C4;
  padding-top: 11px;
  background: var(--ims-status-bad-tint);
}

/* --- Progress bar --------------------------------------------------------- */

body.ims-restyle .sr-progress {
  height: 8px;
  background: var(--ims-border);
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

body.ims-restyle .sr-progress__bar {
  height: 100%;
  background: var(--ims-navy);
  border-radius: 4px;
}

/* --- Panels --------------------------------------------------------------- */

body.ims-restyle .sr-panel {
  background: var(--ims-surface);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-card);
  padding: 20px 24px;
}

body.ims-restyle .sr-panel__title {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-panel-title);
  font-weight: 600;
  color: var(--ims-navy-ink);
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
}

body.ims-restyle .sr-split {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

/* --- Help icon (sr-help) -------------------------------------------------- */

body.ims-restyle .sr-help {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background-color: transparent;
  color: var(--ims-ink-2);
  font-size: var(--ims-fs-label);
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  text-decoration: none;
  flex-shrink: 0;
}

body.ims-restyle .sr-help:hover,
body.ims-restyle .sr-help:focus {
  background-color: var(--ims-blue-soft);
  color: var(--ims-navy);
  outline: none;
}

/* Inside metric boxes: pin to top-right corner so label text never wraps around it */
body.ims-restyle .sr-metric-box .sr-help {
  position: absolute;
  top: 10px;
  right: 10px;
  /* Expand hit area to 44px without moving the visual dot */
  padding: 10px;
  margin: -10px;
  width: 24px;
  height: 24px;
}

/* --- Help tooltip --------------------------------------------------------- */

body.ims-restyle .ui-tooltip.sr-tooltip {
  background: var(--ims-surface);
  color: var(--ims-navy-ink);
  border: 1px solid var(--ims-border);
  border-radius: var(--ims-radius-panel);
  box-shadow: var(--ims-shadow-popover);
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-small);
  line-height: 1.5;
  max-width: 300px;
  padding: 10px 14px;
}

body.ims-restyle .sr-tooltip__title {
  font-weight: 600;
  color: var(--ims-navy-ink);
  margin-bottom: 4px;
}

/* --- New vs existing customers bar list ----------------------------------- */

body.ims-restyle .sr-stack {
  height: 12px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--ims-border);
}

body.ims-restyle .sr-stack__seg--new_customers {
  background: var(--ims-navy);
}

body.ims-restyle .sr-stack__seg--existing_customers {
  background: var(--ims-blue);
}

body.ims-restyle .sr-stack__seg--unknown_customers {
  background: #D5DAE6;
}

body.ims-restyle .sr-bar-list__headline-value {
  font-size: var(--ims-fs-instrument);
  font-weight: 300;
  color: var(--ims-navy-ink);
}

body.ims-restyle .sr-bar-list__label {
  font-size: var(--ims-fs-body);
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-bar-list__value {
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
  font-weight: 500;
}

body.ims-restyle .sr-bar-list__footer {
  font-size: var(--ims-fs-small);
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-bar {
  background: var(--ims-border);
  border-radius: 3px;
  overflow: hidden;
}

body.ims-restyle .sr-bar__fill {
  background: var(--ims-navy);
}

/* --- Qualified leads by vertical and segment ------------------------------ */

body.ims-restyle .sr-seg--0 { background-color: #161A4A; }
body.ims-restyle .sr-seg--1 { background-color: var(--ims-navy); }
body.ims-restyle .sr-seg--2 { background-color: var(--ims-sort-indicator); color: var(--ims-navy-ink); }
body.ims-restyle .sr-seg--3 { background-color: #6B8FB8; }
body.ims-restyle .sr-seg--4 { background-color: #C98A3D; }
body.ims-restyle .sr-seg--5 { background-color: #7F9C6B; }

body.ims-restyle .sr-seg--unknown {
  background: repeating-linear-gradient(135deg, #C9CEDD 0 4px, #EEF0F6 4px 8px);
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-segbars__label {
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
}

body.ims-restyle .sr-segbars__row--unknown .sr-segbars__label {
  color: var(--ims-ink-2);
}

body.ims-restyle .sr-segbars__total {
  font-size: var(--ims-fs-body);
  color: var(--ims-navy-ink);
}

body.ims-restyle .sr-chip {
  background-color: var(--ims-neutral-pill-bg);
  color: var(--ims-navy-ink);
  border-radius: var(--ims-radius-control);
  font-size: var(--ims-fs-body);
}

body.ims-restyle .sr-segbars__legend {
  font-size: var(--ims-fs-body);
  color: var(--ims-ink-2);
}

/* --- Performance by channel table ---------------------------------------- */

body.ims-restyle .sr-table {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  border-collapse: collapse;
}

body.ims-restyle .sr-table thead tr {
  background: var(--ims-navy);
}

body.ims-restyle .sr-table thead th {
  color: var(--ims-on-navy-strong);
  font-size: var(--ims-fs-label);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--ims-tracking-table-head);
  border-bottom: none;
  padding: 10px 8px;
}

body.ims-restyle .sr-table thead th:first-child {
  border-radius: var(--ims-radius-panel) 0 0 0;
}

body.ims-restyle .sr-table thead th:last-child {
  border-radius: 0 var(--ims-radius-panel) 0 0;
}

body.ims-restyle .sr-table td {
  border-bottom: 1px solid var(--ims-rule);
  color: var(--ims-navy-ink);
  padding: 8px;
}

body.ims-restyle .sr-table__row--category td {
  background: #EEF1F8;
  font-weight: 700;
  font-size: var(--ims-fs-body);
}

body.ims-restyle .sr-table__row--channel td {
  background: var(--ims-surface);
}

/* Status left edges via box-shadow on first cell */
body.ims-restyle .sr-table__row--on_target > td:first-child {
  box-shadow: inset 5px 0 0 var(--ims-status-good);
}

body.ims-restyle .sr-table__row--off_target > td {
  background: var(--ims-status-warn-tint);
}

body.ims-restyle .sr-table__row--off_target > td:first-child {
  box-shadow: inset 5px 0 0 var(--ims-status-warn-edge);
}

body.ims-restyle .sr-table__row--red_flag > td {
  background: var(--ims-status-bad-tint);
}

body.ims-restyle .sr-table__row--red_flag > td:first-child {
  box-shadow: inset 5px 0 0 var(--ims-status-bad);
}

body.ims-restyle .sr-table__row--inactive > td:first-child {
  box-shadow: inset 5px 0 0 var(--ims-neutral-outline);
}

body.ims-restyle .sr-table .sr-change--good { color: var(--ims-status-good-text); }
body.ims-restyle .sr-table .sr-change--bad  { color: var(--ims-status-bad-text); }

/* --- Error / message states ----------------------------------------------- */

body.ims-restyle .sr-slot.is-error > .sr-message,
body.ims-restyle .sr-slot.is-empty > .sr-message {
  font-family: var(--ims-font-ui);
  font-size: var(--ims-fs-body);
  color: var(--ims-ink-2);
  padding: 20px 0;
}

/* --- Responsive: tablet and phone ----------------------------------------- */

@media (max-width: 1025px) {
  body.ims-restyle .sr-split {
    flex-direction: column;
  }

  body.ims-restyle .sr-split .ims-grid-3-4,
  body.ims-restyle .sr-split .ims-grid-1-4 {
    width: 100%;
  }
}

@media (max-width: 570px) {
  body.ims-restyle #sr-header .sr-header__title h2 {
    font-size: 20px;
  }

  body.ims-restyle .sr-metric-row {
    gap: 10px;
  }
}


/* ============================================================
   §10  LOGIN PAGE  (body#default-view)
   ============================================================ */

/* Navy background filling the content area below the existing navy header */
body.ims-restyle#default-view #container-content {
  background: var(--ims-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

/* Constrain the form to card width */
body.ims-restyle#default-view #content {
  width: 100%;
  max-width: 400px;
  background: none;
  padding: 0;
}

/* Login card — glass panel matching client-selector */
body.ims-restyle#default-view .content-pane {
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--ims-radius-panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  padding: 28px;
}

/* Field list resets */
body.ims-restyle#default-view form#user-login-form ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

body.ims-restyle#default-view form#user-login-form ul > li {
  margin-bottom: 16px;
  border-top: none !important;
  min-height: auto !important;
  font-size: var(--ims-fs-body) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  overflow: visible !important;
}

/* Labels */
body.ims-restyle#default-view form#user-login-form label {
  font-size: var(--ims-fs-label);
  font-weight: 600;
  letter-spacing: var(--ims-tracking-label);
  text-transform: uppercase;
  color: var(--ims-on-navy-label);
  display: block;
  margin-bottom: 6px;
}

/* Text / password inputs — match client dropdown */
body.ims-restyle#default-view form#user-login-form input[type="text"],
body.ims-restyle#default-view form#user-login-form input[type="password"] {
  width: 100%;
  height: var(--ims-touch);
  border-radius: var(--ims-radius-field);
  background-color: var(--ims-navy-field);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-size: var(--ims-fs-body);
  font-family: var(--ims-font-ui);
  padding: 0 10px;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

body.ims-restyle#default-view form#user-login-form input[type="text"]:focus,
body.ims-restyle#default-view form#user-login-form input[type="password"]:focus {
  background-color: var(--ims-navy-field);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.55);
  outline: none;
}

/* Submit row */
body.ims-restyle#default-view form#user-login-form ul.submit {
  list-style: none;
  padding: 0;
  margin: 0;
}

body.ims-restyle#default-view form#user-login-form ul.submit li {
  border-top: none !important;
  min-height: auto !important;
  margin-bottom: 0;
}

body.ims-restyle#default-view form#user-login-form button.action-button {
  display: block;
  width: 100%;
  height: var(--ims-touch);
  background: var(--ims-red);
  color: #ffffff;
  border: none;
  border-radius: var(--ims-radius-control);
  font-size: var(--ims-fs-body);
  font-family: var(--ims-font-ui);
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  margin-top: 8px;
}

body.ims-restyle#default-view form#user-login-form button.action-button:hover {
  background: #b8151b;
}

/* Flash / error messages */
body.ims-restyle#default-view .message,
body.ims-restyle#default-view ul.errors li {
  color: #ffffff;
  margin-bottom: 12px;
}

/* Footer — keep it on the navy background */
body.ims-restyle#default-view #container-footer {
  background: var(--ims-navy);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.ims-restyle#default-view #container-footer p {
  color: var(--ims-on-navy-label);
}
