/* css/tokens.css */
/* GENERATED FILE: edit scripts/token-spec.mjs and run npm run tokens. How to use these tokens: docs/design-system/tokens.md.
 *
 * Design tokens, following Material Design 3 naming.
 *   --md-ref-*   the raw palette: every tone of every colour. Pages never use these directly.
 *   --md-sys-*   the roles pages use: colour roles, type scale, shape, elevation, motion, state layers.
 *   --mrc-*      ours: status colours (success, warning), brand colours, figure sizes for KPIs, spacing, touch target, focus ring.
 *
 * The platform is light-only by decision: there is no dark theme, and color-scheme is pinned to light.
 *
 * Window size classes (CSS cannot read a variable inside @media, so these are written out):
 *   compact  under 600px      medium  600 to 839px      expanded  840 to 1199px      large  1200px and up
 */

/* IBM Plex Sans, self-hosted (assets/fonts). Latin subset; other characters use the system font. */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-5.3.0-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-5.3.0-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-5.3.0-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../assets/fonts/ibm-plex-sans-5.3.0-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- Reference palette ---- */
  --md-ref-palette-primary0: #000000;
  --md-ref-palette-primary10: #001d32;
  --md-ref-palette-primary20: #003352;
  --md-ref-palette-primary30: #1c4a6c;
  --md-ref-palette-primary40: #376285;
  --md-ref-palette-primary50: #517b9f;
  --md-ref-palette-primary60: #6b95ba;
  --md-ref-palette-primary70: #86afd6;
  --md-ref-palette-primary80: #a1cbf3;
  --md-ref-palette-primary90: #cde5ff;
  --md-ref-palette-primary95: #e7f2ff;
  --md-ref-palette-primary99: #fcfcff;
  --md-ref-palette-primary100: #ffffff;

  --md-ref-palette-secondary0: #000000;
  --md-ref-palette-secondary10: #181d0c;
  --md-ref-palette-secondary20: #2d331f;
  --md-ref-palette-secondary30: #434934;
  --md-ref-palette-secondary40: #5b614a;
  --md-ref-palette-secondary50: #747a62;
  --md-ref-palette-secondary60: #8d937a;
  --md-ref-palette-secondary70: #a8ae93;
  --md-ref-palette-secondary80: #c3c9ae;
  --md-ref-palette-secondary90: #e0e6c9;
  --md-ref-palette-secondary95: #eef4d6;
  --md-ref-palette-secondary99: #faffe4;
  --md-ref-palette-secondary100: #ffffff;

  --md-ref-palette-tertiary0: #000000;
  --md-ref-palette-tertiary10: #271900;
  --md-ref-palette-tertiary20: #412d00;
  --md-ref-palette-tertiary30: #5e4200;
  --md-ref-palette-tertiary40: #7c5800;
  --md-ref-palette-tertiary50: #997018;
  --md-ref-palette-tertiary60: #b58a31;
  --md-ref-palette-tertiary70: #d3a449;
  --md-ref-palette-tertiary80: #f1bf61;
  --md-ref-palette-tertiary90: #ffdea7;
  --md-ref-palette-tertiary95: #ffeed7;
  --md-ref-palette-tertiary99: #fffbff;
  --md-ref-palette-tertiary100: #ffffff;

  --md-ref-palette-error0: #000000;
  --md-ref-palette-error10: #410006;
  --md-ref-palette-error20: #670310;
  --md-ref-palette-error30: #871f24;
  --md-ref-palette-error40: #a73738;
  --md-ref-palette-error50: #c84f4f;
  --md-ref-palette-error60: #e96766;
  --md-ref-palette-error70: #ff8985;
  --md-ref-palette-error80: #ffb3b0;
  --md-ref-palette-error90: #ffdad8;
  --md-ref-palette-error95: #ffedeb;
  --md-ref-palette-error99: #fffbff;
  --md-ref-palette-error100: #ffffff;

  --md-ref-palette-neutral0: #000000;
  --md-ref-palette-neutral10: #1b1c19;
  --md-ref-palette-neutral20: #30312d;
  --md-ref-palette-neutral30: #474743;
  --md-ref-palette-neutral40: #5e5f5a;
  --md-ref-palette-neutral50: #777773;
  --md-ref-palette-neutral60: #91918c;
  --md-ref-palette-neutral70: #acaba6;
  --md-ref-palette-neutral80: #c8c6c1;
  --md-ref-palette-neutral87: #dbdad5;
  --md-ref-palette-neutral90: #e4e2dd;
  --md-ref-palette-neutral92: #eae8e3;
  --md-ref-palette-neutral94: #efeee8;
  --md-ref-palette-neutral95: #f2f1eb;
  --md-ref-palette-neutral96: #f5f4ee;
  --md-ref-palette-neutral98: #fbf9f4;
  --md-ref-palette-neutral99: #fefcf6;
  --md-ref-palette-neutral100: #ffffff;

  --md-ref-palette-neutral-variant0: #000000;
  --md-ref-palette-neutral-variant10: #1a1c16;
  --md-ref-palette-neutral-variant20: #2f312a;
  --md-ref-palette-neutral-variant30: #454840;
  --md-ref-palette-neutral-variant40: #5d5f57;
  --md-ref-palette-neutral-variant50: #76786f;
  --md-ref-palette-neutral-variant60: #909288;
  --md-ref-palette-neutral-variant70: #aaaca2;
  --md-ref-palette-neutral-variant80: #c6c7bd;
  --md-ref-palette-neutral-variant87: #d9dbd0;
  --md-ref-palette-neutral-variant90: #e2e3d8;
  --md-ref-palette-neutral-variant92: #e8e9de;
  --md-ref-palette-neutral-variant94: #edefe4;
  --md-ref-palette-neutral-variant95: #f0f2e6;
  --md-ref-palette-neutral-variant96: #f3f5e9;
  --md-ref-palette-neutral-variant98: #f9faef;
  --md-ref-palette-neutral-variant99: #fcfdf2;
  --md-ref-palette-neutral-variant100: #ffffff;

  --mrc-ref-palette-warm0: #000000;
  --mrc-ref-palette-warm10: #311300;
  --mrc-ref-palette-warm20: #512400;
  --mrc-ref-palette-warm30: #733600;
  --mrc-ref-palette-warm40: #924b13;
  --mrc-ref-palette-warm50: #b0632a;
  --mrc-ref-palette-warm60: #cf7c41;
  --mrc-ref-palette-warm70: #ef9658;
  --mrc-ref-palette-warm80: #ffb688;
  --mrc-ref-palette-warm90: #ffdbc7;
  --mrc-ref-palette-warm95: #ffede4;
  --mrc-ref-palette-warm99: #fffbff;
  --mrc-ref-palette-warm100: #ffffff;

  --mrc-ref-palette-success0: #000000;
  --mrc-ref-palette-success10: #00210d;
  --mrc-ref-palette-success20: #00391a;
  --mrc-ref-palette-success30: #1b512e;
  --mrc-ref-palette-success40: #346944;
  --mrc-ref-palette-success50: #4d825b;
  --mrc-ref-palette-success60: #669d73;
  --mrc-ref-palette-success70: #80b88c;
  --mrc-ref-palette-success80: #9bd4a6;
  --mrc-ref-palette-success90: #b6f0c1;
  --mrc-ref-palette-success95: #c4ffcf;
  --mrc-ref-palette-success99: #f5fff3;
  --mrc-ref-palette-success100: #ffffff;

  --mrc-ref-palette-warning0: #000000;
  --mrc-ref-palette-warning10: #2b1700;
  --mrc-ref-palette-warning20: #472a00;
  --mrc-ref-palette-warning30: #663e00;
  --mrc-ref-palette-warning40: #865300;
  --mrc-ref-palette-warning50: #a86900;
  --mrc-ref-palette-warning60: #c7821d;
  --mrc-ref-palette-warning70: #e69c38;
  --mrc-ref-palette-warning80: #ffb961;
  --mrc-ref-palette-warning90: #ffddb9;
  --mrc-ref-palette-warning95: #ffeede;
  --mrc-ref-palette-warning99: #fffbff;
  --mrc-ref-palette-warning100: #ffffff;

  /* Fixed brand colours */
  --mrc-ref-brand-navy: #0D2D44;
  --mrc-ref-brand-gold: #C99A3D;

  /* ---- Typography ---- */
  --md-ref-typeface-brand: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --md-ref-typeface-plain: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mrc-typeface-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --mrc-font-numeric: tabular-nums; /* use on every figure: digits line up in tables and KPIs */
  --md-sys-typescale-display-large-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-display-large-size: 57px;
  --md-sys-typescale-display-large-line-height: 64px;
  --md-sys-typescale-display-large-weight: 400;
  --md-sys-typescale-display-large-tracking: -0.25px;
  --md-sys-typescale-display-medium-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-display-medium-size: 45px;
  --md-sys-typescale-display-medium-line-height: 52px;
  --md-sys-typescale-display-medium-weight: 400;
  --md-sys-typescale-display-medium-tracking: 0;
  --md-sys-typescale-display-small-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-display-small-size: 36px;
  --md-sys-typescale-display-small-line-height: 44px;
  --md-sys-typescale-display-small-weight: 400;
  --md-sys-typescale-display-small-tracking: 0;
  --md-sys-typescale-headline-large-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-headline-large-size: 32px;
  --md-sys-typescale-headline-large-line-height: 40px;
  --md-sys-typescale-headline-large-weight: 400;
  --md-sys-typescale-headline-large-tracking: 0;
  --md-sys-typescale-headline-medium-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-headline-medium-size: 28px;
  --md-sys-typescale-headline-medium-line-height: 36px;
  --md-sys-typescale-headline-medium-weight: 400;
  --md-sys-typescale-headline-medium-tracking: 0;
  --md-sys-typescale-headline-small-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-headline-small-size: 24px;
  --md-sys-typescale-headline-small-line-height: 32px;
  --md-sys-typescale-headline-small-weight: 400;
  --md-sys-typescale-headline-small-tracking: 0;
  --md-sys-typescale-title-large-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-title-large-size: 22px;
  --md-sys-typescale-title-large-line-height: 28px;
  --md-sys-typescale-title-large-weight: 400;
  --md-sys-typescale-title-large-tracking: 0;
  --md-sys-typescale-title-medium-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-title-medium-size: 16px;
  --md-sys-typescale-title-medium-line-height: 24px;
  --md-sys-typescale-title-medium-weight: 500;
  --md-sys-typescale-title-medium-tracking: 0.15px;
  --md-sys-typescale-title-small-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-title-small-size: 14px;
  --md-sys-typescale-title-small-line-height: 20px;
  --md-sys-typescale-title-small-weight: 500;
  --md-sys-typescale-title-small-tracking: 0.1px;
  --md-sys-typescale-body-large-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-body-large-size: 16px;
  --md-sys-typescale-body-large-line-height: 24px;
  --md-sys-typescale-body-large-weight: 400;
  --md-sys-typescale-body-large-tracking: 0.5px;
  --md-sys-typescale-body-medium-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-body-medium-size: 14px;
  --md-sys-typescale-body-medium-line-height: 20px;
  --md-sys-typescale-body-medium-weight: 400;
  --md-sys-typescale-body-medium-tracking: 0.25px;
  --md-sys-typescale-body-small-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-body-small-size: 12px;
  --md-sys-typescale-body-small-line-height: 16px;
  --md-sys-typescale-body-small-weight: 400;
  --md-sys-typescale-body-small-tracking: 0.4px;
  --md-sys-typescale-label-large-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-label-large-size: 14px;
  --md-sys-typescale-label-large-line-height: 20px;
  --md-sys-typescale-label-large-weight: 500;
  --md-sys-typescale-label-large-tracking: 0.1px;
  --md-sys-typescale-label-medium-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-label-medium-size: 12px;
  --md-sys-typescale-label-medium-line-height: 16px;
  --md-sys-typescale-label-medium-weight: 500;
  --md-sys-typescale-label-medium-tracking: 0.5px;
  --md-sys-typescale-label-small-font: var(--md-ref-typeface-plain);
  --md-sys-typescale-label-small-size: 12px;
  --md-sys-typescale-label-small-line-height: 16px;
  --md-sys-typescale-label-small-weight: 500;
  --md-sys-typescale-label-small-tracking: 0.5px;

  /* Figures for callouts and KPIs, and dense data text (not part of Material) */
  --mrc-typescale-metric-large-font: var(--md-ref-typeface-plain);
  --mrc-typescale-metric-large-size: 40px;
  --mrc-typescale-metric-large-line-height: 48px;
  --mrc-typescale-metric-large-weight: 600;
  --mrc-typescale-metric-large-tracking: -0.5px;
  --mrc-typescale-metric-medium-font: var(--md-ref-typeface-plain);
  --mrc-typescale-metric-medium-size: 28px;
  --mrc-typescale-metric-medium-line-height: 36px;
  --mrc-typescale-metric-medium-weight: 600;
  --mrc-typescale-metric-medium-tracking: -0.25px;
  --mrc-typescale-metric-small-font: var(--md-ref-typeface-plain);
  --mrc-typescale-metric-small-size: 20px;
  --mrc-typescale-metric-small-line-height: 28px;
  --mrc-typescale-metric-small-weight: 600;
  --mrc-typescale-metric-small-tracking: 0;
  --mrc-typescale-data-medium-font: var(--md-ref-typeface-plain);
  --mrc-typescale-data-medium-size: 13px;
  --mrc-typescale-data-medium-line-height: 20px;
  --mrc-typescale-data-medium-weight: 400;
  --mrc-typescale-data-medium-tracking: 0;

  /* ---- Shape ---- */
  --md-sys-shape-corner-none: 0;
  --md-sys-shape-corner-extra-small: 4px;
  --md-sys-shape-corner-small: 8px;
  --md-sys-shape-corner-medium: 12px;
  --md-sys-shape-corner-large: 16px;
  --md-sys-shape-corner-extra-large: 28px;
  --md-sys-shape-corner-full: 9999px;

  /* ---- Elevation ---- */
  --md-sys-elevation-level0: none;
  --md-sys-elevation-level1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-level2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-level3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-level4: 0 2px 3px rgba(0, 0, 0, 0.3), 0 6px 10px 4px rgba(0, 0, 0, 0.15);
  --md-sys-elevation-level5: 0 4px 4px rgba(0, 0, 0, 0.3), 0 8px 12px 6px rgba(0, 0, 0, 0.15);

  /* ---- Motion ---- */
  --md-sys-motion-duration-short1: 50ms;
  --md-sys-motion-duration-short2: 100ms;
  --md-sys-motion-duration-short3: 150ms;
  --md-sys-motion-duration-short4: 200ms;
  --md-sys-motion-duration-medium1: 250ms;
  --md-sys-motion-duration-medium2: 300ms;
  --md-sys-motion-duration-medium3: 350ms;
  --md-sys-motion-duration-medium4: 400ms;
  --md-sys-motion-duration-long1: 450ms;
  --md-sys-motion-duration-long2: 500ms;
  --md-sys-motion-duration-long3: 550ms;
  --md-sys-motion-duration-long4: 600ms;
  --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-standard-decelerate: cubic-bezier(0, 0, 0, 1);
  --md-sys-motion-easing-standard-accelerate: cubic-bezier(0.3, 0, 1, 1);
  --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
  --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
  --md-sys-motion-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);

  /* ---- State layers (the overlay on a hovered, focused or pressed control) ---- */
  --md-sys-state-hover-state-layer-opacity: 0.08;
  --md-sys-state-focus-state-layer-opacity: 0.1;
  --md-sys-state-pressed-state-layer-opacity: 0.1;
  --md-sys-state-dragged-state-layer-opacity: 0.16;
  --md-sys-state-disabled-content-opacity: 0.38;
  --md-sys-state-disabled-container-opacity: 0.12;

  /* ---- Spacing (4px grid), touch target, focus ring ---- */
  --mrc-space-1: 4px;
  --mrc-space-2: 8px;
  --mrc-space-3: 12px;
  --mrc-space-4: 16px;
  --mrc-space-5: 20px;
  --mrc-space-6: 24px;
  --mrc-space-8: 32px;
  --mrc-space-10: 40px;
  --mrc-space-12: 48px;
  --mrc-space-16: 64px;
  --mrc-touch-target: 48px;
  --mrc-focus-ring-width: 3px;
  --mrc-focus-ring-offset: 2px;
}

:root {
  /* ---- Colour roles ---- */
  color-scheme: light;
  --md-sys-color-primary: var(--md-ref-palette-primary30);
  --md-sys-color-on-primary: var(--md-ref-palette-primary100);
  --md-sys-color-primary-container: var(--md-ref-palette-primary90);
  --md-sys-color-on-primary-container: var(--md-ref-palette-primary10);
  --md-sys-color-secondary: var(--md-ref-palette-secondary40);
  --md-sys-color-on-secondary: var(--md-ref-palette-secondary100);
  --md-sys-color-secondary-container: var(--md-ref-palette-secondary90);
  --md-sys-color-on-secondary-container: var(--md-ref-palette-secondary10);
  --md-sys-color-tertiary: var(--md-ref-palette-tertiary40);
  --md-sys-color-on-tertiary: var(--md-ref-palette-tertiary100);
  --md-sys-color-tertiary-container: var(--md-ref-palette-tertiary90);
  --md-sys-color-on-tertiary-container: var(--md-ref-palette-tertiary10);
  --md-sys-color-error: var(--md-ref-palette-error40);
  --md-sys-color-on-error: var(--md-ref-palette-error100);
  --md-sys-color-error-container: var(--md-ref-palette-error90);
  --md-sys-color-on-error-container: var(--md-ref-palette-error10);
  --mrc-sys-color-success: var(--mrc-ref-palette-success40);
  --mrc-sys-color-on-success: var(--mrc-ref-palette-success100);
  --mrc-sys-color-success-container: var(--mrc-ref-palette-success90);
  --mrc-sys-color-on-success-container: var(--mrc-ref-palette-success10);
  --mrc-sys-color-warning: var(--mrc-ref-palette-warning40);
  --mrc-sys-color-on-warning: var(--mrc-ref-palette-warning100);
  --mrc-sys-color-warning-container: var(--mrc-ref-palette-warning90);
  --mrc-sys-color-on-warning-container: var(--mrc-ref-palette-warning10);
  --md-sys-color-background: var(--md-ref-palette-neutral96);
  --md-sys-color-on-background: var(--md-ref-palette-neutral10);
  --md-sys-color-surface: var(--md-ref-palette-neutral98);
  --md-sys-color-on-surface: var(--md-ref-palette-neutral10);
  --md-sys-color-surface-variant: var(--md-ref-palette-neutral-variant90);
  --md-sys-color-on-surface-variant: var(--md-ref-palette-neutral-variant30);
  --md-sys-color-surface-dim: var(--md-ref-palette-neutral87);
  --md-sys-color-surface-bright: var(--md-ref-palette-neutral98);
  --md-sys-color-surface-container-lowest: var(--md-ref-palette-neutral100);
  --md-sys-color-surface-container-low: var(--md-ref-palette-neutral96);
  --md-sys-color-surface-container: var(--md-ref-palette-neutral94);
  --md-sys-color-surface-container-high: var(--md-ref-palette-neutral92);
  --md-sys-color-surface-container-highest: var(--md-ref-palette-neutral90);
  --md-sys-color-outline: var(--md-ref-palette-neutral-variant50);
  --md-sys-color-outline-variant: var(--md-ref-palette-neutral-variant80);
  --md-sys-color-shadow: var(--md-ref-palette-neutral0);
  --md-sys-color-scrim: var(--md-ref-palette-neutral0);
  --md-sys-color-inverse-surface: var(--md-ref-palette-neutral20);
  --md-sys-color-inverse-on-surface: var(--md-ref-palette-neutral95);
  --md-sys-color-inverse-primary: var(--md-ref-palette-primary80);
  --md-sys-color-surface-tint: var(--md-ref-palette-primary30);
  --mrc-sys-color-brand: var(--mrc-ref-brand-navy);
  --mrc-sys-color-on-brand: var(--md-ref-palette-neutral98);
  --mrc-sys-color-on-brand-variant: var(--md-ref-palette-neutral80);
  --mrc-sys-color-brand-highlight: var(--md-ref-palette-secondary80);
  --mrc-sys-color-accent: var(--mrc-ref-brand-gold);
  --mrc-sys-color-on-accent: var(--md-ref-palette-neutral10);
  --mrc-focus-ring-color: var(--md-sys-color-primary);
}

/* ---- Chart colours ----
 * Identity: --mrc-chart-series-1..8 in this fixed order, never cycled; a 9th series folds into --mrc-chart-other. Validated for stacks, bars and lines
 * (adjacent colours); scatter, bubble and map charts carry a 3-series cap. Series colours are for marks, never for text: use the label tokens
 * inside a fill and --mrc-chart-text beside one. Magnitude: --mrc-chart-seq-1..7, light to dark. Polarity: --mrc-chart-div-*. State: --mrc-chart-good,
 * -warning and -critical, reserved, always with an icon and a word. Never use two value scales on one chart (no second y-axis). */
:root {
  --mrc-chart-series-1: #00588e; /* blue */
  --mrc-chart-series-1-label: var(--md-ref-palette-neutral100);
  --mrc-chart-series-2: #ab5a1a; /* orange */
  --mrc-chart-series-2-label: var(--md-ref-palette-neutral100);
  --mrc-chart-series-3: #00a4a2; /* teal */
  --mrc-chart-series-3-label: var(--md-ref-palette-neutral10);
  --mrc-chart-series-4: #956b00; /* gold */
  --mrc-chart-series-4-label: var(--md-ref-palette-neutral100);
  --mrc-chart-series-5: #a35086; /* magenta */
  --mrc-chart-series-5-label: var(--md-ref-palette-neutral100);
  --mrc-chart-series-6: #40833e; /* green */
  --mrc-chart-series-6-label: var(--md-ref-palette-neutral100);
  --mrc-chart-series-7: #7363b9; /* violet */
  --mrc-chart-series-7-label: var(--md-ref-palette-neutral100);
  --mrc-chart-series-8: #af5047; /* red */
  --mrc-chart-series-8-label: var(--md-ref-palette-neutral100);
  --mrc-chart-other: var(--md-ref-palette-neutral-variant60);
  --mrc-chart-current: var(--mrc-chart-series-1); /* this period */
  --mrc-chart-prior: var(--md-sys-color-outline); /* the comparison period: draw it dashed */
  --mrc-chart-seq-1: var(--md-ref-palette-primary90);
  --mrc-chart-seq-2: var(--md-ref-palette-primary80);
  --mrc-chart-seq-3: var(--md-ref-palette-primary70);
  --mrc-chart-seq-4: var(--md-ref-palette-primary60);
  --mrc-chart-seq-5: var(--md-ref-palette-primary50);
  --mrc-chart-seq-6: var(--md-ref-palette-primary40);
  --mrc-chart-seq-7: var(--md-ref-palette-primary30);
  --mrc-chart-div-pos-1: var(--md-ref-palette-primary80);
  --mrc-chart-div-pos-2: var(--md-ref-palette-primary60);
  --mrc-chart-div-pos-3: var(--md-ref-palette-primary40);
  --mrc-chart-div-mid: var(--md-ref-palette-neutral94);
  --mrc-chart-div-neg-1: var(--mrc-ref-palette-warm80);
  --mrc-chart-div-neg-2: var(--mrc-ref-palette-warm60);
  --mrc-chart-div-neg-3: var(--mrc-ref-palette-warm40);
  --mrc-chart-good: var(--mrc-ref-palette-success50);
  --mrc-chart-warning: var(--mrc-ref-palette-warning60);
  --mrc-chart-critical: var(--md-ref-palette-error50);
  --mrc-chart-surface: var(--md-sys-color-surface-container-lowest);
  --mrc-chart-text: var(--md-sys-color-on-surface);
  --mrc-chart-text-secondary: var(--md-sys-color-on-surface-variant);
  --mrc-chart-grid: var(--md-sys-color-outline-variant); /* hairline gridlines */
  --mrc-chart-axis: var(--md-ref-palette-neutral-variant70); /* the baseline */
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --md-sys-motion-duration-short1: 1ms;
    --md-sys-motion-duration-short2: 1ms;
    --md-sys-motion-duration-short3: 1ms;
    --md-sys-motion-duration-short4: 1ms;
    --md-sys-motion-duration-medium1: 1ms;
    --md-sys-motion-duration-medium2: 1ms;
    --md-sys-motion-duration-medium3: 1ms;
    --md-sys-motion-duration-medium4: 1ms;
    --md-sys-motion-duration-long1: 1ms;
    --md-sys-motion-duration-long2: 1ms;
    --md-sys-motion-duration-long3: 1ms;
    --md-sys-motion-duration-long4: 1ms;
  }
}

/* css/app-shell.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

  /* The old variable names, now pointing at the design tokens (css/tokens.css), so every rule that still says var(--navy) or var(--border) follows
     the token palette. New code uses the tokens directly; see docs/design-system/tokens.md, "Moving the old variables over". */
  :root {
    --navy: var(--mrc-sys-color-brand);
    --navy-mid: var(--md-sys-color-primary);
    --navy-light: var(--md-sys-color-primary);
    --sage: var(--mrc-sys-color-brand-highlight);
    --sage-light: var(--md-sys-color-secondary-container);
    --sage-dark: var(--md-sys-color-secondary);
    --cream: var(--md-sys-color-background);
    --white: var(--md-sys-color-surface-container-lowest);
    --danger: var(--md-sys-color-error);
    --danger-light: var(--md-sys-color-error-container);
    --warning: var(--mrc-sys-color-warning);
    --warning-light: var(--mrc-sys-color-warning-container);
    --success: var(--mrc-sys-color-success);
    --success-light: var(--mrc-sys-color-success-container);
    --text-primary: var(--md-sys-color-on-surface);
    --text-secondary: var(--md-sys-color-on-surface-variant);
    --text-muted: var(--md-sys-color-on-surface-variant);
    --border: var(--md-sys-color-outline-variant);
    --shadow: 0 1px 4px color-mix(in srgb, var(--md-sys-color-shadow) 8%, transparent);
  }

  /* Native controls take the page font (they default to the system's), and keyboard focus is always visible: zero specificity, so a rule
     that styles its own focus still wins. */
  button, input, select, textarea { font-family: inherit; }
  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color);
    outline-offset: var(--mrc-focus-ring-offset);
  }

  .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
  /* The skip link is off-screen until it takes keyboard focus. */
  .skip-link {
    position: absolute; left: 8px; top: -64px; z-index: 1000; padding: 10px 16px; border-radius: var(--md-sys-shape-corner-small);
    background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface); text-decoration: none; font-weight: 600;
    transition: top var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
  }
  .skip-link:focus { top: 8px; }
  /* The main landmark takes no box of its own: its children lay out exactly as before. */
  .main-content { display: contents; }

  body {
    font-family: var(--md-ref-typeface-plain);
    background: var(--cream);
    color: var(--text-primary);
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: 1.5;
    display: flex;
    min-height: 100vh;
  }
  #appRoot {
    display: contents;
  }
  body.auth-pending #appRoot,
  body.auth-guest #appRoot,
  body.auth-restricted #appRoot,
  body.auth-config-error #appRoot {
    display: none;
  }
  .auth-shell {
    min-height: 100vh;
    width: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: radial-gradient(circle at top left, color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 12%, transparent), transparent 22%),
      linear-gradient(160deg, var(--md-sys-color-surface-container) 0%, var(--md-sys-color-background) 45%, var(--md-sys-color-surface) 100%);
  }
  body.auth-pending .auth-shell,
  body.auth-guest .auth-shell,
  body.auth-restricted .auth-shell,
  body.auth-config-error .auth-shell {
    display: flex;
  }
  .auth-layout {
    width: min(1180px, 100%);
    min-height: min(760px, calc(100vh - 56px));
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1fr);
    border-radius: var(--md-sys-shape-corner-extra-large);
    overflow: hidden;
    background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 96%, transparent);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-high) 90%, transparent);
    box-shadow: 0 30px 70px color-mix(in srgb, var(--md-sys-color-shadow) 16%, transparent);
  }
  .auth-visual-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 34px 30px 34px 34px;
    background: radial-gradient(circle at 18% 18%, color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 16%, transparent), transparent 24%),
      radial-gradient(circle at 85% 88%, color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent), transparent 28%),
      linear-gradient(180deg, var(--mrc-sys-color-brand) 0%, var(--mrc-sys-color-brand) 58%, var(--md-sys-color-primary) 100%);
    color: color-mix(in srgb, var(--md-sys-color-on-primary) 94%, transparent);
  }
  .auth-visual-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 2%, transparent), transparent 46%, color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 6%, transparent));
    pointer-events: none;
  }
  .auth-visual-brand,
  .auth-visual-copy {
    position: relative;
    z-index: 1;
  }
  .auth-visual-logo {
    width: min(220px, 62%);
    height: auto;
    display: block;
  }
  .auth-visual-copy {
    max-width: 320px;
    padding-bottom: 22px;
  }
  .auth-visual-kicker {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--mrc-sys-color-on-brand-variant) 90%, transparent);
    margin-bottom: 18px;
  }
  .auth-visual-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: clamp(36px, 4.1vw, var(--md-sys-typescale-display-large-size));
    line-height: 0.98;
    letter-spacing: -0.04em;
    margin-bottom: 18px;
    max-width: 260px;
  }
  .auth-visual-text {
    font-size: var(--md-sys-typescale-body-medium-size);
    line-height: 1.65;
    color: color-mix(in srgb, var(--md-sys-color-inverse-on-surface) 78%, transparent);
  }
  .auth-visual-rule {
    width: 64px;
    height: 2px;
    border-radius: var(--md-sys-shape-corner-full);
    background: linear-gradient(90deg, color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 72%, transparent), color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 8%, transparent));
    margin: 22px 0 16px;
  }
  .auth-visual-caption {
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: 1.55;
    color: color-mix(in srgb, var(--mrc-sys-color-on-brand-variant) 82%, transparent);
  }
  .auth-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 34px 38px;
    background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface) 100%);
  }
  .auth-card-inner {
    width: min(430px, 100%);
    padding: 26px 24px 22px;
  }
  .auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
  }
  .auth-brand-badge {
    width: 42px;
    height: 42px;
    border-radius: var(--md-sys-shape-corner-large);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, var(--mrc-sys-color-brand) 0%, var(--md-sys-color-primary) 100%);
    color: var(--white);
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 700;
    letter-spacing: 0.08em;
    box-shadow: 0 12px 24px color-mix(in srgb, var(--md-sys-color-shadow) 16%, transparent);
  }
  .auth-brand-text {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--navy);
  }
  .auth-eyebrow {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--sage-dark);
    margin-bottom: 10px;
  }
  .auth-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: clamp(34px, 3.2vw, var(--md-sys-typescale-display-medium-size));
    line-height: 0.98;
    letter-spacing: -0.04em;
    color: var(--navy);
    margin-bottom: 12px;
    max-width: 380px;
  }
  .auth-copy {
    font-size: var(--md-sys-typescale-title-medium-size);
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 22px;
    max-width: 340px;
  }
  .auth-login-btn {
    min-width: 230px;
    min-height: var(--mrc-touch-target);
    border-radius: var(--md-sys-shape-corner-full);
    box-shadow: 0 12px 24px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  }
  /* Sign in is partner-first (email and password); the MRC team's Google button is one link away. */
  .auth-partner,
  .auth-team,
  .auth-code,
  .auth-welcome,
  .auth-verify {
    width: min(340px, 100%);
    margin-top: 4px;
  }
  .auth-partner-form {
    display: grid;
    gap: 12px;
  }
  .auth-field {
    display: grid;
    gap: 5px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    color: var(--text-secondary);
  }
  .auth-field input {
    min-height: 42px;
    padding: 0 14px;
    border: 1px solid var(--border, color-mix(in srgb, var(--mrc-sys-color-brand) 20%, transparent));
    border-radius: var(--md-sys-shape-corner-medium);
    font: inherit;
    font-size: var(--md-sys-typescale-body-medium-size);
    font-weight: 400;
    color: var(--navy);
    background: var(--white);
  }
  /* Password box with a show/hide eye. The button sits over the right end of the input and the text stops short of it. */
  .auth-pw-row { position: relative; }
  .auth-pw-row .auth-field input { padding-right: 46px; }
  .auth-eye {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 42px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: var(--md-sys-shape-corner-medium);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
  }
  .auth-eye:hover { color: var(--navy); }
  .auth-eye:focus-visible { outline: 2px solid var(--navy); outline-offset: -2px; }
  .auth-eye .eye-shut,
  .auth-eye[aria-pressed="true"] .eye-open { display: none; }
  .auth-eye[aria-pressed="true"] .eye-shut { display: block; }
  .auth-field input:focus-visible {
    outline: 2px solid var(--navy);
    outline-offset: 1px;
  }
  .auth-partner-submit {
    justify-self: start;
    min-width: 0;
    width: 100%;
  }
  .auth-link {
    display: block;
    margin-top: 12px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: var(--mrc-typescale-data-medium-size);
    color: var(--text-secondary);
    text-align: left;
    text-decoration: underline;
    cursor: pointer;
  }
  .auth-link:hover { color: var(--navy); }
  .auth-link[hidden] { display: none; }
  .auth-link:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; border-radius: var(--md-sys-shape-corner-extra-small); }
  /* The "link sent" confirmation, shown in the screen itself (not down in the status line) so it is the first thing read. */
  .auth-sent-note { margin: 0 0 14px; font-size: var(--md-sys-typescale-body-medium-size); line-height: 1.55; color: var(--navy); }
  .auth-sent-note:empty { display: none; }
  /* With no sentence under the heading (the team page), give the button the room the sentence used to. */
  .auth-copy[hidden] ~ .auth-team { margin-top: 28px; }
  /* The team page: one Google button, as wide as the heading above it, in the usual white Google style. */
  .auth-team { width: min(360px, 100%); }
  .auth-team .auth-login-btn {
    width: 100%;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--white);
    color: var(--navy);
    border: 1px solid color-mix(in srgb, var(--mrc-sys-color-brand) 18%, transparent);
    font-weight: 600;
    box-shadow: 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 8%, transparent), 0 8px 18px color-mix(in srgb, var(--md-sys-color-shadow) 8%, transparent);
  }
  .auth-team .auth-login-btn:hover:not(:disabled) { background: var(--md-sys-color-surface); }
  .auth-team .auth-login-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
  .auth-team .auth-login-btn:disabled { opacity: 0.6; cursor: default; }
  .auth-google-mark { flex: none; }
  .auth-partner-form[hidden], .auth-pane[hidden], .auth-tabs[hidden], .auth-welcome[hidden], .auth-welcome .upload-btn[hidden] { display: none; }
  /* The invitation page (/welcome): the address they were invited at is shown, not editable. */
  .auth-field input[readonly] { background: var(--md-sys-color-background); color: var(--text-secondary); cursor: default; }
  .auth-hint { margin: -2px 0 0; font-size: var(--md-sys-typescale-body-small-size); line-height: 1.5; color: var(--text-secondary); }
  /* Two ways to sign in, side by side: a password, or a code emailed to them. */
  .auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    margin-bottom: 18px;
    border-radius: var(--md-sys-shape-corner-full);
    background: color-mix(in srgb, var(--mrc-sys-color-brand) 7%, transparent);
  }
  .auth-tab {
    min-height: 38px;
    padding: 0 10px;
    border: 0;
    border-radius: var(--md-sys-shape-corner-full);
    background: transparent;
    font: inherit;
    font-size: var(--md-sys-typescale-label-large-size);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
  }
  .auth-tab:hover { color: var(--navy); }
  .auth-tab.is-active {
    background: var(--white);
    color: var(--navy);
    box-shadow: 0 1px 4px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
  }
  .auth-tab:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
  .auth-link.auth-forgot { justify-self: end; margin: -4px 0 0; }
  /* Every view is as tall as the tallest (the code-entry step with its confirmation), so the heading and toggle stay put when switching (the card centres its content). */
  .auth-tabs:not([hidden]) ~ .auth-pane { min-height: 272px; }
  /* The note under the form ("a code is on its way...") can run to three lines; reserve them so sending a code does not move the page. */
  .auth-card-inner:has(.auth-tabs:not([hidden])) .auth-status-note { min-height: 4.4em; }
  .auth-link:disabled { color: var(--text-muted, var(--mrc-sys-color-on-brand-variant)); cursor: default; text-decoration: none; }
  /* The emailed 6-digit code: large, evenly spaced digits; the phone keypad comes up (inputmode numeric). */
  .auth-field input.auth-code-input {
    min-height: 52px;
    font-size: var(--md-sys-typescale-headline-medium-size);
    font-weight: 600;
    letter-spacing: 0.35em;
    text-align: center;
    padding: 0 0 0 0.35em;
  }
  .auth-verify .auth-login-btn { width: 100%; }

  /* A signed-in partner sees the dashboards and nothing else (the servers refuse the rest anyway). */
  body.partner-mode .sidebar-section-label,
  body.partner-mode .sidebar-nav .nav-link:not([data-page="dashboards"]) {
    display: none;
  }
  .auth-status-note {
    min-height: 18px;
    margin-top: 14px;
    font-size: var(--mrc-typescale-data-medium-size);
    color: var(--text-secondary);
    max-width: 340px;
  }

  .power-bi-view {
    display: none;
    height: calc(100vh - 52px);
    min-height: 0;
    padding: 0;
  }
  .power-bi-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .power-bi-frame-wrap {
    position: relative;
    flex: 1;
    min-height: 0;
    border: 0;
    background: var(--white);
    box-shadow: none;
    overflow: hidden;
  }
  .power-bi-loading {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    gap: 12px;
    align-content: center;
    background: var(--white);
    color: var(--text-muted);
    transition: opacity 180ms ease, visibility 180ms ease;
  }
  .power-bi-frame-wrap.loaded .power-bi-loading {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
  .power-bi-loading-title {
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 700;
    color: var(--text-secondary);
  }
  .power-bi-sdk-auth {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--white);
  }
  .power-bi-sdk-auth-card {
    width: min(420px, 100%);
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--white);
    box-shadow: 0 18px 48px color-mix(in srgb, var(--md-sys-color-shadow) 10%, transparent);
    text-align: center;
  }
  .power-bi-sdk-eyebrow {
    margin-bottom: 10px;
    color: var(--sage-dark);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }
  .power-bi-sdk-auth-card h2 {
    margin: 0 0 10px;
    color: var(--navy);
    font-size: var(--md-sys-typescale-title-large-size);
    line-height: 1.15;
  }
  .power-bi-sdk-auth-card p {
    margin: 0 0 18px;
    color: var(--text-muted);
    font-size: var(--mrc-typescale-data-medium-size);
    line-height: 1.55;
  }
  .power-bi-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 100%;
    border: 0;
    background: var(--white);
  }
  .power-bi-sdk-host {
    position: absolute;
    inset: 0;
    background: var(--white);
  }
  .power-bi-frame-wrap > iframe,
  .power-bi-frame-wrap > .powerbi-container,
  .power-bi-frame-wrap > .powerbi-frame,
  .power-bi-sdk-host > iframe {
    display: block;
    width: 100% !important;
    height: 100% !important;
    min-height: 100%;
    border: 0;
    background: var(--white);
  }
  .power-bi-chat-shell {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 130;
    pointer-events: none;
  }
  .power-bi-chat-fab {
    width: 54px;
    height: 54px;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 24%, transparent);
    border-radius: var(--md-sys-shape-corner-full);
    background: linear-gradient(135deg, var(--navy-light), var(--navy));
    color: var(--white);
    box-shadow: 0 18px 42px color-mix(in srgb, var(--md-sys-color-shadow) 28%, transparent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  }
  .power-bi-chat-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 50px color-mix(in srgb, var(--md-sys-color-shadow) 34%, transparent);
  }
  .power-bi-chat-fab:focus-visible,
  .power-bi-chat-close:focus-visible,
  .power-bi-chat-send:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--md-sys-color-outline) 42%, transparent);
    outline-offset: 3px;
  }
  .power-bi-chat-popup {
    position: absolute;
    right: 0;
    bottom: 66px;
    width: min(420px, calc(100vw - 32px));
    height: min(560px, calc(100vh - 96px));
    border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 92%, transparent);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--white);
    box-shadow: 0 26px 70px color-mix(in srgb, var(--md-sys-color-shadow) 24%, transparent);
    display: none;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
  }
  .power-bi-chat-shell.open .power-bi-chat-popup {
    display: flex;
  }
  .power-bi-chat-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 18px 13px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface) 100%);
  }
  .power-bi-chat-kicker {
    margin-bottom: 5px;
    color: var(--sage-dark);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
  }
  .power-bi-chat-viewing {
    margin-top: 3px;
    max-width: 290px;
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: 1.35;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .power-bi-chat-viewing:empty { display: none; }
  .power-bi-chat-title {
    color: var(--navy);
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 800;
    line-height: 1.2;
  }
  .power-bi-chat-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .power-bi-chat-popout,
  .power-bi-chat-close {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--white);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: border-color var(--transition), color var(--transition), background var(--transition), opacity var(--transition);
  }
  .power-bi-chat-close {
    font-size: var(--md-sys-typescale-title-large-size);
  }
  .power-bi-chat-popout:hover:not(:disabled),
  .power-bi-chat-close:hover {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 24%, transparent);
    background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent);
    color: var(--navy-light);
  }
  .power-bi-chat-popout:disabled {
    cursor: not-allowed;
    opacity: 0.38;
  }
  .power-bi-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    background: var(--md-sys-color-surface);
  }
  .power-bi-chat-empty {
    padding: 18px;
    border: 1px dashed var(--border);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--white);
    color: var(--text-muted);
    font-size: var(--mrc-typescale-data-medium-size);
    line-height: 1.5;
    text-align: center;
  }
  .power-bi-chat-message {
    display: flex;
    margin-bottom: 12px;
  }
  .power-bi-chat-message.user {
    justify-content: flex-end;
  }
  .power-bi-chat-message.assistant {
    justify-content: flex-start;
  }
  .power-bi-chat-context-reset {
    margin: 12px 0;
    padding: 8px 10px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: 1.35;
    text-align: center;
  }
  .power-bi-chat-bubble {
    max-width: 88%;
    padding: 11px 13px;
    border-radius: var(--md-sys-shape-corner-large);
    font-size: var(--mrc-typescale-data-medium-size);
    line-height: 1.5;
    color: var(--text-secondary);
    background: var(--white);
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px color-mix(in srgb, var(--md-sys-color-shadow) 6%, transparent);
  }
  .power-bi-chat-message.user .power-bi-chat-bubble {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 18%, transparent);
    background: var(--navy-light);
    color: var(--white);
  }
  .power-bi-chat-message.user .power-bi-chat-bubble p,
  .power-bi-chat-bubble p {
    margin: 0 0 8px;
  }
  .power-bi-chat-bubble p:last-child,
  .power-bi-chat-bubble ul:last-child,
  .power-bi-chat-bubble ol:last-child {
    margin-bottom: 0;
  }
  .power-bi-chat-bubble ul,
  .power-bi-chat-bubble ol {
    margin: 8px 0;
    padding-left: 18px;
  }
  .power-bi-chat-attachment-note {
    margin-top: 10px;
    padding: 10px 11px;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 22%, transparent);
    border-radius: var(--md-sys-shape-corner-medium);
    background: color-mix(in srgb, var(--mrc-sys-color-accent) 8%, transparent);
    color: var(--text-secondary);
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: 1.45;
  }
  .power-bi-chat-open-max {
    margin-top: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--navy-light);
    cursor: pointer;
    display: block;
    font: inherit;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 800;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 2px;
  }
  .power-bi-chat-open-max:hover {
    color: var(--navy);
  }
  .power-bi-chat-input-shell {
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--white);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 9px;
    align-items: end;
  }
  .power-bi-chat-input {
    min-height: 42px;
    max-height: 110px;
    box-sizing: border-box;
    overflow-y: hidden;
    resize: none;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 10px 11px;
    color: var(--text-primary);
    font: inherit;
    font-size: var(--mrc-typescale-data-medium-size);
    line-height: 1.4;
  }
  .power-bi-chat-input:focus {
    outline: none;
    border-color: var(--sage-dark);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 16%, transparent);
  }
  .power-bi-chat-send {
    align-self: end;
    justify-self: end;
    min-height: 42px;
    padding-inline: 15px;
  }
  @media (max-width: 760px) {
    .power-bi-view {
      height: calc(100vh - 52px);
      padding: 0;
    }
    .power-bi-frame-wrap,
    .power-bi-frame,
    .power-bi-frame-wrap > iframe,
    .power-bi-frame-wrap > .powerbi-container,
    .power-bi-frame-wrap > .powerbi-frame,
    .power-bi-sdk-host > iframe {
      min-height: 0;
    }
    .power-bi-chat-shell {
      right: 14px;
      bottom: 14px;
    }
    .power-bi-chat-popup {
      width: calc(100vw - 28px);
      height: min(540px, calc(100vh - 86px));
      bottom: 62px;
    }
    .power-bi-chat-input-shell {
      grid-template-columns: 1fr;
    }
    .power-bi-chat-send {
      width: 100%;
    }
  }
  @media (max-width: 980px) {
    .auth-shell {
      padding: 18px;
    }
    .auth-layout {
      grid-template-columns: 1fr;
      min-height: auto;
    }
    .auth-visual-panel {
      min-height: 300px;
      padding: 26px 24px 28px;
    }
    .auth-visual-logo {
      width: min(190px, 52%);
    }
    .auth-visual-copy {
      max-width: 100%;
      padding-bottom: 0;
    }
    .auth-visual-title {
      max-width: 340px;
      font-size: clamp(32px, 8vw, var(--md-sys-typescale-display-medium-size));
    }
    .auth-card {
      padding: 28px 22px 30px;
    }
    .auth-card-inner {
      width: min(460px, 100%);
      padding: 0;
    }
  }
  @media (max-width: 640px) {
    .auth-shell {
      padding: 0;
      background: linear-gradient(180deg, var(--mrc-sys-color-brand) 0%, var(--md-sys-color-background) 52%, var(--md-sys-color-surface) 100%);
    }
    .auth-layout {
      border-radius: 0;
      min-height: 100vh;
      box-shadow: none;
      border: none;
    }
    .auth-visual-panel {
      min-height: 260px;
      border-bottom-left-radius: var(--md-sys-shape-corner-extra-large);
      border-bottom-right-radius: var(--md-sys-shape-corner-extra-large);
      overflow: hidden;
    }
    .auth-card {
      padding: 26px 18px 34px;
    }
    .auth-title {
      max-width: none;
    }
    .auth-copy,
    .auth-status-note {
      max-width: none;
    }
    .auth-login-btn {
      width: 100%;
    }
  }

  /* ── SIDEBAR ── */
  .sidebar {
    width: 220px;
    min-width: 220px;
    background: var(--navy);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 200;
    transition: width 0.22s ease, min-width 0.22s ease;
    overflow: hidden;
  }
  .sidebar.collapsed { width: 60px; min-width: 60px; }
  .sidebar-logo {
    padding: 20px 16px 16px;
    border-bottom: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 8%, transparent);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
    flex-shrink: 0;
  }
  .sidebar-logo img { height: 30px; width: auto; flex-shrink: 0; }
  .sidebar-logo-text {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    color: var(--sage-light);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.15s;
  }
  .sidebar.collapsed .sidebar-logo-text { opacity: 0; }
  .sidebar-nav {
    flex: 1;
    padding: 12px 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .sidebar-section-label {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--mrc-sys-color-on-brand-variant);
    padding: 10px 18px 4px;
    white-space: nowrap;
    opacity: 1;
    transition: opacity 0.15s;
  }
  .sidebar.collapsed .sidebar-section-label { opacity: 0; }
  .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 18px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
  }
  .nav-link:hover { background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 6%, transparent); }
  .nav-link.active {
    background: color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 12%, transparent);
    border-left-color: var(--sage);
  }
  .nav-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--md-sys-shape-corner-small);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 700;
    flex-shrink: 0;
    font-family: var(--md-ref-typeface-plain);
  }
  .nav-label {
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 500;
    color: color-mix(in srgb, var(--md-sys-color-on-primary) 70%, transparent);
    transition: color 0.15s, opacity 0.15s;
    white-space: nowrap;
  }
  .nav-link.active .nav-label { color: var(--white); }
  .nav-link:hover .nav-label { color: var(--white); }
  .sidebar.collapsed .nav-label { opacity: 0; width: 0; }
  .power-bi-subnav {
    display: none;
    margin: 0 10px 8px 51px;
    padding: 4px 0;
  }
  .power-bi-subnav.visible {
    display: grid;
    gap: 3px;
  }
  .power-bi-subnav-loading,
  .power-bi-subnav-btn {
    width: 100%;
    min-height: 28px;
    padding: 6px 10px;
    border: 0;
    border-radius: var(--md-sys-shape-corner-small);
    background: transparent;
    color: color-mix(in srgb, var(--md-sys-color-on-primary) 62%, transparent);
    font: inherit;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
  }
  .power-bi-subnav-loading {
    color: color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 62%, transparent);
  }
  .power-bi-subnav-btn {
    cursor: pointer;
    position: relative;
    transition: background 0.15s, color 0.15s;
  }
  .power-bi-subnav-btn:hover {
    background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 7%, transparent);
    color: var(--white);
  }
  .power-bi-subnav-btn.active {
    background: transparent;
    color: var(--md-sys-color-inverse-on-surface);
    font-weight: 800;
    letter-spacing: 0.01em;
    text-shadow: 0 0 12px color-mix(in srgb, var(--md-sys-color-shadow) 36%, transparent);
  }
  .power-bi-subnav-btn.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    width: 4px;
    height: 14px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--sage);
    transform: translateY(-50%);
  }
  .sidebar.collapsed .power-bi-subnav {
    display: none;
  }
  .sidebar-toggle {
    padding: 12px 16px;
    border-top: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 8%, transparent);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
  }
  .sidebar.collapsed .sidebar-toggle { justify-content: center; }
  .toggle-btn {
    background: none;
    border: 1.5px solid color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 15%, transparent);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 5px 8px;
    cursor: pointer;
    color: var(--sage);
    display: flex;
    align-items: center;
    transition: background 0.15s, border-color 0.15s;
  }
  .toggle-btn:hover { background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 8%, transparent); border-color: var(--sage); }
  .toggle-icon { transition: transform 0.22s; }
  .sidebar.collapsed .toggle-icon { transform: rotate(180deg); }

  /* ── MAIN CONTENT AREA ── */
  .page-content {
    margin-left: 220px;
    flex: 1;
    min-width: 0;
    transition: margin-left 0.22s ease;
    display: flex;
    flex-direction: column;
  }
  .page-content.collapsed { margin-left: 60px; }

  /* ── TOP BAR (tool name) ── */
  .topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 0 40px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px color-mix(in srgb, var(--md-sys-color-shadow) 5%, transparent);
  }
  /* The page title is the page's h1; it takes keyboard focus when the page changes, which needs no ring of its own. */
  .topbar-title:focus { outline: none; }
  .topbar-title {
    display: inline;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 600;
    color: var(--navy);
  }
  .topbar-sub {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-left: 10px;
  }
  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .power-bi-last-updated {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--white);
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
  }
  .power-bi-last-updated[hidden] {
    display: none;
  }
  .power-bi-header-reset-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--white);
    color: var(--navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.15s ease;
  }
  .power-bi-header-reset-btn:hover {
    border-color: var(--sage-dark);
    background: var(--md-sys-color-surface);
    color: var(--navy-light);
    transform: translateY(-1px);
  }
  .power-bi-header-reset-btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--md-sys-color-outline) 35%, transparent);
    outline-offset: 2px;
  }
  .auth-user-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--md-sys-shape-corner-full);
    background: var(--white);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    cursor: default;
  }
  .auth-user-chip[hidden] {
    display: none;
  }
  .auth-user-chip:hover {
    border-color: var(--sage-dark);
    background: var(--md-sys-color-surface);
    color: var(--navy);
  }
  .logout-btn {
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--navy);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 12px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    font-family: var(--md-ref-typeface-plain);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
  }
  .logout-btn:hover {
    border-color: var(--sage-dark);
    background: var(--md-sys-color-surface);
  }


  /* ── KEYWORD CLASSIFIER ── */
  .classifier-section {
    padding: 14px 40px 0;
  }

  .classifier-panel {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .classifier-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
  }
  .classifier-panel.open .classifier-header {
    border-bottom-color: var(--border);
  }
  .classifier-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .classifier-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--sage-dark);
    flex-shrink: 0;
    transition: background 0.2s;
  }
  .classifier-panel.active .classifier-dot { background: var(--mrc-sys-color-success); }
  .classifier-header-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 600;
    color: var(--navy);
  }
  .classifier-header-sub {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-left: 6px;
  }
  .classifier-chevron {
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-small-size);
    transition: transform 0.2s;
  }
  .classifier-panel.open .classifier-chevron {
    transform: rotate(180deg);
  }
  .classifier-body {
    display: none;
    padding: 18px 18px 14px;
  }
  .classifier-panel.open .classifier-body {
    display: block;
  }
  .classifier-prompt-tools {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
  }
  .classifier-prompt-help {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
  }
  .classifier-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }
  .classifier-col-label {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .classifier-col-label.brand { color: var(--mrc-sys-color-success); }
  .classifier-col-label.competitor { color: var(--md-sys-color-error); }
  .classifier-col-label svg { flex-shrink: 0; }
  .classifier-col-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: -2px 0 8px;
  }
  .kw-bulk-btn {
    background: color-mix(in srgb, var(--mrc-sys-color-brand) 4%, transparent);
    border: 1px solid color-mix(in srgb, var(--mrc-sys-color-brand) 12%, transparent);
    border-radius: var(--md-sys-shape-corner-full);
    color: var(--navy);
    cursor: pointer;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    padding: 6px 12px;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
  }
  .kw-bulk-btn:hover {
    background: color-mix(in srgb, var(--mrc-sys-color-brand) 8%, transparent);
    border-color: color-mix(in srgb, var(--mrc-sys-color-brand) 20%, transparent);
    transform: translateY(-1px);
  }
  .kw-clear-btn {
    background: color-mix(in srgb, var(--md-sys-color-error) 6%, transparent);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-error) 14%, transparent);
    border-radius: var(--md-sys-shape-corner-full);
    color: var(--md-sys-color-error);
    cursor: pointer;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    padding: 6px 12px;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
  }
  .kw-clear-btn:hover {
    background: color-mix(in srgb, var(--md-sys-color-error) 10%, transparent);
    border-color: color-mix(in srgb, var(--md-sys-color-error) 22%, transparent);
    transform: translateY(-1px);
  }
  .kw-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
  }
  .kw-input {
    flex: 1;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 6px 10px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-family: var(--md-ref-typeface-plain);
    color: var(--navy);
    background: var(--cream);
    transition: border-color 0.15s, background 0.15s;
  }
  .kw-input:focus {
    outline: none;
    border-color: var(--sage-dark);
    background: var(--white);
  }
  .kw-input.brand:focus { border-color: var(--mrc-sys-color-success); }
  .kw-input.competitor:focus { border-color: var(--md-sys-color-error); }
  .kw-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-medium-size);
    padding: 2px 4px;
    line-height: 1;
    border-radius: var(--md-sys-shape-corner-extra-small);
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
  }
  .kw-remove:hover { color: var(--danger); background: var(--danger-light); }
  .kw-add-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1.5px dashed var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 5px 10px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-family: var(--md-ref-typeface-plain);
    color: var(--text-muted);
    cursor: pointer;
    width: 100%;
    margin-top: 4px;
    transition: border-color 0.15s, color 0.15s;
  }
  .kw-add-btn:hover { border-color: var(--sage-dark); color: var(--navy); }
  .classifier-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 10px 18px 14px;
    gap: 8px;
  }
  .classifier-hint {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    flex: 1;
  }
  .classifier-apply-btn {
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 18px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    font-family: var(--md-ref-typeface-plain);
    cursor: pointer;
    transition: background 0.15s;
  }
  .classifier-apply-btn:hover { background: var(--navy-mid); }
  .classifier-reset-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 16px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    font-family: var(--md-ref-typeface-plain);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
  }
  .classifier-reset-btn:hover { border-color: var(--sage-dark); color: var(--navy); }

  /* ── COLUMN MAPPING MODAL ── */
  .modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, var(--mrc-sys-color-brand) 55%, transparent);
    z-index: 1000;
    align-items: center;
    justify-content: center;
  }
  .modal-overlay.visible { display: flex; }
  .modal-box {
    background: var(--white);
    border-radius: var(--md-sys-shape-corner-large);
    width: 560px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px color-mix(in srgb, var(--md-sys-color-shadow) 25%, transparent);
    display: flex;
    flex-direction: column;
  }
  .modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
  }
  .modal-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 700;
    color: var(--navy);
  }
  .modal-subtitle {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-top: 3px;
  }
  .modal-close {
    background: none;
    border: none;
    font-size: var(--md-sys-typescale-title-large-size);
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
  }
  .modal-close:hover { color: var(--navy); }
  .modal-body { padding: 20px 24px; flex: 1; }
  .modal-warning {
    background: var(--mrc-sys-color-warning-container);
    border: 1px solid var(--mrc-sys-color-warning);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 10px 14px;
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--mrc-sys-color-on-warning-container);
    margin-bottom: 16px;
    display: none;
  }
  .modal-warning.visible { display: block; }
  .modal-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .modal-field-label {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    color: var(--navy);
  }
  .modal-text-input {
    width: 100%;
    height: 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 0 12px;
    background: var(--md-sys-color-surface-container-lowest);
    color: var(--navy);
    font: inherit;
  }
  .modal-text-input:focus {
    outline: none;
    border-color: var(--navy-mid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 8%, transparent);
  }
  .mapping-table {
    width: 100%;
    border-collapse: collapse;
  }
  .mapping-table thead tr {
    background: transparent;
  }
  .mapping-table thead th {
    background: transparent;
    padding: 9px 12px;
    text-align: left;
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--navy);
    border-bottom: 1px solid var(--border);
  }
  .mapping-table thead th:hover {
    color: var(--navy);
  }
  .mapping-table tbody tr { border-bottom: 1px solid var(--border); }
  .mapping-table tbody tr:last-child { border-bottom: none; }
  .mapping-table tbody td { padding: 9px 10px; vertical-align: middle; }
  .mapping-field-name {
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 600;
    color: var(--navy);
  }
  .mapping-field-req {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    color: var(--md-sys-color-error);
    margin-left: 4px;
  }
  .mapping-field-desc {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-top: 1px;
  }
  .mapping-select {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 6px 28px 6px 10px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    color: var(--navy);
    background: var(--cream);
    font-family: var(--md-ref-typeface-plain);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234A6075' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 9px center;
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .mapping-select:focus { outline: none; border-color: var(--navy-mid); }
  .mapping-select.mapped { border-color: var(--sage-dark); background-color: var(--md-sys-color-background); }
  .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
    background: var(--cream);
    border-radius: 0 0 var(--md-sys-shape-corner-large) var(--md-sys-shape-corner-large);
  }
  .modal-btn-primary {
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    padding: 9px 22px;
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 500;
    font-family: var(--md-ref-typeface-plain);
    cursor: pointer;
    transition: background 0.15s;
  }
  .modal-btn-primary:hover { background: var(--navy-mid); }
  .modal-btn-secondary {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 9px 16px;
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 500;
    font-family: var(--md-ref-typeface-plain);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
  }
  .modal-btn-secondary:hover { border-color: var(--sage-dark); color: var(--navy); }
  .bulk-keyword-modal {
    width: 640px;
  }
  .keyword-research-prompt-modal {
    width: 720px;
  }
  .keyword-research-prompt-modal .modal-field + .modal-field {
    margin-top: 14px;
  }
  .keyword-research-prompt-output {
    width: 100%;
    min-height: 230px;
    resize: vertical;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 14px 16px;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--mrc-typescale-data-medium-size);
    line-height: 1.6;
    color: var(--navy);
    background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface-container-lowest) 100%);
  }
  .keyword-research-prompt-output:focus {
    outline: none;
    border-color: var(--sage-dark);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  }
  .bulk-keyword-textarea {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 14px 16px;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--mrc-typescale-data-medium-size);
    line-height: 1.6;
    color: var(--navy);
    background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface-container-lowest) 100%);
  }
  .bulk-keyword-textarea:focus {
    outline: none;
    border-color: var(--sage-dark);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  }

  /* ── UPLOAD ZONE ── */
  .audit-toolbar-shell {
    padding: 16px 32px 0;
  }
  .upload-section {
    padding: 16px 32px 0;
  }
  .upload-zone {
    border: 2px dashed var(--sage);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--white);
    background-clip: padding-box;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
  }
  .upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--navy-mid);
    background: var(--md-sys-color-surface);
  }
  .upload-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    color: var(--sage-dark);
  }
  .upload-text { flex: 1; }
  .upload-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 600;
    color: var(--navy);
  }
  .upload-sub {
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-small-size);
    margin-top: 1px;
  }
  .upload-input { display: none; }
  .upload-btn {
    flex-shrink: 0;
    display: inline-block;
    background: var(--navy);
    color: var(--white);
    padding: 7px 16px;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
  }
  .upload-btn:hover { background: var(--navy-mid); }
  .upload-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
  }
  .file-name-badge {
    display: none;
    margin-top: 12px;
    background: var(--success-light);
    color: var(--success);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    padding: 6px 14px;
    border-radius: var(--md-sys-shape-corner-large);
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  /* ── DATA MANAGEMENT FILE UPLOAD ── */
  .file-upload-card {
    max-width: 860px;
  }
  .file-upload-zone {
    margin-top: 18px;
    padding: 18px 20px;
  }
  .file-upload-actions {
    margin-top: 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  .file-upload-progress {
    width: 100%;
    height: 9px;
    margin-top: 16px;
    accent-color: var(--sage-dark);
  }
  #partnerFileUploadStatus[data-state="success"] {
    color: var(--success);
    font-weight: 600;
  }
  #partnerFileUploadStatus[data-state="error"] {
    color: var(--md-sys-color-error);
    font-weight: 600;
  }

  /* ── DATA MANAGEMENT PARTNER DATA ── */
  .partner-data-card {
    max-width: none;
  }
  .partner-data-head {
    gap: 16px;
  }
  .partner-data-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
  }
  .partner-data-tab {
    border: 1px solid var(--border);
    background: var(--md-sys-color-surface-container-lowest);
    color: var(--text-secondary);
    border-radius: var(--md-sys-shape-corner-full);
    padding: 8px 13px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.16s ease;
  }
  .partner-data-tab:hover,
  .partner-data-tab.active {
    border-color: color-mix(in srgb, var(--mrc-sys-color-brand) 18%, transparent);
    background: var(--navy);
    color: var(--md-sys-color-on-primary);
    box-shadow: 0 10px 22px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  }
  #partnerDataStatus {
    display: block;
    min-height: 18px;
    margin-top: 12px;
  }
  #partnerDataStatus[data-state="success"] {
    color: var(--success);
    font-weight: 700;
  }
  #partnerDataStatus[data-state="error"] {
    color: var(--danger);
    font-weight: 700;
  }
  .partner-data-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    margin-top: 16px;
  }
  .partner-data-form,
  .partner-data-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-large);
    background: var(--md-sys-color-surface-container-lowest);
    box-shadow: var(--shadow);
  }
  .partner-data-form {
    padding: 16px;
  }
  .partner-data-form-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
  }
  .partner-data-form-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 800;
    color: var(--navy);
  }
  .partner-data-form-subtitle {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: 1.45;
  }
  .partner-data-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 11px;
  }
  .partner-data-field {
    display: grid;
    gap: 5px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    color: var(--text-secondary);
  }
  .partner-data-field input,
  .partner-data-field select,
  .partner-data-field textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 9px 10px;
    color: var(--text-primary);
    background: var(--md-sys-color-surface-container-lowest);
    font: inherit;
  }
  .partner-data-field textarea {
    min-height: 74px;
    resize: vertical;
  }
  .partner-data-field input:focus,
  .partner-data-field select:focus,
  .partner-data-field textarea:focus {
    outline: none;
    border-color: var(--sage-dark);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 14%, transparent);
  }
  .partner-data-field-checkbox {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-lowest);
  }
  .partner-data-field-checkbox input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--sage-dark);
  }
  .partner-data-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 15px;
  }
  /* Manual | Import JSON switch at the top of the Search Taxonomy Add Row card. */
  .partner-data-mode-toggle {
    display: inline-flex;
    gap: 2px;
    margin-bottom: 14px;
    padding: 3px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-background);
  }
  .partner-data-mode-btn {
    padding: 6px 14px;
    border: 0;
    border-radius: var(--md-sys-shape-corner-small);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    cursor: pointer;
  }
  .partner-data-mode-btn.active {
    background: var(--white);
    color: var(--navy);
    box-shadow: 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 14%, transparent);
  }
  .partner-data-mode-btn:disabled { opacity: 0.55; cursor: default; }
  .partner-data-mode-btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
  .partner-data-json-import { margin-top: 4px; }
  .partner-data-json-import textarea {
    box-sizing: border-box;
    display: block;
    width: 100%;
    min-height: 190px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--md-sys-color-surface-container-lowest);
    color: var(--text-primary);
    font: 12px/1.5 var(--mrc-typeface-mono);
    resize: vertical;
  }
  .partner-data-json-import textarea:focus {
    outline: none;
    border-color: var(--sage-dark);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 14%, transparent);
  }
  .partner-data-json-import-help {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: 1.5;
  }
  .partner-data-json-import-help code {
    padding: 1px 3px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--md-sys-color-background);
    color: var(--navy);
  }
  .partner-data-table-wrap {
    min-width: 0;
    overflow: hidden;
  }
  .partner-data-table-meta {
    padding: 13px 15px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
  }
  .partner-data-table-scroll {
    overflow: auto;
    max-height: 620px;
  }
  .partner-data-table {
    width: 100%;
    min-width: 820px;
    border-collapse: collapse;
    font-size: var(--md-sys-typescale-body-small-size);
  }
  .partner-data-table th,
  .partner-data-table td {
    padding: 9px 11px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
  }
  .partner-data-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--md-sys-color-surface);
    color: var(--navy);
    font-size: var(--md-sys-typescale-body-small-size);
    letter-spacing: 0.02em;
  }
  .partner-data-row-actions {
    display: flex;
    gap: 7px;
    white-space: nowrap;
  }
  .classifier-reset-btn.danger {
    border-color: color-mix(in srgb, var(--md-sys-color-error) 24%, transparent);
    color: var(--danger);
  }
  @media (max-width: 980px) {
    .partner-data-layout {
      grid-template-columns: 1fr;
    }
    .partner-data-head {
      align-items: flex-start;
      flex-direction: column;
    }
  }

/* ── TOOL TABS: Forecasts and Ad Audit pages switch here, one sidebar link each ── */
.tool-tabs {
  align-items: center; background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 40px; position: sticky; top: 52px; z-index: 99;
}
.tool-tabs[hidden] { display: none; }
@media (max-width: 720px) { .tool-tabs { padding: 0 16px; } }

/* "Max is thinking" while Chat with Max is querying: a light sweep across the text, on the Chat with Max page and in the Power BI popup */
.max-shimmer {
  color: transparent;
  background: linear-gradient(100deg, var(--text-secondary) 35%, color-mix(in srgb, var(--mrc-sys-color-brand) 28%, transparent) 50%, var(--text-secondary) 65%) 0 0 / 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: maxShimmer 1.6s linear infinite;
}
@keyframes maxShimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}
/* Header and sidebar buttons: the tap target is 48px tall even though the button is shorter. */
.toggle-btn, .logout-btn { position: relative; }
.toggle-btn::after, .logout-btn::after { content: ''; position: absolute; left: -4px; right: -4px; top: 50%; height: var(--mrc-touch-target); transform: translateY(-50%); }

/* ---------- Small screens: the sidebar becomes a drawer (compact and medium window sizes, under 840px) ---------- */
.nav-menu-btn {
  display: none; align-items: center; justify-content: center; flex: none; width: var(--mrc-touch-target); height: var(--mrc-touch-target); margin: 0 4px 0 -8px; padding: 0; border: 0;
  border-radius: var(--md-sys-shape-corner-full); background: transparent; color: var(--md-sys-color-on-surface); cursor: pointer;
}
.nav-menu-btn:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) calc(var(--md-sys-state-hover-state-layer-opacity) * 100%), transparent); }
.nav-scrim { position: fixed; inset: 0; z-index: 190; background: color-mix(in srgb, var(--md-sys-color-scrim) 32%, transparent); }
@media (max-width: 839px) {
  .nav-menu-btn { display: inline-flex; }
  /* Closed, the drawer is off screen and hidden from the keyboard and screen readers (visibility), so nothing in it can be tabbed to. */
  .sidebar, .sidebar.collapsed {
    width: min(280px, 86vw); min-width: 0; transform: translateX(-100%); visibility: hidden;
    transition: transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized-accelerate), visibility 0s linear var(--md-sys-motion-duration-medium2);
  }
  body.nav-open .sidebar {
    transform: none; visibility: visible; box-shadow: var(--md-sys-elevation-level3);
    transition: transform var(--md-sys-motion-duration-medium4) var(--md-sys-motion-easing-emphasized-decelerate), visibility 0s;
  }
  /* A remembered "collapsed" desktop sidebar must not shrink the drawer's labels. */
  .sidebar.collapsed .sidebar-logo-text, .sidebar.collapsed .sidebar-section-label { opacity: 1; }
  .sidebar.collapsed .nav-label { opacity: 1; width: auto; }
  .sidebar.collapsed .power-bi-subnav { display: block; }
  .sidebar-toggle { display: none; }
  .page-content, .page-content.collapsed { margin-left: 0; }
  body.nav-open { overflow: hidden; }
  .topbar { padding: 0 12px 0 8px; gap: 8px; }
  .topbar-heading { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .skip-link, .sidebar, body.nav-open .sidebar { transition: none; }
  .max-shimmer { animation: none; color: var(--text-secondary); background: none; }
}

/* css/dashboard.css */
/* ── DASHBOARD BODY ── */
  .dashboard { display: none; padding: 36px 40px 80px; }
  .dashboard.visible { display: block; }
  .audit-view-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
  }
  .audit-view-toolbar .audit-header-actions {
    margin-left: auto;
    justify-content: flex-end;
  }
  /* The period toggle (.audit-period-*) and the Google views (.google-subnav*) are segmented toggle and secondary tabs from css/dash-components.css; the classes stay as hooks for the scripts. */
  .google-subnav { flex-wrap: wrap; }
  .google-view { display: none; }
  .google-view.active { display: block; }


  .multichannel-view { display: none; padding: 36px 40px 80px; }
  .multichannel-shell { display: grid; gap: 20px; }
  .multichannel-kpi-grid { margin-bottom: 0; }
  .multichannel-empty { background: var(--white); border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); padding: 20px; color: var(--text-muted); box-shadow: var(--shadow); }
  .multichannel-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); padding: 18px; box-shadow: var(--shadow); }
  .multichannel-panel-title { font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; color: var(--navy); margin-bottom: 12px; }
  .multichannel-table-wrap { overflow: auto; }
  .multichannel-table { width: 100%; border-collapse: collapse; min-width: 920px; }
  .multichannel-table th, .multichannel-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: var(--md-sys-typescale-body-small-size); }
  .multichannel-table th { font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sage-light); text-align: left; background: var(--navy); }
  .multichannel-table th.td-right { text-align: right; }
  .multichannel-table th:hover { color: var(--white); }
  .multichannel-table tfoot td { font-weight: 700; color: var(--navy); background: var(--md-sys-color-background); border-top: 2px solid var(--navy-mid); }
  .summary-total-row {
    background: var(--md-sys-color-background);
    border-top: 2px solid var(--navy-mid);
  }
  .summary-total-row td {
    color: var(--navy);
  }
  .summary-total-label {
    padding: 10px 14px;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--navy);
  }
  .summary-total-value {
    color: var(--navy);
    font-size: var(--mrc-typescale-data-medium-size);
  }
  .summary-total-value-inline {
    font-size: var(--md-sys-typescale-body-small-size);
    white-space: nowrap;
  }
  .summary-total-brand {
    color: var(--navy);
    font-weight: 600;
  }
  .summary-total-separator {
    color: color-mix(in srgb, var(--mrc-sys-color-brand) 45%, transparent);
    margin: 0 2px;
  }
  .summary-total-sub {
    color: color-mix(in srgb, var(--mrc-sys-color-brand) 55%, transparent);
  }
  .summary-total-muted {
    color: color-mix(in srgb, var(--mrc-sys-color-brand) 45%, transparent);
    font-size: var(--md-sys-typescale-body-small-size);
  }
  .campaign-allocation-inline {
    font-size: var(--md-sys-typescale-body-small-size);
    white-space: nowrap;
  }
  .campaign-allocation-brand {
    color: var(--mrc-sys-color-success);
    font-weight: 600;
  }
  .campaign-allocation-nonbrand {
    color: var(--mrc-sys-color-warning);
    font-weight: 600;
  }
  .campaign-allocation-competitor {
    color: var(--md-sys-color-error);
    font-weight: 600;
  }
  .campaign-allocation-separator {
    color: var(--border);
    margin: 0 2px;
  }
  .multichannel-table.compact { min-width: 100%; }
  .multichannel-brand-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .multichannel-brand-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); overflow: hidden; box-shadow: var(--shadow); }
  .multichannel-brand-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
  .multichannel-brand-totals { font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); }
  .multichannel-brand-bar {
    height: 6px;
    border-radius: 0;
    background: var(--md-sys-color-surface-container);
  }
  .multichannel-brand-card .multichannel-table th {
    color: var(--navy);
    background: var(--md-sys-color-surface);
  }
  .multichannel-brand-card .multichannel-table th:hover {
    color: var(--navy);
  }
  .multichannel-brand-card .multichannel-table-wrap {
    padding: 0 16px 16px;
  }
  .multichannel-channel-badge { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: var(--md-sys-shape-corner-full); font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; }
  .multichannel-channel-badge.amazon { background: var(--md-sys-color-surface-container); color: var(--mrc-sys-color-warning); }
  .multichannel-channel-badge.google { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-primary); }
  .multichannel-channel-badge.meta { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-primary); }
  .multichannel-channel-badge.reddit { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-error); }
  .multichannel-channel-badge.tiktok { background: var(--md-sys-color-surface-container); color: var(--md-sys-color-on-primary-container); }
  .multichannel-channel-badge.walmart { background: var(--mrc-sys-color-success-container); color: var(--mrc-sys-color-success); }

.insights-page-view { display: none; padding: 36px 40px 80px; }
#dataChatView {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  padding-top: 0;
  padding-bottom: 0;
  min-height: calc(100vh - 52px);
  background: var(--white);
}
.insights-page-shell { display: grid; gap: 18px; min-width: 0; width: 100%; }
.insights-page-intro { display: grid; gap: 6px; }
.insights-page-note { color: var(--text-secondary); font-size: var(--mrc-typescale-data-medium-size); max-width: 860px; }
.insights-filter-card,
.insights-report-card,
.data-chat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); box-shadow: var(--shadow); }
.insights-filter-card { padding: 18px; }
.insights-filter-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.insights-filter-field { display: flex; flex-direction: column; gap: 6px; }
.insights-filter-field span { font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; }
.insights-filter-field .insights-filter-helper {
  min-height: 16px;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-muted);
  letter-spacing: normal;
  text-transform: none;
}
.insights-filter-helper.error {
  color: var(--danger);
}
.insights-filter-helper.success {
  color: var(--sage-dark);
}
.insights-filter-field select,
.insights-filter-field input,
.data-chat-input { width: 100%; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface-container-lowest); color: var(--navy); padding: 10px 12px; font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-small-size); box-shadow: inset 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 3%, transparent); }
.client-reporting-channel-dropdown {
  position: relative;
  width: 100%;
}
.client-reporting-channel-button {
  position: relative;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--navy);
  padding: 10px 34px 10px 12px;
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-small-size);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: inset 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 3%, transparent);
  cursor: pointer;
}
.client-reporting-channel-button::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--navy);
  border-bottom: 1.5px solid var(--navy);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}
.client-reporting-channel-button:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.72;
}
.client-reporting-channel-button[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--mrc-sys-color-brand) 38%, transparent);
  background: var(--white);
}
.client-reporting-channel-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  grid-template-columns: 1fr;
  max-height: 260px;
  box-shadow: 0 18px 42px color-mix(in srgb, var(--md-sys-color-shadow) 16%, transparent);
}
.client-reporting-channel-menu[hidden] {
  display: none;
}
.insights-report-card { padding: 18px 18px 12px; min-width: 0; width: 100%; overflow: hidden; }
.monday-insights-header-card { overflow: visible; }
.insights-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.insights-report-title,
.data-chat-title { font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-title-medium-size); font-weight: 600; color: var(--navy); }
.insights-report-subtitle,
.data-chat-subtitle { margin-top: 4px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); line-height: 1.45; }
.insights-report-subtitle.success { color: var(--sage-dark); }
.insights-report-subtitle.error { color: var(--md-sys-color-error); }
.insights-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}
.insights-filter-actions .classifier-reset-btn {
  flex: 0 0 auto;
}
  .insights-report-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; }
  .insights-report-table { width: max-content; min-width: 100%; border-collapse: collapse; }
  .insights-report-table.compact { min-width: 640px; }
  .insights-report-table th,
  .insights-report-table td { padding: 12px 12px; border-bottom: 1px solid var(--border); font-size: var(--md-sys-typescale-body-small-size); text-align: left; }
  .insights-report-table th { font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sage-light); background: var(--navy); }
  .insights-report-table th:hover { color: var(--white); }
  .insights-report-table tbody tr:hover td { background: var(--md-sys-color-surface-container-lowest); }
.client-reporting-table-wrap {
  overflow-y: hidden;
}
.client-reporting-table-wrap .insights-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.generated-reports-list {
  display: grid;
  gap: 12px;
}
.monthly-reporting-brands-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px 14px;
}
.monthly-reporting-brand-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface) 100%);
  color: var(--navy);
  font-size: var(--mrc-typescale-data-medium-size);
}
.monthly-reporting-brand-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
  flex: 0 0 auto;
}
.generated-reports-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface) 100%);
}
.generated-reports-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}
.generated-reports-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.generated-reports-title {
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-medium-size);
  font-weight: 600;
  color: var(--navy);
}
.generated-reports-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--text-muted);
}
.generated-reports-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--md-sys-shape-corner-full);
  padding: 4px 8px;
  background: var(--md-sys-color-background);
  color: var(--navy);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.generated-reports-pill.success {
  background: var(--mrc-sys-color-success-container);
  color: var(--sage-dark);
}
.generated-reports-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 10px;
}
.generated-reports-download-btn {
  white-space: nowrap;
}
.generated-reports-delete-btn {
  white-space: nowrap;
}
.monday-insights-controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-top: 6px;
}
.monday-insights-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.monday-insights-run-field {
  width: min(340px, 100%);
}
.monday-insights-client-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  position: relative;
}
.monday-insights-client-tabs.has-overflow-menu {
  z-index: 30;
}
.monday-insights-client-tab {
  border: 1px solid var(--border);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--navy);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 9px 14px;
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.monday-insights-client-tab:hover {
  border-color: var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
}
.monday-insights-client-tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--white);
}
.monday-insights-client-tab.more {
  border-style: dashed;
  background: var(--md-sys-color-surface-container-lowest);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.monday-insights-client-tab.more.active {
  background: var(--md-sys-color-surface-container-lowest);
  border-color: var(--navy);
  color: var(--navy);
}
.monday-insights-client-tab.more.selected-overflow {
  border-style: solid;
  border-color: var(--navy);
}
.monday-insights-more-wrap {
  position: relative;
  display: inline-flex;
  z-index: 2;
}
.monday-insights-more-caret {
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1;
  opacity: 0.72;
}
.monday-insights-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: min(280px, calc(100vw - 48px));
  max-height: 320px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--white);
  box-shadow: 0 18px 46px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
}
.monday-insights-more-option {
  width: 100%;
  border: 0;
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 11px;
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.monday-insights-more-option:hover {
  background: var(--md-sys-color-surface);
}
.monday-insights-more-option.active {
  background: var(--md-sys-color-surface-container);
  color: var(--navy);
}
.monday-insights-more-current {
  flex: 0 0 auto;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--navy);
  color: var(--white);
  padding: 3px 7px;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 800;
  letter-spacing: 0.02em;
}
.monday-insights-client-tabs.overflow-open {
  row-gap: 10px;
  z-index: 80;
}
.monday-insights-content {
  display: grid;
  gap: 18px;
}
.monday-insight-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.monday-insight-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.monday-insight-card-title {
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-medium-size);
  font-weight: 700;
  color: var(--navy);
}
.monday-insight-card-subtitle {
  margin-top: 5px;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--text-muted);
}
.monday-insight-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-background);
  color: var(--navy);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.monday-insight-status-pill.success {
  background: var(--success-light);
  color: var(--success);
}
.monday-insight-status-pill.warning {
  background: var(--warning-light);
  color: var(--warning);
}
.monday-insight-status-pill.error {
  background: var(--danger-light);
  color: var(--danger);
}
.monday-insight-card-body {
  padding: 16px 18px 18px;
}
.monday-insight-empty {
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
}
.monday-insight-error {
  color: var(--danger);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.55;
}
.monday-prompt-config-grid {
  display: grid;
  gap: 16px;
}
.monday-prompt-config-modal {
  width: min(860px, calc(100vw - 40px));
  max-height: min(88vh, 980px);
}
.monday-prompt-config-modal .modal-body {
  overflow-y: auto;
}
.monday-prompt-config-controls {
  margin-top: 0;
  margin-bottom: 18px;
}
.monday-prompt-config-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}
.monday-prompt-config-column {
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 16px;
  background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface-container-lowest) 100%);
}
.monday-prompt-config-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.monday-prompt-config-column h3 {
  margin: 0;
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-title-medium-size);
  color: var(--navy);
}
.monday-prompt-add-btn {
  padding: 8px 12px;
  font-size: var(--md-sys-typescale-body-small-size);
}
.monday-prompt-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
}
.monday-prompt-card + .monday-prompt-card {
  margin-top: 12px;
}
.monday-prompt-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.monday-prompt-card-title {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--navy);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.monday-prompt-delete-btn {
  border: 1px solid var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--md-sys-color-error);
  cursor: pointer;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 800;
  padding: 6px 10px;
}
.monday-prompt-delete-btn:hover {
  border-color: var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface);
}
.monday-prompt-field {
  display: grid;
  gap: 6px;
}
.monday-prompt-field span {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.monday-prompt-field input,
.monday-prompt-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 10px 12px;
  font: inherit;
  color: var(--navy);
  background: var(--md-sys-color-surface-container-lowest);
}
.monday-prompt-field textarea {
  min-height: 118px;
  resize: vertical;
  line-height: 1.5;
}
.monday-prompt-field textarea::placeholder {
  color: var(--mrc-sys-color-on-brand-variant);
}
.monday-followup-wrap {
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  display: grid;
  gap: 12px;
}
.monday-followup-thread {
  display: grid;
  gap: 12px;
}
.monday-followup-item {
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
  padding: 14px;
}
.monday-followup-question {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.monday-followup-composer {
  display: grid;
  gap: 10px;
}
.monday-followup-composer textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 12px 14px;
  font: inherit;
  color: var(--navy);
  background: var(--md-sys-color-surface-container-lowest);
}
.monday-followup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.monday-followup-helper {
  flex: 1 1 280px;
  min-width: 0;
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.45;
  color: var(--text-muted);
}
.monday-followup-actions .upload-btn {
  flex: 0 0 auto;
}
.monday-followup-inline-status {
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--text-muted);
}
.insights-chat-shell { max-width: none; margin: 0; flex: 1 1 auto; min-height: calc(100vh - 52px); height: calc(100vh - 52px); background: var(--white); overflow: hidden; }
.data-chat-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100%; height: 100%; background: var(--white); border: none; border-radius: 0; box-shadow: none; overflow: hidden; }
.data-chat-sidebar { display: grid; grid-template-rows: auto auto minmax(0, 1fr); background: var(--white); border: none; border-right: 1px solid var(--md-sys-color-surface-container-high); border-radius: 0; min-width: 0; align-self: stretch; position: static; max-height: none; overflow: hidden; }
.data-chat-sidebar-head { padding: 18px 18px 14px; }
.data-chat-new-link { background: none; border: none; color: var(--navy-light); font: inherit; font-size: var(--mrc-typescale-data-medium-size); font-weight: 600; cursor: pointer; padding: 0; }
.data-chat-new-link:hover { color: var(--navy); }
.data-chat-sidebar-section { padding: 0 18px 8px; font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.data-chat-session-list {
  display: grid;
  gap: 4px;
  padding: 0 10px 16px;
  min-height: 0;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.data-chat-session-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px; }
.data-chat-session-row.active { background: var(--md-sys-color-surface-container); border-radius: var(--md-sys-shape-corner-medium); }
.data-chat-session-item { width: 100%; min-width: 0; border: none; background: transparent; color: var(--text-secondary); text-align: left; padding: 10px 12px; border-radius: var(--md-sys-shape-corner-medium); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; overflow: hidden; }
.data-chat-session-item:hover { background: var(--md-sys-color-background); color: var(--navy); }
.data-chat-session-item.active { background: var(--md-sys-color-surface-container); color: var(--navy); }
.data-chat-session-title { display: block; width: 100%; min-width: 0; font-size: var(--mrc-typescale-data-medium-size); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-chat-session-menu { position: relative; display: flex; align-items: center; padding-right: 8px; }
.data-chat-session-menu-toggle { width: 28px; height: 28px; border: none; border-radius: var(--md-sys-shape-corner-full); background: transparent; color: var(--text-muted); font-size: var(--md-sys-typescale-title-medium-size); line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.data-chat-session-menu-toggle:hover,
.data-chat-session-menu-toggle[aria-expanded="true"] { background: var(--md-sys-color-background); color: var(--navy); }
.data-chat-session-menu-popover { position: absolute; top: calc(100% + 6px); right: 0; min-width: 118px; background: var(--md-sys-color-surface-container-lowest); border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); box-shadow: 0 12px 28px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent); padding: 6px; display: none; z-index: 20; }
.data-chat-session-menu-popover.open { display: grid; gap: 2px; }
.data-chat-session-menu-item { border: none; background: transparent; color: var(--navy); text-align: left; font-size: var(--md-sys-typescale-body-small-size); font-weight: 600; padding: 8px 10px; border-radius: var(--md-sys-shape-corner-small); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.data-chat-session-menu-item:hover { background: var(--md-sys-color-background); }
.data-chat-session-menu-item.danger:hover { background: var(--md-sys-color-background); color: var(--md-sys-color-error); }
.data-chat-session-empty { padding: 6px 8px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); }
.data-chat-main { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0; min-height: 0; background: var(--white); padding-left: 22px; overflow: hidden; }
.data-chat-main-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 24px 28px 6px; }
.data-chat-body { display: grid; gap: 22px; padding: 12px 28px 18px; min-height: 0; background: var(--white); align-content: start; overflow-y: auto; overflow-x: hidden; border: none; border-radius: 0; }
.data-chat-message { display: flex; width: min(860px, 100%); margin: 0 auto; justify-content: flex-start; }
.data-chat-message.assistant { justify-content: flex-start; }
.data-chat-message.user { justify-content: flex-start; }
.data-chat-context-reset { width: min(860px, 100%); margin: 18px auto; padding: 9px 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); line-height: 1.4; text-align: center; }
.data-chat-bubble { width: 100%; max-width: 860px; background: transparent; color: var(--navy); border: none; border-radius: 0; padding: 0; font-size: var(--mrc-typescale-data-medium-size); line-height: 1.62; box-shadow: none; }
.data-chat-message.user .data-chat-bubble { width: auto; max-width: 720px; margin-right: 0; background: var(--md-sys-color-surface); border: none; border-radius: var(--md-sys-shape-corner-large); padding: 12px 16px; }
.data-chat-bubble h1,
.data-chat-bubble h2,
.data-chat-bubble h3,
.data-chat-bubble h4 { margin: 18px 0 8px; font-family: var(--md-ref-typeface-plain); color: var(--navy); }
.data-chat-bubble h1,
.data-chat-bubble h2 { font-size: var(--md-sys-typescale-title-large-size); }
.data-chat-bubble h3 { font-size: var(--md-sys-typescale-title-medium-size); }
.data-chat-bubble h4 { font-size: var(--md-sys-typescale-body-medium-size); }
.data-chat-bubble code, .insight-detail-value code, .partner-data-json-import-help code { font-family: var(--mrc-typeface-mono); font-size: var(--md-sys-typescale-body-small-size); }
.data-chat-bubble > :first-child:is(h1, h2, h3, h4) { margin-top: 0; }
.data-chat-bubble p { margin: 0 0 10px; }
.data-chat-bubble p:last-child { margin-bottom: 0; }
.data-chat-bubble ul,
.data-chat-bubble ol {
  margin: 0 0 12px 4px;
  padding-left: 24px;
}
.data-chat-bubble ul:last-child,
.data-chat-bubble ol:last-child { margin-bottom: 0; }
.data-chat-bubble li {
  padding-left: 2px;
}
.data-chat-bubble li + li { margin-top: 6px; }
.data-chat-formula {
  margin: 2px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--md-sys-color-surface-container-high);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--navy);
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--mrc-typescale-data-medium-size);
  font-weight: 600;
  line-height: 1.45;
  overflow-x: auto;
}
.insight-rich-text {
  display: grid;
  gap: 12px;
  max-width: 1120px;
}
.insight-block {
  min-width: 0;
}
.insight-block-first {
  margin-top: 0;
}
.insight-paragraph {
  margin: 0;
  font-size: var(--mrc-typescale-data-medium-size);
  line-height: 1.68;
  color: var(--navy);
}
.insight-paragraph-summary {
  font-size: var(--md-sys-typescale-body-medium-size);
  line-height: 1.72;
}
.insight-paragraph-bridge {
  font-weight: 600;
  color: var(--navy);
}
.insight-section-title {
  margin: 8px 0 0;
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--mrc-typescale-data-medium-size);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--navy);
}
.insight-list {
  margin: 0;
  padding-left: 30px;
  color: var(--navy);
}
.insight-list li {
  padding-left: 6px;
  font-size: var(--mrc-typescale-data-medium-size);
  line-height: 1.68;
}
.insight-list li + li {
  margin-top: 7px;
}
.insight-detail-list {
  display: grid;
  gap: 8px;
}
.insight-detail-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 24%, transparent);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
}
.insight-detail-label {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 800;
  letter-spacing: 0.035em;
  line-height: 1.45;
  text-transform: uppercase;
  color: var(--text-muted);
}
.insight-detail-value {
  min-width: 0;
  font-size: var(--mrc-typescale-data-medium-size);
  line-height: 1.58;
  color: var(--navy);
}
.data-chat-card-blocks { display: grid; gap: 12px; margin-top: 12px; }
.data-chat-result-card { border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface-container-lowest) 100%); box-shadow: 0 6px 18px color-mix(in srgb, var(--md-sys-color-shadow) 5%, transparent); overflow: hidden; }
.data-chat-result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px 10px; }
.data-chat-result-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.data-chat-table-toggle-btn { min-width: 92px; }
.data-chat-result-title { font-family: var(--md-ref-typeface-plain); font-size: var(--mrc-typescale-data-medium-size); font-weight: 700; color: var(--navy); }
.data-chat-result-meta { font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); }
.data-chat-result-note { padding: 0 16px 10px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); }
.data-chat-result-card .insights-report-table-wrap { border-top: 1px solid var(--border); border-radius: 0; background: var(--md-sys-color-surface-container-lowest); }
.data-chat-table-wrap {
  max-height: 472px;
  overflow-y: auto;
}
.data-chat-table-wrap .insights-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.monday-insights-table-wrap {
  max-height: 472px;
  overflow-y: auto;
}
.monday-insights-table-wrap .insights-report-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}
.data-chat-chart-placeholder { padding: 14px 16px 16px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); }
.data-chat-chart-preview-wrap { padding: 8px 16px 16px; border-top: 1px solid var(--border); background: var(--md-sys-color-surface-container-lowest); }
.data-chat-chart-preview { display: block; max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); background: var(--md-sys-color-surface-container-lowest); }
.data-chat-vega-wrap { padding: 12px 16px 16px; border-top: 1px solid var(--border); background: var(--md-sys-color-surface-container-lowest); overflow-x: auto; }
.data-chat-vega-chart { min-height: 320px; min-width: 520px; }
.data-chat-vega-chart > div { width: 100%; }
.data-chat-vega-chart svg { display: block; max-width: 100%; height: auto; }
.data-chat-warning { padding: 10px 12px; border-radius: var(--md-sys-shape-corner-medium); background: var(--md-sys-color-surface); color: var(--md-sys-color-tertiary); font-size: var(--md-sys-typescale-body-small-size); }
.data-chat-empty-note { color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.data-chat-input-shell { padding: 0 28px 24px; background: var(--white); position: sticky; bottom: 0; }
.data-chat-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; padding: 12px 14px; border: 1px solid var(--md-sys-color-surface-container-high); border-radius: var(--md-sys-shape-corner-large); background: var(--md-sys-color-surface-container-lowest); box-shadow: none; }
.data-chat-input { width: 100%; min-height: 24px; max-height: 160px; box-sizing: border-box; overflow-y: hidden; resize: none; border: none; background: transparent; color: var(--navy); padding: 2px 0; font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-medium-size); box-shadow: none; }
.data-chat-input:focus { outline: none; }
.data-chat-send-btn { align-self: end; justify-self: end; min-width: 92px; height: 40px; border-radius: var(--md-sys-shape-corner-full); }
.data-chat-send-btn:disabled { opacity: 0.7; cursor: wait; }
.custom-analysis-drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  justify-content: flex-end;
  background: color-mix(in srgb, var(--mrc-sys-color-brand) 28%, transparent);
}
.custom-analysis-drawer-overlay.visible { display: flex; }
.custom-analysis-drawer {
  width: min(560px, 100%);
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--md-sys-color-surface-container-lowest);
  box-shadow: -18px 0 38px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
}
.custom-analysis-drawer-head,
.custom-analysis-drawer-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
}
.custom-analysis-drawer-footer {
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  border-bottom: none;
}
.custom-analysis-drawer-body {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 22px 24px;
  overflow-y: auto;
}
.custom-analysis-section {
  display: grid;
  gap: 10px;
}
.custom-analysis-section-title {
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--navy);
}
.custom-analysis-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--navy);
  font-size: var(--mrc-typescale-data-medium-size);
  line-height: 1.45;
}
.custom-analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.custom-analysis-brand-field {
  display: grid;
  gap: 8px;
}
.custom-analysis-brand-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 238px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 28%, transparent);
  border-radius: var(--md-sys-shape-corner-large);
  background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface) 100%);
}
.custom-analysis-brand-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--md-sys-color-outline) 24%, transparent);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
  font-size: var(--mrc-typescale-data-medium-size);
  font-weight: 600;
  line-height: 1.25;
  user-select: none;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}
.custom-analysis-brand-option:hover {
  border-color: color-mix(in srgb, var(--mrc-sys-color-brand) 35%, transparent);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--md-sys-color-shadow) 6%, transparent);
}
.custom-analysis-brand-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--md-sys-color-outline) 55%, transparent);
  background: var(--md-sys-color-background);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
}
.custom-analysis-brand-option:has(input:disabled) {
  cursor: not-allowed;
  opacity: 0.62;
}
.custom-analysis-brand-option-all {
  grid-column: 1 / -1;
  background: var(--md-sys-color-surface);
}
.custom-analysis-brand-option input {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--sage-dark);
}
.custom-analysis-brand-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: normal;
  text-transform: none;
}
.custom-analysis-brand-empty {
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
}
.custom-analysis-status {
  min-height: 18px;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--text-muted);
}
.custom-analysis-status.success { color: var(--success); }
.custom-analysis-status.warning { color: var(--warning); }
.custom-analysis-status.error { color: var(--danger); }
.custom-analysis-status.muted { color: var(--text-muted); }
.custom-analysis-results {
  display: grid;
  gap: 14px;
}
.custom-analysis-result-list {
  display: grid;
  gap: 10px;
}
.custom-analysis-result-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
}
.custom-analysis-result-title {
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--mrc-typescale-data-medium-size);
  font-weight: 700;
  color: var(--navy);
}
.custom-analysis-result-meta {
  margin-top: 3px;
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.45;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.custom-analysis-result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.custom-analysis-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: var(--md-sys-shape-corner-full);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--md-sys-color-background);
  color: var(--text-muted);
}
.custom-analysis-pill.complete { background: var(--success-light); color: var(--success); }
.custom-analysis-pill.failed { background: var(--danger-light); color: var(--danger); }
.custom-analysis-prompt-box {
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  overflow: hidden;
  background: var(--md-sys-color-surface-container-lowest);
}
.custom-analysis-prompt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--navy);
}
.custom-analysis-prompt-box pre {
  margin: 0;
  padding: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.5;
  color: var(--navy);
  background: var(--md-sys-color-surface-container-lowest);
}

  /* ── SECTION HEADERS ── */
  .section-label {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sage-dark);
    margin-bottom: 12px;
    margin-top: 40px;
  }
  .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 40px;
    margin-bottom: 12px;
  }
  .section-header .section-label {
    margin: 0;
  }
  .audit-export-btn {
    white-space: nowrap;
  }

  /* ── ACCOUNT STRIP ── */
  .account-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }
  .account-name {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-title-large-size);
    font-weight: 600;
    color: var(--navy);
  }
  .audit-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .account-meta { font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); margin-top: 2px; }
  .filter-row { display: flex; gap: 8px; align-items: center; }
  .filter-select {
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 32px 7px 12px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    color: var(--navy);
    background: var(--white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%234A6075' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    font-family: var(--md-ref-typeface-plain);
    box-shadow: 0 1px 3px color-mix(in srgb, var(--md-sys-color-shadow) 6%, transparent);
    transition: border-color 0.15s, box-shadow 0.15s;
    letter-spacing: 0.01em;
  }
  .filter-select:hover {
    border-color: var(--sage-dark);
    box-shadow: 0 1px 5px color-mix(in srgb, var(--md-sys-color-shadow) 10%, transparent);
  }
  .filter-select:focus {
    outline: none;
    border-color: var(--navy-mid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  }
  .amazon-ad-type-filter {
    min-width: 190px;
  }

  /* ── KPI CARDS ── */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 36px;
  }
  .kpi-card {
    background: var(--white);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 16px 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    border-top: 3px solid var(--sage);
  }
  .kpi-card.danger { border-top-color: var(--danger); }
  .kpi-card.success { border-top-color: var(--success); }
  .kpi-bucket-label {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 4px;
  }
  .kpi-value {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-headline-medium-size);
    font-weight: 600;
    color: var(--navy);
    line-height: 1.1;
    margin-bottom: 10px;
  }
  .kpi-sub-lines {
    border-top: 1px solid var(--border);
    padding-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .kpi-sub-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .kpi-sub-key {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
  }
  .kpi-sub-val {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
  }
  .kpi-accent { border-top-color: var(--sage); }
  .kpi-accent-danger { border-top-color: var(--danger); }
  .kpi-accent-success { border-top-color: var(--success); }

  /* ── CHART CARDS ── */
  .chart-card {
    background: var(--white);
    border-radius: var(--md-sys-shape-corner-medium);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    margin-bottom: 28px;
  }
  .chart-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 4px;
  }
  .chart-subtitle {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-bottom: 16px;
  }
  .chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
  }
  @media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }

  /* ── TABLE ── */
  .table-wrap {
    overflow-x: auto;
    border-radius: var(--md-sys-shape-corner-medium);
    border: 1px solid var(--border);
    margin-bottom: 28px;
    background: var(--white);
    box-shadow: var(--shadow);
  }
  table { width: 100%; border-collapse: collapse; font-size: var(--mrc-typescale-data-medium-size); }
  thead tr { background: var(--navy); }
  thead th {
    padding: 11px 14px;
    text-align: left;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sage-light);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
  }
  thead th:hover { color: var(--white); }
  thead th.sortable { cursor: pointer; }
  thead th.sortable:hover { color: var(--white); }
  thead th .sort-indicator {
    display: inline-block;
    margin-left: 4px;
    opacity: 0.35;
    font-size: var(--md-sys-typescale-body-small-size);
    vertical-align: middle;
  }
  thead th.sort-asc .sort-indicator,
  thead th.sort-desc .sort-indicator { opacity: 1; color: var(--sage); }
  thead th.sort-asc .sort-indicator::after { content: '▲'; }
  thead th.sort-desc .sort-indicator::after { content: '▼'; }
  thead th:not(.sort-asc):not(.sort-desc) .sort-indicator::after { content: '⇅'; }
  tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
  tbody tr:nth-child(even) { background: var(--md-sys-color-surface); }
  tbody tr:hover { background: var(--md-sys-color-background) !important; }
  tbody tr:last-child { border-bottom: none; }
  tbody tr:hover { background: var(--md-sys-color-surface); }
  tbody td { padding: 10px 14px; color: var(--text-primary); vertical-align: middle; }
  thead th:last-child,
  tbody td:last-child,
  tfoot td:last-child { padding-right: 26px; }
  .td-right { text-align: right; font-variant-numeric: tabular-nums; }
  .waste-badge {
    display: inline-block;
    background: var(--danger-light);
    color: var(--danger);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--md-sys-shape-corner-large);
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .strong-badge {
    display: inline-block;
    background: var(--success-light);
    color: var(--success);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--md-sys-shape-corner-large);
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }
  .warn-badge {
    display: inline-block;
    background: var(--warning-light);
    color: var(--warning);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--md-sys-shape-corner-large);
    margin-left: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* ── PAGINATION ── */
  .table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    background: var(--cream);
    border-radius: 0 0 var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium);
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
  }
  .page-btns { display: flex; gap: 6px; }
  .page-btn {
    border: 1px solid var(--border);
    background: var(--white);
    padding: 4px 10px;
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-primary);
  }
  .page-btn.active { background: var(--navy); color: var(--white); border-color: var(--navy); }
  .page-btn:disabled { opacity: 0.4; cursor: default; }

  /* ── INSIGHTS PANEL ── */
  .insights-panel {
    background: var(--white);
    border-radius: var(--md-sys-shape-corner-large);
    overflow: hidden;
    margin-bottom: 40px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .insights-header {
    padding: 18px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 14px;
  }
  .insights-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-title-medium-size);
    font-weight: 600;
    color: var(--navy);
  }
  .health-label {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .insights-body { padding: 20px 24px 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  @media (max-width: 1080px) {
  .insights-filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .insights-page-view { padding: 30px 20px 72px; }
  #dataChatView {
    flex: 0 0 auto;
    display: block;
    padding-top: 0;
    padding-bottom: 24px;
    min-height: auto;
    background: var(--white);
  }
  #dataChatView::before { display: none; }
  .insights-filter-grid,
  .data-chat-input-row,
  .data-chat-header { grid-template-columns: 1fr; display: grid; }
  .custom-analysis-grid,
  .custom-analysis-brand-list { grid-template-columns: 1fr; }
  .data-chat-header { gap: 10px; }
  .insights-report-card,
  .insights-filter-card,
  .data-chat-card { padding: 16px; }
  .insights-chat-shell { flex: 0 0 auto; min-height: auto; height: auto; }
  .data-chat-workspace { grid-template-columns: 1fr; min-height: auto; height: auto; }
  .data-chat-sidebar { border: none; margin-left: 0; padding-left: 0; margin-bottom: 14px; }
  .data-chat-main { padding-left: 0; }
  .data-chat-main-head,
  .data-chat-body,
  .data-chat-input-shell { padding-left: 18px; padding-right: 18px; }
  .data-chat-message.user .data-chat-bubble { margin-right: 0; }
  .monday-insights-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .monday-insights-run-field {
    width: 100%;
  }
  .monday-prompt-config-columns {
    grid-template-columns: 1fr;
  }
  .monday-prompt-config-modal {
    width: min(100vw - 24px, 860px);
    max-height: min(92vh, 980px);
  }
  .monday-insight-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .generated-reports-row {
    flex-direction: column;
    align-items: stretch;
  }
  .generated-reports-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) { .insights-body { grid-template-columns: 1fr; } }
  .phrase-analysis-panel { margin-bottom: 0; }
  .phrase-analysis-header { align-items: flex-end; gap: 12px; }
  .phrase-analysis-subtitle {
    margin-top: 6px;
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 720px;
  }
  .phrase-analysis-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
  }
  .phrase-analysis-body { padding: 16px 24px 24px; }
  .phrase-analysis-source-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    border: 1px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    background: var(--white);
    box-shadow: var(--shadow);
  }
  .phrase-source-btn {
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    line-height: 1;
    padding: 9px 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .phrase-source-btn.active {
    background: var(--cream);
    border-color: var(--sage-dark);
    color: var(--navy);
    box-shadow: 0 1px 3px color-mix(in srgb, var(--md-sys-color-shadow) 8%, transparent);
  }
  .phrase-analysis-meta {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-bottom: 12px;
  }
  .phrase-table-wrap { margin-bottom: 0; }
  .phrase-total-row {
    background: var(--md-sys-color-background);
    border-top: 2px solid var(--navy-mid);
  }
  .phrase-total-row td {
    padding-top: 10px;
    padding-bottom: 10px;
    color: var(--navy);
  }
  .phrase-total-row td:first-child {
    padding-left: 14px;
  }
  .phrase-total-label {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--navy);
  }
  .phrase-total-value {
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 600;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
  }
  .phrase-total-sub {
    font-size: var(--md-sys-typescale-body-small-size);
    color: color-mix(in srgb, var(--mrc-sys-color-brand) 55%, transparent);
    font-variant-numeric: tabular-nums;
  }
  .phrase-total-row .unavailable-metric {
    color: color-mix(in srgb, var(--mrc-sys-color-brand) 55%, transparent);
  }
  .phrase-name {
    font-weight: 600;
    color: var(--navy);
    text-transform: none;
  }
  .phrase-metric-strong { color: var(--mrc-sys-color-success); }
  .phrase-metric-weak { color: var(--md-sys-color-error); }
  .report-type-modal { max-width: 560px; }
  .report-type-body {
    display: grid;
    gap: 10px;
  }
  .report-type-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 6px 0;
    cursor: pointer;
  }
  .report-type-choice {
    display: inline-flex;
    align-items: center;
    gap: 10px;
  }
  .report-type-choice input[type="radio"] {
    accent-color: var(--navy-mid);
    width: 16px;
    height: 16px;
    margin: 0;
  }
  .report-type-label {
    font-size: var(--md-sys-typescale-body-medium-size);
    font-weight: 500;
    color: var(--navy);
  }
  .report-type-status {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
  }
  .report-type-status.loaded {
    color: var(--success);
  }
  @media (max-width: 920px) {
    .phrase-analysis-header {
      align-items: stretch;
      flex-direction: column;
    }
    .phrase-analysis-controls { margin-left: 0; }
    .phrase-analysis-source-toggle {
      display: flex;
      width: 100%;
    }
    .phrase-source-btn {
      flex: 1 1 0;
    }
  }
  .insight-card {
    background: var(--cream);
    border-radius: var(--md-sys-shape-corner-medium);
    padding: 14px 16px;
    border-left: 3px solid var(--sage);
    border: 1px solid var(--border);
    border-left: 3px solid var(--sage);
  }
  .insight-card.danger { border-left-color: var(--md-sys-color-error); }
  .insight-card.warning { border-left-color: var(--mrc-sys-color-warning); }
  .insight-card.success { border-left-color: var(--mrc-sys-color-success); }
  .insight-card.info { border-left-color: var(--sage-dark); }
  .insight-type {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  .insight-card.danger .insight-type { color: var(--md-sys-color-error); }
  .insight-card.warning .insight-type { color: var(--mrc-sys-color-warning); }
  .insight-card.success .insight-type { color: var(--mrc-sys-color-success); }
  .insight-card.info .insight-type { color: var(--sage-dark); }
  .insight-text {
    font-size: var(--mrc-typescale-data-medium-size);
    color: var(--text-secondary);
    line-height: 1.55;
  }
  .insight-text strong { color: var(--navy); font-weight: 600; }

  /* ── BRAND BREAKDOWN PANEL ── */
  .brand-breakdown {
    display: none;
    margin-bottom: 28px;
  }
  .brand-breakdown.visible { display: block; }
  .brand-breakdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
  }
  .brand-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
  }
  .brand-card {
    background: var(--white);
    border-radius: var(--md-sys-shape-corner-medium);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .brand-card-header {
    padding: 10px 16px 9px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
  }
  .brand-card-label {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .brand-card-label.brand { color: var(--mrc-sys-color-success); }
  .brand-card-label.competitor { color: var(--md-sys-color-error); }
  .brand-card-label.nonbrand { color: var(--navy-mid); }
  .brand-card-spend {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
  }
  .brand-card-spend span {
    font-weight: 600;
    color: var(--text-secondary);
  }
  .brand-card-body {
    padding: 12px 16px 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 16px;
  }
  .brand-metric { }
  .brand-metric-label {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 2px;
  }
  .brand-metric-value {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-title-large-size);
    font-weight: 600;
    color: var(--navy);
    line-height: 1.1;
  }
  .brand-metric-sub {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-top: 1px;
    font-variant-numeric: tabular-nums;
  }
  .brand-spend-bar {
    height: 5px;
    border-radius: 0 0 var(--md-sys-shape-corner-extra-small) var(--md-sys-shape-corner-extra-small);
    background: var(--border);
    overflow: hidden;
    margin: 0;
  }
  .brand-spend-bar-fill {
    height: 100%;
    border-radius: var(--md-sys-shape-corner-extra-small);
    transition: width 0.6s ease;
  }
  .brand-spend-bar-fill.brand { background: var(--mrc-sys-color-success); }
  .brand-spend-bar-fill.competitor { background: var(--md-sys-color-error); }
  .brand-spend-bar-fill.nonbrand { background: var(--navy-mid); }

  /* ── CUSTOM TOOLTIP ── */
  .has-tip {
    position: relative;
    cursor: default;
  }
  .has-tip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--mrc-sys-color-brand);
    color: var(--md-sys-color-on-primary);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 400;
    font-family: var(--md-ref-typeface-plain);
    white-space: nowrap;
    padding: 5px 9px;
    border-radius: var(--md-sys-shape-corner-small);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 999;
    letter-spacing: 0;
    text-transform: none;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
  }
  .has-tip::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 1px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--mrc-sys-color-brand);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 999;
  }
  .has-tip:hover::after,
  .has-tip:hover::before { opacity: 1; }

  /* ── CATEGORY TAG ── */
  .cat-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 18px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: default;
    flex-shrink: 0;
  }
  .cat-tag.brand      { background: var(--mrc-sys-color-success-container); color: var(--mrc-sys-color-success); }
  .cat-tag.nonbrand   { background: var(--mrc-sys-color-warning-container); color: var(--mrc-sys-color-warning); }
  .cat-tag.competitor { background: var(--md-sys-color-error-container); color: var(--md-sys-color-error); }
  th.cat-col {
    width: 48px;
    min-width: 48px;
    padding: 11px 16px 11px 6px;
    text-align: center;
  }
  td.cat-col {
    width: 48px;
    text-align: center;
    padding: 0 16px 0 6px;
    vertical-align: middle;
  }

  /* ── KEYWORD CONCENTRATION ── */
  .concentration-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--md-sys-typescale-body-small-size);
    margin-top: 8px;
  }
  .concentration-table thead tr {
    background: var(--md-sys-color-surface);
  }
  .concentration-table thead th {
    padding: 6px 8px;
    text-align: left;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--navy);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }
  .concentration-table thead th.cr { text-align: right; }
  .concentration-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
  }
  .concentration-table tbody tr:last-child { border-bottom: none; }
  .concentration-table tbody tr:hover { background: var(--md-sys-color-surface); }
  .concentration-table tbody td {
    padding: 8px 8px;
    vertical-align: middle;
  }
  .concentration-table tbody td.cr { text-align: right; font-variant-numeric: tabular-nums; }
  .conc-tier-label {
    font-weight: 600;
    color: var(--navy);
    font-size: var(--md-sys-typescale-body-small-size);
  }
  .conc-tier-sub {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-top: 1px;
  }
  .conc-share-bar {
    height: 4px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    background: var(--border);
    margin-top: 3px;
    overflow: hidden;
  }
  .conc-share-bar-fill {
    height: 100%;
    border-radius: var(--md-sys-shape-corner-extra-small);
  }

  /* ── BUCKET TABLE COLUMNS ── */
  .bucket-col {
    min-width: 110px;
    vertical-align: bottom;
    padding-bottom: 10px;
  }
  .th-bucket-label {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sage-light);
    margin-bottom: 2px;
  }
  .th-bucket-primary {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
  }
  .th-bucket-sub {
    font-size: var(--md-sys-typescale-body-small-size);
    color: color-mix(in srgb, var(--md-sys-color-on-primary) 45%, transparent);
    font-weight: 400;
    margin-top: 1px;
    white-space: nowrap;
  }
  .bucket-cell { vertical-align: middle; padding: 10px 14px; }
  .cell-primary {
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 600;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
  }
  .cell-sub {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    margin-top: 2px;
    font-variant-numeric: tabular-nums;
  }
  /* Sort indicator inside bucket label row */
  .bucket-col.sort-asc .th-bucket-label .sort-indicator::after { content: '▲'; opacity:1; color: var(--sage); }
  .bucket-col.sort-desc .th-bucket-label .sort-indicator::after { content: '▼'; opacity:1; color: var(--sage); }
  .bucket-col:not(.sort-asc):not(.sort-desc) .th-bucket-label .sort-indicator::after { content: '⇅'; opacity:0.35; }

  /* ── LEGEND ── */
  .legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 10px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-secondary); }
  .legend-dot { width: 10px; height: 10px; border-radius: var(--md-sys-shape-corner-extra-small); display: inline-block; margin-right: 5px; vertical-align: middle; }

  /* ── SEARCH ── */
  .search-input {
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 12px 7px 34px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    width: 220px;
    font-family: var(--md-ref-typeface-plain);
    color: var(--navy);
    background: var(--white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none'%3E%3Ccircle cx='11' cy='11' r='7' stroke='%238A9BB0' stroke-width='2'/%3E%3Cpath d='M16.5 16.5L21 21' stroke='%238A9BB0' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 10px center;
    box-shadow: 0 1px 3px color-mix(in srgb, var(--md-sys-color-shadow) 6%, transparent);
    transition: border-color 0.15s, box-shadow 0.15s;
    letter-spacing: 0.01em;
  }
  .search-input:hover {
    border-color: var(--sage-dark);
  }
  .search-input:focus {
    outline: none;
    border-color: var(--navy-mid);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
  }
  .table-controls { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
  .term-category-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 4px;
  }
  .term-category-btn {
    border: 1px solid var(--border);
    background: var(--white);
    color: var(--text-muted);
    border-radius: var(--md-sys-shape-corner-small);
    cursor: pointer;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    line-height: 1;
    padding: 9px 11px;
    transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
  }
  .term-category-btn:hover { border-color: var(--sage-dark); color: var(--navy); }
  .term-category-btn.active.brand {
    background: var(--mrc-sys-color-success-container);
    border-color: var(--mrc-sys-color-success);
    color: var(--mrc-sys-color-success);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
  }
  .term-category-btn.active.nonbrand {
    background: var(--mrc-sys-color-warning-container);
    border-color: var(--mrc-sys-color-warning);
    color: var(--mrc-sys-color-warning);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
  }
  .term-category-btn.active.competitor {
    background: var(--md-sys-color-error-container);
    border-color: var(--md-sys-color-error);
    color: var(--md-sys-color-error);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
  }

  /* ── PERFORMANCE FILTERS ── */
  .perf-filter-section {
    padding: 10px 40px 0;
  }
  .perf-filter-panel {
    background: var(--white);
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-medium);
    box-shadow: var(--shadow);
    overflow: hidden;
  }
  .perf-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 18px;
    cursor: pointer;
    user-select: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
  }
  .perf-filter-panel.open .perf-filter-header {
    border-bottom-color: var(--border);
  }
  .perf-filter-header-left {
    display: flex;
    align-items: center;
    gap: 9px;
  }
  .perf-filter-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--navy-mid);
    flex-shrink: 0;
    transition: background 0.2s;
  }
  .perf-filter-panel.active .perf-filter-dot { background: var(--mrc-sys-color-success); }
  .perf-filter-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 600;
    color: var(--navy);
  }
  .perf-filter-chevron {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    transition: transform 0.2s;
  }
  .perf-filter-panel.open .perf-filter-chevron { transform: rotate(180deg); }
  .perf-filter-body {
    display: none;
    padding: 16px 18px;
    gap: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .perf-filter-panel.open .perf-filter-body { display: flex; }
  .perf-filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 200px;
  }
  .perf-filter-group-label {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 2px;
  }
  .perf-filter-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .perf-filter-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
  }
  .perf-filter-input-label {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .perf-filter-input {
    width: 90px;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 6px 10px;
    font-size: var(--mrc-typescale-data-medium-size);
    font-family: var(--md-ref-typeface-plain);
    color: var(--navy);
    font-weight: 500;
    background: var(--cream);
    transition: border-color 0.15s, background 0.15s;
  }
  .perf-filter-input:focus {
    outline: none;
    border-color: var(--navy-mid);
    background: var(--white);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--md-sys-color-shadow) 10%, transparent);
  }
  .perf-filter-input::placeholder { color: var(--text-muted); font-weight: 400; }
  .perf-filter-divider {
    font-size: var(--mrc-typescale-data-medium-size);
    color: var(--border);
    padding-top: 18px;
  }
  .perf-filter-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--border);
    margin-top: 12px;
  }
  .perf-filter-apply {
    background: var(--navy);
    color: var(--white);
    border: none;
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 18px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    font-family: var(--md-ref-typeface-plain);
    cursor: pointer;
    transition: background 0.15s;
  }
  .perf-filter-apply:hover { background: var(--navy-mid); }
  .perf-filter-clear {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 14px;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    font-family: var(--md-ref-typeface-plain);
    cursor: pointer;
    color: var(--text-secondary);
    transition: border-color 0.15s, color 0.15s;
  }
  .perf-filter-clear:hover { border-color: var(--sage-dark); color: var(--navy); }
  .perf-active-badge {
    display: none;
    font-size: var(--md-sys-typescale-body-small-size);
    background: var(--mrc-sys-color-success-container);
    color: var(--mrc-sys-color-success);
    padding: 3px 9px;
    border-radius: var(--md-sys-shape-corner-large);
    font-weight: 500;
  }

  /* ── EMPTY STATE ── */
  .empty-msg { text-align: center; padding: 40px; color: var(--text-muted); font-size: var(--mrc-typescale-data-medium-size); }

  /* ── EXTRACTED UTILITY STYLES ── */
.sidebar-logo-img {
  height: 34px;
  width: 34px;
  object-fit: contain;
  flex-shrink: 0;
}
  .sidebar-logo-text {
    font-size: var(--md-sys-typescale-body-medium-size);
    font-weight: 700;
    color: var(--white);
    letter-spacing: 0.04em;
    white-space: nowrap;
  }
  .sidebar-section-label-offset { margin-top: 8px; }
  .nav-icon-amazon,
  .nav-icon-walmart,
  .nav-icon-google,
  .nav-icon-meta,
  .nav-icon-multi,
  .nav-icon-reddit,
  .nav-icon-tiktok,
  .nav-icon-plain {
    background: transparent !important;
    color: var(--white) !important;
  }
  .topbar-heading {
    display: flex;
    align-items: baseline;
    gap: 6px;
  }
  .file-name-badge {
    display: none;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
  }
  #uploadZone {
    flex-wrap: wrap;
  }
  #uploadZone .upload-text {
    min-width: 0;
  }
  #uploadZone .file-name-badge {
    flex: 1 1 320px;
    min-width: 0;
    flex-wrap: wrap;
  }
  #uploadZone .file-badge-items {
    flex: 1 1 180px;
    min-width: 0;
  }
  #uploadZone #mainBrowseBtn {
    margin-left: auto;
  }
  .file-badge-items {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
  }
  .file-name-pill {
    background: var(--mrc-sys-color-success-container);
    color: var(--mrc-sys-color-success);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    padding: 5px 12px;
    border-radius: var(--md-sys-shape-corner-large);
    display: inline-flex;
    align-items: center;
    gap: 5px;
  }
  #uploadZone .file-name-pill {
    max-width: 100%;
    min-width: 0;
  }
  #uploadZone .file-name-pill span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .file-name-pill.secondary {
    background: var(--md-sys-color-surface-container);
    color: var(--navy);
  }
  .file-name-pill.muted {
    background: var(--md-sys-color-surface);
    color: var(--text-muted);
  }
  .file-action-btn,
  .reset-report-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: var(--md-sys-shape-corner-small);
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
    padding: 4px 10px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
  }
  .file-action-btn:hover,
  .reset-report-btn:hover {
    border-color: var(--sage-dark);
    color: var(--navy);
  }
  .file-action-btn-danger {
    border-color: var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-error);
  }
  .file-action-btn-danger:hover { background: var(--md-sys-color-error-container); }
  .perf-filter-footer-wrap { width: 100%; }
  .active-filters-bar {
    display: none;
    flex-direction: column;
    gap: 6px;
    background: var(--md-sys-color-background);
    border: 1px solid var(--mrc-sys-color-brand-highlight);
    border-radius: var(--md-sys-shape-corner-small);
    padding: 10px 16px;
    margin: 10px 40px 0;
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--navy);
  }
  .active-filter-line {
    display: none;
    align-items: center;
    justify-content: space-between;
  }
  .active-filter-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: var(--mrc-typescale-data-medium-size);
    padding: 0;
  }
  .unavailable-metric {
    color: var(--text-muted);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 500;
  }
  .account-strip-spaced { margin-top: 8px; }
  .reset-report-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: var(--md-sys-shape-corner-small);
    padding: 7px 14px;
    font-size: var(--md-sys-typescale-body-small-size);
    white-space: nowrap;
    background: var(--white);
  }
  .section-label-tight {
    margin-top: 0;
    margin-bottom: 0;
  }
  .pdf-report-shell {
    position: relative;
    padding: 22px 26px 34px;
    color: var(--mrc-sys-color-brand);
    background: radial-gradient(circle at top left, color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 22%, transparent), transparent 28%),
      linear-gradient(180deg, var(--md-sys-color-surface) 0%, var(--md-sys-color-surface-container-lowest) 16%, var(--md-sys-color-surface-container-lowest) 100%);
  }
  .pdf-report-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--mrc-sys-color-brand) 94%, transparent) 0%, color-mix(in srgb, var(--md-sys-color-primary) 92%, transparent) 62%, color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 36%, transparent) 100%);
    height: 150px;
    border-radius: var(--md-sys-shape-corner-large);
    z-index: 0;
  }
  .pdf-report-hero,
  .pdf-report-head,
  .pdf-report-content {
    position: relative;
    z-index: 1;
  }
  .pdf-report-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
    align-items: end;
    padding: 24px 28px 26px;
    color: var(--md-sys-color-on-primary);
  }
  .pdf-report-hero-copy {
    max-width: 640px;
  }
  .pdf-report-kicker {
    display: inline-flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 6px 10px;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 18%, transparent);
    border-radius: var(--md-sys-shape-corner-full);
    background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 10%, transparent);
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }
  .pdf-report-title {
    margin: 0;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-headline-large-size);
    font-weight: 600;
    color: var(--md-sys-color-on-primary);
    line-height: 1.05;
  }
  .pdf-report-subtitle {
    margin-top: 10px;
    font-size: var(--mrc-typescale-data-medium-size);
    color: color-mix(in srgb, var(--md-sys-color-on-primary) 86%, transparent);
  }
  .pdf-report-meta-card {
    min-width: 220px;
    padding: 16px 18px;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 15%, transparent);
    border-radius: var(--md-sys-shape-corner-large);
    background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 10%, transparent);
    box-shadow: 0 18px 36px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
    backdrop-filter: blur(8px);
  }
  .pdf-report-meta-label {
    margin-bottom: 8px;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--md-sys-color-on-primary) 72%, transparent);
  }
  .pdf-report-meta-value {
    font-size: var(--md-sys-typescale-body-medium-size);
    font-weight: 600;
    color: var(--md-sys-color-on-primary);
  }
  .pdf-report-meta-file {
    margin-top: 8px;
    font-size: var(--md-sys-typescale-body-small-size);
    color: color-mix(in srgb, var(--md-sys-color-on-primary) 76%, transparent);
  }
  .pdf-report-head {
    padding: 0 28px;
    margin-bottom: 18px;
  }
  .pdf-report-headline-rule {
    height: 1px;
    background: linear-gradient(90deg, color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 20%, transparent) 0%, color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 72%, transparent) 22%, color-mix(in srgb, var(--mrc-sys-color-brand) 10%, transparent) 100%);
  }
  .pdf-report-content {
    display: grid;
    gap: 20px;
    padding: 0 2px;
  }
  .pdf-report-section {
    page-break-inside: avoid;
    break-inside: avoid;
  }
  .pdf-report-section-body {
    display: grid;
    gap: 16px;
  }
  .pdf-report-section-label {
    margin: 0 0 12px;
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--md-sys-color-secondary);
  }
  .pdf-report-section-overview-intro {
    background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 84%, transparent);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-high) 80%, transparent);
    border-radius: var(--md-sys-shape-corner-large);
    box-shadow: 0 14px 40px color-mix(in srgb, var(--md-sys-color-shadow) 8%, transparent);
    padding: 20px 20px 22px;
  }
  .pdf-report-section-campaigns,
  .pdf-report-section-search-terms,
  .pdf-report-section-insights,
  .pdf-report-section-phrases {
    padding-top: 2px;
  }
  .pdf-report-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid color-mix(in srgb, var(--md-sys-color-surface-container-high) 90%, transparent);
    border-radius: var(--md-sys-shape-corner-large);
    background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface) 100%);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 90%, transparent);
  }
  .pdf-report-shell .dashboard {
    display: block !important;
    padding: 0;
  }
  .pdf-report-shell .google-view {
    display: none;
  }
  .pdf-report-shell .google-view.active {
    display: block;
  }
  .pdf-report-shell .google-subnav,
  .pdf-report-shell .audit-export-btn,
  .pdf-report-shell .reset-report-btn,
  .pdf-report-shell #downloadAuditPdfBtn,
  .pdf-report-shell [data-action="reset-report"],
  .pdf-report-shell .phrase-analysis-controls .audit-export-btn,
  .pdf-report-shell .search-clear-btn,
  .pdf-report-shell .table-footer {
    display: none !important;
  }
  .pdf-report-shell .section-label,
  .pdf-report-shell .section-header {
    display: none !important;
  }
  .pdf-report-shell .account-strip {
    margin-bottom: 4px;
    padding-bottom: 0;
    border-bottom: 0;
  }
  .pdf-report-shell .filter-row {
    gap: 10px;
    flex-wrap: wrap;
  }
  .pdf-report-shell .filter-select,
  .pdf-report-shell .term-category-btn {
    border-radius: var(--md-sys-shape-corner-full);
    box-shadow: none;
    pointer-events: none;
  }
  .pdf-report-shell .table-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }
  .pdf-report-shell .search-wrap {
    min-width: 260px;
  }
  .pdf-report-shell .search-input {
    background: var(--md-sys-color-surface-container-lowest);
  }
  .pdf-report-shell .chart-layout {
    margin-bottom: 0;
    break-inside: avoid;
  }
  .pdf-report-shell .kpi-grid {
    margin-bottom: 0;
    break-inside: avoid;
  }
  .pdf-report-shell .brand-breakdown {
    margin-top: 2px;
  }
  .pdf-report-shell .brand-breakdown-header {
    display: none;
  }
  .pdf-report-shell .brand-breakdown-grid,
  .pdf-report-shell .kpi-grid {
    break-inside: avoid;
  }
  .pdf-report-shell .chart-card,
  .pdf-report-shell .kpi-card,
  .pdf-report-shell .brand-card,
  .pdf-report-shell .insights-panel,
  .pdf-report-shell .table-wrap {
    break-inside: avoid;
    box-shadow: 0 10px 26px color-mix(in srgb, var(--md-sys-color-shadow) 6%, transparent);
  }
  .pdf-report-shell .table-wrap {
    overflow: visible;
  }
  .pdf-report-shell table {
    font-size: var(--md-sys-typescale-body-small-size);
  }
  .pdf-report-shell thead th {
    background: var(--mrc-sys-color-brand);
    color: var(--mrc-sys-color-brand-highlight);
  }
  .pdf-report-shell tbody tr:nth-child(even) {
    background: var(--md-sys-color-surface);
  }
  .pdf-report-shell canvas,
  .pdf-report-shell img.audit-pdf-chart {
    max-width: 100%;
  }
  .pdf-report-shell .phrase-analysis-body,
  .pdf-report-shell .insights-body {
    gap: 12px;
  }
  .pdf-report-shell .phrase-analysis-meta {
    margin-bottom: 0;
  }
  @media print {
    body {
      background: var(--md-sys-color-surface-container-lowest) !important;
      -webkit-print-color-adjust: exact;
      print-color-adjust: exact;
    }
    body > *:not(.pdf-report-shell) {
      display: none !important;
    }
    .pdf-report-shell {
      display: block !important;
      padding: 0;
      background: radial-gradient(circle at top left, color-mix(in srgb, var(--mrc-sys-color-brand-highlight) 22%, transparent), transparent 28%),
        linear-gradient(180deg, var(--md-sys-color-surface) 0%, var(--md-sys-color-surface-container-lowest) 16%, var(--md-sys-color-surface-container-lowest) 100%);
    }
    .pdf-report-shell::before {
      border-radius: 0;
      height: 140px;
    }
    .pdf-report-hero {
      padding: 20px 24px 22px;
    }
    .pdf-report-head {
      padding: 0 24px;
    }
    .pdf-report-content {
      gap: 18px;
      padding: 0;
    }
    .pdf-report-section-overview-intro,
    .pdf-report-section-charts,
    .pdf-report-section-campaigns,
    .pdf-report-section-search-terms,
    .pdf-report-section-insights,
    .pdf-report-section-phrases {
      page-break-inside: avoid;
      break-inside: avoid;
    }
    .pdf-report-section-search-terms,
    .pdf-report-section-phrases {
      break-before: page;
      page-break-before: always;
    }
    @page {
      margin: 0.5in;
      size: landscape;
    }
  }
  .chart-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 16px;
    margin-bottom: 28px;
    align-items: stretch;
  }
  .chart-layout > * { min-width: 0; }
  .chart-card-primary {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .legend-dot-spend { background: var(--mrc-chart-series-1); }
  .legend-dot-conv { background: var(--mrc-chart-series-2); }
  .spend-conv-canvas-wrap {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 240px;
    height: 320px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
  }
  .spend-conv-scroll-inner {
    min-width: 100%;
    height: 100%;
    position: relative;
  }
  #spendConvChart {
    display: block;
    max-width: none;
  }
  .side-chart-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
    min-width: 0;
  }
  .chart-card-compact { margin-bottom: 0; }
  .chart-card-flex {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
  }
  .match-chart-wrap {
    position: relative;
    width: 100%;
    height: 160px;
    margin-top: 8px;
  }
  .match-type-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    width: min(280px, calc(100vw - 56px));
    padding: 14px 14px 12px;
    border: 1px solid color-mix(in srgb, var(--mrc-sys-color-brand) 14%, transparent);
    border-radius: var(--md-sys-shape-corner-large);
    background: linear-gradient(180deg, var(--md-sys-color-surface-container-lowest) 0%, var(--md-sys-color-surface) 100%);
    box-shadow: 0 18px 36px color-mix(in srgb, var(--md-sys-color-shadow) 18%, transparent);
    backdrop-filter: blur(10px);
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, calc(-100% - 14px)) scale(0.98);
    transform-origin: bottom center;
    transition: opacity 0.14s ease, transform 0.14s ease;
    z-index: 5;
  }
  .match-type-tooltip.is-visible {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 14px)) scale(1);
  }
  .match-type-tooltip-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
  }
  .match-type-tooltip-title {
    font-family: var(--md-ref-typeface-plain);
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--navy);
  }
  .match-type-tooltip-total {
    font-size: var(--mrc-typescale-data-medium-size);
    font-weight: 700;
    color: var(--navy);
  }
  .match-type-tooltip-subtitle {
    margin-bottom: 10px;
    font-size: var(--md-sys-typescale-body-small-size);
    line-height: 1.4;
    color: var(--text-muted);
  }
  .match-type-tooltip-body {
    display: grid;
    gap: 8px;
  }
  .match-type-tooltip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
  }
  .match-type-tooltip-row-main {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .match-type-tooltip-swatch {
    width: 10px;
    height: 10px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    flex: 0 0 10px;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 45%, transparent);
  }
  .match-type-tooltip-label {
    min-width: 0;
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    color: var(--navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .match-type-tooltip-metrics {
    display: flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--text-muted);
  }
  .match-type-tooltip-metrics strong {
    font-size: var(--md-sys-typescale-body-small-size);
    color: var(--navy);
  }
  .search-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
  }
  .search-input-with-clear { padding-right: 28px; }
  .search-clear-btn {
    display: none;
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    color: var(--mrc-sys-color-on-brand-variant);
    font-size: var(--md-sys-typescale-body-medium-size);
  }
  .term-type-header {
    font-size: var(--md-sys-typescale-body-small-size);
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--sage-light);
  }
  .pager-controls {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .page-size-select {
    padding: 4px 24px 4px 8px;
    font-size: var(--md-sys-typescale-body-small-size);
  }
  .allocation-tip { cursor: default; }
  .mapping-field-col { width: 40%; }

  @media (max-width: 900px) {
    .chart-layout { grid-template-columns: 1fr; }
  }
}

/* ---------- Overview dashboard (Power BI replacement) ---------- */
.ov-shell { gap: 16px; }
.ov-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.ov-title { margin: 0; font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-title-large-size); color: var(--navy); }
.ov-period { margin: 4px 0 0; font-size: var(--mrc-typescale-data-medium-size); color: var(--text-secondary); }
.ov-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ov-notice { font-size: var(--mrc-typescale-data-medium-size); color: var(--text-secondary); background: var(--white); border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); padding: 10px 14px; }
.ov-notice.error { color: var(--danger); border-color: var(--danger-light); background: var(--danger-light); }

.ov-multi { position: relative; }
.ov-multi-btn { width: 100%; text-align: left; padding: 10px 28px 10px 12px; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface-container-lowest); font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-small-size); color: var(--navy); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: relative; box-shadow: inset 0 1px 2px color-mix(in srgb, var(--md-sys-color-shadow) 3%, transparent); }
.ov-multi-btn::after { content: '▾'; position: absolute; right: 10px; color: var(--text-muted); }
.ov-multi-menu { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; width: max-content; max-width: 320px; background: var(--white); border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-medium); box-shadow: var(--shadow); padding: 8px; }
.ov-multi-search { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.ov-multi-list { max-height: 240px; overflow-y: auto; display: grid; gap: 2px; }
.ov-multi-option { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--md-sys-shape-corner-small); cursor: pointer; }
/* The menu sits inside .insights-filter-field, whose span/input rules target labels and text fields. */
.insights-filter-field .ov-multi-option span { font-size: var(--mrc-typescale-data-medium-size); font-weight: 400; color: var(--text-primary); letter-spacing: 0; text-transform: none; }
.insights-filter-field .ov-multi-option input { width: auto; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; accent-color: var(--navy); flex: none; }
.ov-multi-option:hover { background: var(--cream); }
.ov-multi-empty { margin: 6px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); }
.ov-multi-actions { display: flex; justify-content: flex-end; margin-top: 6px; }

.ov-kpis { display: grid; gap: 14px; transition: opacity 0.15s; }
.ov-kpis.ov-loading { opacity: 0.55; }
.ov-kpi-group-label { margin: 0 0 8px; font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.ov-kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.ov-kpi { background: var(--white); border-radius: var(--md-sys-shape-corner-medium); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.ov-kpi-label { display: flex; align-items: center; gap: 6px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-secondary); }
.ov-info { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; color: var(--text-muted); cursor: help; }
.ov-kpi-value { margin-top: 6px; font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-headline-small-size); font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ov-kpi-change { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; font-size: var(--md-sys-typescale-body-small-size); flex-wrap: wrap; }
.ov-kpi-prior { color: var(--text-muted); }
.ov-delta { font-weight: 600; color: var(--text-secondary); }
.ov-delta.good { color: var(--success); }
.ov-delta.bad { color: var(--danger); }
.ov-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--danger-light); color: var(--danger); border-radius: var(--md-sys-shape-corner-medium); padding: 12px 14px; font-size: var(--mrc-typescale-data-medium-size); }

.ov-card { display: grid; gap: 12px; }
.ov-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ov-card-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ov-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); overflow: hidden; }
.ov-toggle-btn { border: 0; background: var(--white); padding: 7px 12px; font: inherit; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-secondary); cursor: pointer; }
.ov-toggle-btn.active { background: var(--navy); color: var(--white); }
.ov-chart-wrap { position: relative; height: 300px; }
.ov-table td.num, .ov-table th.num { text-align: right; white-space: nowrap; }
.ov-table { transition: opacity 0.15s; }
.ov-table.ov-loading { opacity: 0.55; }
/* Row headers (first column) read as body cells, not the navy column header. */
.ov-table tbody th { background: var(--white); color: var(--navy); font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-small-size); font-weight: 600; letter-spacing: 0; text-transform: none; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ov-compare-table thead th:first-child, .ov-compare-table tbody th { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--border); }
.ov-sortable button { all: unset; cursor: pointer; display: inline-block; width: 100%; text-align: inherit; }
.ov-sortable button:focus-visible { outline: 2px solid var(--sage-light); outline-offset: 2px; }
.ov-sortable.active { color: var(--white); }
.ov-prior-col { color: var(--text-muted); }
.insights-report-table thead th.ov-prior-col { color: var(--sage-light); opacity: 0.75; }
.ov-total-row td, .ov-total-row th { font-weight: 700; background: var(--cream); border-bottom: 2px solid var(--border); }
.ov-table tbody .ov-total-row th { background: var(--cream); }
.ov-row-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-secondary); }
.ov-row-filter select, .ov-row-filter input { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface-container-lowest); font: inherit; font-size: var(--md-sys-typescale-body-small-size); color: var(--navy); }
.ov-row-filter input { width: 110px; }
.ov-row-filter-label { font-weight: 600; color: var(--navy); }
.ov-row-filter-hint { color: var(--text-muted); }
.ov-inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-secondary); }
.ov-inline-field select, .ov-table-search { padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface-container-lowest); font: inherit; font-size: var(--md-sys-typescale-body-small-size); color: var(--navy); }
.ov-table-search { width: 180px; }
.ov-card .ov-row-filter { margin-top: 0; }
.ov-table-note { margin: 0; font-size: var(--md-sys-typescale-body-small-size); color: var(--text-muted); }
.pu-invite { display: grid; grid-template-columns: minmax(200px, 2fr) minmax(110px, 1fr) minmax(110px, 1fr) minmax(170px, 1fr) auto; gap: 12px; align-items: end; margin: 12px 0; }
.pu-invite select { width: 100%; }
.pu-table select { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface-container-lowest); font: inherit; font-size: var(--md-sys-typescale-body-small-size); color: var(--navy); }
.pu-status { font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; border-radius: var(--md-sys-shape-corner-full); padding: 3px 8px; background: var(--sage-light); color: var(--navy); }
.pu-status.disabled { background: var(--danger-light); color: var(--danger); }
.pu-status.invited { background: var(--warning-light); color: var(--mrc-sys-color-warning); }
.pu-disabled td { color: var(--text-muted); }
@media (max-width: 720px) { .pu-invite { grid-template-columns: 1fr; } }
.ov-pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.ov-pager:empty { display: none; }
.ov-pager-text { font-size: var(--md-sys-typescale-body-small-size); color: var(--text-secondary); margin-right: 4px; }

@media (max-width: 1080px) {
  .ov-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .ov-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-kpi-value { font-size: var(--md-sys-typescale-title-large-size); }
  .ov-chart-wrap { height: 240px; }
}
.pu-actions { display: flex; gap: 8px; white-space: nowrap; }

/* css/forecast.css */
/* Forecast View */
.forecast-view {
  display: none;
  padding: 36px 40px 80px;
  overflow-x: hidden;
  min-width: 0;
}

.forecast-shell {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
  width: 100%;
  min-width: 0;
}

.forecast-shell > * {
  min-width: 0;
}

#monthlyForecastWorkflow,
#promoForecastWorkflow {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
}

#forecastPromoPlanPanel,
#forecastPromoReviewPanel { min-width: 0; }

#monthlyForecastWorkflow[hidden],
#promoForecastWorkflow[hidden] {
  display: none;
}

.forecast-workflow-switch {
  display: inline-flex;
  justify-self: start;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-background);
}

.forecast-workflow-tab {
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 600;
  cursor: pointer;
}

.forecast-workflow-tab:hover {
  color: var(--navy);
}

.forecast-workflow-tab.is-active {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--md-sys-color-shadow) 14%, transparent);
}

.forecast-promo-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.forecast-promo-marketplace-note {
  margin-top: 12px;
  border: 1px solid var(--mrc-sys-color-brand-highlight);
  border-radius: var(--md-sys-shape-corner-small);
  padding: 9px 11px;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-tertiary);
  font-size: var(--md-sys-typescale-body-small-size);
}

.forecast-promo-fields input[type="number"] {
  width: 100%;
}

.forecast-promo-compare {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: var(--md-sys-typescale-body-small-size);
}

.forecast-promo-compare input {
  accent-color: var(--navy);
}

.forecast-promo-history-dates {
  display: grid;
  grid-template-columns: minmax(200px, 1.3fr) repeat(2, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface);
}

.forecast-promo-history-dates[hidden] {
  display: none;
}

.forecast-promo-history-dates .forecast-event-picker {
  max-width: none;
  min-width: 0;
  margin-top: 0;
}

.forecast-promo-history-help {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.45;
}

.forecast-history-reset-btn {
  flex: 0 0 auto;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--navy);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.forecast-promo-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.forecast-promo-mode-tabs {
  display: flex;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface);
}

.forecast-promo-mode-tabs button {
  min-height: 38px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-small);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.forecast-promo-mode-tabs button.is-active {
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--navy);
  box-shadow: 0 1px 4px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent);
}

.forecast-promo-review-panel[hidden] { display: none; }
.forecast-promo-review-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 16px;
}
.forecast-promo-review-controls > * { min-width: 0; }
.forecast-promo-review-controls .upload-btn { min-height: 40px; white-space: nowrap; }
.forecast-promo-review-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 24px;
}
.forecast-promo-review-metric {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface);
}
.forecast-promo-review-metric > span { grid-column: 1 / -1; color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); font-weight: 600; }
.forecast-promo-review-metric > div { display: grid; gap: 2px; }
.forecast-promo-review-metric small { color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.forecast-promo-review-metric strong { color: var(--navy); font-size: var(--md-sys-typescale-title-medium-size); }
.forecast-promo-review-metric > b { align-self: end; color: var(--sage-strong, var(--mrc-sys-color-success)); font-size: var(--mrc-typescale-data-medium-size); text-align: right; }
.forecast-promo-review-detail-title { margin: 10px 0; }
.forecast-promo-review-table { min-width: 1120px; }
.forecast-promo-daily-chart { min-width: 0; margin: 8px 0 22px; }
.forecast-promo-chart-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface-container-lowest); }
.forecast-promo-chart-scroll svg { display: block; width: 100%; min-width: 760px; height: auto; }
.forecast-promo-chart-grid { stroke: var(--md-sys-color-inverse-on-surface); stroke-width: 1; }
.forecast-promo-chart-axis { fill: var(--md-sys-color-on-surface-variant); font: 12px var(--md-ref-typeface-plain); }
.forecast-promo-chart-title { fill: var(--md-sys-color-on-surface); font: 600 12px var(--md-ref-typeface-plain); }
.forecast-promo-chart-baseline { fill: var(--mrc-chart-prior); }
.forecast-promo-chart-actual { fill: var(--mrc-chart-current); }
.forecast-promo-chart-legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 8px; color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.forecast-promo-chart-legend span { display: inline-flex; align-items: center; gap: 7px; }
.forecast-promo-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: var(--md-sys-shape-corner-extra-small); }
.forecast-promo-chart-legend i.baseline { background: var(--mrc-chart-prior); }
.forecast-promo-chart-legend i.actual { background: var(--mrc-chart-current); }

.forecast-promo-summary .forecast-summary-block {
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface);
}

.forecast-promo-method-note {
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.5;
}

.forecast-promo-table {
  min-width: 1120px;
}

.forecast-promo-table td,
.forecast-promo-table th {
  white-space: nowrap;
}

.forecast-promo-sku-title {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 400;
}

.forecast-promo-historical-lift {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: end;
  padding-bottom: 4px;
  color: var(--text-secondary);
  font-size: var(--md-sys-typescale-body-small-size);
}

.forecast-promo-historical-lift[hidden] {
  display: none;
}

.forecast-promo-historical-lift button,
.forecast-description-toggle,
.forecast-unit-reset {
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--white);
  color: var(--navy);
  font: inherit;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  cursor: pointer;
  padding: 6px 9px;
}

.forecast-description-toggle {
  flex: none;
  align-self: center;
}

.forecast-promo-historical-lift button:hover,
.forecast-description-toggle:hover,
.forecast-unit-reset:hover {
  background: var(--md-sys-color-background);
}

.forecast-promo-unit-edit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.forecast-promo-unit-edit input {
  width: 86px;
  padding: 5px 6px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-extra-small);
  color: var(--navy);
  font: inherit;
  font-size: var(--md-sys-typescale-body-small-size);
  text-align: right;
}

.forecast-promo-unit-edit input.overridden {
  border-color: var(--sage);
  background: var(--md-sys-color-background);
}

.forecast-unit-reset {
  padding: 4px 6px;
}

.forecast-margin-coverage {
  display: block;
  margin-top: 3px;
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 500;
}

.forecast-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}

.forecast-actions-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.forecast-actions-spacer {
  min-height: 38px;
  margin: 0;
}

.forecast-window-card-head,
.forecast-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.forecast-window-fields {
  display: grid;
  grid-template-columns: minmax(250px, 300px) repeat(2, minmax(155px, 175px));
  width: fit-content;
  max-width: 100%;
  align-items: end;
  gap: 14px;
  margin-top: 14px;
  justify-content: start;
}

.forecast-card-head-stack-mobile {
  align-items: flex-start;
}

.forecast-card-title {
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-title-medium-size);
  font-weight: 600;
  color: var(--navy);
}

.forecast-card-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.45;
}

.forecast-card-subtitle-tight {
  margin-bottom: 12px;
}

.forecast-window-grid {
  display: block;
}

.forecast-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.forecast-field span {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 500;
  color: var(--text-muted);
}

.forecast-field input,
.forecast-field select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--navy);
  font: inherit;
}

.forecast-field input:disabled,
.forecast-field select:disabled {
  color: var(--text-muted);
}

.forecast-baseline-actions {
  justify-content: flex-start;
  align-items: center;
  margin-top: 16px;
  gap: 14px;
  flex-wrap: wrap;
}

.forecast-upload-status {
  flex: 1 1 360px;
  min-width: 240px;
}

.forecast-upload-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.forecast-upload-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  border: 2px dashed var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
  padding: 16px 18px;
  color: var(--text-secondary);
  cursor: pointer;
}

.forecast-upload-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.forecast-upload-zone.loaded {
  border-color: var(--sage-dark);
  background: var(--md-sys-color-surface);
}

.forecast-upload-icon {
  color: var(--navy-mid);
  flex-shrink: 0;
}

.forecast-upload-title {
  font-size: var(--mrc-typescale-data-medium-size);
  font-weight: 600;
  color: var(--navy);
}

.forecast-upload-sub {
  margin-top: 2px;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--text-muted);
}

.forecast-browse-btn {
  flex-shrink: 0;
}

.forecast-upload-status {
  min-height: 18px;
  margin-top: 8px;
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--text-muted);
}

.forecast-upload-status.error {
  color: var(--md-sys-color-error);
}

.forecast-remove-btn,
.forecast-reset-btn,
.forecast-download-btn {
  flex-shrink: 0;
}

.forecast-bulk-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.forecast-bulk-group {
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  padding: 12px;
  background: var(--white);
}

.forecast-bulk-group.share {
  background: var(--md-sys-color-surface-container-lowest);
}

.forecast-bulk-group.spend {
  background: var(--md-sys-color-surface);
}

.forecast-bulk-group.roas {
  background: var(--md-sys-color-surface-container-lowest);
}

.forecast-bulk-label {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--sage-dark);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.forecast-bulk-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.forecast-bulk-controls input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-lowest);
  padding: 0 10px;
  color: var(--navy);
  font: inherit;
}

.forecast-bulk-help {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.4;
}

.forecast-bulk-btn {
  height: 34px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.forecast-bulk-btn:hover {
  border-color: var(--sage-dark);
  color: var(--navy);
  background: color-mix(in srgb, var(--mrc-sys-color-accent) 6%, transparent);
}

.forecast-assumptions-grid {
  display: grid;
  grid-template-columns: 120px repeat(12, minmax(62px, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  max-width: 100%;
  min-width: 0;
  overflow: auto;
}

.forecast-assumption-cell {
  padding: 8px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  background: var(--white);
}

.forecast-assumption-cell.header {
  background: var(--md-sys-color-surface);
  color: var(--sage-dark);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.forecast-assumption-cell.label {
  justify-content: flex-start;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--navy);
}

.forecast-assumption-cell.share-row {
  background: var(--md-sys-color-surface-container-lowest);
}

.forecast-assumption-cell.spend-row {
  background: var(--md-sys-color-surface);
}

.forecast-assumption-cell.roas-row {
  background: var(--md-sys-color-surface-container-lowest);
}

.forecast-assumption-cell.manual-row {
  background: var(--md-sys-color-surface);
}

.forecast-assumption-cell.manual-row.has-error {
  background: var(--md-sys-color-error-container);
}

.forecast-manual-feedback {
  margin: 8px 0 0;
  color: var(--md-sys-color-error);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 600;
}

.forecast-implied-share {
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 600;
  text-align: center;
}

.forecast-assumption-cell input {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: center;
  color: var(--navy);
  font: inherit;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 600;
}

.forecast-assumption-cell input:focus {
  outline: 2px solid var(--navy-mid);
  outline-offset: -2px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  background: var(--md-sys-color-surface-container-lowest);
}

.forecast-chart-wrap {
  position: relative;
  height: 240px;
}

.forecast-chart-tooltip {
  display: none;
  position: absolute;
  pointer-events: none;
  background: var(--navy);
  color: var(--md-sys-color-on-primary);
  font-size: var(--md-sys-typescale-body-small-size);
  padding: 8px 10px;
  border-radius: var(--md-sys-shape-corner-small);
  white-space: nowrap;
  z-index: 5;
  line-height: 1.6;
}

.forecast-chart-legend {
  margin-top: 10px;
}

.forecast-chart-summary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.forecast-summary-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.forecast-summary-label {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.forecast-summary-value {
  font-size: var(--md-sys-typescale-title-medium-size);
  font-weight: 700;
}

.forecast-search-wrap {
  position: relative;
  min-width: 220px;
}

.forecast-search-wrap input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-small);
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--navy);
  font: inherit;
}

.forecast-search-icon {
  position: absolute;
  left: 10px;
  top: 11px;
  color: var(--text-muted);
  pointer-events: none;
}

.forecast-search-clear {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--border);
  color: var(--text-secondary);
  cursor: pointer;
}

#forecastArea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 16px;
}

.forecast-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(70vh, 640px);
}

.forecast-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1200px;
}

.forecast-table thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 8px 10px;
  background: var(--navy);
  border-bottom: 1px solid var(--navy);
  color: var(--sage-light);
  font-family: var(--md-ref-typeface-plain);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: right;
  white-space: nowrap;
}

.forecast-product-col {
  min-width: 210px;
  max-width: 250px;
}

.forecast-product-title {
  display: block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forecast-table thead th.forecast-sticky-col,
.forecast-table tbody td.forecast-sticky-col {
  position: sticky;
  background-clip: padding-box;
}

.forecast-table thead th.forecast-sticky-sku,
.forecast-table tbody td.forecast-sticky-sku {
  position: sticky;
  left: 0;
  min-width: 140px;
  width: 140px;
  z-index: 4;
  background-clip: padding-box;
}

.forecast-table thead th.forecast-sticky-sku {
  z-index: 6;
}

.forecast-sku-row td {
  background: var(--md-sys-color-surface-container-lowest);
}

.forecast-sku-row:nth-child(even) td {
  background: var(--md-sys-color-surface);
}

.forecast-total-row td.forecast-sticky-col {
  background: var(--md-sys-color-background);
}

.forecast-table thead th.forecast-sticky-sku::after,
.forecast-table tbody td.forecast-sticky-sku::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  pointer-events: none;
  background: var(--md-sys-color-surface-variant);
}

.forecast-table thead th.forecast-sticky-sku::after {
  background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 14%, transparent);
}

.forecast-table thead th:hover {
  color: var(--white);
}

.forecast-table thead th.left,
.forecast-table tbody td.left {
  text-align: left;
}

.forecast-table thead th.adj,
.forecast-table tbody td.adj {
  text-align: center;
}

.forecast-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: var(--md-sys-typescale-body-small-size);
  color: var(--navy);
  text-align: right;
  white-space: nowrap;
}

.forecast-table td.forecast-month-cell {
  min-width: 124px;
  padding: 8px 10px;
}

.forecast-cell-stack {
  display: flex;
  min-height: 40px;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 5px;
}

.forecast-cell-prior {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  width: 100%;
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 400;
}

.forecast-prior-label {
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.forecast-prior-value {
  font-variant-numeric: tabular-nums;
}

.forecast-baseline-estimate-label {
  flex: none;
  color: var(--md-sys-color-secondary);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.forecast-baseline-input {
  width: 72px;
  min-width: 0;
  border: 1px solid var(--mrc-sys-color-brand-highlight);
  border-radius: var(--md-sys-shape-corner-extra-small);
  padding: 2px 4px;
  background: var(--md-sys-color-surface-container-lowest);
  color: var(--navy);
  font: inherit;
  font-size: var(--md-sys-typescale-body-small-size);
  text-align: right;
}

.forecast-baseline-input:focus {
  outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color);
  outline-offset: 1px;
  border-color: var(--md-sys-color-outline);
}

.forecast-baseline-input.overridden {
  border-color: var(--md-sys-color-outline);
  background: var(--md-sys-color-surface);
}

.forecast-baseline-input::placeholder {
  color: var(--mrc-sys-color-brand-highlight);
  font-size: var(--md-sys-typescale-body-small-size);
}

.forecast-current-unavailable {
  color: var(--mrc-sys-color-warning);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
}

.forecast-adj-percent {
  margin-left: 4px;
  color: var(--md-sys-color-secondary);
  font-size: var(--md-sys-typescale-body-small-size);
}

.forecast-current-input,
.forecast-adj-input {
  font: inherit;
  border: 0;
  background: transparent;
}

.forecast-current-input {
  width: 86px;
  text-align: right;
  color: var(--navy);
  border-bottom: 1px dashed color-mix(in srgb, var(--mrc-sys-color-brand) 22%, transparent);
}

.forecast-current-input:focus {
  outline: none;
  background: var(--md-sys-color-surface-container-lowest);
  border-bottom-color: var(--navy-mid);
}

.forecast-current-input.overridden {
  color: var(--navy-mid);
  border-bottom-color: color-mix(in srgb, var(--md-sys-color-primary) 42%, transparent);
}

.forecast-adj-input {
  width: 54px;
  text-align: center;
  color: var(--navy-mid);
  border-bottom: 1px dashed color-mix(in srgb, var(--md-sys-color-primary) 22%, transparent);
}

.forecast-adj-input:focus {
  outline: none;
  background: var(--md-sys-color-surface-container-lowest);
}

.forecast-adj-input.positive {
  color: var(--mrc-sys-color-success);
  border-bottom-color: color-mix(in srgb, var(--mrc-sys-color-success) 28%, transparent);
}

.forecast-adj-input.negative {
  color: var(--md-sys-color-error);
  border-bottom-color: color-mix(in srgb, var(--md-sys-color-error) 28%, transparent);
}

.forecast-cell-override {
  background: var(--md-sys-color-background) !important;
}

.forecast-total-row td {
  position: sticky;
  top: var(--forecast-sticky-total-top, 40px);
  z-index: 7;
  padding-top: 9px;
  padding-bottom: 9px;
  font-weight: 700;
  border-top: 2px solid var(--navy-mid);
  background: var(--md-sys-color-background);
  color: var(--navy);
}

.forecast-total-row td.adj {
  background: var(--md-sys-color-background);
}

.forecast-total-row td.forecast-sticky-col {
  z-index: 8;
}

.forecast-table tbody tr.forecast-total-row td.forecast-sticky-sku {
  z-index: 9;
}

.forecast-table thead th.forecast-sticky-sku {
  z-index: 10;
}

.forecast-empty-state {
  text-align: center;
  padding: 44px 16px;
  color: var(--text-muted);
  font-size: var(--mrc-typescale-data-medium-size);
}

.forecast-empty-state svg {
  display: block;
  margin: 0 auto 10px;
  opacity: 0.4;
}

.forecast-actions-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.forecast-blended {
  margin-top: 10px;
  text-align: right;
  color: var(--text-secondary);
  font-size: var(--md-sys-typescale-body-small-size);
}

.forecast-sku-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.forecast-sku-tip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  background: var(--navy);
  color: var(--md-sys-color-on-primary);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 400;
  padding: 4px 8px;
  border-radius: var(--md-sys-shape-corner-extra-small);
  white-space: nowrap;
  transition: opacity 0.14s ease;
}

.forecast-sku-tip-trigger {
  border-bottom: 1px dashed var(--border);
}

.forecast-sku-cell:hover .forecast-sku-tip {
  visibility: visible;
  opacity: 1;
}

.saved-forecast-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.saved-forecast-filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
}

.saved-forecast-filters[hidden] {
  display: none;
}

.saved-forecast-filter-label {
  margin-right: 4px;
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
}

.saved-forecast-filter {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--white);
  color: var(--text-secondary);
  font: inherit;
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 600;
  cursor: pointer;
}

.saved-forecast-filter:hover,
.saved-forecast-filter.is-active {
  border-color: var(--navy);
  background: var(--md-sys-color-background);
  color: var(--navy);
}

.saved-forecast-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--md-sys-shape-corner-medium);
  background: var(--md-sys-color-surface-container-lowest);
}

.saved-forecast-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.saved-forecast-title {
  color: var(--navy);
  font-weight: 600;
  font-size: var(--md-sys-typescale-body-medium-size);
}

.saved-forecast-title-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.saved-forecast-kind {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: var(--md-sys-shape-corner-full);
  background: var(--md-sys-color-surface-container);
  color: var(--navy);
  font-size: var(--md-sys-typescale-body-small-size);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.saved-forecast-kind.is-promo {
  background: var(--md-sys-color-surface-container);
  color: var(--mrc-sys-color-success);
}

.saved-forecast-meta {
  color: var(--text-muted);
  font-size: var(--md-sys-typescale-body-small-size);
  line-height: 1.4;
}

.saved-forecast-open-btn {
  flex-shrink: 0;
}

.saved-forecast-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.saved-forecast-delete-btn {
  background: transparent;
}

@media (max-width: 960px) {
  .multichannel-view { padding: 30px 20px 72px; }
  .multichannel-brand-grid { grid-template-columns: 1fr; }

  .forecast-view {
    padding: 30px 20px 72px;
  }

  .forecast-window-fields,
  .forecast-bulk-grid,
  .forecast-promo-fields,
  .forecast-promo-summary,
  .forecast-promo-history-dates {
    grid-template-columns: 1fr;
  }

  .forecast-promo-history-help {
    grid-column: auto;
    align-items: flex-start;
    flex-direction: column;
  }

  .forecast-upload-row,
  .forecast-card-header-row,
  .forecast-card-head {
    flex-direction: column;
    align-items: stretch;
  }

  .forecast-upload-zone,
  .forecast-upload-main {
    align-items: flex-start;
  }

  .forecast-upload-zone {
    flex-direction: column;
  }

  .forecast-window-fields {
    grid-template-columns: 1fr;
  }

  .forecast-search-wrap {
    min-width: 0;
    width: 100%;
  }

  .saved-forecast-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .saved-forecast-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
.forecast-event-card { margin-top: 18px; }
#forecastWalmartBaselineField[hidden], #forecastBottomUpBulk[hidden], #forecastTopDownBulk[hidden], #forecastTopDownNote[hidden], #forecastRangeTarget[hidden], #forecastPromoHistoryVisual[hidden], #forecastEventCancel[hidden] { display: none; }
.forecast-method-switch { display: flex; gap: 6px; margin: 12px 0 18px; }
.forecast-method-switch button { border: 1px solid var(--border); background: var(--md-sys-color-background); color: var(--navy); border-radius: var(--md-sys-shape-corner-small); padding: 8px 14px; font-family: var(--md-ref-typeface-plain); font-size: var(--md-sys-typescale-body-medium-size); font-weight: 600; cursor: pointer; }
.forecast-method-switch button.is-active { background: var(--navy); border-color: var(--navy); color: var(--md-sys-color-on-primary); }
.forecast-yoy-delta { color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.forecast-range-target { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.forecast-range-target .forecast-field { min-width: 210px; }
.forecast-range-target > span { color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.forecast-sku-sort { min-width: 190px; }
.forecast-sku-sort select { height: 36px; }
.forecast-event-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; padding: 18px 22px; }
.forecast-event-deal-items-wrap { display: grid; gap: 10px; grid-column: 1 / -1; min-width: 0; }
.forecast-event-deal-items { display: grid; gap: 8px; }
.forecast-event-deal-row { display: grid; grid-template-columns: minmax(120px, 1.15fr) repeat(3, minmax(105px, .7fr)) minmax(170px, 1.4fr) auto; gap: 10px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface); }
.forecast-event-deal-row label { display: grid; gap: 4px; min-width: 0; color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.forecast-event-deal-row input { width: 100%; min-width: 0; }
.forecast-event-deal-items-wrap > .classifier-reset-btn { justify-self: start; }
.forecast-event-actions { display: flex; align-items: center; gap: 10px; grid-column: 1 / -1; }
.forecast-event-list { padding: 0 22px 20px; }
.forecast-event-row { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.forecast-event-row > div:first-child { display: grid; gap: 4px; }
.forecast-event-row-copy small { color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.forecast-event-row > div:last-child { display: flex; gap: 8px; align-items: center; }
.forecast-event-row span { color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); }
.forecast-event-row button { border: 1px solid var(--border); border-radius: var(--md-sys-shape-corner-small); background: var(--md-sys-color-surface-container-lowest); color: var(--navy); padding: 6px 10px; cursor: pointer; }
.forecast-event-row-title { font-weight: 700; color: var(--navy); }
.forecast-event-row-meta { color: var(--text-muted); font-size: var(--md-sys-typescale-body-small-size); margin-top: 3px; }
.forecast-event-row-actions { display: flex; gap: 8px; }
.forecast-event-picker { max-width: 420px; margin-top: 14px; }
.forecast-promo-sort { max-width: 275px; margin: 12px 0; }
.forecast-promo-history-visual { display: grid; gap: 8px; margin: 12px 0 20px; }
.forecast-promo-history-metric { border: 1px solid var(--md-sys-color-surface-container-high); border-radius: var(--md-sys-shape-corner-small); padding: 10px 12px; }
.forecast-promo-history-heading { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-size: var(--md-sys-typescale-body-small-size); }
.forecast-promo-history-heading span { color: var(--text-muted); }
.forecast-promo-history-bar { display: grid; grid-template-columns: 56px minmax(0, 1fr) 80px; gap: 10px; align-items: center; font-size: var(--md-sys-typescale-body-small-size); margin-top: 5px; }
.forecast-promo-history-bar > div { height: 10px; border-radius: var(--md-sys-shape-corner-full); background: var(--md-sys-color-surface-container); overflow: hidden; }
.forecast-promo-history-bar i { display: block; height: 100%; border-radius: inherit; }
.forecast-promo-history-bar i.baseline { background: var(--mrc-chart-prior); }
.forecast-promo-history-bar i.event { background: var(--mrc-chart-current); }
.forecast-history-bar-row { display: grid; grid-template-columns: 100px minmax(0, 1fr) 80px; gap: 10px; align-items: center; font-size: var(--md-sys-typescale-body-small-size); }
.forecast-history-bar-track { height: 10px; border-radius: var(--md-sys-shape-corner-full); background: var(--md-sys-color-surface-container); overflow: hidden; }
.forecast-history-bar-fill { display: block; height: 100%; border-radius: inherit; background: var(--navy); }
@media (max-width: 1000px) { .forecast-event-deal-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 800px) { .forecast-event-form { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1200px) { .forecast-promo-review-controls, .forecast-promo-review-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } .forecast-promo-review-controls .upload-btn { justify-self: start; } }
@media (max-width: 640px) { .forecast-promo-review-controls, .forecast-promo-review-metrics { grid-template-columns: 1fr; } .forecast-promo-mode-tabs { width: 100%; } .forecast-promo-mode-tabs button { flex: 1; padding-inline: 8px; } }
@media (max-width: 540px) { .forecast-event-form { grid-template-columns: 1fr; } .forecast-event-deal-row { grid-template-columns: 1fr; } .forecast-event-row { align-items: flex-start; flex-direction: column; } }

/* css/dash-portal.css */
/* Dashboard "portal" look: the colours and components of the client ad insights portal
   (mrc_ad_audit/partner_config/template/page_shell.html) with an app-style type treatment:
   IBM Plex Sans throughout, numbers in tabular figures (aligned like the portal's mono, without
   the report feel), the platform's grey and white surfaces, thin lines instead of shadows, soft delta chips and
   gold-bar callouts. Every dashboard page renders inside .dp (MRCDashUI.mountPage); the rest of
   the Insights Platform keeps its own styles. */

.dp-view {
  /* The portal's names, now aliases of the design tokens (css/tokens.css): the page is the cream canvas and cards are white. */
  --dp-paper: var(--md-sys-color-background);
  --dp-raised: var(--md-sys-color-surface-container-lowest);
  --dp-ink: var(--md-sys-color-on-surface);
  --dp-soft: var(--md-sys-color-on-surface-variant);
  --dp-faint: var(--md-sys-color-on-surface-variant); /* was a grey under 3:1 on the page; text now keeps the 4.5:1 of the secondary ink */
  --dp-line: var(--md-sys-color-outline-variant);
  --dp-brand: var(--md-sys-color-primary);
  --dp-sage: var(--md-sys-color-secondary-container);
  --dp-navy: var(--md-sys-color-primary);
  --dp-slate: var(--md-sys-color-outline);
  --dp-forest: var(--mrc-sys-color-success);
  --dp-forest-soft: var(--mrc-sys-color-success-container);
  --dp-risk: var(--md-sys-color-error);
  --dp-risk-soft: var(--md-sys-color-error-container);
  --dp-gold: var(--mrc-sys-color-accent);
  --dp-radius: var(--md-sys-shape-corner-medium);
  --dp-sans: var(--md-ref-typeface-plain);
  background: var(--dp-paper);
  color: var(--dp-ink);
  font-family: var(--dp-sans);
  -webkit-font-smoothing: antialiased;
}
.dp { gap: 22px; font-family: var(--dp-sans); color: var(--dp-ink); letter-spacing: 0.01em; font-variant-numeric: tabular-nums; }
.dp ::selection { background: var(--dp-gold); color: var(--dp-ink); }

/* ---------- Header ---------- */
.dp .ov-head { align-items: flex-end; padding-bottom: 20px; border-bottom: 1px solid var(--dp-line); }
.dp .dp-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
  font-family: var(--dp-sans); font-size: var(--md-sys-typescale-body-small-size); font-weight: 600; letter-spacing: 0.01em;
  color: var(--dp-soft); padding: 4px 12px; border: 1px solid var(--dp-line); border-radius: var(--md-sys-shape-corner-full); background: var(--dp-raised);
}
.dp .dp-eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--dp-forest); }
.dp .ov-title { font-family: var(--dp-sans); font-size: var(--md-sys-typescale-display-small-size); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; color: var(--dp-ink); }
.dp .ov-period { margin-top: 8px; font-size: var(--md-sys-typescale-body-medium-size); color: var(--dp-soft); }

/* Dashboards: the sections are large tabs (the tabs component) in place of the page title. */
.dp .dp-heading { min-width: 0; max-width: 100%; flex: 1 1 320px; }
/* contain: the tabs never widen the header; they scroll when space is short. */
.dp .dp-sections { margin-top: 2px; contain: inline-size; }
.dp .dp-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.dp .dp-tabs { margin: 14px 0 2px; }

.dp .dp-preview {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-left: 3px solid var(--dp-navy); border-radius: 0 var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0; background: var(--md-sys-color-surface-container); color: var(--dp-navy); padding: 10px 16px; font-size: var(--md-sys-typescale-body-medium-size);
}
.dp .dp-view-as-field span { font-size: var(--md-sys-typescale-body-small-size); font-weight: 600; color: var(--dp-soft); }

/* Buttons, toggles and chips on the dashboards are the components in css/dash-components.css. */
/* Dashboard toolbars use the compact control height, 36px, so buttons, toggles and fields line up; the tap area stays 48px. */
.dp .ds-btn { min-height: 36px; }
.dp .ds-seg-btn { min-height: 34px; }
.dp select { min-height: 36px; }

/* ---------- Filter bar ---------- */
.dp .insights-filter-card,
.dp .insights-report-card { background: var(--dp-raised); border: 1px solid var(--dp-line); border-radius: var(--dp-radius); box-shadow: none; }
.dp .insights-filter-card { padding: 16px 18px; }
.dp .insights-filter-field > span { font-family: var(--dp-sans); font-size: var(--md-sys-typescale-body-small-size); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--dp-soft); }
.dp .insights-filter-field select,
.dp .insights-filter-field input,
.dp .ov-multi-btn,
.dp .ov-card-controls > select,
.dp .ov-inline-field select,
.dp .ov-table-search,
.dp .ov-row-filter select,
.dp .ov-row-filter input {
  font-family: var(--dp-sans); font-size: var(--mrc-typescale-data-medium-size); font-weight: 500; color: var(--dp-ink);
  background: var(--dp-paper); border: 1px solid var(--dp-line); border-radius: var(--md-sys-shape-corner-small); box-shadow: none;
}
.dp .insights-filter-field select:focus,
.dp .insights-filter-field input:focus,
.dp .ov-multi-btn:focus-visible { outline: 2px solid var(--dp-sage); outline-offset: 1px; border-color: var(--dp-navy); }
.dp .ov-multi-menu { background: var(--dp-raised); border: 1px solid var(--dp-line); box-shadow: 0 6px 18px color-mix(in srgb, var(--md-sys-color-shadow) 12%, transparent); }
.dp .ov-multi-option:hover { background: var(--dp-forest-soft); }
.dp .insights-filter-field .ov-multi-option span { font-family: var(--dp-sans); color: var(--dp-ink); }
.dp .insights-filter-field .ov-multi-option input { accent-color: var(--dp-forest); }

/* ---------- Notes: gold-bar callouts ---------- */
.dp .ov-notice,
.dp .ov-table-note {
  border: 0; border-left: 3px solid var(--dp-gold); border-radius: 0 var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0;
  background: var(--dp-raised); color: var(--dp-soft); font-size: var(--md-sys-typescale-body-medium-size); padding: 12px 16px;
}
.dp .ov-table-note { font-size: var(--mrc-typescale-data-medium-size); }
.dp .ov-notice.error { border-left-color: var(--dp-risk); background: var(--dp-risk-soft); color: var(--dp-risk); }

/* ---------- KPI strips ---------- */
.dp .ov-kpis { gap: 22px; }
.dp .ov-kpi-group-label { font-family: var(--dp-sans); font-size: var(--mrc-typescale-data-medium-size); font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--dp-soft); margin-bottom: 10px; }
/* Each tile draws its own right and bottom divider, so a part-filled last row stays blank;
   the strip clips the dividers that would double its outer border. */
.dp .ov-kpi-grid {
  gap: 0; background: var(--dp-raised); border: 1px solid var(--dp-line); border-radius: var(--dp-radius); overflow: hidden;
  grid-template-columns: repeat(var(--kpi-cols, 5), minmax(0, 1fr)); width: calc(var(--kpi-cols, 5) / 5 * 100%);
}
.dp .ov-kpi { background: var(--dp-raised); border-radius: 0; box-shadow: 1px 0 0 var(--dp-line), 0 1px 0 var(--dp-line); padding: 18px 18px 16px; }
.dp .ov-kpi-label { font-size: var(--mrc-typescale-data-medium-size); font-weight: 500; color: var(--dp-soft); }
.dp .ov-kpi-value { font-family: var(--dp-sans); font-size: var(--md-sys-typescale-headline-medium-size); font-weight: 600; letter-spacing: -0.02em; color: var(--dp-ink); margin-top: 6px; }
.dp .ov-kpi-change { margin-top: 8px; gap: 8px; align-items: center; }
.dp .ov-kpi-prior { font-size: var(--md-sys-typescale-body-small-size); color: var(--dp-faint); }
/* The info mark is the icon, not a circled letter. */
/* 24px target (WCAG 2.2): the icon is 16px, the rest is padding that is part of the hit area. */
.dp .ov-info { width: 24px; height: 24px; margin: -4px 0; border: 0; border-radius: var(--md-sys-shape-corner-full); color: var(--dp-soft); }

/* ---------- Change cells ---------- */
/* Tiles use the delta chip component; in tables the change is coloured text. */
.dp td.ov-delta { padding: 11px 14px; font-size: var(--mrc-typescale-data-medium-size); }
.dp td.ov-delta.good { color: var(--dp-forest); }
.dp td.ov-delta.bad { color: var(--dp-risk); }

/* ---------- Cards, chart and tables ---------- */
.dp .insights-report-card { padding: 20px 22px 14px; }
.dp .insights-report-title { font-family: var(--dp-sans); font-size: var(--md-sys-typescale-title-medium-size); font-weight: 600; letter-spacing: -0.015em; color: var(--dp-ink); }
.dp .insights-report-subtitle { font-size: var(--mrc-typescale-data-medium-size); color: var(--dp-soft); }
.dp .ov-card-controls > select { padding: 7px 10px; }
.dp .insights-report-table th,
.dp .insights-report-table td { border-bottom: 1px solid var(--dp-line); font-size: var(--mrc-typescale-data-medium-size); padding: 11px 14px; }
.dp .insights-report-table thead tr { background: transparent; }
.dp .ov-compare-table thead th:first-child { background: var(--dp-raised); }
.dp .insights-report-table thead th {
  background: transparent; color: var(--dp-faint); font-family: var(--dp-sans); font-size: var(--md-sys-typescale-body-small-size); font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; border-bottom: 1px solid var(--dp-line);
}
.dp .ov-sortable button:focus-visible { outline-color: var(--dp-sage); }
/* The sort button fills its header cell and is at least 24px tall (WCAG 2.2 target size). */
.dp .ov-sortable button { display: inline-flex; align-items: center; min-height: 24px; }
.dp .ov-sortable.active { color: var(--dp-ink); }
.dp .insights-report-table thead th.ov-prior-col { color: var(--dp-faint); opacity: 1; }
.dp .ov-table td.num,
.dp .ov-table th.num { font-family: var(--dp-sans); font-variant-numeric: tabular-nums; }
.dp .ov-table tbody th { background: var(--dp-raised); color: var(--dp-ink); font-family: var(--dp-sans); font-size: var(--mrc-typescale-data-medium-size); font-weight: 600; }
.dp .insights-report-table tbody tr:hover td,
.dp .insights-report-table tbody tr:hover th { background: var(--md-sys-color-surface); }
.dp .ov-prior-col { color: var(--dp-faint); }
.dp .ov-total-row td,
.dp .ov-total-row th,
.dp .ov-table tbody .ov-total-row th { background: var(--dp-paper); font-weight: 700; border-bottom: 1px solid var(--dp-line); }
.dp .ov-drill { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 24px; /* WCAG 2.2 target size */ }
.dp .ov-drill:hover span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.dp .ov-drill:focus-visible { outline: 2px solid var(--dp-sage); outline-offset: 2px; border-radius: var(--md-sys-shape-corner-extra-small); }
.dp .ov-drill-icon { color: var(--dp-faint); font-size: var(--md-sys-typescale-body-small-size); width: 10px; }
.dp .ov-child-row td,
.dp .ov-child-row th { background: var(--md-sys-color-surface); font-size: var(--mrc-typescale-data-medium-size); }
.dp .ov-table tbody .ov-child-row th.ov-child-label { font-weight: 500; color: var(--dp-soft); padding-left: 32px; max-width: 420px; }
.dp .ov-child-note { color: var(--dp-faint); font-size: var(--mrc-typescale-data-medium-size); padding-left: 32px; }
.dp .ov-row-link { margin-left: 6px; color: var(--dp-faint); text-decoration: none; font-weight: 600; }
.dp .ov-row-link:hover,
.dp .ov-row-link:focus-visible { color: var(--dp-navy); }
.dp td.ov-share { color: var(--dp-soft); }
.dp .ov-pager-text,
.dp .ov-row-filter { font-size: var(--mrc-typescale-data-medium-size); color: var(--dp-soft); }
.dp .ov-row-filter-label { font-family: var(--dp-sans); font-size: var(--mrc-typescale-data-medium-size); font-weight: 600; color: var(--dp-ink); }
.dp .ov-error { background: var(--dp-risk-soft); color: var(--dp-risk); border-radius: var(--md-sys-shape-corner-medium); }
/* Negative values that need a second look (e.g. organic below zero). */
.dp td.ov-flag { color: var(--dp-risk); background: var(--dp-risk-soft); cursor: help; }
/* Dimension × period grid: the name column stays put while the periods scroll. */
.dp .dp-grid th,
.dp .dp-grid td { white-space: nowrap; }
.dp .dp-grid th:first-child { position: sticky; left: 0; z-index: 1; background: var(--dp-raised); max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.dp .dp-grid td.dp-grid-total { font-weight: 600; border-left: 1px solid var(--dp-line); }

@media (max-width: 1080px) {
  .dp .ov-kpi-grid { width: 100%; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
@media (max-width: 720px) {
  .dp .ov-title { font-size: var(--md-sys-typescale-headline-medium-size); }
  .dp .ov-kpi-value { font-size: var(--md-sys-typescale-title-large-size); }
}

/* ---------- Ad audit patterns ---------- */
/* Settings as chips: one line summarizing period, comparison and filters; Edit opens the controls. */
.dp .dp-settings { margin-top: 2px; }
.dp .dp-settings-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dp .dp-chips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.dp .dp-settings .ov-filters { margin-top: 12px; }
/* The forecast tiles (js/dash-forecast.js, a team file) still make their own change chip; same look as the delta chip component until they move over. */
.dp .ov-kpi-change > .ov-delta {
  display: inline-block; padding: 2px var(--mrc-space-3); border-radius: var(--md-sys-shape-corner-full); background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-medium-weight) var(--md-sys-typescale-label-medium-size)/var(--md-sys-typescale-label-medium-line-height) var(--md-ref-typeface-plain);
}
.dp .ov-kpi-change > .ov-delta.good { background: var(--mrc-sys-color-success-container); color: var(--mrc-sys-color-on-success-container); }
.dp .ov-kpi-change > .ov-delta.bad { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }

/* Page story: headline with the change emphasized, then three signal cards. */
.dp .dp-story { margin-top: 4px; }
.dp .dp-headline {
  margin: 0; max-width: 900px; font-family: var(--dp-sans); font-size: var(--md-sys-typescale-headline-medium-size); font-weight: 600; line-height: 1.25;
  letter-spacing: -0.02em; color: var(--dp-ink);
}
.dp .dp-headline em { font-style: italic; color: var(--dp-ink); }
.dp .dp-headline em.good { color: var(--dp-forest); }
.dp .dp-headline em.bad { color: var(--dp-risk); }
.dp .dp-signals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.dp .dp-signal { background: var(--dp-raised); border: 1px solid var(--dp-line); border-radius: var(--dp-radius); padding: 16px 18px; }
.dp .dp-signal p { margin: 0; }
.dp .dp-signal-label { font-size: var(--mrc-typescale-data-medium-size); font-weight: 600; color: var(--dp-soft); }
.dp .dp-signal-big { margin-top: 6px !important; font-size: var(--md-sys-typescale-headline-medium-size); font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--dp-ink); }
.dp .dp-signal-big.good { color: var(--dp-forest); }
.dp .dp-signal-big.bad { color: var(--dp-risk); }
.dp .dp-signal-big.new { color: var(--dp-navy); }
.dp .dp-signal-text { margin-top: 6px !important; font-size: var(--md-sys-typescale-body-medium-size); line-height: 1.45; color: var(--dp-soft); }
.dp .dp-story.ov-loading { opacity: .55; }
@media (max-width: 900px) { .dp .dp-signals { grid-template-columns: 1fr; } }

/* Tables: one header per metric over its columns, with a divider between metric groups. */
.dp .ov-compare-table thead th.ov-grp { text-align: center; color: var(--dp-ink); border-bottom: 1px solid var(--dp-line); padding-bottom: 6px; }
.dp .ov-compare-table thead tr.ov-subhead th { padding-top: 6px; }
.dp .ov-compare-table .ov-grp-start { border-left: 2px solid var(--md-sys-color-outline-variant); }
.dp .ov-compare-table td.ov-grp-start[title^="Prior"] { cursor: help; }

/* Status pills (New) and the change cell that holds one. */
.dp .dp-pill { display: inline-block; font-family: var(--dp-sans); font-size: var(--md-sys-typescale-body-small-size); font-weight: 700; letter-spacing: 0.03em; padding: 3px 8px; border-radius: var(--md-sys-shape-corner-small); }
.dp .dp-pill.new { background: var(--md-sys-color-surface-container); color: var(--dp-navy); }
.dp td.ov-delta.new { background: transparent; }

.dp .ov-card .ov-row-filter { margin: 4px 0 10px; }

/* ---------- Audits (js/dash-audits.js): the report / history frame and the notices ---------- */
.dp .da-frame {
  /* js/dash-audits.js sizes the frame to the page inside it, so the Audits page scrolls as one page; 640px only holds the place while it loads. */
  display: block; width: 100%; height: 640px; border: 0; background: transparent; overflow: hidden;
}
.dp .da-gear-btn { display: inline-flex; align-items: center; justify-content: center; padding: 0; width: 41px; height: 41px; line-height: 0;
  align-self: flex-end; }   /* same box as the Partner select next to it, lined up with it (not centred on its caption too) */
.dp .da-gear-btn[hidden] { display: none; }
.dp .da-notice { padding: 28px; border: 1px solid var(--dp-line); border-radius: var(--dp-radius); background: var(--dp-raised); }
.dp .da-notice h3 { margin: 0 0 6px; font-size: var(--md-sys-typescale-title-medium-size); }
.dp .da-notice p { margin: 0; color: var(--dp-soft); }

/* css/dash-components.css */
/* Base components (js/dash-components.js, js/dash-icons.js): buttons, chips and the callout card. Built only from the design tokens (css/tokens.css):
   no colours or font sizes of their own. */

.ds-icon { flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Buttons ---------- */
.ds-btn {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: var(--mrc-space-2);
  min-height: 40px; padding: 0 var(--mrc-space-6); border: 1px solid transparent; border-radius: var(--md-sys-shape-corner-full); cursor: pointer; text-decoration: none; white-space: nowrap;
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/var(--md-sys-typescale-label-large-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
/* State layer: a wash of the button's own text colour that deepens on hover, focus and press. */
.ds-btn::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; background: currentColor; opacity: 0; pointer-events: none; transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard); z-index: -1; }
/* The tap target is 48px tall even though the button is 40px: an invisible area, so nothing else moves. */
.ds-btn::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: var(--mrc-touch-target); transform: translateY(-50%); }
.ds-btn:hover::before { opacity: var(--md-sys-state-hover-state-layer-opacity); }
.ds-btn:focus-visible::before { opacity: var(--md-sys-state-focus-state-layer-opacity); }
.ds-btn:active::before { opacity: var(--md-sys-state-pressed-state-layer-opacity); }
.ds-btn:focus-visible { outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color); outline-offset: var(--mrc-focus-ring-offset); }
.ds-btn[disabled], .ds-btn[aria-disabled="true"] { opacity: var(--md-sys-state-disabled-content-opacity); cursor: not-allowed; pointer-events: none; }
.ds-btn--has-icon { padding-left: var(--mrc-space-4); }
/* A button that is "on" (an open disclosure, an active filter) fills with the selected colour. */
.ds-btn--outlined.active { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border-color: transparent; }
.ds-btn--filled { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.ds-btn--tonal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }
.ds-btn--outlined { background: transparent; color: var(--md-sys-color-primary); border-color: var(--md-sys-color-outline); }
.ds-btn--text { background: transparent; color: var(--md-sys-color-primary); padding: 0 var(--mrc-space-3); }
.ds-btn--text.ds-btn--has-icon { padding-left: var(--mrc-space-3); }
.ds-btn--icon { width: 40px; padding: 0; }
.ds-btn--icon::after { left: 50%; right: auto; width: var(--mrc-touch-target); transform: translate(-50%, -50%); }

/* ---------- Segmented toggle ---------- */
.ds-seg { display: inline-flex; border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-full); overflow: hidden; background: transparent; }
.ds-seg-btn {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--mrc-space-4); border: 0; background: transparent; cursor: pointer;
  color: var(--md-sys-color-on-surface); white-space: nowrap;
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/var(--md-sys-typescale-label-large-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
.ds-seg-btn + .ds-seg-btn { border-left: 1px solid var(--md-sys-color-outline); }
.ds-seg-btn::before { content: ''; position: absolute; inset: 0; background: currentColor; opacity: 0; pointer-events: none; transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard); z-index: -1; }
/* The tap target is 48px tall even though the segment is 36px. */
.ds-seg-btn::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: var(--mrc-touch-target); transform: translateY(-50%); }
.ds-seg-btn:hover::before { opacity: var(--md-sys-state-hover-state-layer-opacity); }
.ds-seg-btn:focus-visible::before { opacity: var(--md-sys-state-focus-state-layer-opacity); }
.ds-seg-btn:active::before { opacity: var(--md-sys-state-pressed-state-layer-opacity); }
.ds-seg-btn:focus-visible { outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color); outline-offset: calc(-1 * var(--mrc-focus-ring-width)); }
/* The chosen option: a filled segment and heavier text, so it never relies on colour alone. */
.ds-seg-btn.active, .ds-seg-btn[aria-pressed="true"] { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); font-weight: 600; }
.ds-seg-btn[disabled] { opacity: var(--md-sys-state-disabled-content-opacity); cursor: not-allowed; }

/* ---------- Tabs ---------- */
.ds-tabs { display: flex; gap: var(--mrc-space-6); overflow-x: auto; scrollbar-width: none; min-width: 0; }
.ds-tabs::-webkit-scrollbar { display: none; }
.ds-tab {
  position: relative; isolation: isolate; flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--mrc-space-1); border: 0; border-bottom: 3px solid transparent;
  background: transparent; cursor: pointer; color: var(--md-sys-color-on-surface-variant); white-space: nowrap;
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/var(--md-sys-typescale-label-large-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  transition: color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard), border-color var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
/* Hover, focus and press wash over the label's own box; the tap target is 48px tall. */
.ds-tab::before { content: ''; position: absolute; inset: 0 -4px; border-radius: var(--md-sys-shape-corner-extra-small); background: currentColor; opacity: 0; pointer-events: none; transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard); z-index: -1; }
.ds-tab::after { content: ''; position: absolute; left: -4px; right: -4px; top: 50%; height: var(--mrc-touch-target); transform: translateY(-50%); }
.ds-tab:hover { color: var(--md-sys-color-on-surface); }
.ds-tab:hover::before { opacity: var(--md-sys-state-hover-state-layer-opacity); }
.ds-tab:focus-visible::before { opacity: var(--md-sys-state-focus-state-layer-opacity); }
.ds-tab:active::before { opacity: var(--md-sys-state-pressed-state-layer-opacity); }
.ds-tab:focus-visible { outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color); outline-offset: var(--mrc-focus-ring-offset); border-radius: var(--md-sys-shape-corner-extra-small); }
/* The current tab: darker text, a heavier weight and an underline, so it never relies on colour alone. */
.ds-tab.active, .ds-tab[aria-current="page"] { color: var(--md-sys-color-on-surface); font-weight: 600; border-bottom-color: var(--md-sys-color-primary); }
/* Secondary tabs (views within a section) sit on a hairline and use a thinner underline. */
.ds-tabs--secondary { gap: var(--mrc-space-5); border-bottom: 1px solid var(--md-sys-color-outline-variant); }
.ds-tabs--secondary .ds-tab { border-bottom-width: 2px; margin-bottom: -1px; }
/* Large primary tabs stand in for the page title. */
.ds-tabs--large { gap: 26px; }
.ds-tabs--large .ds-tab {
  min-height: 0; padding: 4px 0 8px; border-bottom-width: 3px;
  font: var(--md-sys-typescale-title-large-weight) var(--md-sys-typescale-title-large-size)/var(--md-sys-typescale-title-large-line-height) var(--md-ref-typeface-plain); font-weight: 600; letter-spacing: -0.02em;
}
@media (max-width: 720px) {
  .ds-tabs--large { gap: var(--mrc-space-4); }
  .ds-tabs--large .ds-tab { font-size: var(--md-sys-typescale-title-medium-size); }
}

/* ---------- Filter chips ---------- */
.ds-filter-chip {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: var(--mrc-space-2); min-height: 32px; padding: 0 var(--mrc-space-2) 0 var(--mrc-space-3);
  border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-small); background: transparent; color: var(--md-sys-color-on-surface-variant); cursor: pointer; white-space: nowrap;
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/var(--md-sys-typescale-label-large-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
.ds-filter-chip::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: currentColor; opacity: 0; pointer-events: none; transition: opacity var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard); z-index: -1; }
.ds-filter-chip::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: var(--mrc-touch-target); transform: translateY(-50%); }
.ds-filter-chip:hover::before { opacity: var(--md-sys-state-hover-state-layer-opacity); }
.ds-filter-chip:focus-visible::before { opacity: var(--md-sys-state-focus-state-layer-opacity); }
.ds-filter-chip:active::before { opacity: var(--md-sys-state-pressed-state-layer-opacity); }
.ds-filter-chip:focus-visible { outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color); outline-offset: var(--mrc-focus-ring-offset); }
/* A filter that is on: a check and the selected fill. */
.ds-filter-chip.is-selected { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); border-color: transparent; padding-left: var(--mrc-space-2); }

/* ---------- Chips ---------- */
.ds-chip {
  display: inline-flex; align-items: center; gap: var(--mrc-space-1); padding: 2px var(--mrc-space-3) 2px var(--mrc-space-2); border-radius: var(--md-sys-shape-corner-full); white-space: nowrap;
  font: var(--md-sys-typescale-label-medium-weight) var(--md-sys-typescale-label-medium-size)/var(--md-sys-typescale-label-medium-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking); font-variant-numeric: var(--mrc-font-numeric);
}
.ds-chip--good { background: var(--mrc-sys-color-success-container); color: var(--mrc-sys-color-on-success-container); }
.ds-chip--watch { background: var(--mrc-sys-color-warning-container); color: var(--mrc-sys-color-on-warning-container); }
.ds-chip--critical { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.ds-chip--neutral { background: var(--md-sys-color-surface-container-high); color: var(--md-sys-color-on-surface-variant); }
.ds-chip--internal { background: var(--md-sys-color-secondary-container); color: var(--md-sys-color-on-secondary-container); }

/* ---------- Card and callout ---------- */
.ds-card {
  background: var(--md-sys-color-surface-container-lowest); border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-medium);
  padding: var(--mrc-space-5); color: var(--md-sys-color-on-surface); font-family: var(--md-ref-typeface-plain);
}
/* The gold bar is the brand's mark for a callout; state is the chip, never the bar's colour. */
.ds-callout { display: flex; flex-direction: column; gap: var(--mrc-space-3); border-left: 4px solid var(--mrc-sys-color-accent); }
.ds-callout-head { display: flex; align-items: center; justify-content: space-between; gap: var(--mrc-space-2); flex-wrap: wrap; }
.ds-callout-chips { display: flex; gap: var(--mrc-space-2); flex-wrap: wrap; }
.ds-callout-eyebrow {
  margin: 0; color: var(--md-sys-color-on-surface-variant);
  font: var(--md-sys-typescale-label-medium-weight) var(--md-sys-typescale-label-medium-size)/var(--md-sys-typescale-label-medium-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking); text-transform: uppercase;
}
.ds-callout-headline {
  margin: 0; color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-title-large-weight) var(--md-sys-typescale-title-large-size)/var(--md-sys-typescale-title-large-line-height) var(--md-ref-typeface-plain);
}
.ds-callout-metric { display: flex; align-items: center; gap: var(--mrc-space-3); flex-wrap: wrap; }
/* A single large figure uses the font's normal proportional digits; only columns of numbers use tabular ones. */
.ds-callout-figure {
  font: var(--mrc-typescale-metric-medium-weight) var(--mrc-typescale-metric-medium-size)/var(--mrc-typescale-metric-medium-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--mrc-typescale-metric-medium-tracking);
}
.ds-callout-caption { color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-body-medium-weight) var(--md-sys-typescale-body-medium-size)/var(--md-sys-typescale-body-medium-line-height) var(--md-ref-typeface-plain); }
.ds-callout-drivers { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--mrc-space-1); }
.ds-callout-drivers li {
  position: relative; padding-left: var(--mrc-space-4); color: var(--md-sys-color-on-surface);
  font: var(--md-sys-typescale-body-medium-weight) var(--md-sys-typescale-body-medium-size)/var(--md-sys-typescale-body-medium-line-height) var(--md-ref-typeface-plain);
}
.ds-callout-drivers li::before { content: ''; position: absolute; left: 2px; top: 9px; width: 5px; height: 5px; border-radius: var(--md-sys-shape-corner-full); background: var(--md-sys-color-outline); }
.ds-callout-actions { display: flex; align-items: center; gap: var(--mrc-space-2); flex-wrap: wrap; margin-top: var(--mrc-space-1); }
/* A leading text button lines its label up with the text above it. */
.ds-callout-actions > .ds-btn--text:first-child { margin-left: calc(-1 * var(--mrc-space-3)); }
.ds-callout-meta { margin: 0; color: var(--md-sys-color-on-surface-variant); font: var(--md-sys-typescale-body-small-weight) var(--md-sys-typescale-body-small-size)/var(--md-sys-typescale-body-small-line-height) var(--md-ref-typeface-plain); }

@media (prefers-reduced-motion: reduce) {
  .ds-btn::before, .ds-seg-btn::before, .ds-tab, .ds-tab::before, .ds-filter-chip::before { transition: none; }
}

/* ---------- Buttons in the shell's own markup ----------
   Sign-in, the modals and the team screens are written as HTML, not built by dash-components.js, so they carry older class names. These classes look and
   behave like the .ds-btn variants (pill shape, label-large type, the same state layers and focus ring); new buttons should use MRCComponents.button. */
.upload-btn, .modal-btn-primary, .modal-btn-secondary {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--mrc-space-2);
  min-height: 36px; padding: 0 var(--mrc-space-5); border: 1px solid transparent; border-radius: var(--md-sys-shape-corner-full); cursor: pointer; text-decoration: none; white-space: nowrap;
  font: var(--md-sys-typescale-label-large-weight) var(--md-sys-typescale-label-large-size)/var(--md-sys-typescale-label-large-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-large-tracking);
  transition: box-shadow var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.modal-btn-primary, .modal-btn-secondary { min-height: 40px; }
.upload-btn, .modal-btn-primary { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.modal-btn-secondary { background: transparent; color: var(--md-sys-color-primary); border-color: var(--md-sys-color-outline); }
/* The state layer is an inset wash of the button's text colour. */
.upload-btn:hover, .modal-btn-primary:hover { background: var(--md-sys-color-primary); box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--md-sys-color-on-primary) calc(var(--md-sys-state-hover-state-layer-opacity) * 100%), transparent); }
.modal-btn-secondary:hover { border-color: var(--md-sys-color-outline); color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--md-sys-color-primary) calc(var(--md-sys-state-hover-state-layer-opacity) * 100%), transparent); }
.upload-btn:active, .modal-btn-primary:active { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--md-sys-color-on-primary) calc(var(--md-sys-state-pressed-state-layer-opacity) * 100%), transparent); }
.modal-btn-secondary:active { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--md-sys-color-primary) calc(var(--md-sys-state-pressed-state-layer-opacity) * 100%), transparent); }
.upload-btn:focus-visible, .modal-btn-primary:focus-visible, .modal-btn-secondary:focus-visible { outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color); outline-offset: var(--mrc-focus-ring-offset); }
.upload-btn:disabled, .modal-btn-primary:disabled, .modal-btn-secondary:disabled { opacity: var(--md-sys-state-disabled-content-opacity); cursor: not-allowed; box-shadow: none; }

/* Compact outlined buttons (export, reset, small actions in tables and panels): the outlined variant at 32px. */
.file-action-btn, .reset-report-btn, .classifier-reset-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--mrc-space-2);
  min-height: 32px; padding: 0 var(--mrc-space-4); border: 1px solid var(--md-sys-color-outline); border-radius: var(--md-sys-shape-corner-full); background: transparent; color: var(--md-sys-color-primary); cursor: pointer; white-space: nowrap;
  font: var(--md-sys-typescale-label-medium-weight) var(--md-sys-typescale-label-medium-size)/var(--md-sys-typescale-label-medium-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking);
  transition: box-shadow var(--md-sys-motion-duration-short2) var(--md-sys-motion-easing-standard);
}
.file-action-btn:hover, .reset-report-btn:hover, .classifier-reset-btn:hover { border-color: var(--md-sys-color-outline); color: var(--md-sys-color-primary); box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--md-sys-color-primary) calc(var(--md-sys-state-hover-state-layer-opacity) * 100%), transparent); }
.file-action-btn:active, .reset-report-btn:active, .classifier-reset-btn:active { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--md-sys-color-primary) calc(var(--md-sys-state-pressed-state-layer-opacity) * 100%), transparent); }
.file-action-btn:focus-visible, .reset-report-btn:focus-visible, .classifier-reset-btn:focus-visible { outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color); outline-offset: var(--mrc-focus-ring-offset); }
.file-action-btn:disabled, .reset-report-btn:disabled, .classifier-reset-btn:disabled { opacity: var(--md-sys-state-disabled-content-opacity); cursor: not-allowed; box-shadow: none; }
.file-action-btn-danger, .classifier-reset-btn.danger { color: var(--md-sys-color-error); }
.file-action-btn-danger:hover, .classifier-reset-btn.danger:hover { color: var(--md-sys-color-error); box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--md-sys-color-error) calc(var(--md-sys-state-hover-state-layer-opacity) * 100%), transparent); }

/* css/dash-charts.css */
/* Chart components (js/dash-charts.js): legend, "View as table", tooltip, table view. Built only from the design tokens (css/tokens.css). */

.mc { font-family: var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface); }

/* ---------- Legend and table toggle ---------- */
.mc-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--mrc-space-3); flex-wrap: wrap; margin: 0 0 var(--mrc-space-2); min-height: var(--mrc-space-6); }
.mc-legend { display: flex; flex-wrap: wrap; gap: var(--mrc-space-1) var(--mrc-space-2); list-style: none; margin: 0; padding: 0; }
.mc-key, .mc-table-toggle {
  display: inline-flex; align-items: center; gap: var(--mrc-space-2); border: 0; background: transparent; cursor: pointer; position: relative;
  font: var(--md-sys-typescale-label-medium-weight) var(--md-sys-typescale-label-medium-size)/var(--md-sys-typescale-label-medium-line-height) var(--md-ref-typeface-plain);
  letter-spacing: var(--md-sys-typescale-label-medium-tracking); border-radius: var(--md-sys-shape-corner-full); padding: var(--mrc-space-1) var(--mrc-space-2);
}
.mc-key { color: var(--md-sys-color-on-surface-variant); }
.mc-key[aria-pressed="false"] { color: var(--md-sys-color-outline); text-decoration: line-through; }
.mc-table-toggle { color: var(--md-sys-color-primary); margin-left: auto; }
/* The tap target is 48px tall even though the control is shorter. */
.mc-key::after, .mc-table-toggle::after { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: var(--mrc-touch-target); transform: translateY(-50%); }
.mc-key:hover, .mc-table-toggle:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) calc(var(--md-sys-state-hover-state-layer-opacity) * 100%), transparent); }
.mc-key:focus-visible, .mc-table-toggle:focus-visible, .mc-stage:focus-visible {
  outline: var(--mrc-focus-ring-width) solid var(--mrc-focus-ring-color); outline-offset: var(--mrc-focus-ring-offset);
}
.mc-swatch, .mc-tip-key { display: inline-block; flex: none; --mc-color: var(--mrc-chart-other); }
.mc-swatch.is-box, .mc-tip-key.is-box { width: 10px; height: 10px; border-radius: 2px; background: var(--mc-color); }
.mc-swatch.is-line, .mc-tip-key.is-line { width: 16px; height: 0; border-top: 2px solid var(--mc-color); }
.mc-swatch.is-dash, .mc-tip-key.is-dash { width: 16px; height: 0; border-top: 2px dashed var(--mc-color); }
.mc-swatch.is-off { opacity: 0.4; }

/* ---------- Stage and tooltip ---------- */
.mc-stage { position: relative; border-radius: var(--md-sys-shape-corner-small); }
.mc-stage-small { height: 140px; }
.mc-tip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 160px; max-width: 280px; padding: var(--mrc-space-2) var(--mrc-space-3);
  background: var(--md-sys-color-inverse-surface); color: var(--md-sys-color-inverse-on-surface); border-radius: var(--md-sys-shape-corner-small);
  box-shadow: var(--md-sys-elevation-level2);
  font: var(--md-sys-typescale-body-small-weight) var(--md-sys-typescale-body-small-size)/var(--md-sys-typescale-body-small-line-height) var(--md-ref-typeface-plain);
  font-variant-numeric: var(--mrc-font-numeric);
}
.mc-tip-title { font-weight: 500; margin: 0 0 var(--mrc-space-1); opacity: 0.85; }
.mc-tip-row { display: flex; align-items: center; gap: var(--mrc-space-2); padding: 1px 0; }
.mc-tip-row strong { font-weight: 600; font-size: var(--md-sys-typescale-body-medium-size); line-height: var(--md-sys-typescale-body-medium-line-height); }
.mc-tip-name { opacity: 0.85; }
.mc-tip-key { --mc-color: var(--md-sys-color-inverse-on-surface); }

/* ---------- Table view ---------- */
.mc-table { max-height: 340px; overflow: auto; border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-small); }
.mc-table table { width: 100%; border-collapse: collapse; font: var(--md-sys-typescale-body-small-weight) var(--md-sys-typescale-body-small-size)/var(--md-sys-typescale-body-small-line-height) var(--md-ref-typeface-plain); font-variant-numeric: var(--mrc-font-numeric); }
.mc-table th, .mc-table td { padding: var(--mrc-space-2) var(--mrc-space-3); border-bottom: 1px solid var(--md-sys-color-outline-variant); text-align: left; white-space: nowrap; }
.mc-table th.num, .mc-table td.num { text-align: right; }
.mc-table thead th { position: sticky; top: 0; background: var(--md-sys-color-surface-container-low); color: var(--md-sys-color-on-surface-variant); font-weight: 500; z-index: 1; }
.mc-table tbody th { font-weight: 500; color: var(--md-sys-color-on-surface); }
.mc-table tbody tr:last-child th, .mc-table tbody tr:last-child td { border-bottom: 0; }
.mc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* A second metric is its own small chart under the first, with its own axis: never two scales on one chart. */
.mc-sub { margin-top: var(--mrc-space-4); padding-top: var(--mrc-space-3); border-top: 1px solid var(--md-sys-color-outline-variant); }
.mc-sub-title { margin: 0 0 var(--mrc-space-1); font: var(--md-sys-typescale-title-small-weight) var(--md-sys-typescale-title-small-size)/var(--md-sys-typescale-title-small-line-height) var(--md-ref-typeface-plain); color: var(--md-sys-color-on-surface); }

@media (prefers-reduced-motion: reduce) {
  .mc-key, .mc-table-toggle { transition: none; }
}
@media (max-width: 720px) {
  .mc-stage-small { height: 120px; }
}
