/* =========================================================================
   Auto-Cuan — UI theme layer
   =========================================================================

   Loaded AFTER the inline <style> block in index.html so it wins without
   !important. It is deliberately a restyle of the component classes that
   already exist (.panel, .action-card, .dashboard-hero, .empty-state, …)
   rather than new markup: the app converges on one card language, one radius
   scale and one type scale without touching behaviour.

   Sections
     1. Tokens
     2. Base + typography
     3. Surfaces and cards
     4. Header and desktop navigation
     5. Mobile bottom navigation + menu sheet
     6. Tables, forms, misc
     7. Reduced motion
   ========================================================================= */

/* ---- 1. Tokens ---------------------------------------------------------

   THE token layer. This block is the only place in the product that assigns a
   value to an --ac-* custom property.

   It used to be two blocks: one here and one in the inline <style> of
   index.html, declaring the SAME names with DIFFERENT values. Because custom
   properties resolve from the winning declaration rather than from source
   order, this file silently redefined every token the inline sheet had just
   set — so `--ac-surface-1` was a flat colour where it was written and a
   diagonal gradient where it was read, `--ac-space-1` was 4px in one file and
   6px in the other, and `--ac-focus` was a colour in one and a box-shadow list
   in the other. That last one made `outline: 2px solid var(--ac-focus)` an
   invalid declaration, so the inline focus outline had simply stopped
   existing. Focus is now one token per job: --ac-focus-color and
   --ac-focus-ring.

   The inline sheet no longer declares tokens. It reads them with a literal
   fallback — var(--ac-x, #hex) — so the maintenance and blocked screens still
   render correctly on a network where this file never arrives.
   ------------------------------------------------------------------------- */
:root {
  /* --- Master Design Tokens (§2) --- */
  --canvas: #090D16;
  --surface: #10151F;
  --surface-elevated: #161C29;
  --border-hairline: rgba(255, 255, 255, 0.08);
  --border-subtle: rgba(255, 255, 255, 0.12);
  --text-primary: #F4F6F8;
  --text-secondary: #9AA4B2;
  --text-tertiary: #626C7A;
  --text-muted: #626C7A;
  --accent-primary: #22C55E;
  --accent-primary-hover: #16A34A;
  --accent-subtle: rgba(34, 197, 94, 0.12);
  --data-positive: #22C55E;
  --data-negative: #EF4444;
  --data-neutral: #F59E0B;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #3B82F6;

  /* --- Canonical Motion Scale (AntiSlop + DESIGN.md §50) --- */
  --motion-press: 90ms;
  --motion-hover: 140ms;
  --motion-state: 190ms;
  --motion-panel: 260ms;
  --motion-story: 420ms;
  --motion-hero-max: 560ms;
  --motion-stagger-tight: 28ms;
  --motion-stagger-story: 64ms;

  /* Canonical Easing (AntiSlop + DESIGN.md §50) */
  --ease-standard: cubic-bezier(.2,.8,.2,1);
  --ease-emphasized: cubic-bezier(.16,1,.3,1);
  --ease-exit: cubic-bezier(.4,0,1,1);

  /* Compatibility aliases for legacy consumers (zero independent numeric scale) */
  --motion-instant: var(--motion-press);
  --motion-fast: var(--motion-state);
  --motion-base: var(--motion-panel);
  --motion-slow: var(--motion-story);
  --motion-stagger: var(--motion-stagger-story);

  --color-bg-canvas: #090d16;
  --color-bg-surface: #0d1320;
  --color-bg-elevated: #111a2a;
  --color-bg-hover: #162033;
  --color-text-primary: #f4f7fb;
  --color-text-secondary: #aab4c3;
  --color-text-muted: #738096;
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --color-border-subtle: rgba(148, 163, 184, 0.12);
  --color-border-default: rgba(148, 163, 184, 0.20);
  --color-accent: #5b8cff;
  --color-on-accent: #091322;
  --color-positive: #34d399;
  --color-positive-soft: rgba(52, 211, 153, 0.12);
  --color-negative: #fb7185;
  --color-negative-soft: rgba(251, 113, 133, 0.12);
  --grid-line: rgba(148, 163, 184, 0.10);
  --grid-header-bg: #0d1320;

  /* --- Ground and surfaces ---------------------------------------------
     Flat, and stepped by lightness alone. Every repeated surface used to
     carry its own diagonal gradient, which is what made a dense screen read
     as muddy: eight cards, eight light sources. One gradient survives, on the
     dashboard hero, because there is exactly one of it. */
  --ac-bg: #090d16;
  --ac-bg-elevated: #0c111b;
  --ac-surface-1: #0f1420;      /* panel — Holver-style neutral card ground */
  --ac-surface-2: #141a27;      /* raised block sitting on a panel */
  --ac-surface-3: #0b101a;      /* recessed well — inputs, nested groups */
  --ac-surface-hover: #19202e;

  /* --- Structure -------------------------------------------------------
     Three weights. A hairline states a boundary, a line draws a container,
     a strong line means the container is interactive or focused. */
  --ac-hairline: rgba(148, 163, 184, 0.085);
  --ac-line: rgba(148, 163, 184, 0.13);
  --ac-line-strong: rgba(148, 163, 184, 0.22);
  --ac-border: var(--ac-line);                 /* inline-sheet alias */
  --ac-border-strong: var(--ac-line-strong);   /* inline-sheet alias */

  /* --- Text ------------------------------------------------------------
     Measured against --ac-surface-1: strong 16.8:1, default 12.1:1,
     muted 6.1:1, dim 3.6:1. Everything that carries meaning clears 4.5:1;
     --ac-text-dim is reserved for non-essential ornament and uppercase
     micro-labels at >=11px, which clear the AA large-text threshold. */
  --color-text-primary: #f8fafc;
  --ac-text-strong: var(--color-text-primary);
  --ac-text: #dbe3ec;
  --ac-text-muted: #93a1b5;
  --ac-text-dim: #475569;
  --ac-text-faint: var(--ac-text-dim);         /* inline-sheet alias */

  /* --- Accent ----------------------------------------------------------
     One accent, spent deliberately: active navigation, primary action, and
     bullish direction. Nothing else earns it. */
  --ac-accent: #34d399;
  --ac-accent-strong: #22c55e;
  --ac-accent-soft: rgba(16, 185, 129, 0.10);
  --ac-accent-line: rgba(52, 211, 153, 0.30);
  --ac-brand: var(--ac-accent-strong);         /* inline-sheet alias */
  --ac-brand-strong: var(--ac-accent);         /* inline-sheet alias */
  --ac-brand-ink: #04130d;

  /* --- Financial semantics --------------------------------------------
     Named by meaning, not hue. Colour is never the only cue: direction is
     always repeated in text or glyph next to it. */
  --ac-bull: #34d399;
  --ac-bull-dim: rgba(52, 211, 153, 0.12);
  --ac-bear: #f87171;
  --ac-bear-dim: rgba(248, 113, 113, 0.12);
  --ac-flat: #94a3b8;
  --ac-flat-dim: rgba(148, 163, 184, 0.10);
  --ac-warn: #fbbf24;
  --ac-warn-dim: rgba(251, 191, 36, 0.12);
  --ac-info: #60a5fa;
  --ac-info-dim: rgba(96, 165, 250, 0.12);
  --ac-danger: #f87171;

  /* --- Radius: five steps, replacing the 6/8/10/12/13/14/16/17/18/20/22/24
     mix that ran across the two sheets.

     The steps are chosen to coincide with Tailwind's rounded-md / -lg / -xl /
     -2xl, because the markup reaches for those utilities 264 times. A token
     scale that disagreed with them would just be a seventh radius language.
     Only rounded-3xl (24px) sits off the scale, and section 2b pulls it in. */
  --ac-radius-xs: 6px;   /* = rounded-md  */
  --ac-radius-sm: 8px;   /* = rounded-lg  */
  --ac-radius-md: 12px;  /* = rounded-xl  */
  --ac-radius-lg: 16px;  /* = rounded-2xl */
  --ac-radius-xl: 20px;  /* rounded-3xl is mapped down to this */

  /* --- Space: one 4px base scale. The two sheets previously ran a 4px and a
     6px scale under identical names. */
  --ac-space-1: 4px;
  --ac-space-2: 8px;
  --ac-space-3: 12px;
  --ac-space-4: 16px;
  --ac-space-5: 20px;
  --ac-space-6: 24px;
  --ac-space-8: 32px;

  /* --- Elevation -------------------------------------------------------
     A contact shadow plus a wide ambient one, and a 1px inner highlight on
     the top edge. The highlight is what reads as craft on a dark surface —
     it implies a light source above the page, so a card looks lit rather
     than cut out. Previous ramp was a single 45-70px blur with no contact
     shadow, which floats without ever landing. */
  --ac-edge: inset 0 1px 0 rgba(255, 255, 255, 0.045);
  --ac-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.34), 0 6px 16px rgba(0, 0, 0, 0.18);
  --ac-shadow-2: 0 2px 4px rgba(0, 0, 0, 0.38), 0 16px 40px rgba(0, 0, 0, 0.28);
  --ac-shadow-sm: var(--ac-shadow-1);          /* inline-sheet alias */
  --ac-shadow-md: var(--ac-shadow-1);          /* inline-sheet alias */
  --ac-shadow-lg: var(--ac-shadow-2);          /* inline-sheet alias */
  --ac-shadow-panel: var(--ac-shadow-2);

  /* --- Type ramp -------------------------------------------------------
     Seven steps. The markup reaches for text-[9px]/[10px]/[11px] in 229
     places; section 2b maps those three arbitrary values onto micro and
     caption so the ramp holds without touching a single class attribute. */
  --ac-text-micro: 11px;      /* uppercase labels, table headers, meta */
  --ac-text-caption: 12px;    /* secondary copy, hints, dense cells */
  --ac-text-body: 13px;       /* default reading size */
  --ac-text-lead: 15px;       /* card and panel titles */
  --ac-text-title: 18px;      /* page and section headings */
  --ac-text-metric: 21px;     /* single KPI figure */
  --ac-text-display: 27px;    /* hero figure */

  --ac-lh-tight: 1.2;
  --ac-lh-snug: 1.45;
  --ac-lh-normal: 1.55;

  /* Redesign v2 (HANDOFF §2.3): faces are self-hosted in /fonts/ac-fonts.css. */
  --ac-font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ac-font-mono: 'Geist Mono', 'SF Mono', 'Roboto Mono', 'Cascadia Code', ui-monospace, monospace;

  /* --- Focus: one job per token. See the header note above. */
  --ac-focus-color: #34d399;
  --ac-focus-ring: 0 0 0 2px rgba(9, 12, 18, 1), 0 0 0 4px rgba(52, 211, 153, 0.62);

  /* A hairline that reads as structure rather than as a drawn box. */
  --ac-control-h: 38px;
  --ac-control-h-touch: 44px;

  /* Table rhythm. Row height is a design decision, not an accident of padding. */
  --ac-row-h: 38px;
  --ac-row-h-dense: 32px;

  --ac-fab-size: 56px;
  --ac-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html:not(.light) {
  --text-primary: #F4F6F8;
}

html.light,
[data-theme="light"] {
  /* --- Master Design Tokens Light Mode (§2) --- */
  --canvas: #F7F8FA;
  --surface: #FFFFFF;
  --surface-elevated: #F1F5F9;
  --border-hairline: #E5E7EB;
  --border-subtle: rgba(0, 0, 0, 0.12);
  --text-primary: #111827; /* WAJIB: bukan #FFFFFF, kontras WCAG AA */
  --text-secondary: #4B5563;
  --text-tertiary: #475569;
  --text-muted: #475569;
  --accent-primary: #16A34A;
  --accent-primary-hover: #15803D;
  --accent-subtle: rgba(22, 163, 74, 0.10);
  --data-positive: #16A34A;
  --data-negative: #DC2626;
  --data-neutral: #F59E0B;
  --danger: #DC2626;
  --warning: #D97706;
  --info: #2563EB;

  --color-bg-canvas: #f8fafc;
  --color-bg-surface: #ffffff;
  --color-bg-elevated: #f8fafc;
  --color-bg-hover: #f1f5f9;
  --color-text-primary: #0f172a;
  --color-text-secondary: #334155;
  --color-text-muted: #475569;
  --color-border-subtle: rgba(15, 23, 42, 0.10);
  --color-border-default: rgba(15, 23, 42, 0.16);
  --color-accent: #2563eb;
  --color-on-accent: #ffffff;
  --color-positive: #047857;
  --color-positive-soft: rgba(4, 120, 87, 0.10);
  --color-negative: #b91c1c;
  --color-negative-soft: rgba(185, 28, 28, 0.10);
  --color-warning: #b45309;
  --grid-line: rgba(15, 23, 42, 0.08);
  --grid-header-bg: #f8fafc;
}

/* ---- 1b. Viewport height ------------------------------------------------
   iOS Safari and Android Chrome both size 100vh to the viewport with the URL bar
   COLLAPSED, so a 100vh shell overshoots the visible area and shifts as the bar
   hides and shows. `dvh` tracks the real viewport; the `vh` line stays first as the
   fallback for engines that do not support it. */
body, #dashboardScreen, .landing-shell { min-height: 100vh; }
.sidebar { height: 100vh; }
#page-analisis { min-height: calc(100vh - 120px); }
#aiSection { min-height: calc(100vh - 64px); }

@supports (height: 100dvh) {
  body, #dashboardScreen, .landing-shell { min-height: 100dvh; }
  .sidebar { height: 100dvh; }
  #page-analisis { min-height: calc(100dvh - 120px); }
  #aiSection { min-height: calc(100dvh - 64px); }
}

/* The app footer sits at the foot of the shell; keep it clear of the home indicator. */
#dashboardScreen > footer { padding-bottom: var(--ac-safe-bottom); }

/* Global Scroll & Unclipped Card Grid Layout */
html, body, #dashboardScreen, .page-content {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#kgCardGrid, #nkCardGrid, #dtCardGrid {
  padding-bottom: 80px;
  margin-bottom: 24px;
  overflow: visible;
}

.dt-card-item, .kg-card-item, .nk-card-item {
  min-height: fit-content;
  height: auto;
  overflow: visible;
  box-sizing: border-box;
}

.trade-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  overflow: visible;
}

/* ---- 1c. Scoped V2 Rollout Foundation & Canonical Primitives (§76, §99) ----
   Migrated surfaces and components opt in deterministically.
   Unmigrated legacy routes remain untouched on their proven styling. */

/* Canonical Design System V2 Scoped Tokens (DESIGN.md §4, §5, §6, §7, §8, §9, §50, §103) */
:where([data-ac-ui="v2"], .ac-ui-v2) {
  /* Ground & Surfaces (§4.1). Values are the redesign v2 canvas `:root` in
     handoff design/project/ac.css (v2.2 eye-comfort palette), mapped onto the
     existing v2 names so there is still exactly one token system. */
  --ac-canvas: #EFF1EC;
  --ac-surface: #FCFCFA;
  --ac-surface-raised: #F5F7F3;
  --ac-surface-hover: #EAEEE8;

  /* Typography / Ink Tokens (§4.1) */
  --ac-ink: #1D2724;
  --ac-text-secondary: #535F5A;
  --ac-text-muted: #5E6A65;
  --ac-text-tertiary: var(--ac-text-muted);

  /* Lines & Borders (§4.1). The canvas has no strong line; it keeps the
     previous 0.20 alpha on the canvas ink. */
  --ac-line-hairline: #DFE4DE;
  --ac-line-default: rgba(29, 39, 36, 0.13);
  --ac-line-strong: rgba(29, 39, 36, 0.20);
  --ac-control-border: #848D88;
  --ac-control-border-hover: #68746E;

  --ac-border: var(--ac-line-default);
  --ac-border-strong: var(--ac-line-strong);

  /* Brand Emerald (§4.1) */
  --ac-brand: #13785D;
  --ac-brand-hover: #0D634C;
  --ac-brand-soft: #E3EFE8;
  --ac-focus: #13785D;
  --ac-focus-ring: 0 0 0 2px var(--ac-surface), 0 0 0 4px var(--ac-focus);

  /* Financial Semantics (§4.1). --ac-negative and --ac-warning-text are the
     darkened values that pass AA (HANDOFF §3). */
  --ac-positive: #26734A;
  --ac-positive-soft: rgba(42, 122, 75, 0.10);
  --ac-negative: #AD3F52;
  --ac-negative-soft: rgba(185, 71, 90, 0.10);
  --ac-warning: #A96D13;
  --ac-warning-text: #8A590D;
  --ac-warning-soft: rgba(169, 109, 19, 0.10);
  --ac-info: #315F9A;
  --ac-info-soft: rgba(49, 95, 154, 0.09);

  /* System State Aliases (§4.1) */
  --ac-success: #26734A;
  --ac-danger: #AD3F52;

  /* Inverted surface (active chip, toast, active segment) and the one
     floating shadow (mascot, bottom sheet, dialog, drawer). HANDOFF §3, §3a. */
  --ac-inv: #1D2724;
  --ac-shadow-float: 0 10px 25px -5px rgba(0, 0, 0, 0.10), 0 8px 10px -6px rgba(0, 0, 0, 0.10);
  --ease-spring: cubic-bezier(.34, 1.45, .64, 1);

  /* Canvas short names. Pages ported from the canvas read these; they only
     point at the v2 tokens above, so dark mode follows automatically.
     --ac-warn is deliberately NOT aliased: legacy rules use --ac-warn as a
     text colour, while the canvas uses it as an accent. Ported canvas CSS
     reads --ac-warning for dots/borders and --ac-warn-t for text. */
  --ac-raised: var(--ac-surface-raised);
  --ac-hover: var(--ac-surface-hover);
  --ac-2: var(--ac-text-secondary);
  --ac-muted: var(--ac-text-muted);
  --ac-hair: var(--ac-line-hairline);
  --ac-line: var(--ac-line-default);
  --ac-ctl: var(--ac-control-border);
  --ac-ctl-h: var(--ac-control-border-hover);
  --ac-brand-h: var(--ac-brand-hover);
  --ac-pos: var(--ac-positive);
  --ac-pos-soft: var(--ac-positive-soft);
  --ac-neg: var(--ac-negative);
  --ac-neg-soft: var(--ac-negative-soft);
  --ac-warn-t: var(--ac-warning-text);
  --ac-warn-soft: var(--ac-warning-soft);
  --shadow2: var(--ac-shadow-float);
  --ease: var(--ease-standard);
  --ease-e: var(--ease-emphasized);
  --spring: var(--ease-spring);

  /* Spacing Scale (4px base, §7) */
  --ac-space-1: 4px;
  --ac-space-2: 8px;
  --ac-space-3: 12px;
  --ac-space-4: 16px;
  --ac-space-5: 20px;
  --ac-space-6: 24px;
  --ac-space-8: 32px;
  --ac-space-10: 40px;
  --ac-space-12: 48px;
  --ac-space-16: 64px;
  --ac-space-20: 80px;
  --ac-space-24: 96px;
  --ac-space-32: 128px;

  /* Shape / Radius Scale (§8) */
  --ac-radius-xs: 4px;
  --ac-radius-sm: 6px;
  --ac-radius-md: 8px;
  --ac-radius-lg: 12px;
  --ac-radius-xl: 16px;
  --ac-radius-full: 999px;

  /* Shared Sizing Tokens (§103.3) */
  --ac-row-dense: 38px;
  --ac-row-comfort: 42px;
  --ac-control-sm: 36px;
  --ac-control-md: 42px;
  --ac-touch-target: 44px;
  --ac-topbar-height: 52px;
  --ac-sidebar-width: 240px;
  --ac-sidebar-rail: 68px;

  /* Z-Index Layers (§103.2) */
  --ac-z-base: 0;
  --ac-z-sticky: 20;
  --ac-z-shell: 40;
  --ac-z-popover: 60;
  --ac-z-drawer: 80;
  --ac-z-modal: 100;
  --ac-z-toast: 120;
  --ac-z-critical-gate: 140;

  /* Categorical Chart Tokens Light (§103.1) */
  --ac-chart-cat-1: #315F9A;
  --ac-chart-cat-2: #7357A6;
  --ac-chart-cat-3: #94602B;
  --ac-chart-cat-4: #2F6F86;
  --ac-chart-cat-5: #8C4F73;
  --ac-chart-cat-6: #536A7C;

  /* Categorical Chart Tokens Dark (§103.1 canonical definitions) */
  --ac-chart-cat-1-dark: #8BB2E8;
  --ac-chart-cat-2-dark: #B9A0E3;
  --ac-chart-cat-3-dark: #DFB277;
  --ac-chart-cat-4-dark: #7FB7CF;
  --ac-chart-cat-5-dark: #D995B7;
  --ac-chart-cat-6-dark: #A9BDCF;

  /* Motion Tokens (§50) */
  --motion-press: 90ms;
  --motion-hover: 140ms;
  --motion-state: 190ms;
  --motion-panel: 260ms;
  --motion-story: 420ms;
  --motion-hero-max: 560ms;

  --motion-stagger-tight: 28ms;
  --motion-stagger-story: 64ms;

  --ease-standard: cubic-bezier(.2,.8,.2,1);
  --ease-emphasized: cubic-bezier(.16,1,.3,1);
  --ease-exit: cubic-bezier(.4,0,1,1);

  /* Scoped v2 Ground Styling */
  color: var(--ac-ink);
  background-color: var(--ac-canvas);
}

/* Canonical Dark Theme Tokens in V2 Scope (§4.2, Night Research Mode) */
html:not(.light) :where([data-ac-ui="v2"], .ac-ui-v2),
[data-theme="dark"] :where([data-ac-ui="v2"], .ac-ui-v2),
:where([data-ac-ui="v2"], .ac-ui-v2)[data-theme="dark"] {
  /* Dark block of handoff design/project/ac.css (HANDOFF §3a). */
  --ac-canvas: #0E1412;
  --ac-surface: #141C19;
  --ac-surface-raised: #19231F;
  --ac-surface-hover: #1F2B27;

  --ac-ink: #E4EBE7;
  --ac-text-secondary: #B2BDB8;
  --ac-text-muted: #9AA7A1;
  --ac-text-tertiary: var(--ac-text-muted);

  --ac-line-hairline: #26322D;
  --ac-line-default: rgba(228, 235, 231, 0.13);
  --ac-line-strong: rgba(228, 235, 231, 0.20);
  --ac-control-border: #56635D;
  --ac-control-border-hover: #76847D;

  --ac-border: var(--ac-line-default);
  --ac-border-strong: var(--ac-line-strong);

  --ac-brand: #48C797;
  --ac-brand-hover: #63D4A9;
  --ac-brand-soft: rgba(61, 187, 142, 0.14);
  --ac-focus: #48C797;
  --ac-focus-ring: 0 0 0 2px var(--ac-surface), 0 0 0 4px var(--ac-focus);

  --ac-positive: #4FC383;
  --ac-positive-soft: rgba(79, 195, 131, 0.13);
  --ac-negative: #F2808F;
  --ac-negative-soft: rgba(242, 128, 143, 0.13);
  --ac-warning: #E2A94B;
  --ac-warning-text: #EBBA66;
  --ac-warning-soft: rgba(226, 169, 75, 0.13);
  --ac-info: #86ADE3;
  --ac-info-soft: rgba(134, 173, 227, 0.13);

  --ac-success: #4FC383;
  --ac-danger: #F2808F;

  --ac-inv: #2F3D38;
  --ac-shadow-float: 0 12px 28px -6px rgba(0, 0, 0, 0.55), 0 8px 10px -6px rgba(0, 0, 0, 0.45);
  color-scheme: dark;

  /* Categorical Chart Tokens Dark (§103.1) */
  --ac-chart-cat-1-dark: #8BB2E8;
  --ac-chart-cat-2-dark: #B9A0E3;
  --ac-chart-cat-3-dark: #DFB277;
  --ac-chart-cat-4-dark: #7FB7CF;
  --ac-chart-cat-5-dark: #D995B7;
  --ac-chart-cat-6-dark: #A9BDCF;

  --ac-chart-cat-1: var(--ac-chart-cat-1-dark);
  --ac-chart-cat-2: var(--ac-chart-cat-2-dark);
  --ac-chart-cat-3: var(--ac-chart-cat-3-dark);
  --ac-chart-cat-4: var(--ac-chart-cat-4-dark);
  --ac-chart-cat-5: var(--ac-chart-cat-5-dark);
  --ac-chart-cat-6: var(--ac-chart-cat-6-dark);
}

/* Explicit Light Theme Overrides in V2 Scope (§4.1) */
html.light :where([data-ac-ui="v2"], .ac-ui-v2),
[data-theme="light"] :where([data-ac-ui="v2"], .ac-ui-v2),
:where([data-ac-ui="v2"], .ac-ui-v2)[data-theme="light"] {
  --ac-canvas: #EFF1EC;
  --ac-surface: #FCFCFA;
  --ac-surface-raised: #F5F7F3;
  --ac-surface-hover: #EAEEE8;

  --ac-ink: #1D2724;
  --ac-text-secondary: #535F5A;
  --ac-text-muted: #5E6A65;
  --ac-text-tertiary: var(--ac-text-muted);

  --ac-line-hairline: #DFE4DE;
  --ac-line-default: rgba(29, 39, 36, 0.13);
  --ac-line-strong: rgba(29, 39, 36, 0.20);
  --ac-control-border: #848D88;
  --ac-control-border-hover: #68746E;

  --ac-border: var(--ac-line-default);
  --ac-border-strong: var(--ac-line-strong);

  --ac-brand: #13785D;
  --ac-brand-hover: #0D634C;
  --ac-brand-soft: #E3EFE8;
  --ac-focus: #13785D;
  --ac-focus-ring: 0 0 0 2px var(--ac-surface), 0 0 0 4px var(--ac-focus);

  --ac-positive: #26734A;
  --ac-positive-soft: rgba(42, 122, 75, 0.10);
  --ac-negative: #AD3F52;
  --ac-negative-soft: rgba(185, 71, 90, 0.10);
  --ac-warning: #A96D13;
  --ac-warning-text: #8A590D;
  --ac-warning-soft: rgba(169, 109, 19, 0.10);
  --ac-info: #315F9A;
  --ac-info-soft: rgba(49, 95, 154, 0.09);

  --ac-success: #26734A;
  --ac-danger: #AD3F52;

  --ac-inv: #1D2724;
  --ac-shadow-float: 0 10px 25px -5px rgba(0, 0, 0, 0.10), 0 8px 10px -6px rgba(0, 0, 0, 0.10);
  color-scheme: light;

  --ac-chart-cat-1: #315F9A;
  --ac-chart-cat-2: #7357A6;
  --ac-chart-cat-3: #94602B;
  --ac-chart-cat-4: #2F6F86;
  --ac-chart-cat-5: #8C4F73;
  --ac-chart-cat-6: #536A7C;
}

/* Numerics & Typography Primitives (Scoped) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-tabular,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-numeric,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-num,
:is([data-ac-ui="v2"], .ac-ui-v2) [data-ac-numeric] {
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-num-positive {
  color: var(--ac-positive);
  font-variant-numeric: tabular-nums lining-nums;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-num-negative {
  color: var(--ac-negative);
  font-variant-numeric: tabular-nums lining-nums;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-warning,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-num-warning {
  color: var(--ac-warning);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-info,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-num-info {
  color: var(--ac-info);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-num-unknown {
  color: var(--ac-text-muted);
  font-variant-numeric: tabular-nums lining-nums;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-evidence-meta {
  font-size: var(--ac-font-size-metadata, 12px);
  color: var(--ac-text-secondary);
  line-height: 1.4;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-aux-meta {
  font-size: var(--ac-font-size-caption, 11px);
  color: var(--ac-text-muted);
  line-height: 1.4;
}

/* Button Primitives (Scoped) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--ac-control-sm, 36px);
  min-height: var(--ac-control-sm, 36px);
  padding: 0 14px;
  font-family: var(--ac-font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  border-radius: var(--ac-radius-sm, 6px);
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
  transition:
    background-color var(--motion-hover, 140ms) var(--ease-standard, cubic-bezier(.2,.8,.2,1)),
    border-color var(--motion-hover, 140ms) var(--ease-standard, cubic-bezier(.2,.8,.2,1)),
    color var(--motion-hover, 140ms) var(--ease-standard, cubic-bezier(.2,.8,.2,1)),
    box-shadow var(--motion-hover, 140ms) var(--ease-standard, cubic-bezier(.2,.8,.2,1)),
    transform var(--motion-press, 90ms) var(--ease-standard, cubic-bezier(.2,.8,.2,1));
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn:active:not(:disabled):not(.is-disabled) {
  transform: translateY(1px);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: 2px;
}

/* Button Variants & Transitional Compatibility */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-primary,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-primary,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="primary"] {
  background-color: var(--ac-brand);
  border-color: var(--ac-brand);
  color: #FFFFFF;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-primary:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-primary:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="primary"]:hover:not(:disabled):not(.is-disabled) {
  background-color: var(--ac-brand-hover);
  border-color: var(--ac-brand-hover);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-secondary,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-secondary,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="secondary"] {
  background-color: var(--ac-surface);
  border-color: var(--ac-control-border);
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-secondary:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-secondary:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="secondary"]:hover:not(:disabled):not(.is-disabled) {
  background-color: var(--ac-surface-hover);
  border-color: var(--ac-control-border-hover);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-quiet,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-quiet,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-ghost,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-ghost,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="ghost"],
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="quiet"] {
  background-color: transparent;
  border-color: transparent;
  color: var(--ac-text-secondary);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-quiet:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-quiet:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-ghost:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-ghost:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="ghost"]:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="quiet"]:hover:not(:disabled):not(.is-disabled) {
  background-color: var(--ac-surface-hover);
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-danger,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-danger,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="danger"] {
  background-color: var(--ac-negative);
  border-color: var(--ac-negative);
  color: #FFFFFF;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-danger:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-danger:hover:not(:disabled):not(.is-disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn[data-variant="danger"]:hover:not(:disabled):not(.is-disabled) {
  background-color: color-mix(in srgb, var(--ac-negative) 85%, black);
  border-color: color-mix(in srgb, var(--ac-negative) 85%, black);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.ac-btn-icon,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn-icon {
  width: var(--ac-control-sm, 36px);
  padding: 0;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn:disabled,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn.is-loading {
  position: relative;
  cursor: wait;
  pointer-events: none;
}

@media (pointer: coarse) {
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn {
    min-height: var(--ac-touch-target, 44px);
    min-width: var(--ac-touch-target, 44px);
  }
}

/* Field & Form Primitives (Scoped) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-label {
  font-family: var(--ac-font-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea {
  width: 100%;
  height: var(--ac-control-md, 42px);
  min-height: var(--ac-control-md, 42px);
  padding: 0 12px;
  font-family: var(--ac-font-sans);
  font-size: 14px;
  color: var(--ac-ink);
  background-color: var(--ac-surface);
  border: 1px solid var(--ac-control-border);
  border-radius: var(--ac-radius-md, 8px);
  outline: none;
  transition:
    border-color var(--motion-hover, 140ms) var(--ease-standard, cubic-bezier(.2,.8,.2,1)),
    box-shadow var(--motion-hover, 140ms) var(--ease-standard, cubic-bezier(.2,.8,.2,1));
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 12px;
  resize: vertical;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input:hover:not(:disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select:hover:not(:disabled),
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea:hover:not(:disabled) {
  border-color: var(--ac-control-border-hover);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea:focus-visible {
  border-color: var(--ac-brand);
  outline: 2px solid var(--ac-focus);
  outline-offset: 1px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input:disabled,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select:disabled,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea:disabled {
  background-color: var(--ac-surface-raised);
  border-color: var(--ac-line-default);
  color: var(--ac-text-muted);
  opacity: 0.65;
  cursor: not-allowed;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input.is-error,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select.is-error,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea.is-error,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input[aria-invalid="true"],
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select[aria-invalid="true"],
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea[aria-invalid="true"] {
  border-color: var(--ac-negative);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input.is-error:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input.is-error:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select.is-error:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select.is-error:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea.is-error:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea.is-error:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input[aria-invalid="true"]:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-input[aria-invalid="true"]:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select[aria-invalid="true"]:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-select[aria-invalid="true"]:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea[aria-invalid="true"]:focus,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea[aria-invalid="true"]:focus-visible {
  border-color: var(--ac-negative);
  outline: 2px solid var(--ac-negative);
  outline-offset: 1px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-field-error {
  font-size: 12px;
  color: var(--ac-negative);
  line-height: 1.4;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-field-helper {
  font-size: 12px;
  color: var(--ac-text-secondary);
  line-height: 1.4;
}

@media (max-width: 1023px) {
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-input,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-select,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea {
    font-size: max(16px, 1em);
  }
}

/* =========================================================================
   Wave 3 — Data Primitives & Detail Pattern (Scoped V2)
   Authority: DESIGN.md FINAL v1.1 (§14, §14.1, §62.1, §63, §76.4, §76.8-§76.14,
   §78.1-§78.5, §80, §87, §88, §89, §90, §91, §92, §103)
   ========================================================================= */

/* ============================================================
   WAVE 3 DATA PRIMITIVES (from fix_uiux_antigravity_repair)
   ============================================================ */
/* Table Primitives (§14, §76.9, §82) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-wrap,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-container,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-table-wrap,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg, 12px);
  background: var(--ac-surface);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-family: var(--ac-font-sans);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-table th {
  position: sticky;
  top: 0;
  z-index: var(--ac-z-sticky, 20);
  height: 36px;
  padding: 6px var(--ac-space-3, 12px);
  background: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.035em;
  border-bottom: 1px solid var(--ac-line-hairline);
  text-align: left;
  white-space: nowrap;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-table td {
  height: var(--ac-row-dense, 38px);
  padding: 6px var(--ac-space-3, 12px);
  border-bottom: 1px solid var(--ac-line-hairline);
  white-space: nowrap;
}

/* Dense table target 36-40px (§76.9) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table--dense td,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tr.ac-row--dense td {
  height: var(--ac-row-dense, 38px);
  padding: 4px var(--ac-space-3, 12px);
}

/* Comfort table target 40-44px (§82) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table--comfort td,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tr.ac-row--comfort td {
  height: var(--ac-row-comfort, 42px);
  padding: 8px var(--ac-space-3, 12px);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr {
  transition: background-color var(--motion-hover, 140ms) var(--ease-standard);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr:hover {
  background: var(--ac-surface-hover);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}

/* Selected row uses brand-soft + non-color-only left edge indicator (§76.9) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] {
  background: var(--ac-brand-soft);
  box-shadow: inset 3px 0 0 var(--ac-brand);
}

/* Sortable column header */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.ac-th--sortable {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color var(--motion-hover, 140ms) var(--ease-standard),
              color var(--motion-hover, 140ms) var(--ease-standard);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.ac-th--sortable:hover {
  background: var(--ac-surface-hover);
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-sort-icon {
  display: inline-block;
  margin-left: 4px;
  vertical-align: middle;
  opacity: 0.4;
  transition: opacity var(--motion-hover, 140ms) var(--ease-standard),
              transform var(--motion-hover, 140ms) var(--ease-standard);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-th--sortable[aria-sort="ascending"] .ac-sort-icon,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-th--sortable.is-sorted-asc .ac-sort-icon {
  opacity: 1;
  color: var(--ac-brand);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-th--sortable[aria-sort="descending"] .ac-sort-icon,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-th--sortable.is-sorted-desc .ac-sort-icon {
  opacity: 1;
  color: var(--ac-brand);
  transform: rotate(180deg);
}

/* Numeric alignment & tabular figures */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.ac-col-num,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-col-num,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.ac-th-num,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-td-num {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Empty cell displays em-dash, never 0 (§78.1) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-cell-empty {
  color: var(--ac-text-muted);
  font-variant-numeric: tabular-nums lining-nums;
  user-select: none;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.ac-sticky-col,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-sticky-col {
  position: sticky;
  left: 0;
  z-index: 5;
  background: inherit;
  border-right: 1px solid var(--ac-line-hairline);
}

/* Surface & Containment Primitives (§9, §76.10, §76.11) */
[data-ac-ui="v2"] .ac-surface-bounded,
.ac-ui-v2.ac-surface-bounded {
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg, 12px);
}

[data-ac-ui="v2"] .ac-surface-floating,
.ac-ui-v2.ac-surface-floating {
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-xl, 16px);
  box-shadow: var(--ac-shadow-level-2);
}

/* Metric Strip Primitives (§76.7) — continuous surface, not KPI card wall */
[data-ac-ui="v2"] .ac-metric-strip,
.ac-ui-v2.ac-metric-strip {
  display: flex;
  align-items: stretch;
  gap: var(--ac-space-4, 16px);
  padding: var(--ac-space-3, 12px) var(--ac-space-4, 16px);
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  overflow-x: auto;
}

[data-ac-ui="v2"] .ac-metric,
.ac-ui-v2.ac-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

[data-ac-ui="v2"] .ac-metric-label,
.ac-ui-v2.ac-metric-label {
  font-size: 11.5px;
  color: var(--ac-text-secondary);
  font-weight: 500;
  line-height: 1.3;
}

[data-ac-ui="v2"] .ac-metric-value,
.ac-ui-v2.ac-metric-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--ac-ink);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.25;
}

/* Status Badge Primitives (§76.8) — text first, compact */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-badge,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--ac-radius-xs, 4px);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid transparent;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-badge--positive {
  background: var(--ac-positive-soft);
  color: var(--ac-positive);
  border-color: rgba(36, 122, 67, 0.2);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-badge--negative {
  background: var(--ac-negative-soft);
  color: var(--ac-negative);
  border-color: rgba(193, 63, 77, 0.2);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-warning,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-badge--warning {
  background: var(--ac-warning-soft);
  color: var(--ac-warning-text);
  border-color: rgba(169, 109, 19, 0.2);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-info,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-badge--info {
  background: var(--ac-info-soft);
  color: var(--ac-info);
  border-color: rgba(49, 95, 154, 0.2);
}

/* ---- 1d. Wave 3: Shared Data Primitives & Detail Pattern (DESIGN.md §82) ----
   Scoped strictly under [data-ac-ui="v2"] and .ac-ui-v2.
   Establishes reusable shared interaction grammar across all workstation surfaces:
   - filter bar order & overflow contract (§76.4)
   - status / freshness / provenance row grammar (§6.2, §76.8, §76.11, §78.2, §97)
   - desktop detail pane (320–380px) & mobile detail sheet (§63, §76.12, §76.13)
   - overlay grammar (modal, toast, popover, sheet) (§76.13, §62)
   - lifecycle / feedback grammar (loading, empty, partial, stale, error) (§76.14, §78.1, §78.4)
   ------------------------------------------------------------------------- */

/* Filter Bar Order & Overflow Contract (§76.4)
   Canonical order: Search → primary filters → sort → view/options → result/freshness status */
[data-ac-ui="v2"] .ac-filter-bar,
.ac-ui-v2.ac-filter-bar,
.ac-ui-v2 .ac-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--ac-space-2, 8px);
  flex-wrap: wrap;
  padding: var(--ac-space-3, 12px) var(--ac-space-4, 16px);
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg, 12px);
  min-height: 52px;
}

[data-ac-ui="v2"] .ac-filter-bar__search,
.ac-ui-v2 .ac-filter-bar__search {
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 320px;
  position: relative;
  display: flex;
  align-items: center;
}

[data-ac-ui="v2"] .ac-filter-bar__search input,
.ac-ui-v2 .ac-filter-bar__search input {
  width: 100%;
  padding-left: 32px;
}

[data-ac-ui="v2"] .ac-filter-bar__search-icon,
.ac-ui-v2 .ac-filter-bar__search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--ac-text-muted);
  pointer-events: none;
}

[data-ac-ui="v2"] .ac-filter-bar__primary,
.ac-ui-v2 .ac-filter-bar__primary {
  display: flex;
  align-items: center;
  gap: var(--ac-space-2, 8px);
  flex-wrap: wrap;
}

[data-ac-ui="v2"] .ac-filter-bar__sort,
.ac-ui-v2 .ac-filter-bar__sort {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ac-text-secondary);
}

[data-ac-ui="v2"] .ac-filter-bar__view,
.ac-ui-v2 .ac-filter-bar__view {
  display: flex;
  align-items: center;
  gap: 4px;
}

[data-ac-ui="v2"] .ac-filter-bar__status,
.ac-ui-v2 .ac-filter-bar__status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ac-text-secondary);
  white-space: nowrap;
}

[data-ac-ui="v2"] .ac-filter-chips,
.ac-ui-v2.ac-filter-chips,
.ac-ui-v2 .ac-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  padding-top: 4px;
}

[data-ac-ui="v2"] .ac-filter-chip,
.ac-ui-v2.ac-filter-chip,
.ac-ui-v2 .ac-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: var(--ac-radius-sm, 6px);
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-default);
  font-size: 11.5px;
  color: var(--ac-ink);
  line-height: 1.3;
}

[data-ac-ui="v2"] .ac-filter-chip__label,
.ac-ui-v2 .ac-filter-chip__label {
  color: var(--ac-text-secondary);
  font-weight: 500;
}

[data-ac-ui="v2"] .ac-filter-chip__value,
.ac-ui-v2 .ac-filter-chip__value {
  color: var(--ac-ink);
  font-weight: 600;
}

[data-ac-ui="v2"] .ac-filter-chip__remove,
.ac-ui-v2 .ac-filter-chip__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: transparent;
  color: var(--ac-text-muted);
  cursor: pointer;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  transition: color var(--motion-hover, 140ms) var(--ease-standard),
              background-color var(--motion-hover, 140ms) var(--ease-standard);
}

[data-ac-ui="v2"] .ac-filter-chip__remove:hover,
.ac-ui-v2 .ac-filter-chip__remove:hover {
  color: var(--ac-negative);
  background: var(--ac-negative-soft);
}

[data-ac-ui="v2"] .ac-filter-chip__remove:focus-visible,
.ac-ui-v2 .ac-filter-chip__remove:focus-visible {
  outline: 2px solid var(--ac-focus);
}

[data-ac-ui="v2"] .ac-filter-more-btn,
.ac-ui-v2 .ac-filter-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ac-brand);
  background: transparent;
  border: 1px dashed var(--ac-control-border);
  border-radius: var(--ac-radius-sm, 6px);
  padding: 6px 10px;
  cursor: pointer;
  min-height: var(--ac-control-sm, 36px);
  transition: background-color var(--motion-hover, 140ms) var(--ease-standard),
              border-color var(--motion-hover, 140ms) var(--ease-standard);
}

[data-ac-ui="v2"] .ac-filter-more-btn:hover,
.ac-ui-v2 .ac-filter-more-btn:hover {
  background: var(--ac-brand-soft);
  border-color: var(--ac-brand);
}

/* Status, Freshness & Provenance Row Grammar (§6.2, §76.8, §76.11, §78.2, §97) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-badge--neutral,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-status-badge--neutral {
  background: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
  border-color: var(--ac-line-hairline);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-text,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-status-text {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-dot,
:is([data-ac-ui="v2"], .ac-ui-v2).ac-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
  background: var(--ac-text-muted);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-dot--positive {
  background: var(--ac-positive);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-dot--negative {
  background: var(--ac-negative);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-dot--warning {
  background: var(--ac-warning);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-dot--info {
  background: var(--ac-info);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-dot--live {
  background: var(--ac-brand);
  box-shadow: 0 0 8px rgba(15, 116, 88, 0.45);
}

[data-ac-ui="v2"] .ac-freshness,
.ac-ui-v2.ac-freshness,
.ac-ui-v2 .ac-freshness {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--ac-text-secondary);
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.3;
}

[data-ac-ui="v2"] .ac-freshness--live,
.ac-ui-v2 .ac-freshness--live {
  color: var(--ac-brand);
  font-weight: 600;
}

[data-ac-ui="v2"] .ac-freshness--stale,
.ac-ui-v2 .ac-freshness--stale {
  color: var(--ac-warning-text);
  font-weight: 500;
}

[data-ac-ui="v2"] .ac-provenance-row,
.ac-ui-v2.ac-provenance-row,
.ac-ui-v2 .ac-provenance-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ac-text-secondary);
  padding: 4px 0;
  font-variant-numeric: tabular-nums lining-nums;
  line-height: 1.4;
}

[data-ac-ui="v2"] .ac-provenance-item,
.ac-ui-v2 .ac-provenance-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

[data-ac-ui="v2"] .ac-provenance-label,
.ac-ui-v2 .ac-provenance-label {
  color: var(--ac-text-muted);
  font-weight: 500;
}

[data-ac-ui="v2"] .ac-provenance-value,
.ac-ui-v2 .ac-provenance-value {
  color: var(--ac-text-secondary);
  font-weight: 500;
}

[data-ac-ui="v2"] .ac-provenance-sep,
.ac-ui-v2 .ac-provenance-sep {
  color: var(--ac-line-default);
  user-select: none;
}

/* Split View Layout & Desktop Detail Pane (320–380px) (§63, §76.12) */
[data-ac-ui="v2"] .ac-split-view,
.ac-ui-v2.ac-split-view,
.ac-ui-v2 .ac-split-view {
  display: flex;
  gap: var(--ac-space-4, 16px);
  align-items: flex-start;
  width: 100%;
  min-width: 0;
}

[data-ac-ui="v2"] .ac-split-view__main,
.ac-ui-v2.ac-split-view__main,
.ac-ui-v2 .ac-split-view__main {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

[data-ac-ui="v2"] .ac-split-view__pane,
.ac-ui-v2.ac-split-view__pane,
.ac-ui-v2 .ac-split-view__pane {
  flex: 0 0 clamp(320px, 25vw, 380px);
  width: clamp(320px, 25vw, 380px);
  min-width: 320px;
  max-width: 380px;
}

[data-ac-ui="v2"] .ac-detail-pane,
.ac-ui-v2.ac-detail-pane,
.ac-ui-v2 .ac-detail-pane {
  width: clamp(320px, 25vw, 380px);
  min-width: 320px;
  max-width: 380px;
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg, 12px);
  box-shadow: var(--ac-shadow-level-1);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: calc(var(--ac-topbar-height, 52px) + 16px);
  max-height: calc(100vh - var(--ac-topbar-height, 52px) - 32px);
  max-height: calc(100dvh - var(--ac-topbar-height, 52px) - 32px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

[data-ac-ui="v2"] .ac-detail-pane__header,
.ac-ui-v2 .ac-detail-pane__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--ac-space-3, 12px) var(--ac-space-4, 16px);
  border-bottom: 1px solid var(--ac-line-hairline);
  background: var(--ac-surface-raised);
  border-radius: var(--ac-radius-lg, 12px) var(--ac-radius-lg, 12px) 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}

[data-ac-ui="v2"] .ac-detail-pane__title,
.ac-ui-v2 .ac-detail-pane__title {
  font-family: var(--ac-font-sans);
  font-size: 15px;
  font-weight: 700;
  color: var(--ac-ink);
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-ac-ui="v2"] .ac-detail-pane__close,
.ac-ui-v2 .ac-detail-pane__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--ac-text-secondary);
  cursor: pointer;
  border-radius: var(--ac-radius-sm, 6px);
  transition: background-color var(--motion-hover, 140ms) var(--ease-standard),
              color var(--motion-hover, 140ms) var(--ease-standard);
}

[data-ac-ui="v2"] .ac-detail-pane__close:hover,
.ac-ui-v2 .ac-detail-pane__close:hover {
  background: var(--ac-surface-hover);
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-detail-pane__close:focus-visible,
.ac-ui-v2 .ac-detail-pane__close:focus-visible {
  outline: 2px solid var(--ac-focus);
}

[data-ac-ui="v2"] .ac-detail-pane__body,
.ac-ui-v2 .ac-detail-pane__body {
  padding: var(--ac-space-4, 16px);
  display: flex;
  flex-direction: column;
  gap: var(--ac-space-3, 12px);
  flex: 1 1 auto;
}

[data-ac-ui="v2"] .ac-detail-pane__footer,
.ac-ui-v2 .ac-detail-pane__footer {
  padding: var(--ac-space-3, 12px) var(--ac-space-4, 16px);
  border-top: 1px solid var(--ac-line-hairline);
  background: var(--ac-surface-raised);
  border-radius: 0 0 var(--ac-radius-lg, 12px) var(--ac-radius-lg, 12px);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

/* Mobile Detail Sheet (§76.12, §76.13, §49) */
@media (max-width: 1023px) {
  [data-ac-ui="v2"] .ac-split-view,
  .ac-ui-v2.ac-split-view,
  .ac-ui-v2 .ac-split-view {
    display: block;
    width: 100%;
  }

  [data-ac-ui="v2"] .ac-split-view__main,
  .ac-ui-v2.ac-split-view__main,
  .ac-ui-v2 .ac-split-view__main {
    width: 100%;
    min-width: 0;
  }

  /* On tablet & mobile, docked side pane is transitioned to overlay sheet so dataset is never crushed (§2346) */
  [data-ac-ui="v2"] .ac-split-view__pane,
  .ac-ui-v2.ac-split-view__pane,
  .ac-ui-v2 .ac-split-view__pane {
    display: none;
  }

  [data-ac-ui="v2"] .ac-detail-sheet,
  .ac-ui-v2.ac-detail-sheet,
  .ac-ui-v2 .ac-detail-sheet {
    position: fixed;
    inset: 0;
    z-index: var(--ac-z-modal, 100);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: transparent;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0s 190ms;
  }

  [data-ac-ui="v2"] .ac-detail-sheet.is-open,
  .ac-ui-v2.ac-detail-sheet.is-open,
  .ac-ui-v2 .ac-detail-sheet.is-open {
    pointer-events: auto;
    visibility: visible;
    transition: visibility 0s 0s;
  }

  [data-ac-ui="v2"] .ac-sheet-backdrop,
  .ac-ui-v2 .ac-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity var(--motion-state, 190ms) var(--ease-standard);
  }

  [data-ac-ui="v2"] .ac-detail-sheet.is-open .ac-sheet-backdrop,
  .ac-ui-v2 .ac-detail-sheet.is-open .ac-sheet-backdrop {
    opacity: 1;
  }

  [data-ac-ui="v2"] .ac-sheet-content,
  .ac-ui-v2 .ac-sheet-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    background: var(--ac-surface);
    border-top: 1px solid var(--ac-line-hairline);
    border-radius: var(--ac-radius-xl, 16px) var(--ac-radius-xl, 16px) 0 0;
    box-shadow: var(--ac-shadow-level-3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: max(var(--ac-space-4, 16px), env(safe-area-inset-bottom, 16px));
    transform: translateY(100%);
    transition: transform var(--motion-panel, 260ms) var(--ease-emphasized);
  }

  [data-ac-ui="v2"] .ac-detail-sheet.is-open .ac-sheet-content,
  .ac-ui-v2 .ac-detail-sheet.is-open .ac-sheet-content {
    transform: translateY(0);
  }

  [data-ac-ui="v2"] .ac-sheet-handle,
  .ac-ui-v2 .ac-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--ac-control-border);
    border-radius: 2px;
    margin: 8px auto 4px auto;
    flex-shrink: 0;
  }

  [data-ac-ui="v2"] .ac-detail-pane__close,
  .ac-ui-v2 .ac-detail-pane__close {
    min-width: var(--ac-touch-target, 44px);
    min-height: var(--ac-touch-target, 44px);
  }
}

@media (min-width: 1024px) {
  [data-ac-ui="v2"] .ac-detail-sheet,
  .ac-ui-v2.ac-detail-sheet,
  .ac-ui-v2 .ac-detail-sheet,
  .ac-detail-sheet {
    display: none !important;
  }
}

/* Overlay Grammar: Dialog, Popover, Toast (§76.13, §62, §1005) */
[data-ac-ui="v2"] .ac-modal-overlay,
.ac-ui-v2.ac-modal-overlay,
.ac-ui-v2 .ac-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--ac-z-modal, 100);
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--motion-state, 190ms) var(--ease-standard),
              visibility 0s 190ms;
}

[data-ac-ui="v2"] .ac-modal-overlay.is-open,
.ac-ui-v2.ac-modal-overlay.is-open,
.ac-ui-v2 .ac-modal-overlay.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--motion-state, 190ms) var(--ease-standard),
              visibility 0s 0s;
}

[data-ac-ui="v2"] .ac-modal,
.ac-ui-v2.ac-modal,
.ac-ui-v2 .ac-modal {
  width: 100%;
  max-width: 540px;
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-xl, 16px);
  box-shadow: var(--ac-shadow-level-3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  transform: scale(0.96);
  transition: transform var(--motion-panel, 260ms) var(--ease-emphasized);
}

[data-ac-ui="v2"] .ac-modal-overlay.is-open .ac-modal,
.ac-ui-v2.ac-modal-overlay.is-open .ac-modal {
  transform: scale(1);
}

[data-ac-ui="v2"] .ac-modal__header,
.ac-ui-v2 .ac-modal__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--ac-line-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

[data-ac-ui="v2"] .ac-modal__title,
.ac-ui-v2 .ac-modal__title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ac-ink);
  line-height: 1.3;
}

[data-ac-ui="v2"] .ac-modal__body,
.ac-ui-v2 .ac-modal__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

[data-ac-ui="v2"] .ac-modal__footer,
.ac-ui-v2 .ac-modal__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--ac-line-hairline);
  background: var(--ac-surface-raised);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

[data-ac-ui="v2"] .ac-popover,
.ac-ui-v2.ac-popover,
.ac-ui-v2 .ac-popover {
  position: absolute;
  z-index: var(--ac-z-popover, 60);
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  box-shadow: var(--ac-shadow-level-2);
  padding: 8px;
  min-width: 160px;
  max-width: 280px;
  font-size: 13px;
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-toast-container,
.ac-ui-v2.ac-toast-container,
.ac-ui-v2 .ac-toast-container {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom, 24px));
  right: 24px;
  z-index: var(--ac-z-toast, 120);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

[data-ac-ui="v2"] .ac-toast,
.ac-ui-v2.ac-toast,
.ac-ui-v2 .ac-toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  box-shadow: var(--ac-shadow-level-2);
  font-size: 13px;
  color: var(--ac-ink);
  max-width: 380px;
  min-height: 40px;
  line-height: 1.4;
}

/* Onboarding Modal Theme & Accessible Contrast (§4.1, §76.13, Visual QC) */
#onboardingModal {
  backdrop-filter: blur(4px);
}

#onboardingModal .onboarding-modal-card,
#onboardingModal > div {
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-xl, 16px);
  box-shadow: var(--ac-shadow-level-3);
  color: var(--ac-ink);
}

#onboardingModal #onboardingContent h3 {
  color: var(--ac-ink);
  font-family: var(--ac-font-sans);
  font-size: 16px;
  font-weight: 700;
}

#onboardingModal #onboardingContent p {
  color: var(--ac-text-secondary);
  font-family: var(--ac-font-sans);
  line-height: 1.5;
}

#onboardingModal #onboardingContent p strong {
  color: var(--ac-brand);
  font-weight: 600;
}

#onboardingModal #onboardingContent p span {
  color: var(--ac-ink);
  font-weight: 600;
}

#onboardingModal #onboardingContent p.text-\[11px\],
#onboardingModal #onboardingContent p.text-xs {
  color: var(--ac-text-muted);
}

#onboardingModal #onboardingContent .h-1 {
  background: var(--ac-line-default);
}

#onboardingModal #onboardingContent .h-1.bg-emerald-500 {
  background: var(--ac-brand);
}

#onboardingModal #onboardingFooter button {
  font-family: var(--ac-font-sans);
  min-height: var(--ac-control-sm, 36px);
  border-radius: var(--ac-radius-md, 8px);
}

#onboardingModal #onboardingFooter button:not(.bg-emerald-500):not(.border-emerald-500\/30) {
  background: var(--ac-surface);
  border: 1px solid var(--ac-control-border);
  color: var(--ac-ink);
}

#onboardingModal #onboardingFooter button:not(.bg-emerald-500):not(.border-emerald-500\/30):hover {
  background: var(--ac-surface-hover);
  border-color: var(--ac-control-border-hover);
}

#onboardingModal #onboardingFooter button.border-emerald-500\/30 {
  background: var(--ac-brand-soft);
  border: 1px solid rgba(15, 116, 88, 0.3);
  color: var(--ac-brand);
}

#onboardingModal #onboardingFooter button.border-emerald-500\/30:hover {
  background: rgba(15, 116, 88, 0.16);
}

#onboardingModal #onboardingFooter button.bg-emerald-500 {
  background: var(--ac-brand);
  color: #FFFFFF;
  border: 1px solid var(--ac-brand);
}

#onboardingModal #onboardingFooter button.bg-emerald-500:hover {
  background: var(--ac-brand-hover);
  border-color: var(--ac-brand-hover);
}

/* Lifecycle & Feedback Grammar (§76.14, §78.1, §78.4) */
@keyframes ac-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

[data-ac-ui="v2"] .ac-skeleton,
.ac-ui-v2.ac-skeleton,
.ac-ui-v2 .ac-skeleton {
  display: block;
  background: linear-gradient(90deg, var(--ac-surface-hover) 0%, var(--ac-surface-raised) 50%, var(--ac-surface-hover) 100%);
  background-size: 200% 100%;
  border-radius: var(--ac-radius-sm, 6px);
  animation: ac-skeleton-shimmer 1.5s infinite;
}

@media (prefers-reduced-motion: reduce) {
  [data-ac-ui="v2"] .ac-skeleton,
  .ac-ui-v2.ac-skeleton,
  .ac-ui-v2 .ac-skeleton {
    animation: none;
    background: var(--ac-surface-hover);
  }
}

[data-ac-ui="v2"] .ac-skeleton-text,
.ac-ui-v2 .ac-skeleton-text {
  height: 14px;
  width: 80%;
  border-radius: 4px;
}

[data-ac-ui="v2"] .ac-skeleton-num,
.ac-ui-v2 .ac-skeleton-num {
  height: 18px;
  width: 64px;
  border-radius: 4px;
  margin-left: auto;
}

[data-ac-ui="v2"] .ac-skeleton-rect,
.ac-ui-v2 .ac-skeleton-rect {
  height: var(--ac-row-dense, 38px);
  width: 100%;
}

[data-ac-ui="v2"] .ac-skeleton-circle,
.ac-ui-v2 .ac-skeleton-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
}

@keyframes ac-spin {
  to { transform: rotate(360deg); }
}

[data-ac-ui="v2"] .ac-refresh-banner,
.ac-ui-v2.ac-refresh-banner,
.ac-ui-v2 .ac-refresh-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--ac-brand-soft);
  border: 1px solid rgba(15, 116, 88, 0.2);
  border-radius: var(--ac-radius-sm, 6px);
  font-size: 12px;
  color: var(--ac-brand);
  font-weight: 500;
  line-height: 1.3;
}

[data-ac-ui="v2"] .ac-refresh-spinner,
.ac-ui-v2 .ac-refresh-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ac-spin 0.8s linear infinite;
  flex-shrink: 0;
}

@media (prefers-reduced-motion: reduce) {
  [data-ac-ui="v2"] .ac-refresh-spinner,
  .ac-ui-v2 .ac-refresh-spinner {
    animation: none;
  }
}

[data-ac-ui="v2"] .ac-empty-state,
.ac-ui-v2.ac-empty-state,
.ac-ui-v2 .ac-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  background: var(--ac-surface);
  border: 1px dashed var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg, 12px);
  gap: 12px;
  width: 100%;
}

[data-ac-ui="v2"] .ac-empty-state__icon,
.ac-ui-v2 .ac-empty-state__icon {
  width: 40px;
  height: 40px;
  color: var(--ac-text-muted);
  opacity: 0.65;
}

[data-ac-ui="v2"] .ac-empty-state__title,
.ac-ui-v2 .ac-empty-state__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ac-ink);
  line-height: 1.3;
}

[data-ac-ui="v2"] .ac-empty-state__desc,
.ac-ui-v2 .ac-empty-state__desc {
  font-size: 13px;
  color: var(--ac-text-secondary);
  max-width: 360px;
  line-height: 1.45;
}

[data-ac-ui="v2"] .ac-empty-state__action,
.ac-ui-v2 .ac-empty-state__action {
  margin-top: 4px;
}

[data-ac-ui="v2"] .ac-stale-banner,
.ac-ui-v2.ac-stale-banner,
.ac-ui-v2 .ac-stale-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--ac-warning-soft);
  border: 1px solid rgba(169, 109, 19, 0.25);
  border-radius: var(--ac-radius-md, 8px);
  font-size: 12.5px;
  color: var(--ac-warning-text);
  line-height: 1.4;
}

[data-ac-ui="v2"] .ac-error-state,
.ac-ui-v2.ac-error-state,
.ac-ui-v2 .ac-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 20px;
  background: var(--ac-surface);
  border: 1px solid rgba(193, 63, 77, 0.25);
  border-radius: var(--ac-radius-lg, 12px);
  gap: 8px;
  width: 100%;
}

[data-ac-ui="v2"] .ac-error-state__title,
.ac-ui-v2 .ac-error-state__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ac-negative);
  line-height: 1.3;
}

[data-ac-ui="v2"] .ac-error-state__message,
.ac-ui-v2 .ac-error-state__message {
  font-size: 12.5px;
  color: var(--ac-text-secondary);
  max-width: 340px;
  line-height: 1.45;
}

[data-ac-ui="v2"] .ac-error-state__retry,
.ac-ui-v2 .ac-error-state__retry {
  margin-top: 8px;
}



/* ---- Table Primitives (§14, §76.9) ------------------------------------- */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-container,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  background-color: var(--ac-surface);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-container:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-wrap:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--ac-font-sans);
  font-size: 13px;
  text-align: left;
}

/* Dense & Comfort Row Height Standards (§14, §103.3) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--ac-line-hairline);
  white-space: nowrap;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th {
  position: sticky;
  top: 0;
  z-index: var(--ac-z-sticky, 20);
  background-color: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--ac-line-default);
  height: 36px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td {
  color: var(--ac-ink);
  height: var(--ac-row-dense, 38px);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-dense th {
  height: 34px;
  padding: 6px 10px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-dense td {
  height: var(--ac-row-dense, 38px);
  padding: 6px 10px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-comfort th {
  height: 36px;
  padding: 8px 14px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-comfort td {
  height: var(--ac-row-comfort, 42px);
  padding: 10px 14px;
}

/* Sticky Column / Identity Cell (§14, §14.1) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table .ac-col-sticky,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table .ac-table-sticky-col {
  position: sticky;
  left: 0;
  background-color: var(--ac-surface);
  box-shadow: 2px 0 0 0 var(--ac-line-hairline);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.ac-col-sticky,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.ac-table-sticky-col {
  background-color: var(--ac-surface-raised);
  z-index: var(--ac-z-sticky, 20);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr:hover td.ac-col-sticky,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr:hover td.ac-table-sticky-col {
  background-color: var(--ac-surface-hover);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected td.ac-col-sticky,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] td.ac-col-sticky,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected td.ac-table-sticky-col,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] td.ac-table-sticky-col {
  background-color: var(--ac-brand-soft);
}

/* Sortable Headers (§78.3) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.is-sortable,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th[data-sortable="true"],
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th button.ac-table-sort-btn {
  cursor: pointer;
  user-select: none;
  transition: color var(--motion-hover, 140ms) var(--ease-standard),
              background-color var(--motion-hover, 140ms) var(--ease-standard);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.is-sortable:hover,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th[data-sortable="true"]:hover {
  background-color: var(--ac-surface-hover);
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.is-sortable:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th[data-sortable="true"]:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th button.ac-table-sort-btn:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  vertical-align: middle;
  color: var(--ac-text-muted);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .is-sorted .ac-sort-indicator {
  color: var(--ac-brand);
}

/* Numeric Columns (§6, §76.9) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table .is-numeric,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table th.is-numeric,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.is-numeric,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-numeric {
  text-align: right;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Row Hover, Selection & Keyboard Focus (§14, §19, §87.1, §88) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr {
  transition: background-color var(--motion-hover, 140ms) var(--ease-standard);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr:hover {
  background-color: var(--ac-surface-hover);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[tabindex]:focus-visible,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-interactive:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
  position: relative;
}

/* Selected row: uses brand semantics, NOT positive green semantics (§2.4, §88) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] {
  background-color: var(--ac-brand-soft);
  box-shadow: inset 3px 0 0 var(--ac-brand);
}

/* Numeric semantic styling on table cells (§6, §14, §88) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-num-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td .ac-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td .ac-num-positive {
  color: var(--ac-positive);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-num-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td .ac-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td .ac-num-negative {
  color: var(--ac-negative);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td.ac-num-neutral,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table td .ac-num-neutral {
  color: var(--ac-text-muted);
}

/* Data meaning precedence: financial direction survives row selection (§88) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected td.ac-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] td.ac-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected td.ac-num-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] td.ac-num-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected .ac-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] .ac-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected .ac-num-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] .ac-num-positive {
  color: var(--ac-positive);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected td.ac-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] td.ac-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected td.ac-num-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] td.ac-num-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected .ac-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] .ac-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr.is-selected .ac-num-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr[aria-selected="true"] .ac-num-negative {
  color: var(--ac-negative);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr:last-child td {
  border-bottom: none;
}

/* Embedded action isolation: prevent button clicks from bubbling unintentionally (§19) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table .ac-cell-action {
  white-space: nowrap;
  text-align: right;
}

/* ---- Two Mobile Data Strategies (§14.1, §48, §76.10, §87.2) ----------- */

/* Strategy A: Decision List */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-list {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  background-color: var(--ac-surface);
  overflow: hidden;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: var(--ac-touch-target, 44px);
  padding: 10px 14px;
  border-bottom: 1px solid var(--ac-line-hairline);
  background-color: var(--ac-surface);
  color: var(--ac-ink);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--motion-hover, 140ms) var(--ease-standard);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-row:last-child {
  border-bottom: none;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-row:hover {
  background-color: var(--ac-surface-hover);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-row:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
  position: relative;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-row.is-selected,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-row[aria-selected="true"] {
  background-color: var(--ac-brand-soft);
  box-shadow: inset 3px 0 0 var(--ac-brand);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-ticker {
  font-weight: 700;
  font-size: 14px;
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-sub {
  font-size: 11px;
  color: var(--ac-text-muted);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-metrics {
  display: flex;
  align-items: center;
  gap: 12px;
  font-variant-numeric: tabular-nums lining-nums;
  font-size: 13px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-decision-affordance {
  display: inline-flex;
  align-items: center;
  color: var(--ac-text-muted);
  font-size: 16px;
}

/* Strategy B: Comparative / Matrix Table retains real table with horizontal scroll */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-table-matrix {
  min-width: 640px;
}

/* ---- Canonical Filter Bar (§76.4, §78.4) ------------------------------- */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  background-color: var(--ac-surface);
  margin-bottom: 12px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-search {
  position: relative;
  flex: 1 1 200px;
  min-width: 160px;
  max-width: 320px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-search input {
  width: 100%;
  height: var(--ac-control-sm, 36px);
  padding-left: 32px;
  padding-right: 44px;
  font-size: 13px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ac-text-muted);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-search-clear {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 0;
  color: var(--ac-text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--ac-radius-xs, 4px);
  min-width: var(--ac-touch-target, 44px);
  min-height: var(--ac-touch-target, 44px);
  width: var(--ac-touch-target, 44px);
  height: var(--ac-touch-target, 44px);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-search-clear:hover {
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-search-clear:focus-visible {
  outline: 2px solid var(--ac-focus);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 4px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--ac-radius-sm, 6px);
  background-color: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-default);
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-chip-remove {
  background: none;
  border: none;
  padding: 0 4px;
  color: var(--ac-text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 20px;
  position: relative;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-chip-remove::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: var(--ac-touch-target, 44px);
  min-height: var(--ac-touch-target, 44px);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-chip-remove:hover {
  color: var(--ac-negative);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-status {
  margin-left: auto;
  font-size: 12px;
  color: var(--ac-text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* ---- Status / Availability Grammar (§76.8, §78.1, §88) ---------------- */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  font-family: var(--ac-font-sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  border-radius: var(--ac-radius-sm, 6px);
  border: 1px solid transparent;
  white-space: nowrap;
}

/* Availability states (§78.1) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-available,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-available {
  background-color: var(--ac-surface-hover);
  color: var(--ac-ink);
  border-color: var(--ac-line-default);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-partial,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-partial {
  background-color: var(--ac-warning-soft);
  color: var(--ac-warning-text);
  border-color: color-mix(in srgb, var(--ac-warning) 25%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-unavailable,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-unavailable {
  background-color: var(--ac-surface-raised);
  color: var(--ac-text-muted);
  border-color: var(--ac-line-hairline);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-stale,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-stale {
  background-color: var(--ac-warning-soft);
  color: var(--ac-warning-text);
  border-color: color-mix(in srgb, var(--ac-warning) 30%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-unknown,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-unknown {
  background-color: var(--ac-surface-raised);
  color: var(--ac-text-muted);
  border-color: var(--ac-line-hairline);
}

/* System & Directional states */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-positive,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-positive {
  background-color: var(--ac-positive-soft);
  color: var(--ac-positive);
  border-color: color-mix(in srgb, var(--ac-positive) 25%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-negative,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-negative {
  background-color: var(--ac-negative-soft);
  color: var(--ac-negative);
  border-color: color-mix(in srgb, var(--ac-negative) 25%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-warning,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-warning {
  background-color: var(--ac-warning-soft);
  color: var(--ac-warning-text);
  border-color: color-mix(in srgb, var(--ac-warning) 25%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-info,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-info {
  background-color: var(--ac-info-soft);
  color: var(--ac-info);
  border-color: color-mix(in srgb, var(--ac-info) 25%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-neutral,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-neutral {
  background-color: var(--ac-surface-hover);
  color: var(--ac-text-secondary);
  border-color: var(--ac-line-default);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-error,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-error {
  background-color: var(--ac-negative-soft);
  color: var(--ac-negative);
  border-color: color-mix(in srgb, var(--ac-negative) 25%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-status-sample,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-badge-sample {
  background-color: var(--ac-info-soft);
  color: var(--ac-info);
  border-color: color-mix(in srgb, var(--ac-info) 30%, transparent);
}

/* ---- Provenance Row (§76.11, §78.2) ------------------------------------ */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-provenance-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ac-text-secondary);
  border-top: 1px solid var(--ac-line-hairline);
  background-color: var(--ac-surface);
  border-radius: 0 0 var(--ac-radius-md, 8px) var(--ac-radius-md, 8px);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-provenance-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-provenance-label {
  color: var(--ac-text-muted);
  font-size: 12px;
  font-weight: 500;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-provenance-value {
  color: var(--ac-text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}

/* ---- Detail Pane & Sheet Grammar (§63, §76.12, §87.1, §87.2) ----------- */

/* Desktop List -> Detail Layout Container */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-list-detail-layout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-list-pane {
  flex: 1 1 0%;
  min-width: 0;
}

/* Desktop Docked Detail Pane (320-380px target width) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-pane {
  width: 360px;
  min-width: 320px;
  max-width: 380px;
  flex-shrink: 0;
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  background-color: var(--ac-surface);
  padding: 16px;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-pane[hidden] {
  display: none;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ac-line-hairline);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ac-ink);
  margin: 0;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--ac-radius-sm, 6px);
  border: 1px solid var(--ac-line-hairline);
  background: transparent;
  color: var(--ac-text-secondary);
  cursor: pointer;
  transition: background-color var(--motion-hover, 140ms) var(--ease-standard),
              color var(--motion-hover, 140ms) var(--ease-standard);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-close:hover {
  background-color: var(--ac-surface-hover);
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-close:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: 2px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  color: var(--ac-ink);
}

/* Mobile Detail Sheet (§76.12, §87.2) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--ac-z-drawer, 80);
  background-color: color-mix(in srgb, var(--ac-canvas) 70%, transparent);
  backdrop-filter: blur(2px);
  touch-action: none;
}

html.light :is([data-ac-ui="v2"], .ac-ui-v2) .ac-sheet-backdrop {
  background-color: color-mix(in srgb, var(--ac-ink) 50%, transparent);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-sheet-backdrop[hidden] {
  display: none;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85vh;
  z-index: var(--ac-z-drawer, 80);
  background-color: var(--ac-surface);
  border-top: 1px solid var(--ac-line-strong);
  border-radius: var(--ac-radius-xl, 16px) var(--ac-radius-xl, 16px) 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  box-shadow: var(--ac-shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-sheet[hidden] {
  display: none;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--ac-touch-target, 44px);
  min-height: var(--ac-touch-target, 44px);
  border-radius: var(--ac-radius-sm, 6px);
  border: 1px solid var(--ac-line-hairline);
  background: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
  cursor: pointer;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-sheet-close:hover {
  background-color: var(--ac-surface-hover);
  color: var(--ac-ink);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-sheet-close:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: 2px;
}

/* ---- Feedback / Loading / Empty / Error Grammar (§56, §57, §58, §76.14, §80, §90) -- */

/* Skeletons */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-skeleton {
  background-color: var(--ac-surface-raised);
  border-radius: var(--ac-radius-xs, 4px);
  display: block;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-skeleton-text {
  height: 14px;
  width: 75%;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-skeleton-cell {
  height: 18px;
  width: 60%;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-skeleton-row {
  height: var(--ac-row-dense, 38px);
  width: 100%;
  border-bottom: 1px solid var(--ac-line-hairline);
}

/* Empty State (§57) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
  text-align: center;
  border: 1px dashed var(--ac-line-default);
  border-radius: var(--ac-radius-md, 8px);
  background-color: var(--ac-surface);
  gap: 10px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ac-ink);
  margin: 0;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-empty-desc {
  font-size: 13px;
  color: var(--ac-text-secondary);
  margin: 0;
  max-width: 420px;
  line-height: 1.5;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-empty-action {
  margin-top: 8px;
}

/* Error State (§58) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--ac-negative) 25%, transparent);
  border-radius: var(--ac-radius-md, 8px);
  background-color: var(--ac-negative-soft);
  gap: 10px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-error-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ac-negative);
  margin: 0;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-error-desc {
  font-size: 13px;
  color: var(--ac-ink);
  margin: 0;
  max-width: 420px;
  line-height: 1.5;
}

/* Refresh Error with Previous Data Preserved (§20, §58, §90) */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-refresh-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-radius: var(--ac-radius-sm, 6px);
  background-color: var(--ac-warning-soft);
  border: 1px solid color-mix(in srgb, var(--ac-warning) 30%, transparent);
  color: var(--ac-warning-text);
  font-size: 12px;
  margin-bottom: 10px;
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-refresh-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

/* Partial & Stale Notification Banners */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-stale-banner,
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-partial-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--ac-radius-sm, 6px);
  background-color: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-default);
  color: var(--ac-text-secondary);
  font-size: 12px;
  margin-bottom: 8px;
}

/* ---- Surface Primitives (Scoped) --------------------------------------- */
:is([data-ac-ui="v2"], .ac-ui-v2) .ac-surface-card {
  background-color: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg, 12px);
}

:is([data-ac-ui="v2"], .ac-ui-v2) .ac-divider {
  height: 1px;
  background-color: var(--ac-line-hairline);
  border: none;
  margin: 0;
}

/* ---- Responsive Overrides (§48, §49, §91.1) ---------------------------- */
@media (max-width: 1023px) {
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-list-detail-layout {
    flex-direction: column;
  }

  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-pane {
    display: none;
  }

  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-search input,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-bar input,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-filter-bar select {
    font-size: 16px;
  }
}


/* ---- 2. Base + typography ---------------------------------------------- */
body {
  font-family: var(--ac-font-sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Numbers in a trading dashboard must line up column to column. */
.panel b, .panel-title, .ps-level b, .dashboard-card b,
.tabular, [class*="tabular-nums"], .ac-num, [data-num],
.dash-level b, .market-tile b, .price-value, .metric-value, .ticker-price {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

.ac-font-mono, .font-mono, .ac-num, [data-mono] {
  font-family: var(--ac-font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---- 2b. Type scale ----------------------------------------------------
   The markup sets its smallest sizes with Tailwind arbitrary values rather
   than with the ramp: text-[9px] in 22 places, text-[10px] in 124, and
   text-[11px] in 83. 9px is below the size at which Inter's numerals stay
   separable on a phone, and three near-identical steps produce no hierarchy —
   they just produce drift.

   Rather than rewrite 229 class attributes (which would also mean 229 chances
   to break a JS hook, and a Tailwind safelist change), the three utilities are
   redefined here onto two real steps: micro (11px) for labels and meta, and
   caption (12px) for dense copy. Tailwind generates these as single-class
   rules, so an equal-specificity rule in this later sheet wins on source
   order. A deliberate per-element override in markup still wins, because
   nothing here is !important.

   Growth is at most +2px, and only on the 9px labels. Line-height is set with
   it: at these sizes the default leading is what makes a dense cell feel
   cramped, not the glyph size. */
.text-\[9px\],
.text-\[10px\] {
  font-size: var(--ac-text-micro);
  line-height: var(--ac-lh-snug);
}

.text-\[11px\] {
  font-size: var(--ac-text-caption);
  line-height: var(--ac-lh-snug);
}

/* Uppercase micro-labels carry tracking, or they read as a smudge. The markup
   already pairs `uppercase` with `tracking-*` in most places; this covers the
   ones that only set the size. */
.text-\[9px\].uppercase,
.text-\[10px\].uppercase {
  letter-spacing: 0.09em;
}

/* Weight hierarchy. The markup uses font-black 60 times, font-bold 80 and
   font-semibold 91 — so nearly every string on the page was competing to be
   the loudest, and none of them won. Inter at weight 900 also loses its
   counters below ~16px and reads as a blob.

   900 is retired in favour of 800; that single step down is the difference
   between "shouting" and "emphatic". Headings keep their prominence through
   size and tracking, which is where it belongs. */
.font-black { font-weight: 800; }

/* Optical sizing: tighten as type grows, so large headings do not read as
   spaced-out and small labels stay separable. */
.text-2xl, .text-3xl, .text-4xl, .text-5xl { letter-spacing: -0.022em; }
.text-xl { letter-spacing: -0.016em; }
.text-lg { letter-spacing: -0.011em; }

/* The only Tailwind radius step that sits off the product scale. Ten uses, all
   of them large decorative containers, and 24px next to the 20px shells read
   as two different corner treatments on the same screen. */
.rounded-3xl { border-radius: var(--ac-radius-xl); }

/* ---- 3. Surfaces and cards ---------------------------------------------

   ONE surface primitive, `.ac-surface`, with variants driven by data-*.

   The product had accumulated sixty-odd card class names — .panel,
   .dashboard-card, .feature-card, .portfolio-card, .landing-card, .mock-card,
   .faq-item, .skeleton-card, .maintenance-card, .subscription-card,
   .dt-card-item, .kg-card-item, .nk-card-item and the rest — each with its own
   background, its own radius and its own shadow. Nothing was wrong with any
   single one; the problem was that no two agreed, so the app read as several
   products stacked together.

   Those names are kept and aliased onto the primitive rather than renamed.
   Every one of them is a JS hook, a querySelector target, or an assertion in
   tools/apply-production-hotfixes.js, so renaming would be sixty chances to
   break behaviour for zero visual gain. New markup should use `.ac-surface`
   directly; existing markup inherits the same rules for free.

   Three levels, and no more: the page ground, a surface on it, and a well
   recessed into that surface. */
.ac-surface,
.panel,
.dashboard-card,
.feature-card,
.portfolio-card,
.skeleton-card,
.landing-auth-card,
.faq-item,
.subscription-summary {
  background: var(--ac-surface-1);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--ac-radius-md);
  box-shadow: none;
}

.ac-surface,
.panel {
  padding: var(--ac-space-4);
}

/* Raised: a block that sits ON a surface and must separate from it. */
.ac-surface[data-elev="2"],
.dashboard-pick-card,
.portfolio-row-card,
.mock-card {
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-line);
  border-radius: var(--ac-radius-md);
  box-shadow: var(--ac-edge), var(--ac-shadow-1);
}

/* Recessed: a well cut INTO a surface — inputs, nested groups, stat strips,
   the market band and the level tiles. No edge highlight and no shadow; light
   does not fall into a hole.

   These tiles each carried their own near-miss border — rgba(28,35,51,0.5) on
   the market band, rgba(148,163,184,0.10) on the level tiles, rgba(2,6,23,0.25)
   as a fill — values close enough to look like a mistake rather than a
   decision. */
.ac-surface[data-elev="0"],
.ac-well,
.market-tile,
.dash-level {
  background: var(--ac-surface-3);
  border: 1px solid var(--ac-hairline);
  border-radius: var(--ac-radius-md);
  box-shadow: none;
}

/* Tone variants. The border carries the tone and the fill stays near-neutral,
   so a coloured card never competes with the figures printed on it. */
.ac-surface[data-tone="accent"] { border-color: var(--ac-accent-line); background: var(--ac-accent-soft); }
.ac-surface[data-tone="warn"]   { border-color: rgba(251, 191, 36, 0.28); background: var(--ac-warn-dim); }
.ac-surface[data-tone="danger"] { border-color: rgba(248, 113, 113, 0.30); background: var(--ac-bear-dim); }

/* Interactive surfaces state it: they lift, and the border wakes up. Static
   cards deliberately do not, so a hover means "this does something". */
.ac-surface[data-interactive],
.dashboard-pick-card,
.action-card,
.feature-card {
  transition: border-color .16s ease, background-color .16s ease,
              box-shadow .16s ease, transform .16s ease;
}
.ac-surface[data-interactive]:hover,
.dashboard-pick-card:hover,
.action-card:hover,
.feature-card:hover {
  border-color: var(--ac-accent-line);
  box-shadow: var(--ac-edge), var(--ac-shadow-2);
  transform: translateY(-1px);
}
.ac-surface[data-interactive]:active,
.dashboard-pick-card:active,
.action-card:active { transform: translateY(0); }

.panel-header {
  align-items: flex-start;
  gap: var(--ac-space-3);
  margin-bottom: var(--ac-space-3);
}

.panel-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--ac-text);
}

.panel-subtitle {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ac-text-muted);
}

/* Section band: a labelled group of panels on the dashboard. Gives the page a
   scannable rhythm (act now → live radar → history) instead of one flat stack. */
.ac-section { margin-top: var(--ac-space-5); }
.ac-section:first-child { margin-top: 0; }

.ac-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ac-space-3);
  margin-bottom: var(--ac-space-3);
  padding-bottom: var(--ac-space-2);
  border-bottom: 1px solid var(--ac-line);
}

.ac-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ac-text-muted);
}

.ac-section-hint {
  font-size: 11px;
  line-height: 1.5;
  color: var(--ac-text-dim);
}

.dashboard-hero {
  border-radius: var(--ac-radius-md);
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--ac-surface-1);
  box-shadow: none;
}

/* The greeting inherits one semantic token in every theme. This selector also
   protects it from legacy utility rules without coupling it to a literal hue. */
#page-dashboard #dashGreeting {
  color: var(--color-text-primary);
  font-size: 24px;
  font-weight: 700;
}

/* .dashboard-card and .feature-card were separate copies of the surface rules
   above and are now aliased onto the primitive; only what makes them different
   is stated here. */

/* Page-level shells: the chart and the portfolio own a whole viewport of the
   page, so they get the larger radius and the deeper shadow. This is the only
   tier above a card. */
.chart-shell, .portfolio-shell {
  background: var(--ac-surface-1);
  border: 1px solid var(--ac-line);
  border-radius: var(--ac-radius-xl);
  box-shadow: var(--ac-edge), var(--ac-shadow-2);
}

/* Quick-access card: layout only. Surface, hover and lift come from the
   primitive block above. */
.action-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 96px;
  padding: var(--ac-space-3);
  text-align: left;
  border-radius: var(--ac-radius-md);
}

.action-card .action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--ac-radius-sm);
  background: var(--ac-accent-soft);
  margin-bottom: var(--ac-space-2);
  transition: background-color .16s ease;
}

.action-card:hover .action-icon { background: rgba(16, 185, 129, 0.18); }
.action-card .action-icon svg { width: 17px; height: 17px; color: var(--ac-accent); }

.dash-badge {
  padding: 4px 9px;
  border-color: var(--ac-line-strong);
  background: var(--ac-surface-3);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ac-text-muted);
}

.dash-section-note {
  border-radius: var(--ac-radius-md);
  padding: var(--ac-space-2) var(--ac-space-3);
  line-height: 1.6;
}

/* .empty-state and .empty-state-text are defined once, in section 8i. */

/* ---- 4. Header and desktop navigation ---------------------------------- */
.app-header {
  background: rgba(9, 12, 18, 0.84);
  border-bottom: 1px solid var(--ac-line);
  /* A sticky bar needs a contact edge, not a drop shadow: the content scrolls
     under it, so what has to read is the boundary, not the depth. */
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 0 10px 26px rgba(0, 0, 0, 0.20);
}

/* Header chrome onto the same line and radius scale as everything else. */
.header-status-chip { border-color: var(--ac-line); background: var(--ac-surface-3); color: var(--ac-text-muted); }
.header-account { border-color: var(--ac-hairline); background: var(--ac-surface-3); }

.nav-btn {
  border-radius: var(--ac-radius-sm);
  font-weight: 600;
  color: var(--ac-text-muted);
}

.nav-btn:hover:not(.disabled) {
  color: var(--ac-text);
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--ac-line);
}

.nav-btn.active {
  color: #6ee7b7;
  background: var(--ac-accent-soft);
  border-color: var(--ac-accent-line);
  box-shadow: inset 0 -2px 0 rgba(52, 211, 153, 0.45);
}

/* ---- 5. Floating mobile navigation launcher ---------------------------- */
/* Below 1024px the scrolling header strip is replaced by a draggable, edge-snapping
   circular launcher. `#mainNav` stays in the DOM as the source of truth for
   mobile-nav.js and for the runtimes that inject buttons into it — only its display
   is dropped.

   A floating control reserves no layout space, which is deliberate: the previous
   fixed bottom bar required padding <body>, and with border-box that shrank the
   100vh body content box below the 100vh shell, leaving a dead band containing the
   footer at the foot of every page. */
.ac-launcher, .ac-navpanel { display: none; }

@media (max-width: 1023px) {
  /* A desktop-collapsed rail may survive the resize in state. Mobile drawer
     presentation always restores full-width account controls and labels. */
  .app-sidebar.collapsed .sidebar-utility-actions,
  .app-sidebar.is-collapsed .sidebar-utility-actions {
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .app-sidebar.collapsed .sidebar-utility-button,
  .app-sidebar.is-collapsed .sidebar-utility-button {
    width: auto;
    min-width: 0;
    min-height: 38px;
    margin: 0;
    padding: 7px 8px;
  }

  .app-sidebar.collapsed .user-profile-badge,
  .app-sidebar.is-collapsed .user-profile-badge {
    width: 100%;
    height: auto;
    justify-content: flex-start;
    padding: 4px;
  }

  .mobile-nav-row { display: none !important; }

  .ac-launcher {
    position: fixed;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ac-fab-size);
    height: var(--ac-fab-size);
    padding: 0;
    border: 1px solid rgba(52, 211, 153, 0.34);
    border-radius: 999px;
    background: radial-gradient(circle at 32% 26%, rgba(52, 211, 153, 0.34), rgba(9, 14, 22, 0.94) 62%);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(14px);
    color: #6ee7b7;
    cursor: grab;
    /* Idle at reduced opacity so it reads as an overlay control, not page content. */
    opacity: 0.58;
    touch-action: none;
    transition: opacity 0.18s ease, transform 0.18s ease, left 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }

  .ac-launcher.ac-hidden { display: none; }
  .ac-launcher:hover, .ac-launcher:focus-visible { opacity: 1; }
  .ac-launcher:focus-visible { outline: 2px solid rgba(52, 211, 153, 0.75); outline-offset: 3px; }
  .ac-launcher.ac-launcher-open { opacity: 1; transform: scale(1.04); }
  /* No position transition mid-drag, or the control lags the finger. */
  .ac-launcher.ac-launcher-dragging { opacity: 1; cursor: grabbing; transition: none; }

  .ac-launcher-ring {
    position: absolute;
    inset: 5px;
    border: 1px solid rgba(148, 163, 184, 0.20);
    border-radius: 999px;
    pointer-events: none;
  }

  .ac-launcher-icon { display: flex; pointer-events: none; }
  .ac-launcher-icon svg { width: 24px; height: 24px; }

  .ac-navpanel { position: fixed; inset: 0; z-index: 41; display: block; }
  .ac-navpanel.hidden { display: none; }

  .ac-navpanel-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 14, 0.52);
    backdrop-filter: blur(2px);
  }

  .ac-navpanel-card {
    position: absolute;
    width: min(320px, calc(100vw - 24px));
    max-height: min(60vh, 460px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
    border: 1px solid var(--ac-line-strong);
    border-radius: var(--ac-radius-xl);
    background: rgba(13, 18, 27, 0.97);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.52);
    animation: acPanelIn 0.16s cubic-bezier(0.22, 1, 0.36, 1);
  }

  @keyframes acPanelIn { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }

  .ac-navpanel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ac-space-2);
    margin-bottom: var(--ac-space-2);
  }

  .ac-navpanel-title {
    font-size: var(--ac-text-micro);
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ac-text-muted);
  }

  .ac-navpanel-close {
    width: 30px;
    height: 30px;
    border: 1px solid var(--ac-line);
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.6);
    color: var(--ac-text-muted);
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
  }

  .ac-navpanel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

  .ac-navpanel-item {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    padding: 10px 11px;
    border: 1px solid var(--ac-line);
    border-radius: var(--ac-radius-md);
    background: var(--ac-surface-2);
    color: #d7e0ec;
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }

  .ac-navpanel-item .ac-nav-icon { display: flex; flex: 0 0 auto; }
  .ac-navpanel-item .ac-nav-icon svg { width: 17px; height: 17px; }
  .ac-navpanel-item .ac-nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .ac-navpanel-item.active {
    border-color: var(--ac-accent-line);
    background: var(--ac-accent-soft);
    color: #6ee7b7;
  }
}

/* ---- 5b. Fullscreen chart viewer --------------------------------------- */
/* Shared by the Chart page and Pattern so both read as the same viewer. */
.ac-viewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: #080c12;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.ac-viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ac-space-3);
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ac-line);
  background: rgba(11, 15, 22, 0.96);
}

.ac-viewer-heading { min-width: 0; }
.ac-viewer-title { font-size: 15px; font-weight: 700; color: var(--ac-text); }
.ac-viewer-subtitle { margin-top: 2px; font-size: 11.5px; color: var(--ac-text-muted); }
.ac-viewer-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.ac-viewer-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--ac-line-strong);
  border-radius: var(--ac-radius-sm);
  background: rgba(15, 23, 42, 0.7);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.ac-viewer-btn:hover { border-color: var(--ac-accent-line); color: #6ee7b7; }
.ac-viewer-close { border-color: rgba(148, 163, 184, 0.3); }

.ac-viewer-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ac-viewer-chart { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; }
.ac-viewer-main {
  width: 100%;
  /* renderLightweightChart sets an explicit pixel height from
     chartDims('fullscreen', …); shrinking would fight it. */
  flex: 0 0 auto;
  min-height: 0;
}
.ac-viewer-rsi { width: 100%; flex: 0 0 auto; border-top: 1px solid rgba(148, 163, 184, 0.10); }

.ac-viewer-metrics {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.10);
  font-size: var(--ac-text-micro);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 640px) { .ac-viewer-metrics { grid-template-columns: repeat(8, minmax(0, 1fr)); } }

.ac-viewer-hint {
  flex: 0 0 auto;
  padding: 6px 12px 10px;
  color: var(--ac-text-dim);
  font-size: var(--ac-text-micro);
  text-align: center;
}

.ac-viewer-imageframe {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* The frame owns every gesture so the page behind can never scroll or bounce. */
  touch-action: none;
  overscroll-behavior: contain;
  background: #0b0e14;
}

.ac-viewer-image {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}

.ac-viewer-imageframe[data-zoomed="1"] { cursor: grab; }
.ac-viewer-empty { padding: 32px; color: var(--ac-text-muted); font-size: 12.5px; text-align: center; }

/* ---- 6. Tables, forms, misc -------------------------------------------- */
/* Header rows read as labels, not data. Kept at the inherited size so the
   dense screener tables do not reflow. */
th {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ac-text-muted);
}

/* A horizontally scrolling table must not hand its overscroll to the page —
   that is what makes a sideways swipe trigger back-navigation on Android and
   rubber-band the whole document on iOS. */
.overflow-x-auto, .overflow-y-auto, .nav-scroll-container {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ---- 6b. Mobile refinement --------------------------------------------- */
@media (max-width: 640px) {
  .panel { padding: var(--ac-space-3); }
  .ac-section { margin-top: var(--ac-space-4); }
  .action-card { min-height: 88px; }
  button, [role="button"] { touch-action: manipulation; }

  /* Comfortable targets everywhere, not just where a utility happened to set one. */
  .nav-btn, .screener-tab, .nk-screener-tab, .dt-screener-tab { min-height: 40px; }

  /* Touch target standard >= 44px for all interactive controls on mobile */
  .nav-btn, .screener-tab, .nk-screener-tab, .dt-screener-tab,
  .ac-btn, .ac-segment, .ac-viewer-btn,
  .action-card, .dashboard-pick-card,
  .wl-star-btn, button, [role="button"], [role="tab"] {
    min-height: var(--ac-control-h-touch, 44px);
    touch-action: manipulation;
  }

  /* The sticky header must clear the notch. */
  .app-header { padding-top: env(safe-area-inset-top, 0px); }

  /* Side and bottom padding: clears floating launcher and safe areas on mobile */
  .page-content {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    padding-bottom: calc(var(--ac-fab-size, 56px) + var(--ac-safe-bottom, 16px) + 24px);
  }

  /* Bottom sheets and dialogs stay clear of the home indicator. */
  [role="dialog"] { padding-bottom: env(safe-area-inset-bottom, 0px); }

  /* Tighter rhythm: cards carried desktop-sized gaps into a 390px column. */
  .dashboard-hero { border-radius: var(--ac-radius-lg); }
  .ac-section-head { margin-bottom: var(--ac-space-2); }
}

/* On the narrowest phones the section hint competes with its own heading. */
@media (max-width: 479px) {
  .ac-section-hint { display: none; }
}

/* ---- 6c. Glow / readability balance ------------------------------------
   The hero and panel gradients were competing with body copy. Softening the
   decorative layers keeps the premium feel while text contrast wins. */
.dashboard-hero::after { opacity: 0.55; }
.glow-emerald { box-shadow: 0 0 16px rgba(16, 185, 129, 0.18), 0 0 44px rgba(16, 185, 129, 0.06); }
.glow-emerald:hover { box-shadow: 0 0 22px rgba(16, 185, 129, 0.30), 0 0 58px rgba(16, 185, 129, 0.12); }

/* =========================================================================
   8. Institutional pass
   =========================================================================

   Sections 1–7 established one card language and one radius scale. This section
   takes the product from coherent to institutional: the refinements a desk-grade
   financial tool needs, applied to the component classes and element selectors
   that already exist rather than to new markup. Nothing here requires an HTML
   change, so none of it can alter behaviour.

   Specificity note
   ----------------
   The Tailwind Play CDN injects its sheet at runtime, and the injection point is
   not guaranteed to precede this file. Rules below that must beat a utility on
   the same element therefore carry two or more classes (or an element + class)
   so they win on specificity, not on source order. No !important is used, so a
   deliberate utility on an individual element can still opt out.

   Contents
     8a. Extended tokens
     8b. Numerals and financial typography
     8c. Surface hierarchy
     8d. Section rhythm and headings
     8e. Tables
     8f. Metric and KPI blocks
     8g. Controls: buttons, tabs, inputs, selects
     8h. Badges, pills, status
     8i. Empty, loading and error states
     8j. Modal and drawer chrome
     8k. Interaction feedback
     8l. Responsive composition
   ========================================================================= */

/* ---- 8a. Extended tokens ------------------------------------------------
   Folded into the single :root block in section 1. This heading is kept so the
   section numbering below still matches the contents list above. */

/* ---- 8b. Numerals and financial typography ------------------------------ */
/* Every figure in the product lines up column to column and does not reflow as
   digits change. Section 2 applied this to a handful of classes; a financial
   product needs it wherever a number can appear. */
table td,
table th,
.panel td,
.panel th,
.metric-grid *,
.dashboard-card b,
.dashboard-pick-card b,
[class*="text-right"],
.ac-num,
[data-num] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1, "cv11" 1;
}

/* Numeric columns and financial metric figures use monospace for optimal alignment */
table td.text-right,
table th.text-right,
.panel table tbody td.text-right,
.ps-level b,
.dash-level b,
.dash-level .text-lg,
.dash-level .text-xl,
#screenerStats p:last-child,
#nkScreenerStats p:last-child,
#dtScreenerStats p:last-child {
  font-family: var(--ac-font-mono);
  font-variant-numeric: tabular-nums;
}

/* Tickers are identifiers. Monospace font and fixed weight stop them reading
   as prose and make a column of them immediately scannable. */
.panel td:first-child b,
.dashboard-pick-card b:first-child,
.ticker-badge,
.ticker-symbol {
  font-family: var(--ac-font-mono);
  letter-spacing: 0.02em;
}

/* ---- 8c. Surface hierarchy ---------------------------------------------- */
/* Three levels, deliberately: the page ground, a panel, and content nested
   inside a panel. Previously panels and their inner blocks shared a tone, so a
   dense screen read as one undifferentiated field. */
/* A panel nested inside a panel, and the utility-built blocks that act like
   one, become a recessed well — the third and last level. Aliased onto the
   `.ac-well` primitive rather than restated. */
.panel .panel,
.panel .bg-dark-700\/50,
.panel .bg-dark-800\/50 {
  background: var(--ac-surface-3);
  border-color: var(--ac-hairline);
  border-radius: var(--ac-radius-md);
  box-shadow: none;
}

/* The hero is the one surface allowed to carry a gradient, so it stays the
   visual anchor of the dashboard instead of competing with the cards below.
   Its base rules live in section 3; nothing is restated here. */

/* ---- 8d. Section rhythm and headings ------------------------------------ */
/* Section labels are navigation, not content. Smaller, wider-tracked, dimmer —
   so the eye lands on the data underneath them first. */
.ac-section-title {
  font-size: var(--ac-text-micro);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ac-text-dim);
}
.ac-section-hint {
  font-size: var(--ac-text-caption);
  color: var(--ac-text-dim);
}
.ac-section-head { border-bottom-color: var(--ac-hairline); }

.panel-title {
  font-size: var(--ac-text-lead);
  letter-spacing: -0.012em;
  line-height: var(--ac-lh-tight);
}
.panel-subtitle {
  font-size: var(--ac-text-caption);
  line-height: var(--ac-lh-normal);
  color: var(--ac-text-muted);
}

/* ---- 8e. Tables --------------------------------------------------------- */
/* The screener and ranking tables are the product's core reading surface.
   Header rows become labels, body rows get a real rhythm and a hover, numeric
   columns align on the decimal, and the header sticks so a long scan never
   loses its column meanings. */
.panel table,
.overflow-x-auto > table {
  border-collapse: separate;
  border-spacing: 0;
}

.panel table thead th,
.overflow-x-auto > table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #10151f;
  font-size: var(--ac-text-micro);
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ac-text-dim);
  white-space: nowrap;
  border-bottom: 1px solid var(--ac-line);
  padding-top: 9px;
  padding-bottom: 9px;
}

.panel table tbody td,
.overflow-x-auto > table tbody td {
  height: var(--ac-row-h);
  border-bottom: 1px solid var(--ac-hairline);
  color: var(--ac-text-muted);
}

/* The identifier column carries the row. */
.panel table tbody td:first-child,
.overflow-x-auto > table tbody td:first-child {
  color: var(--ac-text);
  font-weight: 700;
}

.panel table tbody tr,
.overflow-x-auto > table tbody tr {
  transition: background-color var(--motion-fast, 180ms) var(--ease-standard);
}
.panel table tbody tr:hover,
.overflow-x-auto > table tbody tr:hover {
  background: rgba(52, 211, 153, 0.045);
}
.panel table tbody tr:last-child td,
.overflow-x-auto > table tbody tr:last-child td {
  border-bottom: 0;
}

/* A horizontally scrolling table gets a visible edge so it is obvious there is
   more to the right, without adding a scrollbar that eats a row of height. */
.overflow-x-auto {
  scrollbar-width: thin;
}
.overflow-x-auto::-webkit-scrollbar { height: 6px; }
.overflow-x-auto::-webkit-scrollbar-thumb { background: var(--ac-line-strong); border-radius: 999px; }

/* 2-column sticky header support for screener tables (# and Ticker remain visible during horizontal scroll) */
.panel table th.sticky-col-1,
.panel table td.sticky-col-1,
.overflow-x-auto > table th.sticky-col-1,
.overflow-x-auto > table td.sticky-col-1 {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #11151e;
}

.panel table th.sticky-col-2,
.panel table td.sticky-col-2,
.overflow-x-auto > table th.sticky-col-2,
.overflow-x-auto > table td.sticky-col-2 {
  position: sticky;
  left: 36px;
  z-index: 4;
  background: #11151e;
  border-right: 1px solid var(--ac-line);
  box-shadow: 2px 0 6px -2px rgba(0, 0, 0, 0.45);
}

.panel table thead th.sticky-col-1,
.panel table thead th.sticky-col-2,
.overflow-x-auto > table thead th.sticky-col-1,
.overflow-x-auto > table thead th.sticky-col-2 {
  z-index: 6;
  background: #10151f;
}

/* ---- 8f. Metric and KPI blocks ------------------------------------------ */
/* A metric is a label and a figure, and the figure wins. These blocks are built
   from utilities in generated markup, so target the shapes they actually take. */
.metric-grid > div,
.panel .grid > .rounded-xl {
  border-color: var(--ac-hairline);
}

.dashboard-hero h1,
.dashboard-hero .text-2xl,
.dashboard-hero .text-3xl {
  letter-spacing: -0.022em;
  line-height: var(--ac-lh-tight);
}

/* ---- 8g. Controls --------------------------------------------------------

   ONE control primitive, `.ac-btn`, with variants driven by data-variant and
   data-size.

   Buttons in this product were built inline: the screener's three type tabs
   each carry their own hand-written string of eight utilities, and the active
   and inactive appearances are two different strings swapped by JS. That is
   why no two buttons in the app share a height, a radius or a focus ring.

   As with the surface primitive, the existing control class names are aliased
   rather than renamed — they are JS hooks and build-gate assertions. New
   markup should use `.ac-btn`; the rest inherits the shared control shape and
   keeps whatever it sets on top.

   .landing-btn and .maintenance-btn deliberately keep their full definitions
   in the inline sheet of index.html: those two render on screens that are
   shown precisely when the network is failing, and they must not depend on
   this file arriving. What is here only refines them. */
.ac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: var(--ac-control-h);
  padding: 0 13px;
  border: 1px solid var(--ac-line);
  border-radius: var(--ac-radius-sm);
  background: var(--ac-surface-2);
  color: var(--ac-text);
  font-family: inherit;
  font-size: var(--ac-text-body);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease, color .14s ease;
}

.ac-btn:hover:not(:disabled) {
  border-color: var(--ac-line-strong);
  background: var(--ac-surface-hover);
  color: var(--ac-text-strong);
}

/* Primary: the one action on a screen that the product wants taken. Solid, so
   it cannot be confused with the outlined secondaries around it. */
.ac-btn[data-variant="primary"] {
  border-color: transparent;
  background: linear-gradient(180deg, #3ddba4, var(--ac-accent-strong));
  color: var(--ac-brand-ink);
  font-weight: 700;
}
.ac-btn[data-variant="primary"]:hover:not(:disabled) {
  background: linear-gradient(180deg, #5ce4b6, #14c98c);
  color: var(--ac-brand-ink);
}

/* Ghost: navigation and low-stakes toggles. No border until touched. */
.ac-btn[data-variant="ghost"] {
  border-color: transparent;
  background: transparent;
  color: var(--ac-text-muted);
}
.ac-btn[data-variant="ghost"]:hover:not(:disabled) {
  border-color: var(--ac-line);
  background: rgba(148, 163, 184, 0.07);
}

/* Danger is stated, never merely tinted: destructive actions read as such
   before the click, not after. */
.ac-btn[data-variant="danger"] {
  border-color: rgba(248, 113, 113, 0.32);
  background: var(--ac-bear-dim);
  color: #fca5a5;
}
.ac-btn[data-variant="danger"]:hover:not(:disabled) {
  border-color: rgba(248, 113, 113, 0.5);
  background: rgba(248, 113, 113, 0.18);
  color: #fecaca;
}

.ac-btn[data-size="sm"] { min-height: 30px; padding: 0 10px; font-size: var(--ac-text-caption); }
.ac-btn[data-size="lg"] { min-height: var(--ac-control-h-touch); padding: 0 18px; font-size: var(--ac-text-lead); }

/* A control that is working says so, and stops accepting input while it does. */
.ac-btn[data-loading] { pointer-events: none; opacity: 0.7; }
.ac-btn[data-loading]::before {
  content: "";
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
  animation: acSpin .7s linear infinite;
}
@keyframes acSpin { to { transform: rotate(360deg); } }

/* Segmented control: one track, N segments, exactly one selected. Used by the
   screener's Konglo / Non-Konglo / Day Trade switch. A shared track is what
   makes it read as a single choice rather than three unrelated buttons. */
.ac-segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--ac-hairline);
  border-radius: var(--ac-radius-md);
  background: var(--ac-surface-3);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.ac-segmented::-webkit-scrollbar { display: none; }

.ac-segment {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--ac-radius-sm);
  background: transparent;
  color: var(--ac-text-muted);
  font-family: inherit;
  font-size: var(--ac-text-body);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color .14s ease, background-color .14s ease;
}

.ac-segment:hover:not(.is-active) {
  color: var(--ac-text);
  background: rgba(148, 163, 184, 0.07);
}

/* The selected segment is stated by fill AND weight AND colour, so it survives
   a greyscale rendering and a colour-blind reader. */
.ac-segment.is-active {
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-accent-line);
  color: var(--ac-accent);
  font-weight: 700;
  box-shadow: var(--ac-edge), 0 1px 2px rgba(0, 0, 0, 0.28);
}

@media (max-width: 640px) {
  .ac-segment { min-height: 38px; padding: 0 12px; font-size: var(--ac-text-caption); }
}

/* The existing control classes inherit the shared shape: one height, one
   radius, one transition, one type size. Each keeps its own colours. */
.nav-btn,
.ac-viewer-btn,
.new-chat-btn,
.maintenance-btn,
.landing-btn,
.subscription-action,
.screener-tab,
.nk-screener-tab,
.dt-screener-tab {
  font-family: inherit;
  line-height: 1.15;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease, color .14s ease;
}

/* One control height, one border tone, one focus ring, across buttons, tabs,
   inputs and selects. Previously each surface set its own. */
.panel input[type="text"],
.panel input[type="search"],
.panel input[type="number"],
.panel select,
.page-content input[type="text"],
.page-content input[type="search"],
.page-content input[type="number"],
.page-content select {
  min-height: 38px;
  border-radius: var(--ac-radius-sm);
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-3);
  color: var(--ac-text);
  font-size: var(--ac-text-body);
  transition: border-color .14s ease, box-shadow .14s ease;
}
.panel input:hover,
.panel select:hover,
.page-content input:hover,
.page-content select:hover {
  border-color: var(--ac-line-strong);
}
.panel input:focus-visible,
.panel select:focus-visible,
.page-content input:focus-visible,
.page-content select:focus-visible {
  outline: none;
  border-color: var(--ac-accent-line);
  box-shadow: var(--ac-focus-ring);
}

/* Placeholder copy must read as a prompt, not as a value. */
.page-content input::placeholder { color: var(--ac-text-dim); }

/* Tabs: the selected one is stated, the rest recede. */
.screener-tab,
.nk-screener-tab,
.dt-screener-tab {
  font-size: var(--ac-text-body);
  font-weight: 700;
  color: var(--ac-text-dim);
  border-radius: var(--ac-radius-sm);
  transition: color .14s ease, background-color .14s ease;
}
.screener-tab:hover,
.nk-screener-tab:hover,
.dt-screener-tab:hover { color: var(--ac-text-muted); }
.screener-tab.active,
.nk-screener-tab.active,
.dt-screener-tab.active {
  color: var(--ac-accent);
  background: var(--ac-accent-soft);
}

/* ---- 8h. Badges, pills, status ------------------------------------------ */
/* Status is carried by weight and tracking as well as hue, so it survives a
   greyscale print, a colour-blind reader, and a dim phone in daylight. */
.panel span[class*="rounded"][class*="text-["],
.panel span[class*="rounded-full"],
.dashboard-pick-card span[class*="rounded"] {
  font-weight: 800;
  letter-spacing: 0.045em;
}

/* ---- 8i. Empty, loading and error states -------------------------------- */
/* The empty state was a tall box with a small icon marooned in the middle. It
   now sits at a deliberate height with its copy measured for reading. */
.empty-state {
  padding: 26px 20px;
  border: 1px dashed var(--ac-line);
  border-radius: var(--ac-radius-md);
  background: var(--ac-surface-3);
}
.empty-state-icon {
  width: 22px;
  height: 22px;
  color: var(--ac-text-dim);
  opacity: 0.85;
}
.empty-state-text {
  /* Sole source of the icon-to-copy gap: .empty-state-icon used to add its own
     margin-bottom in the inline sheet, and consolidating the two definitions
     left this one carrying the whole rhythm. */
  margin-top: var(--ac-space-3);
  max-width: 42ch;
  margin-left: auto;
  margin-right: auto;
  font-size: var(--ac-text-caption);
  line-height: var(--ac-lh-normal);
  color: var(--ac-text-muted);
}
.empty-state-amber { border-color: rgba(251, 191, 36, 0.28); background: var(--ac-warn-dim); }
.empty-state-amber .empty-state-icon,
.empty-state-amber .empty-state-text { color: #fcd34d; }

/* The error tone was declared only in the inline sheet of index.html, which
   loads BEFORE this file. `.empty-state` here sets border and background at the
   same specificity and later in the cascade, so it overrode both — the three
   .empty-state-error containers in the markup have been rendering with the
   neutral tint. Only their text stayed red, because
   `.empty-state-error .empty-state-text` is two classes and outranks it.
   Stated here, alongside the amber tone, so it actually applies. */
.empty-state-error { border-color: rgba(248, 113, 113, 0.30); background: var(--ac-bear-dim); }
.empty-state-error .empty-state-icon,
.empty-state-error .empty-state-text { color: #fca5a5; }

/* Skeletons match the surface they stand in for, so the swap does not flash. */
.skeleton { border-radius: var(--ac-radius-sm); }

/* ---- 8j. Modal and drawer chrome ---------------------------------------- */
[role="dialog"] > div {
  border-color: var(--ac-hairline);
  box-shadow: var(--ac-shadow-2);
}

/* ---- 8k. Interaction feedback ------------------------------------------- */
/* One focus ring product-wide, replacing the mix of outlines and box-shadows. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--ac-focus-ring);
  border-radius: var(--ac-radius-sm);
}

/* Disabled means unavailable, not merely faded. */
button:disabled,
.panel button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ---- 8m. Screener toolbar ------------------------------------------------
   Two stacked full-width notice bars plus three oversized stat tiles were
   spending roughly 150px of vertical space, above the fold, before a single
   candidate appeared. They are reference material, not the reading surface, so
   they are demoted rather than removed: nothing is hidden, it simply stops
   outranking the data. */
.page-content .scr-info-bar {
  padding: 7px 0 7px 11px;
  border: 0;
  border-left: 2px solid var(--ac-line-strong);
  border-radius: 0;
  background: none;
  font-size: var(--ac-text-caption);
  line-height: 1.5;
}
/* The disclaimer keeps a warning accent; the legend is neutral reference. */
.page-content .scr-info-bar.text-amber-400\/70 {
  border-left-color: rgba(251, 191, 36, 0.42);
}

/* Stat tiles become a compact strip: label above figure, left aligned, one
   shared rule between them instead of three separate boxes. */
/* Flex rather than the markup's equal-width grid: three short figures stretched
   across a 1100px row left most of each tile empty. Hugging the content turns
   them into a scan-strip that reads in one pass. */
#screenerStats, #nkScreenerStats, #dtScreenerStats {
  display: flex;
  flex-wrap: wrap;
  width: max-content;
  max-width: 100%;
  gap: 0;
  border: 1px solid var(--ac-hairline);
  border-radius: var(--ac-radius-md);
  background: var(--ac-surface-3);
  overflow: hidden;
}
#screenerStats > div,
#nkScreenerStats > div,
#dtScreenerStats > div {
  border: 0;
  border-left: 1px solid var(--ac-hairline);
  border-radius: 0;
  background: none;
  padding: 8px 18px;
  text-align: left;
  min-width: 104px;
}
#screenerStats > div:first-child,
#nkScreenerStats > div:first-child,
#dtScreenerStats > div:first-child { border-left: 0; }

#screenerStats p:first-child,
#nkScreenerStats p:first-child,
#dtScreenerStats p:first-child {
  font-size: var(--ac-text-micro);
  font-weight: 800;
  letter-spacing: 0.13em;
  color: var(--ac-text-dim);
}
#screenerStats p:last-child,
#nkScreenerStats p:last-child,
#dtScreenerStats p:last-child {
  margin-top: 2px;
  font-size: var(--ac-text-lead);
  font-weight: 700;
  color: var(--ac-text);
  font-variant-numeric: tabular-nums;
}

/* ---- 8n. Screener result cards ------------------------------------------
   The meta run under each ticker ("Score: 82  Exec: A  Vol: 1.8x  BCA") was a
   single stream of text with no rhythm, so nothing in it could be found without
   reading all of it. Separating the pairs and fixing the label weight makes the
   row scannable at a glance. */
.panel .grid > div > .text-\[11px\],
.dashboard-pick-card .text-\[11px\] {
  line-height: 1.7;
}

/* Level tiles (Entry 1 / Entry 2 / Stop Loss / TP1 / TP2 / R/R): the label is
   reference, the figure is the reading. */
.page-content .grid > div > .text-\[9px\],
.page-content .grid > div > .text-\[10px\] {
  font-size: var(--ac-text-micro);
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* Standardized Trade Plan Grid across Day Trade, Swing Konglo, Swing Non-Konglo cards */
.trade-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}

.trade-plan-tile {
  border-radius: var(--ac-radius-sm, 7px);
  padding: 5px 6px;
  text-align: center;
}

.trade-plan-tile .trade-plan-label {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}

.trade-plan-tile .trade-plan-value {
  font-size: 11px;
  font-weight: 700;
  font-family: var(--ac-font-mono);
  font-variant-numeric: tabular-nums;
}

.trade-plan-tile[data-type="entry"] {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.22);
}
.trade-plan-tile[data-type="entry"] .trade-plan-label { color: #60a5fa; }
.trade-plan-tile[data-type="entry"] .trade-plan-value { color: #93c5fd; }

.trade-plan-tile[data-type="sl"] {
  background: var(--ac-bear-dim);
  border: 1px solid rgba(248, 113, 113, 0.22);
}
.trade-plan-tile[data-type="sl"] .trade-plan-label { color: var(--ac-bear); }
.trade-plan-tile[data-type="sl"] .trade-plan-value { color: #fca5a5; }

.trade-plan-tile[data-type="tp"] {
  background: var(--ac-bull-dim);
  border: 1px solid rgba(52, 211, 153, 0.22);
}
.trade-plan-tile[data-type="tp"] .trade-plan-label { color: var(--ac-bull); }
.trade-plan-tile[data-type="tp"] .trade-plan-value { color: #6ee7b7; }

.trade-plan-tile[data-type="rr"] {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.22);
}
.trade-plan-tile[data-type="rr"] .trade-plan-label { color: #a78bfa; }
.trade-plan-tile[data-type="rr"] .trade-plan-value { color: #c4b5fd; }

/* ---- 8o. Landing ---------------------------------------------------------
   The marketing surface shares the product's type ramp so the first impression
   and the app do not read as two different companies. */
/* .feature-card, .faq-item and .landing-card are aliased onto the surface
   primitive in section 3, and .landing-card states its own larger radius in
   the inline sheet. The hover lift comes from the interactive variant. Nothing
   needs restating here. */

/* ---- 8p. Dashboard information architecture ------------------------------
   Second pass, from feedback on the real production page: the first viewport
   was spent on a greeting, a full-width container holding one market number,
   and five shortcut cards duplicating the primary navigation — while Radar Hari
   Ini, the only genuinely decision-useful block, sat below the fold.

   Nothing is removed and no markup changes. Priority is re-expressed through
   size, weight and spacing: greeting and shortcuts recede, market status
   compacts, radar rises.

   Direction: Koyfin's habit of leading with market state at high density, and
   its restraint with borders. */

/* Greeting: context, not headline. It was set at text-3xl/font-black, making
   "Halo, budi" the largest object on a financial dashboard. */
#page-dashboard .dashboard-hero { padding: 13px 16px; }
#page-dashboard #dashGreeting {
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
#page-dashboard .dashboard-hero > div > div > p {
  font-size: 12px;
  line-height: 1.5;
  margin-top: 3px;
}
#page-dashboard .dash-badge { padding: 3px 8px; font-size: var(--ac-text-micro); }

/* Market status: a strip sized to the amount of information it actually holds.
   One metric does not need a full-height panel. */
#page-dashboard #ihsgSummaryCard {
  padding: 11px 14px;
  border-radius: var(--ac-radius-md);
}
#page-dashboard #ihsgSummaryCard .text-2xl,
#page-dashboard #ihsgSummaryCard .text-3xl {
  font-size: 20px;
  letter-spacing: -0.02em;
}

/* Quick access: the same five destinations already sit in the header nav, so
   they are demoted from 96px feature cards to a compact shortcut row. They stay
   reachable — thumb-sized on phones — without outranking market data. */
#page-dashboard .action-card {
  min-height: 0;
  padding: 10px 12px;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  box-shadow: none;
  background: var(--ac-surface-3);
}
#page-dashboard .action-card .action-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 0;
  flex: 0 0 auto;
  border-radius: 8px;
}
#page-dashboard .action-card .action-icon svg { width: 14px; height: 14px; }
#page-dashboard .action-card > div,
#page-dashboard .action-card > span { min-width: 0; }
#page-dashboard .action-card p:first-of-type { font-size: 12.5px; }
/* The one-line description is redundant next to a labelled nav destination. */
#page-dashboard .action-card p + p { display: none; }

@media (max-width: 640px) {
  /* Phones keep a comfortable target even in the compact row. */
  #page-dashboard .action-card { min-height: 44px; }
}

/* Safety notice: important, but it was the widest, brightest band on the page.
   Same words, same colour family, proportionate weight. */
#page-dashboard .dash-section-note {
  padding: 7px 0 7px 11px;
  border: 0;
  border-left: 2px solid rgba(251, 191, 36, 0.42);
  border-radius: 0;
  background: none;
  font-size: var(--ac-text-caption);
}

/* Radar: the block a user actually came for. Give it the emphasis the greeting
   used to hold. */
#page-dashboard .ac-section:has(#dashboardTop5List) .ac-section-title,
#page-dashboard .ac-section:has(.dashboard-pick-card) .ac-section-title {
  font-size: var(--ac-text-caption);
  color: var(--ac-text-muted);
}

/* Tighter vertical rhythm throughout: the page breathed at a rate suited to a
   marketing site, not a terminal. */
#page-dashboard .space-y-4 > * + * { margin-top: 12px; }
#page-dashboard .ac-section { margin-top: 18px; }

/* A data product should not letterbox itself on a business laptop. */
@media (min-width: 1280px) {
  #page-dashboard.page-content { max-width: 100%; }
}

/* ---- 8q. Admin ----------------------------------------------------------
   The action row used six different accent hues — blue, purple, amber, cyan,
   green, red — for six equally routine operations, so colour carried no
   meaning and the row read as noise. Administrative tools should be quiet;
   colour is reserved for the ones that matter.

   Access control is untouched: this is presentation only. */
#adminPanel button {
  border-color: var(--ac-hairline);
  color: var(--ac-text-muted);
  background: var(--ac-surface-3);
  font-weight: 700;
  transition: border-color .14s ease, color .14s ease, background-color .14s ease;
}
#adminPanel button:hover {
  color: var(--ac-text);
  border-color: var(--ac-line-strong);
  background: rgba(148, 163, 184, 0.07);
}
#adminPanel button svg { color: inherit; opacity: .75; }

/* Security Center is the one elevated-consequence entry point, so it keeps a
   distinguishing tone — now the only coloured control in the row. */
#adminPanel button[onclick*="ecurity"] {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.28);
  background: rgba(248, 113, 113, 0.07);
}
#adminPanel button[onclick*="ecurity"]:hover {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
}

/* Admin is an elevated context inside the same product, not a second website:
   one hairline rule states it without a different visual language. */
#adminPanel > div {
  border-color: var(--ac-hairline);
  border-top: 2px solid rgba(52, 211, 153, 0.28);
}

/* Long admin tables get the same treatment as the screener's. */
#adminPanel table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #10151f;
  font-size: var(--ac-text-micro);
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ac-text-dim);
  white-space: nowrap;
}
#adminPanel table tbody td {
  height: var(--ac-row-h);
  border-bottom: 1px solid var(--ac-hairline);
  font-variant-numeric: tabular-nums;
}
#adminPanel table tbody tr:hover { background: rgba(52, 211, 153, 0.045); }

/* ---- 8r. Locked and subscription states ---------------------------------
   A locked feature must read as a boundary the product drew on purpose, not as
   something that broke. The gates already exist in markup; this gives them a
   deliberate surface instead of a bare container. */
#screenerLoginGate, #sektorLoginGate, #portofolioLoginGate {
  padding: 26px 22px;
  border: 1px dashed var(--ac-line-strong);
  border-radius: var(--ac-radius-lg);
  background: var(--ac-surface-3);
  text-align: center;
}
#screenerLoginGate p, #sektorLoginGate p, #portofolioLoginGate p {
  max-width: 46ch;
  margin-left: auto;
  margin-right: auto;
  font-size: var(--ac-text-body);
  line-height: var(--ac-lh-normal);
  color: var(--ac-text-muted);
}

/* ---- 8l. Responsive composition ----------------------------------------- */
@media (max-width: 640px) {
  /* Phones get the dense row height: the same information, less scrolling. */
  .panel table tbody td,
  .overflow-x-auto > table tbody td { height: var(--ac-row-h-dense); }

  .panel-title { font-size: 14px; }
  .empty-state { padding: 22px 16px; }
}

@media (min-width: 1536px) {
  #page-screener.page-content,
  #page-sektor.page-content { max-width: 100%; }
}

/* =========================================================================
   8s. Landing rhythm
   =========================================================================

   Measured on the Phase 1 build at 1440x900: the page ran 4367px — 4.9 screens
   — to deliver 627 words. Eight sections, every one of them a 36px heading
   over one sentence over a grid of cards, every one padded 72px top and
   bottom. So the type ramp was 60px for the hero and then 36px eight times
   running, which is not a hierarchy, it is a plateau; and roughly 7px of page
   height was being spent per word of content.

   Nothing is deleted here. The fix is rhythm, not subtraction:

     - The section heading drops to 26px. That restores a real interval below
       the 60px hero and puts card titles (15px) a legible step below it, so
       the ramp becomes 60 / 26 / 15 / 13 instead of 60 / 36 / 36 / 36.
     - Section padding drops from 72px to 44px, and the first section after the
       hero gets less still, because the hero already supplies separation.
     - Section intro copy is given a reading measure. A 60-word paragraph set
       across 1180px is what made these sections read as empty: the eye has no
       column to follow, so the whitespace reads as absence rather than as
       breathing room.
     - Card interiors tighten, which is what makes a grid of six read as one
       object instead of six.
   ========================================================================= */

.landing-section { padding: 44px 0; }
.landing-hero + .landing-section { padding-top: 32px; }

.landing-section h2 {
  font-size: 26px;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

/* The one-line section intro is a deck, not body copy: it sits directly under
   the heading and should read as one breath. */
.landing-section h2 + p,
.landing-section > div > p:first-of-type {
  max-width: 62ch;
  font-size: var(--ac-text-body);
  line-height: var(--ac-lh-normal);
  color: var(--ac-text-muted);
}

.landing-section .feature-card { padding: 16px; }
.landing-section .faq-item { padding: 14px 16px; }

/* Eight consecutive card grids is the monotony. A hairline rule under each
   section heading gives the page a spine to scan down, so the sections read as
   chapters of one document rather than as eight repetitions of one block. */
.landing-section > .landing-container > div:first-child,
.landing-section > .landing-container > header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ac-hairline);
  margin-bottom: 22px;
}

@media (max-width: 640px) {
  .landing-section { padding: 32px 0; }
  .landing-section h2 { font-size: 21px; }
}

/* =========================================================================
   8t. Screener tables: semantic column groups and a pinned identity
   =========================================================================

   The three screener tables run 17, 18 and 22 columns. Their headers describe
   five distinct things —

     identity   who is this
     verdict    what does the model think
     market     what is price doing
     plan       what would the trade be
     context    timing, direction, notes

   — but every column was drawn identically, so a reader scanning left to right
   got no signal about where one kind of information ended and the next began,
   and lost the ticker entirely once the table scrolled sideways.

   Two changes, both functional:

     1. A hairline at each group boundary. Not a border on every column, which
        would add noise; one rule exactly where the meaning changes.
     2. The identity columns are pinned, so the row keeps its name during the
        horizontal scroll these widths make inevitable.

   Boundaries are per-table because the column sets differ. They are keyed off
   the tbody id, and stated as the FIRST column of each new group. Empty-state
   rows use a single colspan cell, which no :nth-child(4+) selector matches, so
   they are unaffected.
   ========================================================================= */

/* Swing Konglo — 17 cols: Ticker Group Tier | Exec Setup | Last Chg% RSI
   Vol/Avg20 | Entry Area SL TP1 TP2 RR | Timing Arah Catatan */
#screenerTableBody tr > :nth-child(4),
#screenerTableBody tr > :nth-child(6),
#screenerTableBody tr > :nth-child(10),
#screenerTableBody tr > :nth-child(15),
/* Swing Non-Konglo — 18 cols, same set with a leading rank column. */
#nkScreenerTableBody tr > :nth-child(5),
#nkScreenerTableBody tr > :nth-child(7),
#nkScreenerTableBody tr > :nth-child(11),
#nkScreenerTableBody tr > :nth-child(16),
/* Day Trade — 22 cols: # Ticker Board | Status Setup-Score Exec Setup | Last
   Chg% Vol/Avg20 Tx-Today Pre-Spike Momentum | Entry Area SL TP1 TP2 RR |
   Timing Arah Time-Plan Catatan */
#dtScreenerTableBody tr > :nth-child(4),
#dtScreenerTableBody tr > :nth-child(8),
#dtScreenerTableBody tr > :nth-child(14),
#dtScreenerTableBody tr > :nth-child(19) {
  border-left: 1px solid var(--ac-line);
}

/* The same boundaries in the header, so the grouping is stated before the data
   rather than inferred from it. The tbody id cannot reach its own thead, so the
   header rows carry a column-count class instead. */
.scr-cols-17 > :nth-child(4),
.scr-cols-17 > :nth-child(6),
.scr-cols-17 > :nth-child(10),
.scr-cols-17 > :nth-child(15),
.scr-cols-18 > :nth-child(5),
.scr-cols-18 > :nth-child(7),
.scr-cols-18 > :nth-child(11),
.scr-cols-18 > :nth-child(16),
.scr-cols-22 > :nth-child(4),
.scr-cols-22 > :nth-child(8),
.scr-cols-22 > :nth-child(14),
.scr-cols-22 > :nth-child(19) {
  border-left: 1px solid var(--ac-line);
}

/* ---- Pinned identity ----------------------------------------------------
   An opaque background is mandatory on a sticky cell or the scrolling columns
   read straight through it. The header's own sticky rule from section 8e wins
   at the intersection via a higher z-index. */
#screenerTableBody tr > :nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--ac-surface-1);
  box-shadow: 1px 0 0 var(--ac-line);
}

/* Where a rank column leads, both it and the ticker pin, and the rank is given
   a fixed width so the ticker's offset is not a guess. */
#nkScreenerTableBody tr > :nth-child(1),
#dtScreenerTableBody tr > :nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 34px;
  min-width: 34px;
  max-width: 34px;
  background: var(--ac-surface-1);
}
#nkScreenerTableBody tr > :nth-child(2),
#dtScreenerTableBody tr > :nth-child(2) {
  position: sticky;
  left: 34px;
  z-index: 1;
  background: var(--ac-surface-1);
  box-shadow: 1px 0 0 var(--ac-line);
}

/* Hover has to repaint the pinned cells too, or the row appears to break in
   half as the cursor crosses it. */
.panel table tbody tr:hover > :nth-child(1),
.overflow-x-auto > table tbody tr:hover > :nth-child(1),
.panel table tbody tr:hover > :nth-child(2),
.overflow-x-auto > table tbody tr:hover > :nth-child(2) {
  background: #16202b;
}

/* Deliberately NO blanket right-align rule here. The row builders already set
   alignment per cell — text-right on figures, text-center on status columns,
   left by default — and an id-scoped nth-child range would outrank all of it,
   silently right-aligning the centred columns it happened to span. Section 8b
   supplies the tabular figures; the existing per-cell classes stay in charge of
   alignment. */

@media (max-width: 640px) {
  /* Pinning costs horizontal room that a phone does not have, and every
     screener already renders a card grid at this width. */
  #screenerTableBody tr > :nth-child(1),
  #nkScreenerTableBody tr > :nth-child(1),
  #nkScreenerTableBody tr > :nth-child(2),
  #dtScreenerTableBody tr > :nth-child(1),
  #dtScreenerTableBody tr > :nth-child(2) {
    position: static;
    box-shadow: none;
  }
}

/* =========================================================================
   9. The pick card
   =========================================================================

   The Top 5 card is the object a trader reads to make a decision, and it had
   become twelve consecutive `mt-1` rows of label/value pairs at 10–11px, every
   row the same weight and the same 4px gap. Three consequences:

     - Nothing was grouped, so the eye had no landing point.
     - Six accent hues were in play — emerald, blue, purple, cyan, amber, grey,
       plus the dynamic grade/risk colours — which means colour carried no
       information. Everything coloured is the same as nothing coloured.
     - The trade itself (ladder, entry, stop, targets) sat BELOW six rows of
       metadata, so the least decision-relevant content was read first.

   The card is now three zones, separated by a hairline and a real spacing
   step rather than by another 4px: what this is, what the trade is, and what
   to be careful about. Every field that was rendered before is still rendered,
   in the same order within its zone; only grouping, weight and colour change.

   Colour is spent on direction and risk only. Targets are bull, stops are
   bear, warnings are warn, and everything else — EntryQ, PlanQ, Breakout,
   Setup Age, RR, action — is neutral. The grade and risk colours stay, because
   those come from the scoring model and genuinely encode a scale.
   ========================================================================= */

.dashboard-pick-card { padding: 12px 13px; }

/* Zones. The separator is what replaces eleven identical 4px gaps. */
.dash-zone + .dash-zone {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--ac-hairline);
}

/* ---- Zone 1: what this is ---------------------------------------------- */
.dash-ident { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.dash-ident-ticker {
  font-size: var(--ac-text-lead);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ac-text-strong);
}
.dash-ident-price {
  font-size: var(--ac-text-body);
  font-weight: 600;
  color: var(--ac-text);
  font-variant-numeric: tabular-nums;
}
.dash-ident-tag {
  padding: 2px 7px;
  border: 1px solid var(--ac-hairline);
  border-radius: 999px;
  background: var(--ac-surface-3);
  font-size: var(--ac-text-micro);
  font-weight: 600;
  color: var(--ac-text-dim);
}
/* The score is the one figure the ranking is built on, so it reads as a
   figure rather than as another label/value pair. */
.dash-ident-score { margin-left: auto; text-align: right; flex: 0 0 auto; }
.dash-ident-score span {
  display: block;
  font-size: var(--ac-text-micro);
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ac-text-dim);
}
.dash-ident-score b {
  display: block;
  margin-top: 1px;
  font-size: var(--ac-text-metric);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ac-text-strong);
  font-variant-numeric: tabular-nums;
}

.dash-verdict { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 6px; }
.dash-verdict > span { font-size: var(--ac-text-caption); color: var(--ac-text-dim); }
.dash-verdict > span > b { margin-left: 4px; font-weight: 700; color: var(--ac-text); }

/* ---- Zone 2: the trade -------------------------------------------------- */
/* Given the most room, because it is the reason the card exists. */
.dash-trade .dash-ladder { margin-top: 0; }
.dash-trade .dash-level-grid { margin-top: 8px; }

.dash-level span {
  font-size: var(--ac-text-micro);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ac-text-dim);
}
.dash-level b {
  margin-top: 2px;
  font-size: var(--ac-text-body);
  font-weight: 700;
  color: var(--ac-text);
  font-variant-numeric: tabular-nums;
}
/* Direction, and only direction, is coloured. */
.dash-level[data-tone="danger"] b { color: var(--ac-bear); }
.dash-level[data-tone="target"] b { color: var(--ac-bull); }
.dash-level[data-tone="danger"] { border-color: rgba(248, 113, 113, 0.18); }
.dash-level[data-tone="target"] { border-color: rgba(52, 211, 153, 0.18); }

/* ---- Zone 3: caveats and detail ---------------------------------------- */
/* Reference material. Present, complete, and quieter than the trade. */
/* Five reference fields stacked two-up cost three rows and made the caveat zone
   taller than the trade above it — the least decision-relevant part of the card
   dominating the most. Three columns on a desktop-width card puts them in two. */
.dash-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 14px;
}
@media (min-width: 1024px) {
  .dash-meta { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.dash-meta > span {
  min-width: 0;
  font-size: var(--ac-text-micro);
  line-height: 1.38;
  color: var(--ac-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dash-meta > span > b { font-weight: 600; color: var(--ac-text-muted); }

/* A flag is a caution, so it is shaped like one: a rule in the margin rather
   than another coloured sentence in a stack of coloured sentences.

   Bounded to two lines. The markup these replaced used `truncate`, which caps a
   note at one line and hides the rest; dropping that made the caveat zone grow
   without limit on a verbose row — it measured taller than the trade above it.
   Two lines keeps more of the note than the original single line did while
   still giving the card a predictable height. */
.dash-flag {
  margin-top: 3px;
  padding-left: 9px;
  border-left: 2px solid var(--ac-line-strong);
  font-size: var(--ac-text-micro);
  line-height: var(--ac-lh-snug);
  color: var(--ac-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-flag[data-tone="warn"] { border-left-color: rgba(251, 191, 36, 0.5); color: #e8c877; }
.dash-flag[data-tone="info"] { border-left-color: var(--ac-accent-line); }

/* Same reasoning as the flags: was `truncate` at one line, now bounded at two. */
.dash-reason {
  margin-top: 5px;
  font-size: var(--ac-text-micro);
  line-height: var(--ac-lh-snug);
  color: var(--ac-text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dash-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.dash-chips > span {
  padding: 2px 7px;
  border: 1px solid var(--ac-hairline);
  border-radius: 999px;
  background: var(--ac-surface-3);
  font-size: var(--ac-text-micro);
  color: var(--ac-text-muted);
}

/* ---- Loading -----------------------------------------------------------
   The skeleton mirrors the card's real footprint — identity row, ladder, level
   grid — so the arriving data fills a shape that is already there instead of
   pushing the list down. */
.dash-skeleton {
  padding: 12px 13px;
  border: 1px solid var(--ac-hairline);
  border-radius: var(--ac-radius-md);
  background: var(--ac-surface-1);
}
.dash-skeleton + .dash-skeleton { margin-top: 8px; }
.dash-skeleton-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dash-skeleton-bar { height: 8px; margin-top: 14px; }
.dash-skeleton-levels { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.dash-skeleton-levels .skeleton-line { height: 26px; border-radius: var(--ac-radius-xs); }
.dash-skeleton-label {
  margin-top: 10px;
  text-align: center;
  font-size: var(--ac-text-micro);
  color: var(--ac-text-dim);
}

@media (max-width: 640px) {
  .dash-skeleton-levels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The rank badge stops being a coloured tile and becomes an ordinal. */
.dash-rank {
  flex: 0 0 auto;
  width: 22px;
  font-size: var(--ac-text-caption);
  font-weight: 700;
  line-height: 1.4;
  color: var(--ac-text-dim);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .dash-meta { grid-template-columns: minmax(0, 1fr); }
  .dash-ident-score b { font-size: var(--ac-text-lead); }
}

/* ---- 8q. WCAG 2.1 AA accessible financial palette & text contrast overrides ---- */
/* Low-contrast dark text classes are raised to clear the 4.5:1 AA contrast ratio on dark surfaces */
.panel .text-slate-500,
.panel .text-slate-600,
.panel .text-gray-500,
.panel .text-gray-600,
.page-content .text-slate-500,
.page-content .text-slate-600,
.page-content .text-gray-500,
.page-content .text-gray-600 {
  color: var(--ac-text-muted);
}

/* Badge and indicator text contrast on dark badge background fills */
.panel .text-emerald-500,
.panel .text-green-500,
.page-content .text-emerald-500,
.page-content .text-green-500 {
  color: var(--ac-bull);
}

.panel .text-rose-500,
.panel .text-red-500,
.page-content .text-rose-500,
.page-content .text-red-500 {
  color: var(--ac-bear);
}

.badge-bull {
  background: var(--ac-bull-dim);
  border: 1px solid rgba(52, 211, 153, 0.25);
  color: var(--ac-bull);
}

.badge-bear {
  background: var(--ac-bear-dim);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: var(--ac-bear);
}

.badge-neutral {
  background: var(--ac-flat-dim);
  border: 1px solid rgba(148, 163, 184, 0.20);
  color: var(--ac-text-muted);
}

/* ---- 7. Reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .header-status-dot {
    animation: none !important;
    opacity: 1 !important;
  }
  .ac-launcher, .ac-navpanel-card, .action-card, .panel,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-input,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-select,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-textarea,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-table tbody tr,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-skeleton,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-detail-sheet {
    transition: none !important;
    animation: none !important;
  }
  .action-card:hover,
  :is([data-ac-ui="v2"], .ac-ui-v2) .ac-btn:active { transform: none !important; }
  .panel table tbody tr { transition: none !important; }
}

/* AUTO_CUAN_DESKTOP_HEADER_FLEX_NAVBAR_V2 */
/* Single row desktop navbar with nowrap, space-between, and right-aligned account section */
@media (min-width: 1280px) {
  .app-header > .header-shell > .flex,
  .header-shell > .flex {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    column-gap: 16px !important;
  }

  .app-header > .header-shell > .flex > :first-child,
  .header-shell > .flex > :first-child {
    flex-shrink: 0 !important;
  }

  .app-header > .header-shell > .flex > .desktop-nav,
  .header-shell > .flex > .desktop-nav {
    flex: 0 1 auto !important;
    max-width: none !important;
  }

  .app-header > .header-shell > .flex > .desktop-header-chips,
  .header-shell > .flex > .desktop-header-chips {
    flex-shrink: 0 !important;
  }

  .app-header > .header-shell > .flex > .header-account,
  .header-shell > .flex > .header-account {
    display: flex !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    margin-left: auto !important;
  }
}

/* Ticker Search Controls & Header Search Bar Fix */
/* PR1 layout fix: a 24px top margin on BOTH `.analisis-saham-controls`
   (the wrapper, `#analisisChartHeader`) and `.unified-top-bar` (its child)
   stacked to ~48px of dead dark space below the sticky tab strip, which read
   as a broken void. The wrapper owns the gap; the inner bar must not add its
   own again. */
.analisis-saham-controls,
.ticker-search-container {
  position: relative !important;
  z-index: 10 !important;
  margin-top: 12px !important;
  margin-bottom: 16px !important;
  clear: both !important;
}

#analisisChartHeader[style*="display: none"] {
  display: none !important;
}

.unified-top-bar,
.screener-search-bar,
.screener-search-wrap,
#screenerSearchWrap,
#nkSearchWrap,
#dtSearchWrap {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  flex-wrap: wrap !important;
  position: relative !important;
  z-index: 10 !important;
  margin-top: 0 !important;
  margin-bottom: 12px !important;
  clear: both !important;
}

/* Fallback static constraint for legacy recovery regression check */
.ticker-search-container.is-static,
.screener-search-bar.is-static {
  position: static !important;
}

/* Floating AI Assistant input icon anchor */
#analisisFollowUp .floating-ai-icon,
.unified-chat-composer .floating-ai-icon,
.unified-chat-composer .ai-icon,
#analisisFollowUp .ai-icon,
.ai-assistant-icon,
#aiAssistantIcon,
.chat-composer-wrapper .floating-ai-icon,
.chat-composer-wrapper .ai-icon {
  position: absolute !important;
  right: 14px !important;
  bottom: 12px !important;
  top: auto !important;
  transform: none !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

/* Eliminasi Double Scrollbar pada Hasil Analisis Saham */
#panelAnalisisText,
.unified-card:has(#analisisResult),
.unified-primary-col:has(#analisisResult) {
  overflow: visible !important;
}

#analisisResult {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  max-height: min(72vh, 680px) !important;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
}

#analisisResult .ai-content,
#analisisResult .ai-rich-text,
#analisisResult > div {
  overflow-y: visible !important;
  max-height: none !important;
}

#analisisResult::-webkit-scrollbar {
  width: 6px;
}
#analisisResult::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
  border-radius: 9999px;
}
#analisisResult::-webkit-scrollbar-track {
  background: transparent;
}

/* Screener Card Grids Padding & Overflow */
#screenerCardGrid,
.screener-card-grid,
.card-grid {
  padding-bottom: 32px;
  max-width: 100%;
}

#kgCardGrid,
#nkCardGrid,
#dtCardGrid {
  padding-bottom: 80px !important;
  margin-bottom: 24px !important;
  overflow: visible !important;
}

#dashboardScreen {
  overflow: visible !important;
}

/* Canonical .page-content rule (single source of truth). The previous
   contradictory `overflow-y: auto !important` here fought the later
   `overflow-y: visible !important` declaration; the visible value wins for
   desktop reflow, so the auto rule is removed to eliminate the conflict. */
.page-content {
  overflow-y: visible !important;
  overflow-x: clip !important;
  -webkit-overflow-scrolling: touch;
}

/* Global scroll safety without breaking desktop reflow */
html {
  overflow-y: scroll;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
}

/* Header status badge pills — restored visibility and layout */
.desktop-header-chips {
  display: flex !important;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header-status-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border: 1px solid var(--ac-line);
  border-radius: 999px;
  background: var(--ac-surface-3);
  color: var(--ac-text-muted);
  font-size: var(--ac-text-micro);
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.header-status-chip.safe {
  border-color: rgba(52, 211, 153, 0.30);
  background: rgba(52, 211, 153, 0.08);
  color: #6ee7b7;
}

.header-status-chip.warn {
  border-color: rgba(251, 191, 36, 0.30);
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
}

.header-status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.55);
}

/* Hide status chips on mobile — they clutter the compact header */
@media (max-width: 1023px) {
  .desktop-header-chips { display: none !important; }
}

/* AUTO_CUAN_DESKTOP_HEADER_CENTER_V2 */
/* 4-column grid: Logo | Nav(center) | Status Chips | Account
   Keeps navigation centered and badges visible without overlap. */
@media (min-width: 1280px) {
  .app-header > .header-shell > .flex {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    column-gap: 12px;
  }

  .app-header > .header-shell > .flex > :first-child {
    justify-self: start;
  }

  .app-header > .header-shell > .flex > .desktop-nav {
    justify-self: center;
    width: max-content;
    max-width: none;
    flex: none;
  }

  .app-header > .header-shell > .flex > .desktop-header-chips {
    justify-self: center;
  }

  .app-header > .header-shell > .flex > :last-child {
    justify-self: end;
  }
}

/* ==========================================================================
   AUTO-CUAN THEME SYSTEM: DARK (SLATE/ZINC) & LIGHT (CLEAN FINANCIAL)
   ========================================================================== */
html.light, body.light, [data-theme="light"] {
  --pw-bg: #f8fafc;
  --pw-bg-2: #f1f5f9;
  --pw-panel: #ffffff;
  --pw-panel-2: #f8fafc;
  --pw-panel-3: #f1f5f9;
  --pw-panel-hover: #f1f5f9;
  --pw-panel-strong: #f1f5f9;
  --pw-surface: #ffffff;
  --pw-line: #e2e8f0;
  --pw-line-strong: #cbd5e1;
  --pw-text: #0f172a;
  --pw-text-strong: #020617;
  --pw-muted: #334155;
  --pw-dim: #475569;
  --pw-bull: #047857;
  --pw-bear: #b91c1c;
  --pw-warn: #b45309;
  --pw-info: #1d4ed8;
  --pw-grid: transparent;

  --color-text-primary: #0f172a !important;
  --color-text-secondary: #334155 !important;
  --color-text-muted: #475569 !important;
  --color-positive: #047857 !important;
  --color-negative: #b91c1c !important;
  --color-warning: #b45309 !important;
  --ac-bg: #f8fafc;
  --ac-surface-1: #ffffff;
  --ac-surface-2: #f8fafc;
  --ac-surface-3: #f1f5f9;
  --ac-text-strong: var(--color-text-primary);
  --ac-surface: #ffffff;
  --ac-panel: #ffffff;
  --ac-panel-header: #f1f5f9;
  --ac-border: #e2e8f0;
  --ac-text: #0f172a;
  --ac-text-sub: #334155;
  --ac-text-muted: #475569;
  --ac-text-dim: #475569;
  --ac-bull: #047857;
  --ac-bear: #b91c1c;
  --ac-warn: #b45309;

  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html.light .bg-dark-900,
html.light .bg-dark-900\/80,
html.light .bg-dark-900\/70,
html.light .bg-dark-900\/60 {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

html.light .bg-dark-800,
html.light .bg-dark-800\/80,
html.light .bg-dark-800\/90,
html.light .bg-dark-800\/60,
html.light .bg-dark-800\/40 {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}

html.light .bg-dark-700,
html.light .bg-dark-700\/80,
html.light .bg-dark-700\/60,
html.light .bg-dark-700\/40,
html.light .bg-dark-700\/50 {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

html.light .border-dark-600,
html.light .border-dark-600\/30,
html.light .border-dark-600\/40,
html.light .border-dark-600\/50,
html.light .border-dark-600\/60,
html.light .border-dark-700,
html.light .border-dark-700\/30,
html.light .border-dark-700\/40,
html.light .border-dark-700\/50,
html.light .border-dark-700\/60 {
  border-color: #e2e8f0 !important;
}

html.light .text-white,
html.light .text-gray-100,
html.light .text-gray-200 {
  color: #111827 !important;
}

html.light .text-gray-300,
html.light .text-gray-400 {
  color: #4B5563 !important;
}

html.light .text-gray-500,
html.light .text-gray-600 {
  color: #6B7280 !important;
}

/* WCAG AA Semantic Contrast in Light Mode (> 4.5:1 on white) */
html.light .text-emerald-300,
html.light .text-emerald-400,
html.light .text-emerald-500,
html.light .text-green-300,
html.light .text-green-400,
html.light .text-green-500 {
  color: #047857 !important;
}

html.light .text-red-300,
html.light .text-red-400,
html.light .text-red-500,
html.light .text-rose-300,
html.light .text-rose-400,
html.light .text-rose-500 {
  color: #b91c1c !important;
}

html.light .text-amber-200,
html.light .text-amber-300,
html.light .text-amber-400,
html.light .text-amber-500,
html.light .text-yellow-300,
html.light .text-yellow-400 {
  color: #b45309 !important;
}

html.light .app-header {
  background-color: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html.light .panel,
html.light .dashboard-card,
html.light .screener-card,
html.light .dashboard-hero,
html.light .unified-card,
html.light .portfolio-card,
html.light .market-tile {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
  color: #0f172a !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

html.light #page-dashboard #dashGreeting {
  color: var(--color-text-primary);
}

html.light .app-sidebar {
  background-color: #ffffff !important;
  border-right-color: #e2e8f0 !important;
}

html.light .sidebar-item {
  color: #334155 !important;
}

html.light .sidebar-item:hover {
  background-color: #f1f5f9 !important;
  color: #047857 !important;
}

html.light .sidebar-item.active {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
}

html.light .theme-toggle-btn,
html.light .workspace-sidebar-toggle,
html.light .sidebar-collapse-toggle,
html.light .theme-toggle-compact {
  color: #334155 !important;
  background-color: #f1f5f9 !important;
  border-color: #cbd5e1 !important;
}

html.light .theme-toggle-btn:hover,
html.light .workspace-sidebar-toggle:hover,
html.light .sidebar-collapse-toggle:hover,
html.light .theme-toggle-compact:hover {
  color: #0f172a !important;
  background-color: #e2e8f0 !important;
}

html.light .sidebar-brand,
html.light .sidebar-footer {
  border-color: #e2e8f0 !important;
}

html.light .sidebar-brand-text strong,
html.light .sidebar-brand-text p,
html.light .user-name {
  color: #0f172a !important;
}

html.light .sidebar-brand-text span {
  color: #475569 !important;
}

html.light .user-role {
  color: #047857 !important;
}

html.light .user-avatar {
  background-color: #ecfdf5 !important;
  border-color: #a7f3d0 !important;
  color: #047857 !important;
}

/* Kill the grid pattern in light mode too — the light sheet must read flat. */
html.light body {
  background-image: none !important;
}

/* ==========================================================================
   COLLAPSIBLE WORKSPACE SIDEBAR
   Fixed rail on the left; the app body gets matching padding so tables gain
   the reclaimed width the moment the rail collapses.
   ========================================================================== */
#appSidebar.hidden,
.app-sidebar.hidden {
  display: none;
}

.app-layout {
  display: flex;
  align-items: flex-start;
  width: 100%;
  min-height: 100vh;
}

#sidebar,
#appSidebar,
.app-sidebar {
  position: sticky;
  top: 0;
  width: 240px;
  height: 100dvh;         /* §1.2: dynamic viewport height — accounts for mobile toolbars */
  height: 100vh;          /* fallback for browsers without dvh support */
  flex: 0 0 auto;
  background: var(--color-bg-surface);
  border-right: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 60;
  transition: width var(--motion-base, 200ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
  overflow-x: hidden;
  overflow-y: hidden;     /* children handle their own scroll */
}

/* §1.2: Nav area scrolls independently — footer is always visible */
.sidebar-nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;          /* required for flex children to shrink-scroll */
}

/* §1.2: Footer locked at bottom — never clipped */
.sidebar-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--color-border-subtle);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}



#sidebar.collapsed,
#sidebar.is-collapsed,
#appSidebar.collapsed,
#appSidebar.is-collapsed,
.app-sidebar.collapsed,
.app-sidebar.is-collapsed {
  width: 72px !important;
  flex: 0 0 72px !important;
}

.sidebar-scrim {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(2, 6, 12, 0.62);
  backdrop-filter: blur(3px);
}

.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .sidebar-badge,
.app-sidebar.collapsed .user-info,
.app-sidebar.is-collapsed .sidebar-label,
.app-sidebar.is-collapsed .sidebar-brand-text,
.app-sidebar.is-collapsed .sidebar-badge,
.app-sidebar.is-collapsed .user-info {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-item,
.app-sidebar.is-collapsed .sidebar-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

.app-sidebar.collapsed .sidebar-brand,
.app-sidebar.is-collapsed .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 72px;
  padding: 12px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.sidebar-brand-lockup { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sidebar-brand-text { display: grid; min-width: 0; }
.sidebar-brand-text strong { color: var(--color-text-primary); font-size: 14px; line-height: 1.25; }
.sidebar-brand-text span { color: var(--color-text-muted); font-size: 10px; }
.sidebar-brand .brand-mark { display: grid; place-items: center; flex: 0 0 34px; }
.sidebar-brand .brand-mark svg { width: 18px; height: 18px; }
.sidebar-collapse-toggle,
.theme-toggle-compact {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  cursor: pointer;
}
.sidebar-collapse-toggle:hover,
.theme-toggle-compact:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.sidebar-collapse-toggle svg,
.theme-toggle-compact svg { width: 15px; height: 15px; transition: transform var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)); }
.app-sidebar.collapsed .sidebar-collapse-toggle svg,
.app-sidebar.is-collapsed .sidebar-collapse-toggle svg { transform: rotate(180deg); }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px; }
.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--color-border-subtle);
  overflow: hidden;
}
.sidebar-footer .theme-toggle-compact {
  width: 100%;
  height: 32px;
  border-radius: 8px;
  justify-self: stretch;
}
.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  cursor: pointer;
  border-radius: 8px;
  padding: 4px;
  transition: background-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
}
.user-profile-badge:hover {
  background-color: var(--color-bg-hover);
}

.sidebar-profile-button {
  width: 100%;
  border: 1px solid var(--color-border-subtle);
  background: var(--color-bg-elevated);
  color: inherit;
  text-align: left;
}

.sidebar-profile-chevron {
  margin-left: auto;
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
}

.sidebar-utility-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.sidebar-utility-button {
  min-width: 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid var(--color-border-default);
  border-radius: 8px;
  background: var(--color-bg-elevated);
  color: var(--color-text-secondary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard), color var(--motion-fast) var(--ease-standard);
}

.sidebar-utility-button:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.sidebar-utility-danger {
  color: #f0a7ad;
}

.sidebar-utility-danger:hover {
  border-color: rgba(239,68,68,.28);
  background: rgba(239,68,68,.08);
  color: #fecaca;
}
.user-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 50%;
  background: var(--color-bg-hover);
  border: 1px solid var(--color-border-default);
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 700;
}
.user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.user-name {
  overflow: hidden;
  color: var(--color-text-primary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  overflow: hidden;
  color: var(--color-positive);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-sidebar.collapsed .sidebar-footer,
.app-sidebar.is-collapsed .sidebar-footer {
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 12px 6px;
  overflow: hidden;
}
.app-sidebar.collapsed .user-profile-badge,
.app-sidebar.is-collapsed .user-profile-badge {
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  padding: 1px;
}

.app-sidebar.collapsed .sidebar-utility-actions,
.app-sidebar.is-collapsed .sidebar-utility-actions {
  grid-template-columns: 1fr;
  width: 100%;
}

.app-sidebar.collapsed .sidebar-utility-button,
.app-sidebar.is-collapsed .sidebar-utility-button {
  width: 36px;
  min-width: 36px;
  margin: 0 auto;
  padding: 0;
}

.app-main-viewport {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* The content column. `min-width: 0` is what stops a wide table inside a page
   from forcing the flex row wider than the viewport — without it the column
   refuses to shrink below its content and the sidebar is pushed off-screen. */
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* App Content Transition (§6.5) */
.app-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity var(--motion-fast, 180ms) var(--ease-standard),
              transform var(--motion-fast, 180ms) var(--ease-standard);
  will-change: auto;
}

/* App Shell Sidebar State sync */
.app-shell[data-sidebar-state="collapsed"] #appSidebar {
  width: 72px;
}

/* Button Micro-interactions (§6.2) */
.sidebar-item:active,
.nav-btn:active,
.analisis-tab:active,
.pcc-subtab:active,
.market-tile:active {
  transform: scale(0.98);
  transition: transform var(--motion-instant) var(--ease-standard);
}

/* Analisis Saham Sub-tab Strip (§1.3 & §6.3): Single Row Nowrap */
.analisis-tab-strip {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 2px;
  width: 100% !important;
}
.analisis-tab-strip::-webkit-scrollbar {
  display: none;
}
.analisis-tab {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* Checkbox Standard Design System Token (§1.2 & §2.4) */
input[type="checkbox"] {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px;
  min-height: 16px;
  accent-color: var(--accent-primary, #22C55E);
  border-radius: var(--ac-radius-xs, 4px);
  cursor: pointer;
  flex-shrink: 0;
  vertical-align: middle;
}


/* Content stays readable without animation support. Landing motion uses WAAPI. */
.scroll-reveal { opacity: 1; transform: none; }

/* Mobile drawer trigger in the header. Hidden from 1024px up, where the rail
   itself is permanently docked. */
.workspace-sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background-color: rgba(148, 163, 184, 0.06);
  color: #cbd5e1;
  flex-shrink: 0;
  transition: background-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
}

.workspace-sidebar-toggle:hover {
  background-color: rgba(148, 163, 184, 0.14);
  color: #ffffff;
}

/* Single Shell HolverAI on Desktop (>= 1024px):
   Hide the horizontal top header bar inside #appMain so it never duplicates
   #appSidebar on desktop. Standalone pages (/analisis-saham, /portfolio-planner)
   do not wrap .app-header in #appMain, so their header remains 100% intact. */
@media (min-width: 1024px) {
  .workspace-sidebar-toggle,
  #appMain > .app-header,
  #workspaceTabRail {
    display: none !important;
  }

  .app-sidebar:not(.hidden) {
    display: flex !important;
    position: fixed;
    inset: 0 auto 0 0;
    top: 0;
    left: 0;
    height: 100dvh;
    max-height: 100dvh;
  }

  /* The desktop rail is truly viewport-fixed. Main content receives the exact
     rail offset instead of relying on sticky flex behaviour that could drift
     with tall pages or nested overflow owners. */
  #appMain {
    width: calc(100% - 240px);
    margin-left: 240px;
    min-height: 100dvh;
  }

  #appShell[data-sidebar-state="collapsed"] #appMain,
  body.sidebar-collapsed #appMain {
    width: calc(100% - 72px);
    margin-left: 72px;
  }
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  min-height: 38px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #aab4c3;
  transition: all var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
  white-space: nowrap;
  width: 100%;
  border: 1px solid transparent;
  text-align: left;
}

.sidebar-item svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.sidebar-item:hover {
  color: #f4f7fb;
  background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active {
  color: #090d16;
  background-color: #ffffff;
  border-color: #ffffff;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  background-color: rgba(148, 163, 184, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.15);
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  transition: background-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              border-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
}

.theme-toggle-btn:hover {
  background-color: rgba(148, 163, 184, 0.16);
  color: #ffffff;
}

@media (max-width: 1023px) {
  /* Below 1024px the rail leaves the flex flow and becomes an overlay drawer,
     so the content column keeps the full viewport width instead of being
     squeezed to 240px less. `position: fixed` here is scoped to small screens
     only — from 1024px up the rail is a real sticky flex column. */
  .app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    height: 100dvh;
    transform: translateX(-100%);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    transition: transform 0.25s ease, width 0.22s ease;
  }
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }
  /* The collapsed rail is a desktop affordance only; on phones the drawer
     always opens full width so labels stay readable. */
  .app-sidebar.collapsed,
  .app-sidebar.is-collapsed {
    width: 240px;
  }
}

/* Dynamic-viewport height for the flex shell. Declared AFTER the 100vh
   fallbacks above so the dvh value wins wherever it is supported; on browsers
   without dvh support the 100vh rules simply stand. */
@supports (height: 100dvh) {
  .app-layout { min-height: 100dvh; }
  .app-sidebar { height: 100dvh; }
}

/* AUTO_CUAN_DESKTOP_HEADER_CENTER_V1 */
/* Keep the navigation centered on the viewport instead of centering it only
   inside the space left between unequal brand and account groups. */
@media (min-width: 1280px) {
  .app-header > .header-shell > .flex {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    column-gap: 16px;
  }

  .app-header > .header-shell > .flex > :first-child {
    justify-self: start;
  }

  .app-header > .header-shell > .flex > .desktop-nav {
    justify-self: center;
    width: max-content;
    max-width: none;
    flex: none;
  }

  .app-header > .header-shell > .flex > :last-child {
    justify-self: end;
  }
}

/* ===========================================================================
   12. Phases 2–5 Visual Refinement (Radar, Stock Cards, Sektor Hot, Spacing)
   =========================================================================== */
#appMain {
  overflow-x: hidden;
}

#sektorGroupsGrid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)) !important;
  gap: 16px !important;
}

.sektor-group-card,
.dt-card-item,
.kg-card-item,
.nk-card-item {
  border-radius: 12px !important;
  padding: 16px !important;
}

.trade-plan-grid {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 6px !important;
  align-items: stretch !important;
}

.trade-plan-tile {
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  min-height: 44px !important;
  padding: 6px 8px !important;
  border-radius: 8px !important;
  font-family: var(--ac-font-mono);
  font-variant-numeric: tabular-nums;
}

/* ===========================================================================
   13. Batch 3 (Fase 13 - 14): #page-money-management Fintech & Table Overhaul
   =========================================================================== */
#page-money-management .dashboard-hero {
  border-radius: 14px !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(11, 15, 25, 0.96)) !important;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.28) !important;
}

#page-money-management .ac-segmented {
  display: inline-flex !important;
  gap: 6px !important;
  padding: 5px !important;
  background: rgba(15, 23, 42, 0.78) !important;
  border: 1px solid rgba(148, 163, 184, 0.16) !important;
  border-radius: 12px !important;
}

#page-money-management .ac-segment {
  border-radius: 8px !important;
  padding: 7px 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #94a3b8 !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  transition: all 0.16s ease !important;
  cursor: pointer;
}

#page-money-management .ac-segment:hover {
  color: #f1f5f9 !important;
  background: rgba(30, 41, 59, 0.65) !important;
}

#page-money-management .ac-segment.is-active,
#page-money-management .ac-segment.active {
  color: #34d399 !important;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 78, 59, 0.32)) !important;
  border-color: rgba(16, 185, 129, 0.48) !important;
  font-weight: 700 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.14) !important;
}

/* TanStack-Grade Compact Density on Money Management Spreadsheet Tables */
#mmCashflowSpreadsheetTable,
#mmJournalSpreadsheetTable {
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-variant-numeric: tabular-nums !important;
}

#mmCashflowSpreadsheetTable thead th,
#mmJournalSpreadsheetTable thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  padding: 8px 10px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  color: #94a3b8 !important;
  background-color: #0f172a !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.24) !important;
  white-space: nowrap !important;
}

#mmCashflowSpreadsheetTable tbody td,
#mmJournalSpreadsheetTable tbody td {
  padding: 7px 10px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
  font-variant-numeric: tabular-nums !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.09) !important;
  vertical-align: middle !important;
}

#mmCashflowSpreadsheetTable tbody td.font-mono,
#mmJournalSpreadsheetTable tbody td.font-mono,
#mmCashflowSpreadsheetTable tfoot td.font-mono,
#mmJournalSpreadsheetTable tfoot td.font-mono {
  font-family: var(--ac-font-mono, 'Geist Mono', monospace) !important;
  font-variant-numeric: tabular-nums !important;
}

#mmCashflowSpreadsheetTable tbody tr:hover,
#mmJournalSpreadsheetTable tbody tr:hover {
  background-color: rgba(30, 41, 59, 0.55) !important;
}

#mmCashflowSpreadsheetTable tfoot,
#mmJournalSpreadsheetTable tfoot {
  position: sticky !important;
  bottom: 0 !important;
  z-index: 15 !important;
  background-color: #0f172a !important;
  border-top: 2px solid rgba(16, 185, 129, 0.45) !important;
}

#mmCashflowSpreadsheetTable tfoot td,
#mmJournalSpreadsheetTable tfoot td {
  padding: 8px 10px !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  font-variant-numeric: tabular-nums !important;
  background-color: #0f172a !important;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12) !important;
}

/* Light Mode Overrides for #page-money-management (WCAG AA >= 4.5:1) */
html.light #page-money-management .dashboard-hero {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
}

html.light #page-money-management .dashboard-hero h2 {
  color: #0f172a !important;
}

html.light #page-money-management .dashboard-hero p {
  color: #475569 !important;
}

html.light #page-money-management .ac-segmented {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

html.light #page-money-management .ac-segment {
  color: #475569 !important;
}

html.light #page-money-management .ac-segment:hover {
  color: #0f172a !important;
  background: #ffffff !important;
}

html.light #page-money-management .ac-segment.is-active,
html.light #page-money-management .ac-segment.active {
  color: #047857 !important;
  background: #ffffff !important;
  border: 1px solid rgba(5, 150, 105, 0.48) !important;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06) !important;
}

html.light #page-money-management .bg-dark-800,
html.light #page-money-management .bg-dark-800\/80,
html.light #page-money-management .bg-dark-800\/60,
html.light #page-money-management .bg-dark-900,
html.light #page-money-management .bg-dark-900\/90 {
  background-color: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.light #mmCashflowSpreadsheetTable thead th,
html.light #mmJournalSpreadsheetTable thead th {
  background-color: #f1f5f9 !important;
  color: #334155 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

html.light #mmCashflowSpreadsheetTable tbody td,
html.light #mmJournalSpreadsheetTable tbody td {
  background-color: #ffffff !important;
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html.light #mmCashflowSpreadsheetTable tbody tr:hover,
html.light #mmJournalSpreadsheetTable tbody tr:hover {
  background-color: #f1f5f9 !important;
}

html.light #mmCashflowSpreadsheetTable tfoot,
html.light #mmJournalSpreadsheetTable tfoot,
html.light #mmCashflowSpreadsheetTable tfoot td,
html.light #mmJournalSpreadsheetTable tfoot td {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-top-color: #047857 !important;
}

html.light #page-money-management .text-white {
  color: #0f172a !important;
}

html.light #page-money-management .text-gray-200,
html.light #page-money-management .text-gray-300,
html.light #page-money-management .text-gray-400,
html.light #page-money-management .text-gray-500 {
  color: #334155 !important;
}

html.light #page-money-management .text-emerald-400,
html.light #page-money-management .text-emerald-300 {
  color: #047857 !important;
}

html.light #page-money-management .text-rose-400,
html.light #page-money-management .text-rose-300 {
  color: #b91c1c !important;
}

html.light #page-money-management .text-blue-300,
html.light #page-money-management .text-blue-400 {
  color: #1d4ed8 !important;
}

html.light #page-money-management .text-cyan-300,
html.light #page-money-management .text-cyan-400 {
  color: #0369a1 !important;
}

/* ===========================================================================
   14. Batch 4 (Fase 15 - 19): Final UI/UX Polish, Accessibility & Responsiveness
   =========================================================================== */

/* --- FASE 15: Micro-interactions & Zero-Shift Transitions --- */
.radar-card,
.metric-tile,
.bandar-card,
.sector-card,
.action-item,
.journal-item,
.position-card,
.dashboard-card,
.dashboard-pick-card,
.panel {
  transition: background-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              border-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              box-shadow var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              transform var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)) !important;
}

.radar-card:hover,
.metric-tile:hover,
.bandar-card:hover,
.sector-card:hover,
.action-item:hover,
.dashboard-card:hover,
.dashboard-pick-card:hover {
  border-color: rgba(52, 211, 153, 0.38) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24) !important;
  transform: translateY(-1px) !important;
}

.radar-card:active,
.metric-tile:active,
.bandar-card:active,
.sector-card:active,
.action-item:active,
.dashboard-card:active,
.dashboard-pick-card:active {
  transform: translateY(0) !important;
}

.sub-tab-btn,
.tab,
.tab-btn,
.nav-btn,
.sidebar-item,
.workspace-sidebar-toggle,
.sidebar-collapse-toggle,
.analisis-tab,
.ac-btn {
  transition: background-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              border-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              box-shadow var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)) !important;
}

.theme-toggle-btn,
.theme-toggle-compact,
.market-tile-link {
  transition: background-color var(--motion-instant, 100ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              border-color var(--motion-instant, 100ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              color var(--motion-instant, 100ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              box-shadow var(--motion-instant, 100ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)) !important;
}

/* --- FASE 16: Responsiveness - Sidebar Collapse & Mobile/Tablet Viewport --- */
/* Desktop Collapsed Sidebar Rail (72px) */
.app-sidebar.collapsed,
.app-sidebar.is-collapsed {
  width: 72px !important;
  flex: 0 0 72px !important;
}

.app-sidebar.collapsed .sidebar-brand,
.app-sidebar.is-collapsed .sidebar-brand {
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 10px 4px !important;
  min-height: 72px !important;
}

.app-sidebar.collapsed .sidebar-brand-lockup,
.app-sidebar.is-collapsed .sidebar-brand-lockup {
  justify-content: center !important;
  width: 100% !important;
  gap: 0 !important;
}

.app-sidebar.collapsed .brand-mark,
.app-sidebar.is-collapsed .brand-mark {
  margin: 0 auto !important;
}

.app-sidebar.collapsed .sidebar-brand-text,
.app-sidebar.collapsed .sidebar-label,
.app-sidebar.collapsed .sidebar-badge,
.app-sidebar.collapsed .user-info,
.app-sidebar.is-collapsed .sidebar-brand-text,
.app-sidebar.is-collapsed .sidebar-label,
.app-sidebar.is-collapsed .sidebar-badge,
.app-sidebar.is-collapsed .user-info {
  display: none !important;
}

.app-sidebar.collapsed .sidebar-collapse-toggle,
.app-sidebar.is-collapsed .sidebar-collapse-toggle {
  margin: 2px auto 0 !important;
}

.app-sidebar.collapsed .sidebar-item,
.app-sidebar.is-collapsed .sidebar-item {
  justify-content: center !important;
  padding: 10px 0 !important;
  gap: 0 !important;
  width: 100% !important;
}

.app-sidebar.collapsed .sidebar-item svg,
.app-sidebar.is-collapsed .sidebar-item svg {
  margin: 0 auto !important;
}

.app-sidebar.collapsed .sidebar-footer,
.app-sidebar.is-collapsed .sidebar-footer {
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  padding: 10px 4px !important;
  gap: 8px !important;
}

.app-sidebar.collapsed .user-profile-badge,
.app-sidebar.is-collapsed .user-profile-badge {
  justify-content: center !important;
  margin: 0 auto !important;
  padding: 0 !important;
  width: auto !important;
}

.app-sidebar.collapsed .user-avatar,
.app-sidebar.is-collapsed .user-avatar {
  width: 32px !important;
  height: 32px !important;
  margin: 0 auto !important;
}

.app-sidebar.collapsed .theme-toggle-compact,
.app-sidebar.is-collapsed .theme-toggle-compact {
  display: inline-grid !important;
  margin: 0 auto !important;
}

/* Tablet Layout (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-main {
    width: 100% !important;
    max-width: 100% !important;
  }
  .page-content {
    padding: 16px 20px !important;
  }
}

/* Mobile Viewport (< 768px) */
@media (max-width: 767px) {
  .app-layout {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .app-main {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  .page-content {
    padding: 12px 10px !important;
    max-width: 100% !important;
  }
  .workspace-sidebar-toggle {
    min-width: 44px !important;
    min-height: 44px !important;
  }
  .radar-grid,
  .metric-grid,
  .dashboard-grid {
    grid-template-columns: 1fr !important;
  }
}

/* --- FASE 17: Eliminasi Double Scrollbar & Horizontal Overflow --- */
html {
  overflow-y: scroll !important;
  overflow-x: hidden !important;
}

body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
}

.app-layout {
  overflow-x: hidden !important;
  max-width: 100vw !important;
}

.app-main {
  overflow-x: hidden !important;
  overflow-y: visible !important;
}

.page-content {
  overflow-y: visible !important;
  overflow-x: clip !important;
}

/* Isolated horizontal scroll for tables only */
.table-responsive-container,
.table-wrap,
.overflow-x-auto {
  overflow-x: auto !important;
  max-width: 100% !important;
  scrollbar-width: thin !important;
  -webkit-overflow-scrolling: touch !important;
}

/* --- FASE 18: Audit WCAG AA Lengkap (Light & Dark Mode) --- */
/* Keyboard Accessibility Focus Visible Ring */
button:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
a:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
input:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
select:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
textarea:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
.btn:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
.tab:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
.sidebar-item:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
.sub-tab-btn:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
.workspace-sidebar-toggle:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
.sidebar-collapse-toggle:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  outline: 2px solid var(--accent-primary, #22c55e) !important;
  outline-offset: 2px !important;
}

/* Light Mode Comprehensive WCAG AA/AAA Contrast Overrides */
html.light,
[data-theme="light"] {
  --canvas: #F7F8FA;
  --surface: #FFFFFF;
  --surface-elevated: #F1F5F9;
  --border-hairline: #E5E7EB;
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-tertiary: #475569;
  --text-muted: #475569;
  --accent-primary: #16A34A;
  --accent-primary-hover: #15803D;
  --data-positive: #16A34A;
  --data-negative: #DC2626;
  --color-bg-canvas: #F7F8FA;
  --color-bg-surface: #FFFFFF;
  --color-bg-elevated: #F1F5F9;
  --color-text-primary: #111827;
  --color-text-secondary: #4B5563;
  --color-text-muted: #4B5563;
}

html.light body {
  background-color: #F7F8FA !important;
  color: #111827 !important;
}

html.light .app-header {
  background-color: #FFFFFF !important;
  border-bottom: 1px solid #E5E7EB !important;
}

html.light .app-sidebar {
  background-color: #FFFFFF !important;
  border-right: 1px solid #E5E7EB !important;
}

html.light .dashboard-hero,
html.light .dashboard-card,
html.light .action-card,
html.light .panel,
html.light .metric-tile,
html.light .radar-card {
  background-color: #FFFFFF !important;
  border-color: #E5E7EB !important;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.05) !important;
}

html.light .text-white,
html.light .text-gray-100,
html.light .text-gray-200,
html.light .text-gray-300,
html.light .card-title,
html.light .panel-title {
  color: #111827 !important;
}

html.light .text-gray-400,
html.light .text-gray-500,
html.light .text-muted,
html.light .text-dim,
html.light .panel-subtitle,
html.light .card-subtitle {
  color: #4B5563 !important;
}

html.light .sidebar-item {
  color: #334155 !important;
}

html.light .sidebar-item:hover {
  background-color: #f1f5f9 !important;
  color: #047857 !important;
}

html.light .sidebar-item.active {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #a7f3d0 !important;
}

html.light .bourse-status,
html.light #marketStatusBourseChip {
  background-color: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 700 !important;
}

html.light .ticker-link {
  color: #047857 !important;
}

html.light .ticker-link:hover {
  color: #065f46 !important;
  text-decoration: underline !important;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .ac-launcher, .ac-navpanel-card, .action-card, .panel { transition: none !important; animation: none !important; }
  .action-card:hover { transform: none; }
  .panel table tbody tr { transition: none !important; }
  .radar-card,
  .metric-tile,
  .bandar-card,
  .sector-card,
  .action-item,
  .journal-item,
  .position-card,
  .dashboard-card,
  .sub-tab-btn,
  .tab,
  .btn,
  .sidebar-item {
    transition: none !important;
    transform: none !important;
  }
}

/* Semantic Flow Colors */
.flow-positive {
  color: var(--data-positive, #22C55E) !important;
}
.flow-negative {
  color: var(--data-negative, #EF4444) !important;
}

/* Workspace shell owner. Portfolio's standalone layout is scoped separately. */
#appShell.app-shell {
  display:flex; align-items:stretch; width:100%; max-width:none; margin:0; padding:0;
  min-height:100vh; min-height:100dvh; overflow:visible !important;
}
#appMain.app-main { min-width:0; width:auto !important; max-width:none !important; margin:0 !important; padding:0; flex:1; }
#appContent.app-content { min-width:0; transform:none; will-change:auto; }
#appSidebar.app-sidebar {
  position:fixed !important; top:0 !important; left:0; bottom:0; width:240px;
  height:100vh !important; height:100dvh !important; max-height:100dvh !important;
  display:flex !important; flex-direction:column; overflow:hidden; z-index:75;
  background:var(--color-bg-surface); border:0; border-right:1px solid var(--color-border-default);
  transition:width var(--motion-fast) var(--ease-standard),transform var(--motion-fast) var(--ease-standard);
}
#appSidebar.hidden { display:none !important; }
#appSidebar > .sidebar-brand { display:flex !important; align-items:center !important; flex:0 0 auto; gap:10px; padding:20px 14px 16px; min-height:76px; border-bottom:1px solid var(--color-border-subtle); }
#appSidebar .sidebar-brand-lockup { display:flex; align-items:center; gap:10px; min-width:0; }
#appSidebar .sidebar-brand-text { display:grid; gap:3px; min-width:0; }
#appSidebar .sidebar-brand-text strong { font-size:14px; font-weight:600; color:var(--color-text-primary); letter-spacing:-.025em; }
#appSidebar .sidebar-brand-text > span { font-size:10px; color:var(--color-text-secondary); }
#appSidebar .brand-mark { width:32px !important; height:32px !important; flex:0 0 32px; border-radius:9px; color:var(--brand-mark-ink); background:var(--brand-mark-bg) !important; border:1px solid var(--brand-mark-line); box-shadow:none !important; }
#appSidebar .sidebar-collapse-toggle { display:grid; place-items:center; width:24px; height:30px; flex-shrink:0; padding:0; margin-left:auto; border:0; background:transparent; color:var(--color-text-secondary); }
#appSidebar > .sidebar-nav { display:block; flex:1 1 0%; min-height:0; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; scrollbar-color:rgba(148,163,184,0.2) transparent; padding:8px 8px 32px 8px; }
#appSidebar > .sidebar-nav::-webkit-scrollbar { width:4px; }
#appSidebar > .sidebar-nav::-webkit-scrollbar-track { background:transparent; }
#appSidebar > .sidebar-nav::-webkit-scrollbar-thumb { background:rgba(148,163,184,0.2); border-radius:4px; }
#appSidebar > .sidebar-nav::-webkit-scrollbar-thumb:hover { background:rgba(148,163,184,0.4); }
#appSidebar .sidebar-nav-group { padding-bottom:5px; }
#appSidebar .sidebar-nav-group:last-child { padding-bottom:28px; }
#appSidebar .sidebar-group-label { color:var(--color-text-secondary); font-size:9px; font-weight:500; line-height:1.5; letter-spacing:.09em; text-transform:uppercase; padding:12px 12px 6px; margin:0; }
#appSidebar .sidebar-item { position:relative; display:flex; align-items:center; justify-content:flex-start; min-height:36px; width:100%; padding:7px 11px; gap:10px; border:1px solid transparent; border-radius:8px; background:transparent; color:var(--color-text-secondary); font:500 12px/1.45 Inter,system-ui,sans-serif; text-align:left; box-shadow:none; transition:background-color 150ms ease,color 150ms ease,border-color 150ms ease; }
#appSidebar .sidebar-item.hidden { display:none !important; }
#appSidebar .sidebar-item > svg { width:16px; height:16px; flex:0 0 16px; }
#appSidebar .sidebar-item:hover { color:var(--color-text-primary); background:var(--color-bg-hover); }
#appSidebar .sidebar-item.active { background:var(--color-bg-elevated) !important; color:var(--color-accent) !important; border-color:var(--color-border-default) !important; box-shadow:0 1px 2px rgba(0,0,0,0.2) !important; }
#appSidebar .sidebar-item.active::before { content:''; position:absolute; left:-1px; top:8px; bottom:8px; width:3px; background:var(--color-accent); border-radius:2px; }
#appSidebar .sidebar-item:active { transform:none; }
#appSidebar .sidebar-badge { margin-left:auto; border:1px solid rgba(16,185,129,0.35); background:rgba(16,185,129,0.12); border-radius:4px; padding:1px 5px; font-size:9px; font-weight:700; letter-spacing:.04em; color:#34d399; }
#appSidebar .sidebar-badge.is-admin { border-color:rgba(244,63,94,0.35); background:rgba(244,63,94,0.12); color:#fb7185; }
#appSidebar > .sidebar-footer { flex:0 0 auto; display:flex; flex-direction:column; align-items:stretch; gap:8px; margin-top:auto; padding:12px; border-top:1px solid var(--color-border-default); background:var(--color-bg-surface); }
#appSidebar .theme-toggle-compact { display:flex; align-items:center; justify-content:flex-start; gap:10px; width:100%; min-height:32px; padding:5px 9px; border:0; border-radius:7px; background:transparent; color:var(--color-text-secondary); font-size:11px; }
#appSidebar .user-profile-badge { display:flex; align-items:center; justify-content:flex-start; gap:10px; min-width:0; width:100%; padding:5px 7px; border:0; border-radius:7px; background:transparent; }
#appSidebar .user-avatar { display:grid; place-items:center; width:30px; height:30px; flex:0 0 30px; border-radius:9px; border:1px solid var(--color-border-default); background:var(--color-bg-elevated); color:var(--color-text-primary); font-size:12px; font-weight:600; }
#appSidebar .user-info { display:grid; gap:2px; min-width:0; }
#appSidebar .user-name { color:var(--color-text-primary); font-size:12px; font-weight:500; }
#appSidebar .user-role { color:var(--color-text-secondary); font-size:9px; }
#appSidebar :is(button,[role="button"]):focus-visible { outline:2px solid var(--color-accent); outline-offset:-2px; }
#sidebarScrim { z-index:74; backdrop-filter:none; background:rgba(3,7,18,.56); }
@media (max-height: 820px) and (min-width: 1024px) {
  #appSidebar > .sidebar-brand { min-height: 52px; padding: 10px 14px 8px; }
  #appSidebar .sidebar-group-label { padding: 4px 12px 2px; }
  #appSidebar .sidebar-item { min-height: 32px; padding: 5px 10px; font-size: 11.5px; }
  #appSidebar > .sidebar-footer { padding: 8px 12px; gap: 4px; }
}
html.workspace-menu-open { overflow:hidden !important; }
@media(max-width:1023px) {
  /* The drawer and scrim live in the dashboard's isolated stacking context.
     Lift that owner above the body-level bottom bar only while the menu is open. */
  html.workspace-menu-open #dashboardScreen {
    position: relative;
    z-index: var(--ac-z-drawer, 80);
  }
}
@media(min-width:1024px) {
  body.sidebar-open #appMain.app-main { margin-left:240px !important; transition:margin-left var(--motion-fast) var(--ease-standard); }
  body.sidebar-open.sidebar-collapsed #appMain.app-main { margin-left:72px !important; }
  #appSidebar.is-collapsed { width:72px !important; }
  #appSidebar.is-collapsed > .sidebar-brand { flex-direction:column; padding:14px 8px !important; gap:8px; }
  #appSidebar.is-collapsed .sidebar-collapse-toggle { margin:0; }
  #appSidebar.is-collapsed .sidebar-group-label { font-size:0; padding:6px 0; margin:4px 8px; border-top:1px solid var(--color-border-subtle); }
  #appSidebar.is-collapsed .sidebar-item { justify-content:center; min-height:37px; padding:7px; }
  #appSidebar.is-collapsed :is(.sidebar-label,.sidebar-brand-text,.sidebar-badge,.user-info) { display:none !important; }
  #appSidebar.is-collapsed > .sidebar-footer { padding:12px 8px; }
  #appSidebar.is-collapsed :is(.theme-toggle-compact,.user-profile-badge) { width:100%; display:flex !important; align-items:center; justify-content:center; margin:0 !important; }
}
@media(max-width:1023px) {
  #appSidebar.app-sidebar { width:260px !important; max-width:calc(100vw - 48px); transform:translateX(-100%); visibility:hidden; pointer-events:none; }
  #appSidebar.mobile-open { transform:translateX(0); visibility:visible; pointer-events:auto; }
  #appSidebar.is-collapsed > .sidebar-brand { flex-direction:row !important; justify-content:flex-start !important; }
  #appSidebar.is-collapsed .sidebar-item { justify-content:flex-start !important; padding:8px 11px !important; }
  #appSidebar.is-collapsed :is(.sidebar-label,.sidebar-brand-text,.user-info) { display:grid !important; }
  #appSidebar.is-collapsed .sidebar-badge { display:inline-block !important; }
  #appSidebar .sidebar-item { min-height:40px; }
  #appSidebar.is-collapsed .sidebar-footer { align-items:stretch !important; }
  #appSidebar.is-collapsed .sidebar-collapse-toggle { margin-left:auto; }
  #appMain > .app-header { background:var(--color-bg-surface); border-radius:0; padding:0; }
}
@media(prefers-reduced-motion:reduce) { #appSidebar.app-sidebar,body.sidebar-open #appMain.app-main { transition:none; } }

/* Sub-tab strip single row */
.analisis-tab-strip,
#analisisTabStrip,
.subtab-strip {
  display: flex !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  width: 100% !important;
  gap: 6px !important;
  scrollbar-width: none !important;
}
.analisis-tab-strip::-webkit-scrollbar,
#analisisTabStrip::-webkit-scrollbar,
.subtab-strip::-webkit-scrollbar {
  display: none !important;
}
.analisis-tab {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* App Content Page Transitions */
#appContent,
.app-content {
  transition: opacity var(--motion-fast, 180ms) var(--ease-standard),
              transform var(--motion-fast, 180ms) var(--ease-standard) !important;
}

/* Dashboard Top 5 Cards Alignment */
#page-dashboard #dashboardTop5List,
#dashboardTop5List.dashboard-top5-grid {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 12px;
  margin-top: 0;
}
#page-dashboard #dashboardTop5List > *,
#dashboardTop5List.dashboard-top5-grid > * {
  width: 100%;
  margin-top: 0;
  margin-bottom: 0;
}

/* Standardize Tailwind & Component Transitions to Master Spec */
.transition,
.transition-all {
  transition-duration: var(--motion-fast, 180ms) !important;
  transition-timing-function: var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)) !important;
  transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform !important;
}

button:not(.no-motion-override),
.btn:not(.no-motion-override),
.sidebar-item,
.analisis-tab,
.tab {
  transition-duration: var(--motion-fast, 180ms) !important;
  transition-timing-function: var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)) !important;
}

/* Progress Bar Motion Token (§6.1) */
#psFill,
.ps-fill {
  transition: width var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)) !important;
}

/* Reduced Motion Enforcement (§6.1) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .action-card:hover { transform: none; }
  .panel table tbody tr { transition: none; }
  #appContent,
  .app-content {
    transition: none !important;
    animation: none !important;
  }
}

/* ==========================================================================
   WCAG AA ACCESSIBILITY & CONTRAST REMEDIATION (Master Spec §2)
   ========================================================================== */

/* --- DARK MODE CONTRAST REINFORCEMENTS --- */
html:not(.light) .panel-subtitle,
html:not(.light) #dashboardTop5LockNote,
html:not(.light) p.panel-subtitle,
html:not(.light) .dash-reason,
html:not(.light) .empty-state-text {
  color: #A0AEC0 !important;
}

html:not(.light) #dashboardTop5List .metric span,
html:not(.light) .radar-card .metric span,
html:not(.light) .dashboard-pick-card .metric span,
html:not(.light) #dashboardTop5List span.text-gray-400,
html:not(.light) #dashboardTop5List span.text-gray-500,
html:not(.light) .dashboard-pick-card span:not(.badge):not(.pill):not(.font-bold) {
  color: #CBD5E1 !important;
}

html:not(.light) #screenerStats p.uppercase,
html:not(.light) #screenerStats .text-gray-500 {
  color: #A0AEC0 !important;
}

html:not(.light) .scr-detail-hint {
  color: #9AA4B2 !important;
}

/* --- LIGHT MODE CONTRAST & CARD / BADGE POLISH --- */
html.light {
  --surface: #FFFFFF;
  --canvas: #F7F8FA;
  --text-primary: #111827;
  --text-secondary: #4B5563;
  --text-muted: #475569;
  --data-positive: #0f7a57;
  --data-negative: #c13f4d;
  --data-neutral: #a96d13;
  --accent-primary: #0f7458;
  --accent-primary-hover: #0b6049;
  --accent-subtle: rgba(15, 116, 88, .09);
  --color-positive: #0f7a57;
  --color-negative: #c13f4d;
  --color-accent: #0f7458;
}

/* Light mode panels & cards ground */
html.light .dashboard-pick-card,
html.light .radar-card,
html.light .screener-card,
html.light .market-tile {
  background: #FFFFFF !important;
  border-color: #E2E8F0 !important;
  color: #111827 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Light mode headers and titles */
html.light .page-title,
html.light h1, html.light h2, html.light h3 {
  color: #111827 !important;
}

html.light .page-subtitle,
html.light .panel-subtitle,
html.light p.panel-subtitle,
html.light .empty-state-text,
html.light #dashboardTop5LockNote {
  color: #4B5563 !important;
}

/* Hardcoded dark backgrounds in HTML containers must become clean light surfaces */
html.light .bg-dark-900\/80,
html.light .bg-dark-900\/90,
html.light .bg-dark-800\/60,
html.light .bg-dark-800\/80,
html.light .bg-dark-700\/40,
html.light .bg-dark-600\/40,
html.light .bg-dark-600\/60 {
  background-color: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
  color: #111827 !important;
}

html.light select.bg-dark-900\/90,
html.light input.bg-dark-900\/90 {
  background-color: #FFFFFF !important;
  border-color: #CBD5E1 !important;
  color: #111827 !important;
}

/* Light mode price targets, current price, stop loss */
html.light .is-now {
  color: #1E293B !important;
  font-weight: 600 !important;
}

html.light .is-target {
  color: #B45309 !important;
  font-weight: 600 !important;
}

html.light .is-stop {
  color: #B91C1C !important;
  font-weight: 600 !important;
}

html.light .dash-flag {
  color: #92400E !important;
  background: #FEF3C7 !important;
  border-color: #FCD34D !important;
}

/* Light mode badges & grades */
html.light .dashboard-pick-card b,
html.light .radar-card b {
  color: #15803D !important;
}

html.light .dashboard-pick-card b.warn,
html.light .dashboard-pick-card b.text-amber-400,
html.light .radar-card b.text-amber-400 {
  color: #B45309 !important;
}

html.light .dashboard-pick-card b.info,
html.light .dashboard-pick-card b.text-blue-400,
html.light .radar-card b.text-blue-400 {
  color: #1D4ED8 !important;
}

/* Light mode Position Sizing inline widget (.ac-pos-calc-box) */
html.light .ac-pos-calc-box {
  background: #F8FAFC !important;
  border: 1px solid #CBD5E1 !important;
  color: #1E293B !important;
}

html.light .ac-pos-calc-box * {
  color: #334155 !important;
}

html.light .ac-pos-calc-box strong,
html.light .ac-pos-calc-box b {
  color: #0F172A !important;
}

html.light .ac-pos-calc-box strong[style*="6ee7b7"],
html.light .ac-pos-calc-box strong[style*="4ade80"] {
  color: #15803D !important;
}

html.light .ac-pos-calc-box strong[style*="fca5a5"],
html.light .ac-pos-calc-box strong[style*="f87171"] {
  color: #B91C1C !important;
}

html.light .ac-pos-calc-box strong[style*="93c5fd"],
html.light .ac-pos-calc-box span[style*="93c5fd"] {
  color: #1D4ED8 !important;
}

html.light .ac-pos-calc-box strong[style*="f59e0b"],
html.light .ac-pos-calc-box span[style*="fbbf24"] {
  color: #B45309 !important;
}

html.light .ac-pos-calc-box button {
  background: #EFF6FF !important;
  border: 1px solid #93C5FD !important;
  color: #1D4ED8 !important;
}

/* Light mode Signal Gate card trigger & drawer (.ac-gate-card-trigger) */
html.light .ac-gate-card-trigger button {
  background: #F1F5F9 !important;
  border: 1px solid #CBD5E1 !important;
  color: #334155 !important;
}

html.light .ac-gate-card-trigger button * {
  color: #334155 !important;
}

html.light .ac-gate-card-trigger button span[style*="6ee7b7"] {
  color: #15803D !important;
}

html.light .ac-gate-card-trigger button span[style*="fca5a5"] {
  color: #B91C1C !important;
}

html.light .ac-gate-card-trigger button span[style*="fbbf24"] {
  color: #B45309 !important;
}

html.light .ac-gate-drawer,
html.light .ac-gate-transparency-box {
  background: #F8FAFC !important;
  border: 1px solid #CBD5E1 !important;
  color: #1E293B !important;
}

html.light .ac-gate-drawer *,
html.light .ac-gate-transparency-box * {
  color: #334155 !important;
}

/* Light mode screener tabs & info bars */
html.light .screener-tab.active {
  color: #065F46 !important;
  background: #D1FAE5 !important;
  border: 1px solid #6EE7B7 !important;
  font-weight: 700 !important;
}

html.light .screener-tab {
  color: #4B5563 !important;
  background: #F1F5F9 !important;
}

html.light .scr-info-bar {
  background: #F8FAFC !important;
  color: #4B5563 !important;
  border-color: #E2E8F0 !important;
}

html.light .scr-info-bar strong {
  color: #111827 !important;
}

html.light .scr-info-bar.text-amber-400\/70 {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border-color: #FDE68A !important;
}

html.light .scr-info-bar.text-amber-400\/70 strong {
  color: #78350F !important;
}

html.light #screenerMetaBadge {
  background: #FEF3C7 !important;
  color: #92400E !important;
  border-color: #FDE68A !important;
}

html.light .screener-card strong {
  color: #111827 !important;
}

html.light .screener-card span.text-emerald-300,
html.light .screener-card span[class*="emerald"],
html.light .screener-card strong.text-emerald-300 {
  color: #15803D !important;
}

/* Light mode Analisis & Cockpit AI */
html.light [id="page-analisis"],
html.light .analisis-header,
html.light .analisis-cockpit {
  background: transparent !important;
}

html.light .unified-prompt-chip {
  color: #1F2937 !important;
  background: #E2E8F0 !important;
  border: 1px solid #CBD5E1 !important;
}

html.light .unified-ticker-badge {
  color: #065F46 !important;
  background: #D1FAE5 !important;
  border: 1px solid #6EE7B7 !important;
}

html.light #analisisActiveTickerTag,
html.light #chatActiveTickerTag {
  color: #065F46 !important;
  background: #E2E8F0 !important;
  border: 1px solid #CBD5E1 !important;
}

html.light a.action-btn,
html.light button.action-btn {
  color: #065F46 !important;
}

/* Dark mode Market tile units and notes */
html:not(.light) .market-tile-unit,
html:not(.light) .market-tile-note,
html:not(.light) #dashMarketGateNote {
  color: #A0AEC0 !important;
}

/* Skenario Box Contrast in Position Sizing */
html:not(.light) .ac-pos-scenario-box {
  background: rgba(30, 41, 59, 0.5) !important;
  color: #CBD5E1 !important;
}
html:not(.light) .ac-pos-scenario-a {
  color: #93C5FD !important;
}
html:not(.light) .ac-pos-scenario-b {
  color: #A7F3D0 !important;
}

html.light .ac-pos-scenario-box {
  background: #F1F5F9 !important;
  border: 1px solid #CBD5E1 !important;
  color: #1E293B !important;
}
html.light .ac-pos-scenario-box * {
  color: #1E293B !important;
}
html.light .ac-pos-scenario-a {
  color: #1D4ED8 !important;
}
html.light .ac-pos-scenario-b {
  color: #15803D !important;
}

/* Light mode Sisa R/R warning text */
html.light .dash-rr-sisa-warn,
html.light [title*="Sisa R/R"],
html.light span[style*="F59E0B"],
html.light span[style*="f59e0b"] {
  color: #92400E !important;
}
html.light [title*="Sisa R/R"] b {
  color: #78350F !important;
}

/* Light mode Screener Cards, Labels, and Chips */
html.light label.flex.items-center,
html.light label[class*="bg-dark-900"],
html.light label:has(#kgHideVeryHigh),
html.light label:has(#nkHideVeryHigh),
html.light label:has(#dtHideVeryHigh) {
  background: #F1F5F9 !important;
  background-color: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
  color: #111827 !important;
}

html.light [data-lifecycle-chip="1"],
html.light [data-lifecycle-chip],
html.light span[data-lifecycle-chip] {
  color: #334155 !important;
  background: #F1F5F9 !important;
  border-color: #CBD5E1 !important;
}
html.light [data-lifecycle-chip] * {
  color: #334155 !important;
}

html.light .dt-card-item strong,
html.light .kg-card-item strong,
html.light .nk-card-item strong,
html.light .screener-card strong {
  color: #111827 !important;
}

html.light .dt-card-item strong[style*="6ee7b7"],
html.light .kg-card-item strong[style*="6ee7b7"],
html.light .nk-card-item strong[style*="6ee7b7"],
html.light .screener-card strong[style*="6ee7b7"] {
  color: #15803D !important;
}

html.light .dt-card-item span[style*="6ee7b7"],
html.light .kg-card-item span[style*="6ee7b7"],
html.light .nk-card-item span[style*="6ee7b7"],
html.light .screener-card span[style*="6ee7b7"] {
  color: #15803D !important;
}

html.light .dt-card-item span[style*="e5e7eb"],
html.light .kg-card-item span[style*="e5e7eb"],
html.light .nk-card-item span[style*="e5e7eb"],
html.light .screener-card span[style*="e5e7eb"] {
  color: #0f172a !important;
}

/* Light mode Screener positive percentage contrast (WCAG AA >= 4.5:1 on #FFFFFF) */
html.light .scr-chg-val,
html.light .dt-card-item span.scr-chg-val,
html.light .kg-card-item span.scr-chg-val,
html.light .nk-card-item span.scr-chg-val,
html.light .dt-card-item span[style*="var(--data-positive)"],
html.light .kg-card-item span[style*="var(--data-positive)"],
html.light .nk-card-item span[style*="var(--data-positive)"],
html.light .screener-card span[style*="var(--data-positive)"],
html.light .dt-card-item span[style*="16A34A"],
html.light .kg-card-item span[style*="16A34A"],
html.light .nk-card-item span[style*="16A34A"] {
  color: #15803D !important;
}

/* Light mode Analisis header & command bar background override (v6.css override) */
html.light [id="page-analisis"] > div:first-child,
html.light #analisisPartialMount,
html.light [id="page-analisis"] #analisisPartialMount {
  background: #FFFFFF !important;
  background-color: #FFFFFF !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-color: #E2E8F0 !important;
}

/* Light mode Analisis header overrides */
html.light [id="page-analisis"],
html.light .page-content[id="page-analisis"],
html.light #analisisContent,
html.light .analisis-header,
html.light .analisis-cockpit {
  background: transparent !important;
  background-color: transparent !important;
}
html.light .page-title,
html.light h1.page-title {
  color: #111827 !important;
}
html.light .page-subtitle,
html.light p.page-subtitle {
  color: #4B5563 !important;
}
html.light #analisisResult strong,
html.light #analisisContent strong,
html.light [id="page-analisis"] strong {
  color: #0f172a !important;
}
html.light #analisisActiveTickerTag,
html.light #chatActiveTickerTag {
  color: #064E3B !important;
  background-color: #E2E8F0 !important;
  border-color: #CBD5E1 !important;
}
html.light a[href*="chart"] span,
html.light .action-btn span,
html.light .unified-card-header button span,
html.light #subPanelAnalisisAI button span,
html.light button[onclick*="switchAnalisisSubTab('chart')"] span {
  color: #064E3B !important;
}

/* Stabilize nested mini card utility buttons during theme toggle */
.ac-pos-calc-box button,
.ac-gate-card-trigger button {
  transition: none !important;
}

/* Shared brand contract: the arrow must remain legible in every shell/theme. */
:root { --brand-mark-bg:#153f34; --brand-mark-ink:#a5f2da; --brand-mark-line:#38695a; }
html.light { --brand-mark-bg:#e1f5eb; --brand-mark-ink:#07593f; --brand-mark-line:#badbcb; }
#landingPage .landing-logo, .app-header .brand-mark { display:inline-grid; place-items:center; width:34px; height:34px; border-radius:9px; border:1px solid var(--brand-mark-line); background:var(--brand-mark-bg); color:var(--brand-mark-ink); flex:0 0 34px; }
#landingPage .landing-logo svg, #appSidebar .brand-mark svg, .app-header .brand-mark svg { color:var(--brand-mark-ink) !important; stroke:currentColor; fill:none; }
/* Accessible real value + decorative rolling glyphs; never duplicate speech. */

/* The brand mark is not a live-status indicator. */
#appSidebar .brand-mark::after,.app-header .brand-mark::after { display:none !important; }
.app-header .brand-mark { background:var(--brand-mark-bg) !important; box-shadow:none !important; }

/* Account controls follow the active theme, including the mobile header. */
#appMain > .app-header .header-account { background:transparent !important; border:0 !important; box-shadow:none !important; padding:0 !important; }
#appMain > .app-header #headerAccountSection { background:transparent !important; border:0 !important; box-shadow:none !important; min-width:0; }
#appMain > .app-header :is(#headerUserLabel,#logoutBtn) { background:var(--color-bg-surface) !important; color:var(--color-text-primary) !important; border:1px solid var(--color-border-default) !important; box-shadow:none !important; }
#appMain > .app-header #headerUsername { max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
@media(max-width:600px) {
 #appMain > .app-header :is(#headerUserLabel,#logoutBtn) { min-height:44px; }
 #appMain > .app-header #headerUsername { max-width:70px; }
 #appMain > .app-header .header-account { min-width:0; flex:0 1 auto !important; margin-left:auto !important; }
 #appMain > .app-header > .header-shell > .flex { gap:8px !important; min-width:0; }
 #appMain > .app-header > .header-shell > .flex > :first-child { flex:1 1 auto !important; min-width:0 !important; gap:8px !important; }
 #appMain > .app-header #headerAccountSection { padding:0 !important; gap:6px; }
 #appMain > .app-header h1 { font-size:13px !important; overflow:hidden; text-overflow:ellipsis; }
 #appMain > .app-header #headerUserLabel { padding-inline:8px !important; }
}
@media(max-width:359px) {
 #appMain > .app-header #headerUsername { max-width:44px; }
 #appMain > .app-header > .header-shell > .flex > :first-child > .min-w-0 { display:none; }
}

@media(max-width:1023px) { #appMain > .app-header :is(#headerUserLabel,#logoutBtn) { min-height:44px; } }

/* ==========================================================================
   WAVE 2: APPLICATION SHELL, NAVIGATION & ACCOUNT ENTRY
   Scoped strictly under [data-ac-ui="v2"]
   ========================================================================== */

:root {
  --ac-sidebar-width: 240px;
  --ac-topbar-height: 52px;
}

/* Scoped Desktop Shell */
#appSidebar[data-ac-ui="v2"] {
  width: var(--ac-sidebar-width, 240px);
  background: var(--ac-surface);
  border-right: 1px solid var(--ac-line-default);
}

.app-header[data-ac-ui="v2"] {
  height: var(--ac-topbar-height, 52px);
  min-height: var(--ac-topbar-height, 52px);
}

.app-header[data-ac-ui="v2"] .header-shell {
  padding-top: 0 !important;
  padding-bottom: 0 !important;
  height: 100%;
  display: flex;
  align-items: center;
}

/* Hide duplicate horizontal navigation in V2 shell */
.app-header[data-ac-ui="v2"] .mobile-nav-row {
  display: none !important;
}

/* De-duplicate account controls from topbar */
.app-header[data-ac-ui="v2"] #headerAccountSection {
  display: none !important;
}

#appSidebar[data-ac-ui="v2"] .sidebar-subgroup-label {
  display: none !important;
}

#appSidebar[data-ac-ui="v2"] .sidebar-utility-actions {
  display: none !important;
}

#appSidebar[data-ac-ui="v2"] .sidebar-group-label {
  color: var(--ac-text-secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px 2px;
}

#appSidebar[data-ac-ui="v2"] .sidebar-item {
  color: var(--ac-text-secondary);
  font-size: 12px;
  font-weight: 500;
  min-height: 28px;
  padding: 4px 10px;
  gap: 8px;
  border-radius: var(--ac-radius-md, 8px);
}

#appSidebar[data-ac-ui="v2"] .sidebar-item:hover {
  color: var(--ac-ink);
  background: var(--ac-surface-hover);
}

#appSidebar[data-ac-ui="v2"] .sidebar-item.active {
  background: var(--ac-surface-raised) !important;
  color: var(--ac-ink) !important;
  font-weight: 600;
  border-color: var(--ac-line-hairline) !important;
}

#appSidebar[data-ac-ui="v2"] .sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  background: var(--ac-brand);
  border-radius: 0 var(--ac-radius-xs, 4px) var(--ac-radius-xs, 4px) 0;
}

#appSidebar[data-ac-ui="v2"] .sidebar-item.active svg {
  color: var(--ac-brand) !important;
}

#appSidebar[data-ac-ui="v2"] .sidebar-item:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}

/* Docked Sidebar Account Entry */
#sidebarAccountEntry[data-ac-ui="v2"] {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--ac-radius-md, 8px);
  border: 1px solid var(--ac-line-default);
  background: var(--ac-surface);
  color: var(--ac-ink);
  cursor: pointer;
  text-align: left;
  transition: background var(--motion-hover) var(--ease-standard), border-color var(--motion-hover) var(--ease-standard);
}

#sidebarAccountEntry[data-ac-ui="v2"]:hover {
  background: var(--ac-surface-hover);
  border-color: var(--ac-line-strong);
}

#sidebarAccountEntry[data-ac-ui="v2"]:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: 2px;
}

/* Mobile launcher replacement: scoped ONLY when V2 bottom bar is active on the shell */
#acBottomBar[data-ac-ui="v2"]:not([hidden]):not(.ac-hidden) ~ .ac-launcher,
.app-shell:has(#acBottomBar[data-ac-ui="v2"]:not([hidden]):not(.ac-hidden)) .ac-launcher,
body:has(> #acBottomBar[data-ac-ui="v2"]:not([hidden]):not(.ac-hidden)) .ac-launcher {
  display: none !important;
}

/* Mobile Navigation Bar & More Sheet */
@media (max-width: 1023px) {
  #appMain {
    padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 12px) !important;
  }
}

#acBottomBar[data-ac-ui="v2"] {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--ac-z-shell, 40);
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--ac-surface);
  border-top: 1px solid var(--ac-line-default);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  transition: transform var(--motion-hover) var(--ease-standard);
}

#acBottomBar.ac-keyboard-active {
  transform: translateY(100%);
  pointer-events: none;
}

#acBottomBar.ac-hidden {
  display: none !important;
}

.ac-bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: var(--ac-touch-target, 44px);
  border: 0;
  background: transparent;
  color: var(--ac-text-secondary);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  padding: 6px 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.ac-bottom-nav-item:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}

.ac-bottom-nav-item.active {
  color: var(--ac-brand);
  font-weight: 600;
}

.ac-bottom-nav-item.active .ac-bottom-icon {
  color: var(--ac-brand);
}

.ac-bottom-nav-item.hidden {
  display: none !important;
}

#acMoreSheetBackdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: var(--ac-z-drawer, 80);
}

#acMoreSheetBackdrop[hidden] {
  display: none !important;
}

#acMoreSheet[data-ac-ui="v2"] {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: min(85dvh, 680px);
  background: var(--ac-surface);
  color: var(--ac-ink);
  border-top: 1px solid var(--ac-line-default);
  border-radius: var(--ac-radius-xl, 16px) var(--ac-radius-xl, 16px) 0 0;
  z-index: var(--ac-z-drawer, 80);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#acMoreSheet[data-ac-ui="v2"][hidden] {
  display: none !important;
}

.ac-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ac-line-hairline);
  flex-shrink: 0;
}

.ac-sheet-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ac-ink);
}

.ac-sheet-close {
  width: var(--ac-control-sm, 36px);
  height: var(--ac-control-sm, 36px);
  border-radius: var(--ac-radius-md, 8px);
  border: 1px solid var(--ac-line-default);
  background: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
  font-size: 20px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.ac-sheet-close:hover {
  color: var(--ac-ink);
}

.ac-sheet-close:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: 2px;
}

.ac-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior: contain;
}

.ac-sheet-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ac-sheet-group-label {
  margin: 0 0 6px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ac-text-secondary);
}

.ac-sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--ac-touch-target, 44px);
  padding: 8px 12px;
  border-radius: var(--ac-radius-md, 8px);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ac-ink);
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.ac-sheet-item:hover {
  background: var(--ac-surface-hover);
}

.ac-sheet-item:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}

.ac-sheet-item.active {
  background: var(--ac-surface-raised);
  color: var(--ac-brand);
  font-weight: 600;
  border-color: var(--ac-line-hairline);
}

.ac-sheet-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: var(--ac-text-secondary);
}

.ac-sheet-item.active .ac-sheet-item-icon {
  color: var(--ac-brand);
}

.ac-sheet-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--ac-radius-xs, 4px);
  border: 1px solid var(--ac-line-default);
  background: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
}

@media (min-width: 1024px) {
  #acBottomBar,
  #acMoreSheet,
  #acMoreSheetBackdrop {
    display: none !important;
  }
}

/* =========================================================================
   WAVE 5 — SCREENER & SEKTOR HOT CANONICAL STYLES
   ========================================================================= */

/* Screener selected row with semantic edge indicator (§87.1, §88) */
.kg-table-row.is-selected,
.nk-table-row.is-selected,
.dt-table-row.is-selected,
.ac-wave5-row.is-selected {
  background-color: var(--ac-brand-soft);
  border-left: 3px solid var(--ac-brand);
}

/* Screener dense table rows (§13, §14) */
#screenerTableBody tr,
#nkScreenerTableBody tr,
#dtScreenerTableBody tr,
#sektorGroupTableBody tr {
  min-height: var(--ac-row-dense);
}

/* Screener desktop detail pane (§16, §63, §76.12) */
.ac-screener-detail-pane {
  background: var(--ac-surface);
  border: 1px solid var(--ac-line);
  border-radius: var(--ac-radius-lg);
  box-shadow: var(--ac-shadow-panel);
}

/* Dialog focus & accessibility (§49, §67) */
#scrDetailModal:focus-visible,
#screenerDetailPane:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}

/* Wave 5 semantic utility classes */
.ac-wave5-table-wrap {
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-1);
}
.ac-wave5-table-wrap:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: -2px;
}
.ac-wave5-thead {
  background: var(--ac-surface-1);
  border-bottom: 1px solid var(--ac-line);
  z-index: var(--ac-z-sticky);
}
.ac-wave5-th {
  color: var(--ac-text-muted);
}
.ac-wave5-row {
  border-bottom: 1px solid var(--ac-hairline);
  transition: background-color var(--motion-fast) ease;
}
.ac-wave5-row:hover {
  background-color: var(--ac-surface-hover);
}
.ac-wave5-border-b {
  border-bottom: 1px solid var(--ac-line);
}
.ac-wave5-text {
  color: var(--ac-text);
}
.ac-wave5-muted {
  color: var(--ac-text-muted);
}
.ac-wave5-dim {
  color: var(--ac-text-dim);
}
.ac-wave5-danger {
  color: var(--ac-danger);
}
.ac-wave5-detail-close {
  color: var(--ac-text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.ac-wave5-detail-close:hover {
  color: var(--ac-text);
  background: var(--ac-surface-hover);
}
.ac-wave5-detail-btn {
  flex: 1;
  padding: 10px 12px;
  border-radius: var(--ac-radius-sm);
  font-size: var(--ac-text-caption);
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--motion-fast) ease;
}
.ac-wave5-detail-btn-muted {
  color: var(--ac-text-muted);
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-line);
}
.ac-wave5-detail-btn-muted:hover {
  background: var(--ac-surface-hover);
  color: var(--ac-text);
}
.ac-wave5-detail-btn-research {
  color: var(--ac-info);
  background: var(--ac-info-dim);
  border: 1px solid var(--ac-line);
}
.ac-wave5-detail-btn-research:hover {
  background: var(--ac-surface-hover);
}
.ac-wave5-detail-btn-chart {
  color: var(--ac-brand);
  background: var(--ac-brand-soft);
  border: 1px solid var(--ac-accent-line);
}
.ac-wave5-detail-btn-chart:hover {
  background: var(--ac-accent-soft);
}
.ac-wave5-badge-brand {
  background: var(--ac-brand-soft);
  border: 1px solid var(--ac-accent-line);
  color: var(--ac-brand);
}
.ac-wave5-card {
  background: var(--ac-surface-1);
  border: 1px solid var(--ac-line);
}
.ac-wave5-card:hover {
  background: var(--ac-surface-hover);
  border-color: var(--ac-line-strong);
}
.ac-wave5-btn-action {
  background: var(--ac-brand-soft);
  color: var(--ac-brand);
  border: 1px solid var(--ac-accent-line);
}
.ac-wave5-btn-action:hover {
  background: var(--ac-accent-soft);
}

/* Wave 6: Dashboard & Research Lenses Design System Tokens */
.ac-cell-empty {
  color: var(--ac-text-faint);
}

.insider-mobile-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.insider-mobile-tabs .ac-tab-btn {
  flex: 1 1 0%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 12px;
  font-size: var(--ac-text-caption);
  font-weight: 600;
  border-radius: var(--ac-radius-md);
  border: 1px solid var(--ac-hairline);
  background: var(--ac-surface-2);
  color: var(--ac-text-muted);
  cursor: pointer;
}

.insider-mobile-tabs .ac-tab-btn.ac-tab-active {
  background: var(--ac-accent);
  color: var(--color-on-accent);
  border-color: var(--ac-accent);
}

@media (min-width: 1024px) {
  .insider-mobile-tabs {
    display: none;
  }
}

@media (max-width: 1023.98px) {
  .insider-mobile-hidden {
    display: none;
  }
}

/* Wave 6: Search controls and title contrast */
#insiderRosterTickerInput {
  width: 108px;
  max-width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

#insiderRosterTickerInput + button {
  flex-shrink: 0;
}

.page-title {
  color: var(--color-text-primary);
}

.page-subtitle {
  color: var(--color-text-secondary);
}

/* =========================================================================
   WAVE 7 — MONITORING: WATCHLIST, PORTFOLIO & TRACK RECORD CANONICAL STYLES
   ========================================================================= */

/* --- Watchlist Filter Buttons --- */
.wl-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 var(--ac-space-12, 12px);
  font-size: var(--ac-text-caption);
  font-weight: 600;
  border-radius: var(--ac-radius-sm);
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-2);
  color: var(--ac-text-muted);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.wl-filter-btn:hover {
  background: var(--ac-surface-3);
  color: var(--ac-text);
  border-color: var(--ac-line-strong);
}
.wl-filter-btn.active {
  background: var(--ac-brand-soft);
  color: var(--ac-bull);
  border-color: var(--ac-bull);
}

/* --- Watchlist Error Banner --- */
.wl-error-banner {
  padding: var(--ac-space-12, 12px) var(--ac-space-16, 16px);
  border-radius: var(--ac-radius-md);
  font-size: var(--ac-text-caption);
  line-height: 1.5;
  background: var(--ac-negative-soft);
  color: var(--ac-negative);
  border: 1px solid var(--ac-line);
}

/* --- Watchlist Desktop Table --- */
.wl-table-wrap {
  display: block;
  overflow-x: auto;
  overflow-y: auto;
  max-height: 540px;
  border: 1px solid var(--ac-line);
  border-radius: var(--ac-radius-md);
  background: var(--ac-surface-1);
}
.wl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ac-text-caption);
}
.wl-table thead th {
  position: sticky;
  top: 0;
  z-index: var(--ac-z-sticky);
  background: var(--ac-surface-2);
  color: var(--ac-text-muted);
  font-weight: 700;
  font-size: var(--ac-text-micro);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: var(--ac-space-12, 12px);
  border-bottom: 1px solid var(--ac-line);
}
.wl-table tbody tr {
  border-bottom: 1px solid var(--ac-line);
  transition: background var(--motion-fast) var(--ease-standard);
}
.wl-table tbody tr:hover {
  background: var(--ac-surface-2);
}
.wl-table td {
  padding: var(--ac-space-12, 12px);
  color: var(--ac-text);
}
.wl-ticker-cell {
  display: flex;
  align-items: center;
  gap: var(--ac-space-8, 8px);
  flex-wrap: wrap;
}
.wl-ticker-symbol {
  font-size: var(--ac-text-body);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ac-text-strong);
}
.wl-note-tag {
  display: inline-flex;
  align-items: center;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--ac-text-micro);
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: var(--ac-radius-sm);
  background: var(--ac-brand-soft);
  color: var(--ac-bull);
  border: 1px solid var(--ac-line);
  cursor: pointer;
}
.wl-note-btn {
  font-size: var(--ac-text-micro);
  color: var(--ac-text-muted);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.wl-note-btn:hover {
  color: var(--ac-brand);
}
.wl-alert-row {
  display: flex;
  align-items: center;
  gap: var(--ac-space-8, 8px);
  margin-bottom: var(--ac-space-4, 4px);
}
.wl-alert-row:last-child {
  margin-bottom: 0;
}
.wl-alert-label {
  font-family: monospace;
  font-size: var(--ac-text-caption);
  color: var(--ac-text-muted);
}
.wl-badge-active {
  display: inline-flex;
  align-items: center;
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: var(--ac-radius-sm);
  font-size: var(--ac-text-micro);
  font-weight: 600;
  background: var(--ac-positive-soft);
  color: var(--ac-positive);
  border: 1px solid var(--ac-line);
}
.wl-badge-triggered {
  display: inline-flex;
  align-items: center;
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: var(--ac-radius-sm);
  font-size: var(--ac-text-micro);
  font-weight: 600;
  background: var(--ac-surface-3);
  color: var(--ac-text-muted);
  border: 1px solid var(--ac-line);
}
.wl-no-alert {
  font-size: var(--ac-text-caption);
  font-style: italic;
  color: var(--color-text-secondary);
}
.wl-icon-btn {
  background: none;
  border: 0;
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  color: var(--ac-text-muted);
  cursor: pointer;
  font-size: var(--ac-text-caption);
  line-height: 1;
}
.wl-icon-btn:hover {
  color: var(--ac-text);
}
.wl-icon-btn.wl-icon-danger:hover {
  color: var(--ac-negative);
}
.wl-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 8px;
  font-size: var(--ac-text-caption);
  font-weight: 600;
  border-radius: var(--ac-radius-sm);
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-2);
  color: var(--ac-text);
  cursor: pointer;
  margin-left: 4px;
  transition: color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.wl-action-btn:hover {
  background: var(--ac-surface-3);
  border-color: var(--ac-line-strong);
}
.wl-action-btn.wl-action-alert {
  color: var(--pw-info, var(--info));
  border-color: var(--pw-info, var(--info));
}
.wl-action-btn.wl-action-alert:focus-visible {
  outline: 2px solid var(--pw-info, var(--info));
  outline-offset: 3px;
}
.wl-action-btn.wl-action-danger {
  color: var(--ac-negative);
  border-color: var(--ac-line);
}

/* --- Watchlist Mobile Decision Cards --- */
.wl-mobile-cards {
  display: none;
}
.wl-mobile-card {
  padding: var(--ac-space-12, 12px) var(--ac-space-16, 16px);
  border-radius: var(--ac-radius-md);
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-1);
  display: flex;
  flex-direction: column;
  gap: var(--ac-space-8, 8px);
}
.wl-mobile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ac-space-12, 12px);
}
.wl-mobile-ticker {
  font-size: var(--ac-text-lead);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ac-text-strong);
}
.wl-mobile-card-price-wrap {
  display: flex;
  align-items: baseline;
  gap: var(--ac-space-8, 8px);
  text-align: right;
}
.wl-mobile-price {
  font-size: var(--ac-text-body);
  font-weight: 700;
  color: var(--ac-text);
}
.wl-mobile-change {
  font-size: var(--ac-text-caption);
  font-weight: 700;
}
.wl-mobile-note {
  font-size: var(--ac-text-caption);
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: var(--ac-radius-sm);
  background: var(--ac-brand-soft);
  color: var(--ac-bull);
  border: 1px solid var(--ac-line);
  cursor: pointer;
  word-break: break-word;
}
.wl-mobile-card-alerts {
  font-size: var(--ac-text-caption);
}
.wl-mobile-card-alerts .wl-alert-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--ac-space-4, 4px);
  margin-bottom: var(--ac-space-4, 4px);
}
.wl-mobile-card-alerts .wl-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  width: 44px;
  height: 44px;
  padding: 0;
  font-size: var(--ac-text-body);
}
.wl-mobile-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ac-space-8, 8px);
  padding-top: var(--ac-space-8, 8px);
  border-top: 1px solid var(--ac-line);
}
.wl-mobile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 8px;
  white-space: nowrap;
  font-size: var(--ac-text-caption);
  font-weight: 700;
  border-radius: var(--ac-radius-sm);
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-2);
  color: var(--ac-text);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.wl-mobile-btn:hover {
  background: var(--ac-surface-3);
}
.wl-mobile-btn.wl-mobile-btn-alert {
  color: var(--pw-info, var(--info));
  border-color: var(--pw-info, var(--info));
}
.wl-mobile-btn.wl-mobile-btn-alert:focus-visible {
  outline: 2px solid var(--pw-info, var(--info));
  outline-offset: 3px;
}
.wl-mobile-btn.wl-mobile-btn-danger {
  color: var(--ac-negative);
  border-color: var(--ac-line);
}

@media (max-width: 767.98px) {
  .wl-filter-btn {
    min-height: 44px;
    padding: 0 var(--ac-space-12, 12px);
  }
  .wl-mobile-note {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .wl-table-wrap {
    display: none;
  }
  .wl-mobile-cards {
    display: flex;
    flex-direction: column;
    gap: var(--ac-space-12, 12px);
  }
}

/* --- Watchlist Alert History Cards & States --- */
/* The legacy fixed dark panel otherwise makes light-theme metadata unreadable. */
#wlAlertHistoryModal > div {
  background-color: var(--ac-surface-1);
}

.wl-hist-card {
  display: flex;
  align-items: flex-start;
  gap: var(--ac-space-12, 12px);
  padding: var(--ac-space-12, 12px);
  border-radius: var(--ac-radius-md);
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-line);
}
.wl-hist-icon {
  font-size: var(--ac-text-body);
  line-height: 1;
  margin-top: var(--ac-space-4, 4px);
}
.wl-hist-body {
  flex: 1;
  min-width: 0;
}
.wl-hist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ac-space-8, 8px);
}
.wl-hist-action {
  font-size: var(--ac-text-caption);
  font-weight: 700;
}
.wl-hist-time {
  font-size: var(--ac-text-micro);
  color: var(--color-text-secondary);
}
.wl-hist-detail {
  font-size: var(--ac-text-micro);
  color: var(--ac-text-muted);
  margin-top: var(--ac-space-4, 4px);
}
.wl-hist-created { color: var(--ac-bull); }
.wl-hist-updated { color: var(--pw-info, var(--info)); }
.wl-hist-deleted { color: var(--ac-bear); }
.wl-hist-triggered { color: var(--ac-warn); }
.wl-hist-default { color: var(--ac-text-muted); }
.wl-hist-loading, .wl-hist-empty {
  text-align: center;
  padding: var(--ac-space-24, 24px) 0;
  font-size: var(--ac-text-caption);
  color: var(--color-text-secondary);
}
.wl-hist-error {
  text-align: center;
  padding: var(--ac-space-24, 24px) 0;
  font-size: var(--ac-text-caption);
  color: var(--ac-negative);
}
.wl-login-prompt {
  padding: var(--ac-space-32, 32px) var(--ac-space-16, 16px);
  text-align: center;
  color: var(--ac-text-muted);
  font-size: var(--ac-text-body);
}
.wl-login-link {
  color: var(--ac-brand);
  text-decoration: underline;
  font-weight: 700;
}
.wl-empty-filter {
  padding: var(--ac-space-32, 32px) var(--ac-space-16, 16px);
  text-align: center;
  font-size: var(--ac-text-caption);
  color: var(--color-text-secondary);
}
.wl-empty-filter-icon {
  font-size: var(--ac-text-lead);
  margin-bottom: var(--ac-space-8, 8px);
}
.wl-empty-filter-title {
  font-weight: 700;
  color: var(--ac-text);
  margin: 0;
}
.wl-empty-filter-sub {
  margin: var(--ac-space-4, 4px) 0 0;
  color: var(--color-text-secondary);
}

/* Warning copy uses warning ink, not a translucent accent. */
#page-watchlist .text-amber-400\/70 {
  color: var(--ac-warn);
}

/* --- Track Record Styles --- */
.tr-view-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--ac-space-8, 8px);
  padding: var(--ac-space-8, 8px) var(--ac-space-12, 12px);
  border-radius: var(--ac-radius-sm);
  font-size: var(--ac-text-caption);
  font-weight: 600;
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-2);
  color: var(--ac-text-muted);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease-standard), background var(--motion-fast) var(--ease-standard), border-color var(--motion-fast) var(--ease-standard);
}
.tr-view-tab:hover {
  background: var(--ac-surface-3);
  color: var(--ac-text);
}
.tr-view-tab.active {
  background: var(--ac-brand-soft);
  color: var(--ac-brand);
  border-color: var(--ac-brand);
}

/* Track Record Stat Box */
.tr-stat-card {
  background: var(--ac-surface-1);
  border: 1px solid var(--ac-line);
  border-radius: var(--ac-radius-md);
  color: var(--ac-text-muted);
}
.tr-stat-card #trBestGain {
  color: var(--ac-text-strong);
}
.tr-stat-card #trBestGainSub {
  color: var(--color-text-secondary);
}

#page-trackrecord #trSlHitsSub {
  color: var(--ac-bear);
}
#page-trackrecord #trTp1HitsSub {
  color: var(--ac-bull);
}

@media (max-width: 768px) {
  #page-trackrecord #trackRecordSummaryGrid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: var(--ac-space-3, 12px) var(--ac-space-4, 16px) !important;
  }
}

/* Category Collapsible Wrapper */
details.tr-cat-collapsible {
  border: none;
  padding: 0;
  margin: 0 0 var(--ac-space-24, 24px) 0;
}
details.tr-cat-collapsible .tr-cat-summary {
  display: none;
}
details.tr-cat-collapsible > #trCategoryGrid {
  display: grid;
}

.tr-cat-card {
  background: var(--ac-surface-1);
  border: 1px solid var(--ac-line);
  border-radius: var(--ac-radius-md);
  padding: var(--ac-space-12, 12px) var(--ac-space-16, 16px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-standard);
}
.tr-cat-card:hover {
  border-color: var(--ac-brand);
}
.tr-cat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ac-space-8, 8px);
  margin-bottom: var(--ac-space-8, 8px);
}
.tr-cat-card-title {
  display: flex;
  align-items: center;
  gap: var(--ac-space-8, 8px);
  font-weight: 700;
  font-size: var(--ac-text-caption);
  color: var(--ac-text-strong);
}
.tr-cat-pill {
  font-size: var(--ac-text-micro);
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: 9999px;
  font-weight: 600;
  background: var(--ac-positive-soft);
  color: var(--ac-positive);
  border: 1px solid var(--ac-line);
}
.tr-cat-desc {
  font-size: var(--ac-text-micro);
  color: var(--color-text-secondary);
  margin: 0 0 var(--ac-space-12, 12px) 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tr-cat-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ac-space-4, 4px);
  padding-top: var(--ac-space-8, 8px);
  border-top: 1px solid var(--ac-line);
  text-align: center;
  font-size: var(--ac-text-micro);
}
.tr-stat-lbl {
  display: block;
  color: var(--color-text-secondary);
  font-size: var(--ac-text-micro);
}
.tr-stat-val {
  display: block;
  font-weight: 700;
  color: var(--ac-text);
  font-size: var(--ac-text-caption);
}

.tr-row {
  border-bottom: 1px solid var(--ac-line);
  transition: background var(--motion-fast) var(--ease-standard);
}
.tr-row:hover {
  background: var(--ac-surface-2);
}
.tr-col-ticker {
  position: sticky;
  left: 0;
  background: var(--ac-surface-1);
  z-index: var(--ac-z-sticky);
}
.tr-ticker-group {
  display: flex;
  align-items: center;
  gap: var(--ac-space-8, 8px);
}
.tr-score-chip {
  font-size: var(--ac-text-micro);
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: var(--ac-radius-sm);
  background: var(--ac-surface-3);
  color: var(--ac-text-muted);
  border: 1px solid var(--ac-line);
}
.tr-source-chip {
  font-size: var(--ac-text-micro);
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: var(--ac-radius-sm);
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-line);
  color: var(--ac-text-muted);
}
.tr-date-main {
  font-size: var(--ac-text-micro);
  color: var(--ac-text);
  font-weight: 600;
}
.tr-subtext-line {
  font-size: var(--ac-text-micro);
  color: var(--color-text-secondary);
  margin-top: var(--ac-space-4, 4px);
  display: flex;
  align-items: center;
  gap: var(--ac-space-4, 4px);
}
.tr-subtext-center {
  justify-content: center;
}
.tr-subtext-val {
  color: var(--ac-text-muted);
}
.tr-subtext-sep {
  color: var(--ac-line-strong);
}
.tr-status-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--ac-space-4, 4px) var(--ac-space-8, 8px);
  border-radius: 9999px;
  font-size: var(--ac-text-micro);
  font-weight: 600;
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-2);
  color: var(--ac-text);
}
.tr-status-tp2, .tr-status-tp1 {
  background: var(--ac-positive-soft);
  color: var(--ac-bull);
  border-color: var(--ac-bull);
}
.tr-status-sl {
  background: var(--ac-negative-soft);
  color: var(--ac-bear);
  border-color: var(--ac-bear);
}
.tr-status-running {
  background: var(--ac-info-soft);
  color: var(--pw-info, var(--info));
  border-color: var(--pw-info, var(--info));
}
.tr-status-waiting {
  background: var(--ac-warning-soft);
  color: var(--ac-warning-text, var(--ac-warn));
  border-color: var(--ac-warning-text, var(--ac-warn));
}
.tr-status-expired {
  background: var(--ac-surface-3);
  color: var(--ac-text-muted);
  border-color: var(--ac-line);
}
.tr-loading-cell {
  color: var(--ac-text-muted);
}
.tr-error-cell {
  color: var(--ac-negative);
}

/* --- Track Record Mobile Cards --- */
.tr-mobile-cards {
  display: none;
}
.tr-mobile-card {
  padding: var(--ac-space-12, 12px) var(--ac-space-16, 16px);
  border-radius: var(--ac-radius-md);
  border: 1px solid var(--ac-line);
  background: var(--ac-surface-1);
  display: flex;
  flex-direction: column;
  gap: var(--ac-space-8, 8px);
}
.tr-mobile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--ac-space-8, 8px);
}
.tr-mobile-ticker-group {
  display: flex;
  align-items: center;
  gap: var(--ac-space-8, 8px);
}
.tr-mobile-ticker {
  font-size: var(--ac-text-lead);
  color: var(--ac-text-strong);
}
.tr-mobile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--ac-line);
  border-bottom: 1px solid var(--ac-line);
}
.tr-mobile-stat .tr-stat-lbl {
  font-size: var(--ac-text-micro);
  color: var(--color-text-secondary);
  white-space: nowrap;
}
.tr-mobile-stat .tr-stat-val {
  font-size: var(--ac-text-caption);
  color: var(--ac-text);
  margin-top: var(--ac-space-4, 4px);
}
.tr-mobile-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--ac-text-micro);
  color: var(--color-text-secondary);
}

@media (max-width: 767.98px) {
  details.tr-cat-collapsible {
    border: 1px solid var(--ac-line);
    border-radius: var(--ac-radius-md);
    background: var(--ac-surface-1);
    margin-bottom: var(--ac-space-16, 16px);
    overflow: hidden;
  }
  details.tr-cat-collapsible summary,
  details.tr-cat-collapsible .tr-cat-summary {
    min-height: 44px;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--ac-space-16, 16px);
    font-size: var(--ac-text-caption);
    font-weight: 700;
    color: var(--ac-text);
    cursor: pointer;
    user-select: none;
    background: var(--ac-surface-2);
  }
  details.tr-cat-collapsible[open] .tr-cat-summary {
    border-bottom: 1px solid var(--ac-line);
  }
  details.tr-cat-collapsible #trCategoryGrid {
    padding: var(--ac-space-12, 12px);
    display: grid;
  }
  #trTableWrap {
    display: none;
  }
  .tr-mobile-cards {
    display: flex;
    flex-direction: column;
    gap: var(--ac-space-12, 12px);
  }
}

/* --- Portfolio Command Center Subnav --- */
.pcc-subnav {
  display: flex;
  gap: var(--ac-space-8, 8px);
  margin-bottom: var(--ac-space-16, 16px);
  padding-bottom: var(--ac-space-12, 12px);
  border-bottom: 1px solid var(--ac-line);
}

/* ==========================================================================
   WAVE 10 CANONICAL RETIREMENT CONSOLIDATION
   Migrated from legacy final-uiux-polish.css into canonical ui-theme.css.
   Retires duplicate ownership while preserving 100% of verified behavior.
   Dead decommissioned Money Management styles permanently retired.
   ========================================================================== */

/* ---- Native-feeling shell & Night Research Canvas Parity ---------------- */
html:not(.light) body,
html[data-theme="dark"] body,
body:not(.light) {
  background-color: var(--color-bg-canvas, #090d16) !important;
  color: var(--color-text-primary, #f4f7fb) !important;
}

html:not(.light) :is(#dashboardScreen, .app-shell, .app-layout, #appMain, #appContent, .page-content),
html[data-theme="dark"] :is(#dashboardScreen, .app-shell, .app-layout, #appMain, #appContent, .page-content) {
  background-color: transparent !important;
}

html.light #dashboardScreen,
html.light .app-shell,
html.light .app-layout,
html.light #appMain,
html.light #appContent {
  background: transparent !important;
}

/* Ensure Account Center hidden tabs stay strictly hidden */
.ac-center-tab[hidden],
[data-ac-tab="subscription"],
#acPanelSubscription {
  display: none !important;
}

#appMain {
  min-width: 0;
  isolation: isolate;
}

#appContent {
  width: min(100%, var(--ac-page-max));
  margin-inline: auto;
  padding-inline: var(--ac-page-pad);
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

html.light .app-sidebar {
  background: rgba(250, 252, 251, .94) !important;
  border-right: 1px solid var(--ac-line) !important;
  box-shadow: 1px 0 0 rgba(255,255,255,.7);
  backdrop-filter: blur(18px) saturate(1.05);
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
}

html.light .sidebar-brand {
  border-bottom-color: var(--ac-line) !important;
}

html.light .brand-mark,
html.light .landing-logo {
  color: #ffffff !important;
  background: #17211e !important;
  border-color: #17211e !important;
  box-shadow: none !important;
}

html.light .sidebar-brand-text strong,
html.light .sidebar-item,
html.light .sidebar-footer,
html.light .user-profile-badge {
  color: var(--ac-text) !important;
}

html.light .sidebar-brand-text span,
html.light .sidebar-group-label,
html.light .sidebar-footer .sidebar-label,
html.light .user-role {
  color: var(--ac-text-dim) !important;
}

html.light .sidebar-group-label {
  letter-spacing: .12em;
  font-size: 10px;
  font-weight: 700;
}

html.light .sidebar-item {
  position: relative;
  min-height: 40px;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  background: transparent !important;
  color: var(--ac-text-muted) !important;
  transition:
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard);
}

html.light .sidebar-item:hover {
  background: rgba(18,35,29,.045) !important;
  border-color: rgba(18,35,29,.06) !important;
  color: var(--ac-text) !important;
}

html.light .sidebar-item.active,
html.light .sidebar-item[aria-current="page"] {
  background: #17211e !important;
  border-color: #17211e !important;
  color: #ffffff !important;
  box-shadow: 0 6px 16px rgba(18,35,29,.12) !important;
}

html.light .sidebar-item.active svg,
html.light .sidebar-item[aria-current="page"] svg {
  color: #dff8ef !important;
}

html.light .sidebar-badge {
  background: rgba(15,116,88,.10) !important;
  border-color: rgba(15,116,88,.18) !important;
  color: #0b6049 !important;
}

html.light .sidebar-item.active .sidebar-badge {
  background: rgba(255,255,255,.14) !important;
  border-color: rgba(255,255,255,.18) !important;
  color: #ffffff !important;
}

html.light .sidebar-collapse-toggle,
html.light .theme-toggle-compact {
  background: #ffffff !important;
  border-color: var(--ac-line) !important;
  color: var(--ac-text-muted) !important;
}

html.light .user-profile-badge {
  background: #ffffff !important;
  border-color: var(--ac-line) !important;
  box-shadow: var(--ac-shadow-1);
}

html.light .user-avatar {
  background: #17211e !important;
  color: #ffffff !important;
  border-color: #17211e !important;
}

/* ---- Top chrome ---------------------------------------------------------- */
html.light .app-header,
html.light .workspace-topbar {
  background: rgba(250,252,251,.88) !important;
  border-bottom-color: var(--ac-line) !important;
  box-shadow: 0 1px 0 rgba(18,35,29,.04) !important;
  backdrop-filter: blur(16px) saturate(1.05);
  -webkit-backdrop-filter: blur(16px) saturate(1.05);
}

html.light .header-account,
html.light .header-status-chip {
  background: #ffffff !important;
  border-color: var(--ac-line) !important;
  color: var(--ac-text-muted) !important;
}

/* ---- Page rhythm --------------------------------------------------------- */
.page-content {
  min-width: 0;
  max-width: 100%;
  transform-origin: 50% 0;
  backface-visibility: hidden;
  overflow-x: clip;
}

#appMain,
#appContent {
  min-width: 0;
  max-width: 100%;
}

#appContent {
  overflow-x: clip;
}

/* Horizontal scrolling belongs only to explicit dense-data containers, never
   to the entire application page. */
.page-content :is(.overflow-x-auto,.table-responsive-container,.broker-summary-table-wrap,.ms-grid-viewport) {
  max-width: 100%;
}

.page-content:not(.hidden) {
  will-change: opacity, transform;
}

#page-dashboard,
#page-screener,
#page-watchlist,
#page-sektor,
#page-portofolio,
[id='page-analisis'],
#page-news {
  padding-top: clamp(12px, 1.2vw, 20px);
}

html.light :is(
  .panel,
  .dashboard-card,
  .unified-card,
  .portfolio-card,
  .skeleton-card,
  .subscription-summary,
  .chart-shell,
  .portfolio-shell,
  .money-sheet-shell,
  .ms-workbook
) {
  background: #ffffff !important;
  border-color: var(--ac-line) !important;
  color: var(--ac-text) !important;
  box-shadow: var(--ac-shadow-1) !important;
}

html.light :is(.panel,.dashboard-card,.unified-card,.portfolio-card) {
  border-radius: 14px !important;
}

html.light :is(.dashboard-pick-card,.action-card,.feature-card,.portfolio-row-card) {
  transition:
    transform var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard);
}

@media (hover:hover) {
  html.light :is(.dashboard-pick-card,.action-card,.feature-card,.portfolio-row-card):hover {
    transform: translateY(-1px);
    border-color: rgba(15,116,88,.22) !important;
    box-shadow: var(--ac-shadow-2) !important;
  }
}

html.light :is(
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea
):not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  background: #fbfcfb !important;
  color: var(--ac-text) !important;
  border-color: var(--ac-line-strong) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9);
}

html.light :is(input,select,textarea):focus:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  border-color: rgba(15,116,88,.48) !important;
  box-shadow: 0 0 0 3px rgba(15,116,88,.10) !important;
  outline: none;
}

html.light button:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
html.light a:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
html.light [role="button"]:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)),
html.light summary:focus-visible:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  outline: 2px solid rgba(15,116,88,.72) !important;
  outline-offset: 3px;
}

/* ---- Dense data: calm and precise --------------------------------------- */
html.light table:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  border-color: var(--ac-line) !important;
}

html.light thead th:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  background: #f7f9f8 !important;
  color: #59665f !important;
  border-bottom-color: var(--ac-line-strong) !important;
}

html.light tbody td:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  color: #26322e !important;
  border-bottom-color: rgba(18,35,29,.07) !important;
}

html.light tbody tr:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  transition: background-color var(--motion-instant) linear;
}

html.light tbody tr:hover:not(:where([data-ac-ui="v2"], .ac-ui-v2, [data-ac-ui="v2"] *, .ac-ui-v2 *)) {
  background: #f5f8f6 !important;
}

html.light :is(.text-emerald-300,.text-emerald-400,.text-green-300,.text-green-400) {
  color: #0f7458 !important;
}

html.light :is(.text-rose-300,.text-rose-400,.text-red-300,.text-red-400) {
  color: #b83847 !important;
}

html.light :is(.text-amber-300,.text-amber-400,.text-yellow-300,.text-yellow-400) {
  color: #8c5a12 !important;
}

/* ---- Smooth loading without theatrical motion -------------------------- */
@keyframes ac-polish-skeleton {
  0% { background-position: 160% 0; }
  100% { background-position: -60% 0; }
}

html.light :is(.animate-pulse,.skeleton,.skeleton-card) {
  animation: none !important;
}

html.light :is(.skeleton,.skeleton-card) {
  background:
    linear-gradient(100deg,#eef2f0 20%,#fafcfb 38%,#eef2f0 58%) !important;
  background-size: 220% 100% !important;
  animation: ac-polish-skeleton 1.15s linear infinite !important;
}

/* ---- Landing: reference-inspired, Auto-Cuan-owned ----------------------- */
html.light #landingPage {
  --lp-bg: #f2f4f1;
  --lp-surface: #ffffff;
  --lp-raised: #e9eeeb;
  --lp-text: #18211e;
  --lp-muted: #63706a;
  --lp-line: rgba(18,35,29,.12);
  --lp-accent: #17211e;
  --lp-on-accent: #ffffff;
  --lp-wordmark: #27463b;
  --lp-beam: rgba(35,68,57,.11);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,255,255,.96) 0, rgba(255,255,255,.58) 26rem, transparent 54rem),
    #f2f4f1 !important;
}

html.light #landingPage .landing-nav {
  top: 16px;
  width: min(1180px, calc(100% - 32px));
  background: rgba(255,255,255,.83) !important;
  border-color: rgba(18,35,29,.11) !important;
  border-radius: 999px !important;
  box-shadow: 0 12px 36px rgba(18,35,29,.08) !important;
  backdrop-filter: blur(18px) saturate(1.08);
  -webkit-backdrop-filter: blur(18px) saturate(1.08);
}

html.light #landingPage .landing-nav > .landing-container {
  min-height: 64px;
}

html.light #landingPage .landing-brand {
  color: var(--lp-text);
}

html.light #landingPage .landing-icon-button {
  border-radius: 999px;
  background: rgba(255,255,255,.76);
}

html.light #landingPage .landing-btn {
  border-radius: 999px;
  font-weight: 600;
}

html.light #landingPage .landing-btn-primary {
  background: #17211e !important;
  color: #ffffff !important;
  box-shadow: 0 8px 20px rgba(18,35,29,.12);
}

html.light #landingPage .landing-hero {
  padding-top: clamp(76px, 9vw, 132px);
  min-height: min(760px, calc(100dvh - 32px));
  display: grid;
  align-content: center;
  background: transparent !important;
}

html.light #landingPage .landing-hero::after {
  content: "";
  position: absolute;
  inset: 4% 5% 6%;
  pointer-events: none;
  background:
    linear-gradient(118deg, transparent 0 19%, rgba(23,33,30,.075) 19.4% 31%, transparent 31.4% 53%, rgba(23,33,30,.055) 53.4% 65%, transparent 65.4%),
    radial-gradient(ellipse at 52% 48%, rgba(255,255,255,.95), transparent 44%);
  filter: blur(.2px);
  opacity: .9;
  z-index: 0;
}

html.light #landingPage .landing-beams {
  opacity: .55;
}

html.light #landingPage .landing-beams span {
  background: linear-gradient(90deg, transparent 6%, rgba(27,49,42,.12) 48%, transparent 68%);
  filter: blur(14px);
}

html.light #landingPage .landing-wordmark {
  color: rgba(39,70,59,.52);
  max-width: 1040px;
  margin-bottom: 8px;
}

html.light #landingPage .landing-hero h1 {
  max-width: 860px !important;
  font-size: clamp(36px, 4vw, 58px) !important;
  line-height: 1.04 !important;
  letter-spacing: -.055em !important;
  font-weight: 650 !important;
}

html.light #landingPage .landing-hero h1 + p {
  max-width: 660px;
  font-size: clamp(14px, 1.25vw, 17px) !important;
  line-height: 1.75 !important;
}

html.light #landingPage .landing-hero-note {
  color: #7b8782 !important;
}

html.light #landingPage .landing-hero-index {
  color: #78857f;
  border-top-color: rgba(18,35,29,.10);
}

html.light #landingPage .landing-section {
  background: transparent !important;
  border-top-color: rgba(18,35,29,.09);
  padding: clamp(58px, 7vw, 96px) 0;
}

html.light #landingPage .landing-section h2 {
  max-width: 760px;
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 600 !important;
}

html.light #landingPage .landing-card,
html.light #landingPage .feature-card,
html.light #landingPage .faq-item {
  border-color: rgba(18,35,29,.10) !important;
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(18,35,29,.025), 0 10px 28px rgba(18,35,29,.035) !important;
}

html.light #landingPage .feature-card {
  min-height: 230px;
}

html.light #landingPage .feature-icon {
  background: #f0f3f1;
  border-color: rgba(18,35,29,.08);
  color: #17211e;
}

html.light #landingPage .landing-radar-window {
  overflow: hidden;
  background: #101613 !important;
  border-color: rgba(18,35,29,.18) !important;
  box-shadow: 0 22px 64px rgba(18,35,29,.16) !important;
}

html.light #landingPage .landing-radar-window :is(.landing-window-bar,.mock-card,.landing-window-note,.landing-sector-strip) {
  color: #aeb9b4 !important;
}

html.light #landingPage .landing-radar-window .landing-window-bar {
  background: #151c19;
  border-bottom-color: rgba(255,255,255,.08);
}

html.light #landingPage .landing-radar-window .mock-card {
  border-color: rgba(255,255,255,.08) !important;
}

html.light #landingPage .landing-radar-window :is(h3,strong,.landing-market-value,.landing-small-value) {
  color: #f2f6f4 !important;
}

html.light #landingPage .landing-radar-window .landing-chip {
  background: #1c2521;
  border-color: rgba(255,255,255,.09);
  color: #c9d2ce;
}

html.light #landingPage .landing-radar-window .heat-cell {
  background: #18201d !important;
  border-color: rgba(255,255,255,.08) !important;
  color: #c7d0cc !important;
}

html.light #landingPage .landing-radar-window .landing-window-note {
  border-top-color: rgba(255,255,255,.07);
}

html.light #landingPage footer {
  background: #e9eeeb;
  border-top-color: rgba(18,35,29,.10);
}

/* ---- View transitions when supported ------------------------------------ */
@supports (view-transition-name: none) {
  #appMain { view-transition-name: app-main; }
  #appSidebar { view-transition-name: app-sidebar; }
  ::view-transition-group(app-sidebar) { animation-duration: var(--motion-fast); }
  ::view-transition-old(app-main),
  ::view-transition-new(app-main) {
    animation-duration: var(--motion-base);
    animation-timing-function: var(--ease-emphasized);
  }
  ::view-transition-old(app-main) {
    animation-name: ac-vt-old;
  }
  ::view-transition-new(app-main) {
    animation-name: ac-vt-new;
  }
}

@keyframes ac-vt-old {
  to { opacity: .72; transform: translateY(-2px); }
}

@keyframes ac-vt-new {
  from { opacity: .72; transform: translateY(5px); }
}

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 1023px) {
  #appContent {
    padding-inline: clamp(12px, 3.5vw, 18px);
  }

  html.light .app-sidebar {
    background: rgba(250,252,251,.985) !important;
    box-shadow: 18px 0 48px rgba(18,35,29,.13) !important;
  }

  html.light #landingPage .landing-nav {
    top: 8px;
    border-radius: 18px !important;
  }
}

@media (max-width: 600px) {
  html.light #landingPage .landing-hero {
    min-height: auto;
    padding-top: 58px;
  }

  html.light #landingPage .landing-wordmark {
    margin-inline: -12px;
  }

  html.light #landingPage .landing-section {
    padding-block: 44px;
  }

  html.light #landingPage .feature-card {
    min-height: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}


/* ==========================================================================
   PER-SURFACE FINAL PASS
   ========================================================================== */

/* Analysis: keep the whole research workspace visually inside one product. */
html.light [id='page-analisis'] {
  --research-panel: #ffffff;
  --research-well: #f7f9f8;
  --research-line: rgba(18,35,29,.10);
}

html.light [id='page-analisis'] .analisis-tab-strip {
  position: sticky;
  top: 0;
  z-index: 24;
  margin-bottom: 14px !important;
  padding: 6px !important;
  background: rgba(247,249,248,.92) !important;
  border-color: var(--research-line) !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 0 rgba(18,35,29,.04) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

html.light [id='page-analisis'] .analisis-tab {
  min-height: 38px !important;
  color: #64716b !important;
  border-radius: 9px !important;
  transition:
    color var(--motion-fast) var(--ease-standard),
    background-color var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    transform var(--motion-fast) var(--ease-standard) !important;
}

html.light [id='page-analisis'] .analisis-tab:hover {
  color: #1e2a26 !important;
  background: #ffffff !important;
  border-color: rgba(18,35,29,.08) !important;
}

html.light [id='page-analisis'] .analisis-tab.active {
  background: #17211e !important;
  border-color: #17211e !important;
  color: #ffffff !important;
  box-shadow: 0 5px 14px rgba(18,35,29,.10) !important;
}

html.light [id='page-analisis'] :is(.unified-top-bar,.unified-card,.broker-summary-panel) {
  background: #ffffff !important;
  border-color: var(--research-line) !important;
  box-shadow: var(--ac-shadow-1) !important;
}

html.light [id='page-analisis'] .unified-top-bar {
  border-radius: 14px !important;
}

html.light [id='page-analisis'] :is(.unified-chat-messages,#analisisResult,#unifiedAiChartResultWrap) {
  scrollbar-color: rgba(18,35,29,.20) transparent;
  overscroll-behavior: contain;
}

html.light [id='page-analisis'] .unified-chat-composer {
  background: rgba(255,255,255,.94) !important;
  border-top-color: var(--research-line) !important;
  backdrop-filter: none;
}

html.light [id='page-analisis'] :is(.unified-prompt-chip,.analisis-subtab) {
  background: #f5f7f6 !important;
  border-color: rgba(18,35,29,.10) !important;
  color: #52605b !important;
  box-shadow: none !important;
}

html.light [id='page-analisis'] :is(.unified-prompt-chip,.analisis-subtab):hover {
  background: #eef3f0 !important;
  border-color: rgba(15,116,88,.20) !important;
  color: #0f7458 !important;
}

html.light [id='page-analisis'] .analisis-subtab.active {
  background: #17211e !important;
  border-color: #17211e !important;
  color: #ffffff !important;
}

html.light [id='page-analisis'] #rankingPaywallGate {
  background: #f8faf9 !important;
  border-color: rgba(18,35,29,.10) !important;
  box-shadow: none !important;
}

html.light [id='page-analisis'] #rankingContentWrap > div:first-child {
  background: #f8faf9 !important;
  border-color: rgba(18,35,29,.08) !important;
}

/* Portfolio: the generated scoped sheet is dark-first. This final layer keeps
   the component functional while remapping it to the app's selected light theme. */
html.light #portofolioPartialMount {
  color-scheme: light;
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface2: #f6f8f7;
  --line: rgba(18,35,29,.10);
  --line2: rgba(18,35,29,.18);
  --text: #26322e;
  --strong: #17211e;
  --muted: #62706a;
  --muted2: #84908b;
  --accent: #0f7458;
  --info: #315f9a;
  --warn: #a96d13;
  --danger: #c13f4d;
  --shadow: 0 1px 2px rgba(18,35,29,.04), 0 12px 30px rgba(18,35,29,.06);
}

html.light #portofolioPartialMount .brand-mark {
  background: #17211e !important;
  color: #ffffff !important;
  box-shadow: none !important;
}

html.light #portofolioPartialMount :is(.btn,.tab,.session-chip) {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.11) !important;
  color: #52605b !important;
  box-shadow: none !important;
}

html.light #portofolioPartialMount :is(.btn,.tab):hover {
  background: #f3f6f4 !important;
  border-color: rgba(15,116,88,.20) !important;
  color: #17211e !important;
}

html.light #portofolioPartialMount :is(.btn.primary,.tab.active,.tab[aria-selected="true"]) {
  background: #17211e !important;
  border-color: #17211e !important;
  color: #ffffff !important;
}

html.light #portofolioPartialMount .tab-strip {
  top: 0;
  background: linear-gradient(rgba(243,245,244,.98) 78%, rgba(243,245,244,0)) !important;
  border-bottom-color: rgba(18,35,29,.08) !important;
  box-shadow: none !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html.light #portofolioPartialMount :is(
  .access-gate,
  .panel,
  .card,
  .metric,
  .position-card,
  .planner-card,
  .scenario-card,
  .journal-card
) {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.10) !important;
  box-shadow: var(--ac-shadow-1) !important;
}

html.light #portofolioPartialMount :is(input,select,textarea) {
  color-scheme: light;
  background: #fbfcfb !important;
  color: #17211e !important;
  border-color: rgba(18,35,29,.14) !important;
}

html.light #portofolioPartialMount :is(input,textarea)::placeholder {
  color: #89948f !important;
}

html.light #portofolioPartialMount :is(table,thead,tbody,tr,th,td) {
  border-color: rgba(18,35,29,.08) !important;
}

html.light #portofolioPartialMount thead th {
  background: #f7f9f8 !important;
  color: #5f6d67 !important;
}


/* Dashboard: information hierarchy before decoration. */
html.light #page-dashboard .dashboard-hero {
  background:
    linear-gradient(110deg, rgba(15,116,88,.055), transparent 34%),
    #ffffff !important;
}

html.light #page-dashboard :is(.dash-level,.market-tile,.dashboard-card) {
  border-color: rgba(18,35,29,.09) !important;
}

html.light #page-dashboard .action-card {
  min-height: 90px;
}

html.light #page-dashboard .dash-badge:not([class*="amber"]):not(.dash-badge-warning) {
  background: #f5f7f6 !important;
  border-color: rgba(18,35,29,.10) !important;
  color: #5f6d67 !important;
}
html.light #page-dashboard .dash-badge:is([class*="amber"], .dash-badge-warning),
html.light .dash-badge:is([class*="amber"], .dash-badge-warning) {
  background: #fef3c7 !important;
  border-color: rgba(217, 119, 6, 0.35) !important;
  color: #92400e !important;
}

/* Modals: one predictable sheet language. */
html.light :is(
  #loginModal,
  #registerModal,
  #selfResetModal,
  #authV2ResetModal,
  #resetPasswordModal,
  #authChoiceModal,
  #accountModal,
  #subscriptionModal
) {
  background: rgba(20,29,26,.30) !important;
  backdrop-filter: blur(7px) !important;
  -webkit-backdrop-filter: blur(7px) !important;
}

html.light :is(
  #loginModal,
  #registerModal,
  #selfResetModal,
  #authV2ResetModal,
  #authChoiceModal,
  #accountModal,
  #subscriptionModal
) > div {
  background: #ffffff !important;
  color: #17211e !important;
  border-color: rgba(18,35,29,.10) !important;
  box-shadow: 0 24px 72px rgba(18,35,29,.16) !important;
}

html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) input {
  background: #f8fafc !important;
  color: #0f172a !important;
  border-color: #cbd5e1 !important;
}
html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) input::placeholder {
  color: #94a3b8 !important;
}
html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) label {
  color: #1e293b !important;
}
html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) :is(h1, h2, h3, h4) {
  color: #0f172a !important;
}
html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) p {
  color: #475569 !important;
}
html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) .steps div:not(.on) {
  color: #64748b !important;
}
html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) .steps div i {
  background: #e2e8f0 !important;
}
html.light :is(#loginModal, #registerModal, #selfResetModal, #authV2ResetModal) .strength i:not([style*="background"]) {
  background: #e2e8f0 !important;
}

/* Interaction feedback: ~100ms is perceptible, not theatrical. */
.ac-pressing {
  transform: scale(.985) !important;
  transition-duration: var(--motion-instant) !important;
}

/* Scrollbars remain visible enough to communicate overflow, without taking
   attention away from data. */
html.light * {
  scrollbar-color: rgba(18,35,29,.20) transparent;
}

html.light *::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

html.light *::-webkit-scrollbar-thumb {
  background: rgba(18,35,29,.18);
  border: 2px solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

html.light *::-webkit-scrollbar-thumb:hover {
  background: rgba(18,35,29,.28);
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Long pages should not rubber-band nested data surfaces into the window. */
:is(
  #rankingTableWrap,
  #screenerTableWrap,
  #nkScreenerTableWrap,
  #dtScreenerTableWrap,
  #sektorDetailTable,
  .ms-grid-viewport,
  .unified-chat-messages
) {
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
  html.light [id='page-analisis'] .analisis-tab-strip,
  html.light #portofolioPartialMount .tab-strip {
    margin-inline: calc(-1 * var(--ac-page-pad));
    padding-inline: var(--ac-page-pad) !important;
    border-radius: 0 !important;
  }
}


/* ==========================================================================
   ACCOUNT CENTER + SYSTEM STATES + MOBILE FINISHING
   ========================================================================== */

html.light #acAccountCenter {
  background: rgba(23,33,30,.28) !important;
  backdrop-filter: blur(10px) saturate(1.02) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.02) !important;
}

html.light #acAccountCenter .ac-center-shell {
  color-scheme: light;
  color: #17211e;
  background:
    radial-gradient(circle at 92% -12%, rgba(15,116,88,.07), transparent 32%),
    #f8faf9 !important;
  border-color: rgba(18,35,29,.11) !important;
  border-radius: 22px !important;
  box-shadow: 0 28px 80px rgba(18,35,29,.18), inset 0 1px 0 rgba(255,255,255,.9) !important;
}

html.light #acAccountCenter .ac-center-head {
  border-bottom: 0;
}

html.light #acAccountCenter .ac-center-avatar {
  background: #17211e !important;
  color: #ffffff !important;
  box-shadow: none !important;
  border-radius: 14px !important;
}

html.light #acAccountCenter :is(.ac-center-title,.ac-section-title,.ac-big-name,.ac-plan-name,.ac-plan-price) {
  color: #17211e !important;
}

html.light #acAccountCenter :is(.ac-center-subtitle,.ac-muted,.ac-label,.ac-section-kicker,.ac-terms-footer) {
  color: #6a7771 !important;
}

html.light #acAccountCenter .ac-center-eyebrow {
  color: #0f7458 !important;
}

html.light #acAccountCenter .ac-center-close {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.11) !important;
  color: #6a7771 !important;
}

html.light #acAccountCenter .ac-center-close:hover {
  background: #f1f4f2 !important;
  border-color: rgba(18,35,29,.18) !important;
  color: #17211e !important;
}

html.light #acAccountCenter .ac-center-tabs {
  border-bottom-color: rgba(18,35,29,.08) !important;
}

html.light #acAccountCenter .ac-center-tab {
  color: #66736d !important;
  border-radius: 999px !important;
}

html.light #acAccountCenter .ac-center-tab:hover {
  color: #17211e !important;
  background: #eef2f0 !important;
}

html.light #acAccountCenter .ac-center-tab[aria-selected="true"] {
  color: #ffffff !important;
  background: #17211e !important;
  border-color: #17211e !important;
  box-shadow: none !important;
}

html.light #acAccountCenter .ac-card,
html.light #acAccountCenter .ac-term-section,
html.light #acAccountCenter .ac-plan,
html.light #acAccountCenter .ac-terms-intro {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.10) !important;
  box-shadow: 0 1px 2px rgba(18,35,29,.035), 0 8px 20px rgba(18,35,29,.035) !important;
}

html.light #acAccountCenter .ac-card-accent {
  background:
    radial-gradient(circle at 100% 0, rgba(15,116,88,.06), transparent 34%),
    #ffffff !important;
  border-color: rgba(15,116,88,.16) !important;
}

html.light #acAccountCenter .ac-facts {
  background: rgba(18,35,29,.06) !important;
  border-color: rgba(18,35,29,.08) !important;
}

html.light #acAccountCenter .ac-fact {
  background: #fbfcfb !important;
}

html.light #acAccountCenter .ac-fact dt {
  color: #75817c !important;
}

html.light #acAccountCenter .ac-fact dd {
  color: #26322e !important;
}

html.light #acAccountCenter :is(.ac-input,.ac-select) {
  background: #fbfcfb !important;
  color: #17211e !important;
  border-color: rgba(18,35,29,.14) !important;
}

html.light #acAccountCenter :is(.ac-input,.ac-select):focus {
  border-color: rgba(15,116,88,.42) !important;
  box-shadow: 0 0 0 3px rgba(15,116,88,.09) !important;
}

html.light #acAccountCenter .ac-btn {
  background: #ffffff !important;
  color: #26322e !important;
  border-color: rgba(18,35,29,.12) !important;
}

html.light #acAccountCenter .ac-btn:hover {
  background: #f3f6f4 !important;
  border-color: rgba(15,116,88,.20) !important;
}

html.light #acAccountCenter .ac-btn-primary {
  background: #17211e !important;
  color: #ffffff !important;
  border-color: #17211e !important;
}

html.light #acAccountCenter .ac-chip {
  background: #f3f6f4 !important;
  border-color: rgba(18,35,29,.11) !important;
  color: #5e6b65 !important;
}

html.light #acAccountCenter .ac-chip-ok {
  background: rgba(15,116,88,.08) !important;
  border-color: rgba(15,116,88,.17) !important;
  color: #0f7458 !important;
}

html.light #acAccountCenter .ac-chip-warn {
  background: rgba(169,109,19,.08) !important;
  border-color: rgba(169,109,19,.18) !important;
  color: #8c5a12 !important;
}

html.light #acAccountCenter .ac-loading {
  color: #68756f !important;
}

html.light #acAccountCenter .ac-loading::before {
  border-color: rgba(18,35,29,.12) !important;
  border-top-color: #0f7458 !important;
}

html.light #acAccountCenter .ac-empty {
  color: #68756f !important;
}

html.light #acAccountCenter .ac-callout {
  background: #f6f8f7 !important;
  border-color: rgba(18,35,29,.10) !important;
  color: #66736d !important;
}

html.light #acAccountCenter .ac-callout-success {
  background: rgba(15,116,88,.07) !important;
  border-color: rgba(15,116,88,.16) !important;
  color: #0f7458 !important;
}

html.light #acAccountCenter .ac-callout-warning {
  background: rgba(169,109,19,.07) !important;
  border-color: rgba(169,109,19,.16) !important;
  color: #8c5a12 !important;
}

html.light #acAccountCenter .ac-term-section :is(h3,p,li) {
  color: #52605b !important;
}

html.light #acAccountCenter .ac-term-section h3 {
  color: #17211e !important;
}

/* Generic non-destructive state language. These selectors deliberately target
   existing classes and do not alter runtime control flow. */
html.light :is(
  .ac-empty,
  .empty-state,
  .data-empty,
  .ranking-empty,
  .watchlist-empty
) {
  color: #6f7c76 !important;
}

html.light :is(
  .error-state,
  .data-error,
  .loading-error,
  [data-state="error"]
) {
  color: #b83847 !important;
}

html.light :is(
  .stale-state,
  .data-stale,
  [data-state="stale"]
) {
  color: #8c5a12 !important;
}

/* Mobile: app-like sheet behavior and stable touch targets. */
@media (max-width: 760px) {
  html.light #acAccountCenter {
    padding: 0 !important;
    place-items: end center !important;
    background: rgba(23,33,30,.34) !important;
  }

  html.light #acAccountCenter .ac-center-shell {
    width: 100% !important;
    max-height: 94dvh !important;
    border-radius: 22px 22px 0 0 !important;
    border-bottom: 0 !important;
    box-shadow: 0 -18px 58px rgba(18,35,29,.16) !important;
  }

  html.light #acAccountCenter .ac-center-head {
    padding-top: max(18px, env(safe-area-inset-top)) !important;
  }

  html.light #acAccountCenter .ac-center-tabs {
    scroll-snap-type: x proximity;
  }

  html.light #acAccountCenter .ac-center-tab {
    min-height: 42px;
    scroll-snap-align: start;
  }

  html.light #acAccountCenter main {
    padding-bottom: max(22px, env(safe-area-inset-bottom)) !important;
  }

  :is(button,a,[role="button"],summary) {
    -webkit-tap-highlight-color: transparent;
  }

  .page-content {
    overflow-x: clip;
  }
}

/* Small-height devices: keep actions reachable when browser chrome is large. */
@media (max-height: 620px) and (max-width: 900px) {
  html.light #acAccountCenter .ac-center-shell {
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }

  html.light #landingPage .landing-hero {
    min-height: auto !important;
  }
}


/* ==========================================================================
   MOBILE NAV + RESPONSIVE APP FEEL
   ========================================================================== */

html.light .workspace-sidebar-toggle {
  background: rgba(255,255,255,.92) !important;
  border-color: rgba(18,35,29,.11) !important;
  color: #26322e !important;
  box-shadow: 0 8px 22px rgba(18,35,29,.08) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

html.light .ac-launcher {
  background: #17211e !important;
  border-color: #17211e !important;
  color: #ffffff !important;
  box-shadow: 0 10px 28px rgba(18,35,29,.18) !important;
}

html.light .ac-launcher-ring {
  border-color: rgba(255,255,255,.18) !important;
}

html.light .ac-navpanel-backdrop {
  background: rgba(23,33,30,.24) !important;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

html.light .ac-navpanel-card {
  background: rgba(255,255,255,.97) !important;
  border-color: rgba(18,35,29,.11) !important;
  color: #17211e !important;
  box-shadow: 0 18px 58px rgba(18,35,29,.16) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html.light .ac-navpanel-title {
  color: #17211e !important;
}

html.light .ac-navpanel-close {
  color: #6d7974 !important;
  background: #f4f7f5 !important;
  border-color: rgba(18,35,29,.09) !important;
}

html.light .ac-navpanel-item {
  color: #4f5e58 !important;
  background: #f8faf9 !important;
  border-color: rgba(18,35,29,.08) !important;
}

html.light .ac-navpanel-item:hover {
  color: #17211e !important;
  border-color: rgba(15,116,88,.18) !important;
  background: #f1f5f3 !important;
}

html.light .ac-navpanel-item.active,
html.light .ac-navpanel-item[aria-current="page"] {
  background: #17211e !important;
  border-color: #17211e !important;
  color: #ffffff !important;
}

html.light .ac-nav-icon {
  color: inherit !important;
}

/* Reduce unnecessary paint work on long offscreen sections without hiding
   their intrinsic footprint or creating scroll jumps. */
@supports (content-visibility: auto) {
  #page-dashboard > section,
  #page-sektor > section,
  #page-watchlist > section,
  [id='page-analisis'] .analisis-tab-panel:not(.active) {
    contain-intrinsic-size: auto 520px;
  }
}

/* Keep horizontal data scroll local to its surface. */
:is(
  .table-responsive,
  .overflow-x-auto,
  .ms-grid-viewport,
  #rankingTableWrap,
  #screenerTableWrap,
  #nkScreenerTableWrap,
  #dtScreenerTableWrap
) {
  overscroll-behavior-inline: contain;
}

/* Consistent tap feedback without global scale animation conflicts. */
@media (pointer: coarse) {
  button,
  a,
  [role="button"],
  summary,
  .sidebar-item,
  .ac-navpanel-item {
    touch-action: manipulation;
  }

  html.light :is(
    button,
    a,
    [role="button"],
    .sidebar-item,
    .ac-navpanel-item
  ):active {
    transition-duration: var(--motion-instant) !important;
  }
}

@media (max-width: 1023px) {
  #appContent {
    width: 100%;
  }

  html.light .app-sidebar.mobile-open {
    border-right-color: rgba(18,35,29,.12) !important;
  }

  html.light .app-sidebar.mobile-open .sidebar-nav {
    overscroll-behavior: contain;
  }

  html.workspace-menu-open,
  html.workspace-menu-open body {
    overscroll-behavior: none;
  }
}

@media (max-width: 600px) {
  :root {
    --ac-page-pad: 14px;
  }

  #appContent {
    padding-inline: 14px;
  }

  .page-content {
    padding-top: 10px !important;
  }

  html.light :is(.panel,.dashboard-card,.unified-card,.portfolio-card) {
    border-radius: 12px !important;
  }

  html.light #page-dashboard .dashboard-hero {
    border-radius: 14px !important;
  }

  html.light #page-dashboard .action-card {
    min-height: 76px;
  }

  html.light .ac-navpanel-card {
    max-width: calc(100vw - 24px);
  }
}


/* ==========================================================================
   SCREENER / WATCHLIST / SECTOR HOT / TRACK RECORD
   ========================================================================== */

#page-screener,
#page-watchlist,
#page-sektor,
#page-trackrecord {
  max-width: 1320px !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Shared page headings */
html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) :is(
  .page-title,
  h1,
  h2,
  h3,
  h4,
  .text-white,
  .text-gray-100,
  .text-gray-200
) {
  color: #17211e !important;
}

html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) :is(
  .page-subtitle,
  .text-gray-300,
  .text-gray-400,
  .text-gray-500,
  .text-gray-600
) {
  color: #68756f !important;
}

/* Normalize legacy dark utility surfaces only inside these four pages. */
html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) [class*="bg-dark-"] {
  background-color: #ffffff !important;
}

html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) [class*="border-dark-"] {
  border-color: rgba(18,35,29,.10) !important;
}

html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) :is(
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea
) {
  background: #fbfcfb !important;
  color: #17211e !important;
  border-color: rgba(18,35,29,.14) !important;
}

html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) :is(
  input,
  textarea
)::placeholder {
  color: #8a9691 !important;
}

/* Screener --------------------------------------------------------------- */
html.light #page-screener .page-header {
  margin-bottom: 18px !important;
}

html.light #page-screener .ac-segmented {
  width: fit-content;
  max-width: 100%;
  padding: 4px !important;
  background: #eef2f0 !important;
  border: 1px solid rgba(18,35,29,.08) !important;
  border-radius: 11px !important;
}

html.light #page-screener .ac-segment {
  color: #5f6d67 !important;
  border-radius: 8px !important;
}

html.light #page-screener .ac-segment:hover {
  color: #17211e !important;
  background: rgba(255,255,255,.68) !important;
}

html.light #page-screener .ac-segment.is-active,
html.light #page-screener .ac-segment[aria-pressed="true"] {
  color: #ffffff !important;
  background: #17211e !important;
  box-shadow: 0 4px 12px rgba(18,35,29,.10) !important;
}

html.light #page-screener #patternFilterContainer,
html.light #page-screener .scr-filter-grid {
  background: #f8faf9 !important;
  border-color: rgba(18,35,29,.09) !important;
  box-shadow: none !important;
}

html.light #page-screener .scr-info-bar {
  background: #f8faf9 !important;
  border: 1px solid rgba(18,35,29,.08) !important;
  color: #68756f !important;
}

html.light #page-screener .scr-info-bar strong {
  color: #34413c !important;
}

html.light #page-screener #screenerStats > div,
html.light #page-screener #nkScreenerStats > div,
html.light #page-screener #dtScreenerStats > div {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
  box-shadow: 0 1px 2px rgba(18,35,29,.025) !important;
}

html.light #page-screener :is(.screener-tab,.nk-screener-tab,.dt-screener-tab) {
  color: #67746e !important;
  background: transparent !important;
  border: 1px solid transparent !important;
}

html.light #page-screener :is(.screener-tab,.nk-screener-tab,.dt-screener-tab):hover {
  color: #17211e !important;
  background: #f3f6f4 !important;
  border-color: rgba(18,35,29,.08) !important;
}

html.light #page-screener :is(.screener-tab,.nk-screener-tab,.dt-screener-tab).active {
  color: #ffffff !important;
  background: #17211e !important;
  border-color: #17211e !important;
}

html.light #page-screener :is(
  #screenerTableWrap,
  #nkScreenerTableWrap,
  #dtScreenerTableWrap
) {
  border: 1px solid rgba(18,35,29,.09) !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  box-shadow: var(--ac-shadow-1);
}

/* Watchlist --------------------------------------------------------------- */
html.light #page-watchlist .dashboard-hero {
  background:
    linear-gradient(110deg, rgba(169,109,19,.045), transparent 32%),
    #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
}

html.light #page-watchlist > .grid > div {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
  box-shadow: var(--ac-shadow-1);
}

html.light #page-watchlist #watchlistList > *,
html.light #page-watchlist #watchlistCards > * {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
  box-shadow: 0 1px 2px rgba(18,35,29,.035) !important;
}

html.light #page-watchlist #watchlistList > *:hover,
html.light #page-watchlist #watchlistCards > *:hover {
  border-color: rgba(15,116,88,.18) !important;
  box-shadow: var(--ac-shadow-1) !important;
}

/* Sector Hot -------------------------------------------------------------- */
html.light #page-sektor #sektorListView > div:first-child {
  padding: 2px 0 4px;
}

html.light #page-sektor #sektorGroupsGrid > * {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
  box-shadow: var(--ac-shadow-1) !important;
  transition:
    transform var(--motion-fast) var(--ease-standard),
    border-color var(--motion-fast) var(--ease-standard),
    box-shadow var(--motion-fast) var(--ease-standard);
}

@media (hover:hover) {
  html.light #page-sektor #sektorGroupsGrid > *:hover {
    transform: translateY(-1px);
    border-color: rgba(15,116,88,.18) !important;
    box-shadow: var(--ac-shadow-2) !important;
  }
}

html.light #page-sektor #sektorDetailTable {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
  box-shadow: var(--ac-shadow-1);
}

html.light #page-sektor #sektorStaleWarn {
  color: #8c5a12 !important;
}

/* Track Record ------------------------------------------------------------ */
html.light #page-trackrecord .dashboard-hero {
  background:
    linear-gradient(110deg, rgba(15,116,88,.05), transparent 36%),
    #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
}

html.light #page-trackrecord > .flex.items-center.gap-2.border-b {
  border-bottom-color: rgba(18,35,29,.09) !important;
}

html.light #page-trackrecord :is(#trViewTabTable,#trViewTabBacktest) {
  border-radius: 9px !important;
}

html.light #page-trackrecord #trViewTabTable,
html.light #page-trackrecord #trViewTabBacktest {
  color: #65726c !important;
  background: transparent !important;
  border-color: transparent !important;
}

html.light #page-trackrecord #trViewTabTable.bg-emerald-500\/20,
html.light #page-trackrecord #trViewTabBacktest.bg-emerald-500\/20 {
  color: #ffffff !important;
  background: #17211e !important;
  border-color: #17211e !important;
}

html.light #page-trackrecord :is(
  #trackRecordSummaryGrid > div,
  #trBacktestViewPanel .grid > div,
  #trTableViewPanel > div[class*="bg-dark-"],
  #trBacktestViewPanel > div[class*="bg-dark-"]
) {
  background: #ffffff !important;
  border-color: rgba(18,35,29,.09) !important;
  box-shadow: var(--ac-shadow-1);
}

html.light #page-trackrecord :is(
  #trTableWrap,
  #trBacktestTradesWrap
) {
  background: #ffffff !important;
  scrollbar-gutter: stable;
}

html.light #page-trackrecord canvas {
  filter: saturate(.92) contrast(.99);
}

/* Shared data tables ------------------------------------------------------ */
html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) thead tr,
html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) thead th {
  background: rgba(247,249,248,.97) !important;
  color: #5f6d67 !important;
  border-color: rgba(18,35,29,.09) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

html.light :is(#page-screener,#page-watchlist,#page-sektor,#page-trackrecord) tbody tr:hover {
  background: #f6f8f7 !important;
}

/* Desktop density: use available width without turning rows into billboards. */
@media (min-width: 1280px) {
  #page-screener,
  #page-watchlist,
  #page-sektor,
  #page-trackrecord {
    max-width: 1400px !important;
  }
}

@media (max-width: 767px) {
  #page-screener,
  #page-watchlist,
  #page-sektor,
  #page-trackrecord {
    padding-inline: 0 !important;
  }

  html.light #page-screener .ac-segmented {
    width: 100%;
  }

  html.light #page-screener .ac-segment {
    flex: 1 1 0;
    min-width: 0;
  }

  html.light #page-trackrecord > .flex.items-center.gap-2.border-b {
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  html.light #page-trackrecord > .flex.items-center.gap-2.border-b::-webkit-scrollbar {
    display: none;
  }

  html.light #page-trackrecord :is(#trViewTabTable,#trViewTabBacktest) {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-height: 42px;
  }
}


/* ==========================================================================
   FINANCIAL + MARKET STRUCTURE RESEARCH — V2
   ========================================================================== */

.ac-research-kicker{margin:0 0 6px;color:var(--ac-accent);font-size:9px;font-weight:850;letter-spacing:.16em;text-transform:uppercase}
.ac-research-ticker-tools{display:grid;grid-template-columns:auto 104px auto;align-items:center;gap:8px;flex:0 0 auto}
.ac-financial-search-label{color:var(--ac-text-dim);font-size:9px;font-weight:780;letter-spacing:.08em;text-transform:uppercase}
.ac-research-ticker-input{width:104px;height:38px;padding:0 11px;border:1px solid var(--ac-line-strong);border-radius:10px;background:var(--ac-surface-2);color:var(--ac-text);font:760 12px/1 ui-monospace,SFMono-Regular,Menlo,monospace;text-transform:uppercase;outline:none;transition:border-color var(--motion-state) var(--ease-standard),box-shadow var(--motion-state) var(--ease-standard)}
.ac-research-ticker-input:focus{border-color:rgba(15,116,88,.48);box-shadow:0 0 0 3px rgba(15,116,88,.09)}
.ac-research-load-btn{min-height:38px;padding:0 14px;border:1px solid #17211e;border-radius:10px;background:#17211e;color:#fff;font-size:10px;font-weight:780;cursor:pointer;transition:transform var(--motion-hover) var(--ease-standard),background-color var(--motion-hover) var(--ease-standard)}
.ac-research-load-btn:hover{background:#26322e}.ac-research-load-btn:active{transform:scale(.985)}

.ac-financial-shell{--fin-bg:#f7f9f7;--fin-panel:#fff;--fin-line:rgba(23,33,30,.10);--fin-soft:rgba(15,116,88,.07);overflow:hidden;border:1px solid var(--fin-line);border-radius:18px;background:radial-gradient(900px 360px at 92% -10%,rgba(15,116,88,.09),transparent 60%),linear-gradient(180deg,#fbfcfb 0%,var(--fin-bg) 100%);box-shadow:0 18px 50px rgba(15,28,23,.07)}
.ac-financial-head{display:flex;align-items:flex-start;justify-content:space-between;gap:24px;padding:20px 22px;border-bottom:1px solid var(--fin-line)}
.ac-financial-heading{min-width:0;max-width:650px}.ac-financial-heading h2{margin:0;color:var(--ac-text);font-size:clamp(20px,2.4vw,31px);line-height:1.02;letter-spacing:-.045em;font-weight:690}.ac-financial-heading>p:last-child{max-width:620px;margin:8px 0 0;color:var(--ac-text-muted);font-size:11px;line-height:1.65}
.ac-financial-state{min-height:230px;display:flex;align-items:center;justify-content:center;gap:9px;padding:28px;color:var(--ac-text-muted);font-size:11px;text-align:center}.ac-financial-state-dot{width:7px;height:7px;border-radius:50%;background:var(--ac-accent);box-shadow:0 0 0 5px rgba(15,116,88,.08)}
.ac-financial-content{padding:18px}.ac-financial-topline{display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:12px}.ac-financial-identity{min-width:0;display:flex;align-items:center;gap:12px}
.ac-financial-symbol{display:grid;place-items:center;width:54px;height:54px;flex:0 0 54px;border:1px solid rgba(15,116,88,.16);border-radius:15px;background:var(--fin-soft);color:#0a6b50;font:850 13px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:-.02em}
.ac-financial-overline{display:block;color:var(--ac-text-dim);font-size:8px;font-weight:820;letter-spacing:.13em;text-transform:uppercase}.ac-financial-identity h3{margin:3px 0 0;color:var(--ac-text);font-size:14px;line-height:1.2;letter-spacing:-.02em}.ac-financial-identity p{margin:4px 0 0;color:var(--ac-text-muted);font-size:10px}
.ac-financial-coverage{min-width:132px;padding:10px 11px;border:1px solid var(--fin-line);border-radius:12px;background:rgba(255,255,255,.68)}.ac-financial-coverage span,.ac-financial-coverage strong{display:block}.ac-financial-coverage span{color:var(--ac-text-dim);font-size:8px;font-weight:800;letter-spacing:.1em;text-transform:uppercase}.ac-financial-coverage strong{margin-top:3px;color:var(--ac-text);font-size:13px;font-variant-numeric:tabular-nums}
.ac-financial-coverage i{--ac-financial-coverage:0%;display:block;position:relative;overflow:hidden;height:3px;margin-top:8px;border-radius:999px;background:rgba(15,116,88,.10)}.ac-financial-coverage i::after{content:"";position:absolute;inset:0 auto 0 0;width:var(--ac-financial-coverage);border-radius:inherit;background:#0f7458;transition:width 320ms var(--ease-emphasized)}
.ac-financial-grid{display:grid;grid-template-columns:minmax(260px,.92fr) minmax(0,1.6fr);gap:12px;align-items:stretch}
.ac-financial-focus-card{position:relative;overflow:hidden;min-height:240px;padding:22px;border:1px solid rgba(15,116,88,.16);border-radius:16px;background:radial-gradient(circle at 82% 20%,rgba(15,116,88,.13),transparent 34%),linear-gradient(145deg,#10231d 0%,#162b24 100%);color:#f3faf7}.ac-financial-focus-card::after{content:"";position:absolute;width:210px;height:210px;right:-105px;bottom:-110px;border:1px solid rgba(152,232,207,.12);border-radius:50%}
.ac-financial-focus-label{position:relative;z-index:1;display:block;color:#a8bdb6;font-size:9px;font-weight:760;letter-spacing:.09em;text-transform:uppercase}.ac-financial-focus-card>strong{position:relative;z-index:1;display:block;margin-top:26px;color:#f7fffb;font-size:clamp(40px,6vw,68px);line-height:.9;letter-spacing:-.07em;font-weight:620;font-variant-numeric:tabular-nums}.ac-financial-focus-card>small{position:relative;z-index:1;display:block;margin-top:12px;color:#b6c8c2;font-size:10px}.ac-financial-focus-card>p{position:absolute;z-index:1;left:22px;right:22px;bottom:18px;margin:0;color:#8ca49b;font-size:9.5px;line-height:1.55}
.ac-financial-orbit{position:absolute;inset:0;pointer-events:none;opacity:.36}.ac-financial-orbit i{position:absolute;border:1px solid rgba(136,223,197,.18);border-radius:50%}.ac-financial-orbit i:nth-child(1){width:180px;height:180px;right:-60px;top:-72px}.ac-financial-orbit i:nth-child(2){width:112px;height:112px;right:-16px;top:-34px}.ac-financial-orbit i:nth-child(3){width:6px;height:6px;right:58px;top:38px;background:#75d8ba;border:0;box-shadow:0 0 0 8px rgba(117,216,186,.08)}
.ac-financial-metric-stack{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.ac-financial-metric{min-width:0;padding:17px 18px;border:1px solid var(--fin-line);border-radius:15px;background:rgba(255,255,255,.88)}.ac-financial-metric:first-child{grid-column:1/-1}.ac-financial-metric span{display:block;color:var(--ac-text-dim);font-size:9px;font-weight:760;letter-spacing:.04em}.ac-financial-metric strong{display:block;margin-top:9px;color:var(--ac-text);font-size:clamp(22px,3vw,36px);line-height:1;letter-spacing:-.045em;font-weight:620;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.ac-financial-metric small{display:block;margin-top:8px;color:var(--ac-text-muted);font-size:9px;line-height:1.45}
.ac-financial-source-rail{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1px;margin-top:12px;overflow:hidden;border:1px solid var(--fin-line);border-radius:13px;background:var(--fin-line)}.ac-financial-source{min-width:0;padding:13px 14px;background:rgba(255,255,255,.90)}.ac-financial-source span{display:block;color:var(--ac-text-dim);font-size:8px;font-weight:760;letter-spacing:.05em;text-transform:uppercase}.ac-financial-source strong{display:block;margin-top:5px;color:var(--ac-text);font-size:10px;font-weight:650;line-height:1.45;overflow-wrap:anywhere}
.ac-financial-trust-note{display:flex;align-items:flex-start;gap:10px;margin-top:12px;padding:11px 13px;border:1px solid rgba(15,116,88,.10);border-radius:12px;background:rgba(15,116,88,.045)}.ac-financial-trust-note>span{display:grid;place-items:center;width:18px;height:18px;flex:0 0 18px;border-radius:50%;background:rgba(15,116,88,.11);color:#0f7458;font:800 9px/1 ui-monospace,SFMono-Regular,Menlo,monospace}.ac-financial-trust-note p{margin:0;color:var(--ac-text-muted);font-size:9.5px;line-height:1.55}

.ac-research-data-head{align-items:flex-start!important;gap:18px}.ac-research-state{min-height:180px;display:grid;place-items:center;padding:24px;color:var(--ac-text-muted);font-size:12px;text-align:center}.ac-research-data-content{padding:18px}.ac-metric-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.ac-metric-tile{min-width:0;padding:17px;border:1px solid var(--ac-line);border-radius:12px;background:#fbfcfb}.ac-metric-tile span{display:block;color:var(--ac-text-muted);font-size:10px;font-weight:650;letter-spacing:.02em}.ac-metric-tile strong{display:block;margin-top:8px;color:var(--ac-text);font-size:clamp(20px,2vw,28px);font-weight:650;line-height:1.15;letter-spacing:-.035em;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.ac-metric-tile small{display:block;margin-top:7px;color:var(--ac-text-dim);font-size:10px;line-height:1.45}.ac-research-detail-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin-top:12px;border:1px solid var(--ac-line);border-radius:12px;overflow:hidden;background:var(--ac-surface-2)}.ac-research-detail{min-width:0;padding:13px 15px;background:#fff}.ac-research-detail:nth-child(2n){border-left:1px solid var(--ac-line)}.ac-research-detail:nth-child(n+3){border-top:1px solid var(--ac-line)}.ac-research-detail span{display:block;color:var(--ac-text-dim);font-size:10px}.ac-research-detail strong{display:block;margin-top:5px;color:var(--ac-text);font-size:11px;font-weight:650;overflow-wrap:anywhere}.ac-research-note,.ac-research-footnote{margin-top:12px;padding:11px 13px;border:1px solid rgba(18,35,29,.08);border-radius:10px;background:#f7f9f8;color:var(--ac-text-muted);font-size:10px;line-height:1.6}

html:not(.light) .ac-financial-shell{--fin-bg:#0b1110;--fin-panel:#101816;--fin-line:rgba(168,195,184,.12);--fin-soft:rgba(52,211,153,.08);background:radial-gradient(900px 360px at 92% -10%,rgba(52,211,153,.08),transparent 60%),linear-gradient(180deg,#0d1412 0%,#090e0d 100%);box-shadow:none}
html:not(.light) .ac-financial-symbol{color:#8ce5c8;background:rgba(52,211,153,.08);border-color:rgba(52,211,153,.14)}html:not(.light) .ac-financial-coverage,html:not(.light) .ac-financial-metric,html:not(.light) .ac-financial-source{background:rgba(15,23,21,.76)}html:not(.light) .ac-research-ticker-input{background:rgba(15,23,42,.7);color:#edf4ef}html:not(.light) .ac-research-load-btn{background:#10b981;border-color:#10b981;color:#03140f}html:not(.light) .ac-metric-tile,html:not(.light) .ac-research-detail{background:rgba(15,23,42,.52)}html:not(.light) .ac-research-note,html:not(.light) .ac-research-footnote{background:rgba(15,23,42,.45)}

#landingPage .landing-hero-v2{min-height:min(860px,calc(100svh - 64px))}
#landingPage .landing-hero-grid-v2{grid-template-columns:minmax(0,1.02fr) minmax(360px,.78fr);gap:clamp(34px,6vw,86px);align-items:center}
#landingPage .landing-hero-copy-v2{max-width:720px}#landingPage .landing-hero-copy-v2 h1{max-width:760px;margin:18px 0 0;font-size:clamp(48px,6.4vw,88px);line-height:.92;letter-spacing:-.062em;text-wrap:balance}#landingPage .landing-hero-copy-v2 h1 span{color:var(--lp-accent,#0f7458)}#landingPage .landing-hero-lead{max-width:650px;margin:24px 0 0;font-size:clamp(14px,1.25vw,17px);line-height:1.75}#landingPage .landing-hero-actions{margin-top:26px}
#landingPage .landing-proof-row{display:flex;flex-wrap:wrap;gap:8px 18px;margin-top:24px;color:var(--lp-muted,#66746f);font-size:9px;font-weight:720;letter-spacing:.035em}#landingPage .landing-proof-row span{display:inline-flex;align-items:center;gap:7px}#landingPage .landing-proof-row b{color:var(--lp-accent,#0f7458);font:820 8px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.08em}
#landingPage .landing-product-map{position:relative;overflow:hidden;min-width:0;padding:14px;border:1px solid rgba(18,35,29,.12);border-radius:22px;background:radial-gradient(circle at 80% 0%,rgba(15,116,88,.09),transparent 34%),rgba(250,252,250,.82);box-shadow:0 30px 70px rgba(18,35,29,.09);backdrop-filter:blur(18px)}#landingPage .landing-product-map::before{content:"";position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(rgba(15,116,88,.035) 1px,transparent 1px),linear-gradient(90deg,rgba(15,116,88,.035) 1px,transparent 1px);background-size:28px 28px;mask-image:linear-gradient(to bottom,#000,transparent 84%)}
#landingPage .landing-product-map-head,#landingPage .landing-map-footer{position:relative;z-index:1;display:flex;align-items:center;justify-content:space-between;gap:14px}#landingPage .landing-product-map-head{padding:6px 5px 12px}#landingPage .landing-product-map-head>div{display:grid;gap:3px}#landingPage .landing-map-kicker{color:var(--lp-muted,#7a8882);font:800 8px/1 ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.13em}#landingPage .landing-product-map-head strong{font-size:12px;letter-spacing:-.02em}
#landingPage .landing-map-status{display:inline-flex;align-items:center;gap:6px;padding:5px 8px;border:1px solid rgba(15,116,88,.11);border-radius:999px;color:var(--lp-muted,#66746f);font-size:8px;font-weight:760}#landingPage .landing-map-status i{width:6px;height:6px;border-radius:50%;background:#24a87c;box-shadow:0 0 0 5px rgba(36,168,124,.08)}
#landingPage .landing-product-core{position:relative;z-index:1;display:flex;align-items:center;gap:12px;padding:18px;border:1px solid rgba(15,116,88,.15);border-radius:16px;background:#10231d;color:#f5fbf8}#landingPage .landing-product-core-mark{display:grid;place-items:center;width:44px;height:44px;flex:0 0 44px;border:1px solid rgba(139,231,202,.22);border-radius:13px;background:rgba(139,231,202,.08);color:#a1ead2;font:850 11px/1 ui-monospace,SFMono-Regular,Menlo,monospace}#landingPage .landing-product-core span,#landingPage .landing-product-core strong,#landingPage .landing-product-core small{display:block}#landingPage .landing-product-core span{color:#8ba89e;font-size:8px;font-weight:760;letter-spacing:.09em;text-transform:uppercase}#landingPage .landing-product-core strong{margin-top:3px;font-size:16px;letter-spacing:-.03em}#landingPage .landing-product-core small{margin-top:4px;color:#9eb3ac;font-size:9px}
#landingPage .landing-module-grid{position:relative;z-index:1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px;margin-top:7px}#landingPage .landing-module-grid article{min-width:0;display:flex;align-items:center;gap:10px;padding:12px;border:1px solid rgba(18,35,29,.09);border-radius:13px;background:rgba(255,255,255,.78);transition:transform var(--motion-panel) var(--ease-emphasized),border-color var(--motion-panel) var(--ease-standard),background-color var(--motion-panel) var(--ease-standard)}#landingPage .landing-module-grid article:last-child{grid-column:1/-1}#landingPage .landing-module-grid article:hover{transform:translateY(-2px);border-color:rgba(15,116,88,.20);background:#fff}#landingPage .landing-module-grid article>span{display:grid;place-items:center;width:26px;height:26px;flex:0 0 26px;border-radius:8px;background:rgba(15,116,88,.065);color:#0f7458;font:800 8px/1 ui-monospace,SFMono-Regular,Menlo,monospace}#landingPage .landing-module-grid strong,#landingPage .landing-module-grid small{display:block}#landingPage .landing-module-grid strong{color:var(--lp-text,#17211e);font-size:10px;letter-spacing:-.01em}#landingPage .landing-module-grid small{margin-top:3px;color:var(--lp-muted,#66746f);font-size:8.5px}
#landingPage .landing-map-footer{padding:12px 5px 4px;color:var(--lp-muted,#66746f);font-size:8px}#landingPage .landing-map-footer span:last-child{color:var(--lp-accent,#0f7458);font-weight:780}
html:not(.light) #landingPage .landing-product-map{border-color:rgba(148,163,184,.13);background:radial-gradient(circle at 80% 0%,rgba(52,211,153,.08),transparent 34%),rgba(9,14,13,.86);box-shadow:0 30px 80px rgba(0,0,0,.28)}html:not(.light) #landingPage .landing-module-grid article{border-color:rgba(148,163,184,.10);background:rgba(15,23,21,.72)}html:not(.light) #landingPage .landing-module-grid article:hover{background:rgba(18,28,25,.94)}html:not(.light) #landingPage .landing-module-grid strong{color:#eef5f1}

@media(max-width:980px){#landingPage .landing-hero-grid-v2{grid-template-columns:1fr;gap:34px}#landingPage .landing-product-map{width:min(680px,100%)}.ac-financial-grid{grid-template-columns:1fr}.ac-financial-focus-card{min-height:220px}.ac-financial-source-rail{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){#landingPage .landing-hero-v2{min-height:auto}#landingPage .landing-hero-copy-v2 h1{font-size:clamp(44px,14vw,64px)}#landingPage .landing-proof-row{display:grid;gap:8px}#landingPage .landing-product-map{padding:10px;border-radius:18px}#landingPage .landing-module-grid{grid-template-columns:1fr}#landingPage .landing-module-grid article:last-child{grid-column:auto}#landingPage .landing-map-footer{align-items:flex-start;flex-direction:column}.ac-financial-head{flex-direction:column;padding:17px}.ac-research-ticker-tools{width:100%;grid-template-columns:auto minmax(0,1fr) auto}.ac-research-ticker-input{width:auto;min-width:0}.ac-financial-content{padding:12px}.ac-financial-topline{align-items:flex-start;flex-direction:column}.ac-financial-coverage{width:100%}.ac-financial-metric-stack{grid-template-columns:1fr}.ac-financial-metric:first-child{grid-column:auto}.ac-financial-source-rail{grid-template-columns:1fr}.ac-metric-grid,.ac-research-detail-grid{grid-template-columns:1fr}.ac-research-detail:nth-child(2n){border-left:0}.ac-research-detail+.ac-research-detail{border-top:1px solid var(--ac-line)}}
@media(prefers-reduced-motion:reduce){#landingPage .landing-module-grid article,.ac-financial-coverage i::after{transition:none!important}}

html.light .sidebar-profile-button,
html.light .sidebar-utility-button {
  background:#fff !important;
  border-color:var(--ac-line) !important;
  color:var(--ac-text-muted) !important;
}
html.light .sidebar-utility-button:hover {
  background:#f5f8f6 !important;
  color:var(--ac-text) !important;
}
html.light .sidebar-utility-danger {
  color:#a33943 !important;
}

/* Sidebar group empty collapse (FINAL-BUG-007) */
.sidebar-nav-group:not(:has(.sidebar-item:not(.hidden):not([hidden]))) {
  display: none !important;
}

html.light .sidebar-group-label {
  color: #475569 !important;
}
html.light .text-muted {
  color: #475569 !important;
}

/* Riset Pasar Subgroup Labels (FINAL-RISK-003) */
.sidebar-subgroup-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  /* FINAL-A11Y-005 dark-mode parity: --text-secondary clears WCAG AA
     (>=4.5:1) on the dark sidebar surfaces where --text-tertiary was ~3.5:1. */
  color: var(--text-secondary, #9AA4B2);
  padding: 6px 12px 2px;
  margin-top: 4px;
}
html.light .sidebar-subgroup-label {
  color: #475569 !important;
}
#appSidebar.is-collapsed .sidebar-subgroup-label {
  display: none !important;
}

/* Mobile Touch Ergonomics Polish (FINAL-POLISH-002) */
@media (max-width: 768px) {
  .nav-btn,
  .mobile-nav-row .nav-btn,
  .theme-toggle-compact,
  .sidebar-item,
  .header-actions button,
  .header-actions a,
  #logoutBtn,
  #headerUserLabel,
  #btnJalankanAnalisis,
  .analisis-subtab {
    min-height: 44px !important;
  }
}

/* ==========================================================================
   WAVE 4R: FINANCIAL & STRUKTUR PASAR V2 SCOPED OVERRIDES
   Pure canonical tokens. Zero hardcoded colors, gradients, or raw z-index.
   ========================================================================== */

/* Scoped V2 [hidden] enforcement ensuring author/framework flex/grid never overrides hidden */
#panel-tab-financial[data-ac-ui="v2"][hidden],
#panel-tab-financial[data-ac-ui="v2"] [hidden],
#panel-tab-market-structure[data-ac-ui="v2"][hidden],
#panel-tab-market-structure[data-ac-ui="v2"] [hidden] {
  display: none !important;
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-shell {
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg);
  box-shadow: none;
  overflow: hidden;
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ac-space-4);
  padding: var(--ac-space-4);
  border-bottom: 1px solid var(--ac-line-hairline);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-symbol {
  background: var(--ac-brand-soft);
  color: var(--ac-brand);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-family: var(--ac-font-mono);
  font-weight: 700;
  font-size: 13px;
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-coverage {
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  padding: var(--ac-space-2) var(--ac-space-3);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-coverage i {
  background: var(--ac-surface-hover);
  display: block;
  height: 4px;
  border-radius: var(--ac-radius-pill);
  overflow: hidden;
  margin-top: var(--ac-space-2);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-coverage i::after {
  background: var(--ac-brand);
  content: "";
  display: block;
  height: 100%;
  width: var(--ac-financial-coverage, 0%);
  transition: width var(--motion-panel) var(--ease-standard);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-all-unavailable {
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  color: var(--ac-text-muted);
  padding: var(--ac-space-5);
  text-align: center;
  margin: var(--ac-space-4);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--ac-space-3);
  margin-top: var(--ac-space-3);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-metric-card {
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  padding: var(--ac-space-3);
  display: flex;
  flex-direction: column;
  gap: var(--ac-space-1);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-metric-label {
  color: var(--ac-text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#panel-tab-financial[data-ac-ui="v2"] :is(#financialPbv, #financialBvps, #financialMarketCap, #financialShares) {
  color: var(--ac-ink);
  font-size: 18px;
  font-weight: 600;
  font-family: var(--ac-font-mono);
  font-variant-numeric: tabular-nums;
  margin: var(--ac-space-1) 0;
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-metric-card small {
  color: var(--ac-text-secondary);
  font-size: 11px;
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-source-rail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--ac-line-hairline);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  overflow: hidden;
  margin-top: var(--ac-space-3);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-source {
  background: var(--ac-surface-raised);
  padding: var(--ac-space-3);
  color: var(--ac-text-secondary);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-source strong {
  color: var(--ac-ink);
  font-weight: 600;
  font-size: 11px;
  display: block;
  margin-top: var(--ac-space-1);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-financial-trust-note {
  background: var(--ac-brand-soft);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  padding: var(--ac-space-3);
  color: var(--ac-text-secondary);
  font-size: 11px;
  margin-top: var(--ac-space-3);
}

/* --- Struktur Pasar V2 Scoped Overrides --- */

#panel-tab-market-structure[data-ac-ui="v2"] .ac-research-kicker {
  color: var(--color-text-secondary);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-market-structure-layout {
  display: flex;
  gap: var(--ac-space-4);
  align-items: flex-start;
  padding: var(--ac-space-3);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-market-structure-main {
  flex: 1 1 auto;
  min-width: 0;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-table tr.ac-table-row {
  cursor: pointer;
  transition: background-color var(--motion-hover) var(--ease-standard);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-table tr.ac-table-row:hover {
  background: var(--ac-surface-hover);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-table tr.ac-table-row.is-selected {
  background: var(--ac-brand-soft);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-table td,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-cell-date {
  padding-top: 6.8px !important;
  padding-bottom: 6.8px !important;
  line-height: 18px !important;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-badge-good {
  background: var(--ac-positive-soft);
  color: var(--ac-positive);
  border: 1px solid var(--ac-line-hairline);
  padding: 2px 8px;
  border-radius: var(--ac-radius-sm);
  font-size: 11px;
  font-weight: 600;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-badge-warning {
  background: var(--ac-warning-soft);
  color: var(--ac-warning-text);
  border: 1px solid var(--ac-line-hairline);
  padding: 2px 8px;
  border-radius: var(--ac-radius-sm);
  font-size: 11px;
  font-weight: 600;
}

#panel-tab-market-structure[data-ac-ui="v2"] :is(.ac-badge-neutral, .ac-badge-dim) {
  background: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
  border: 1px solid var(--ac-line-hairline);
  padding: 2px 8px;
  border-radius: var(--ac-radius-sm);
  font-size: 11px;
  font-weight: 600;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-filter-chip {
  padding: var(--ac-space-1) var(--ac-space-3);
  border-radius: var(--ac-radius-sm);
  border: 1px solid var(--ac-line-hairline);
  background: var(--ac-surface-raised);
  color: var(--ac-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: background-color var(--motion-hover) var(--ease-standard), color var(--motion-hover) var(--ease-standard);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-filter-chip.is-active {
  background: var(--ac-brand-soft);
  border-color: var(--ac-brand);
  color: var(--ac-brand);
  font-weight: 600;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-metric-tile {
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  padding: var(--ac-space-3);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-metric-tile span {
  color: var(--ac-text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  display: block;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-metric-tile strong {
  color: var(--ac-ink);
  font-size: 16px;
  font-weight: 600;
  font-family: var(--ac-font-mono);
  display: block;
  margin-top: var(--ac-space-1);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-metric-tile small {
  color: var(--ac-text-secondary);
  font-size: 10px;
  display: block;
  margin-top: var(--ac-space-1);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-research-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: var(--ac-line-hairline);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  overflow: hidden;
  margin-top: var(--ac-space-3);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-research-detail {
  background: var(--ac-surface-raised);
  padding: var(--ac-space-2) var(--ac-space-3);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-research-detail span {
  color: var(--ac-text-muted);
  font-size: 10px;
  display: block;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-research-detail strong {
  color: var(--ac-ink);
  font-size: 12px;
  font-weight: 600;
  display: block;
  margin-top: var(--ac-space-1);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-research-note {
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md);
  padding: var(--ac-space-3);
  color: var(--ac-text-secondary);
  font-size: 11px;
  margin-top: var(--ac-space-3);
}

/* Docked Desktop Detail Pane (>=1024px) */
@media (min-width: 1024px) {
  #panel-tab-market-structure[data-ac-ui="v2"] .ac-market-structure-layout .ac-detail-pane {
    width: 360px;
    min-width: 320px;
    max-width: 380px;
    flex: 0 0 360px;
    position: sticky;
    top: var(--ac-space-4);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--ac-surface);
    border: 1px solid var(--ac-line-hairline);
    border-radius: var(--ac-radius-lg);
    padding: var(--ac-space-4);
  }

  #panel-tab-market-structure[data-ac-ui="v2"] #marketStructureDetailSheet {
    display: none !important;
  }
}

/* Mobile Detail Sheet (<1024px) */
@media (max-width: 1023px) {
  #panel-tab-market-structure[data-ac-ui="v2"] .ac-market-structure-layout {
    display: block;
    padding: var(--ac-space-2);
  }

  #panel-tab-market-structure[data-ac-ui="v2"] .ac-market-structure-layout .ac-detail-pane {
    display: none !important;
  }

  #panel-tab-market-structure[data-ac-ui="v2"] #marketStructureDetailSheet {
    position: fixed;
    inset: 0;
    z-index: var(--ac-z-drawer);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }

  #panel-tab-market-structure[data-ac-ui="v2"] #marketStructureDetailSheet[hidden] {
    display: none !important;
  }

  #panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--ac-canvas) 70%, transparent);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  html.light #panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sheet-backdrop {
    background: color-mix(in srgb, var(--ac-ink) 50%, transparent);
  }

  #panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sheet-panel {
    position: relative;
    background: var(--ac-surface);
    border-top: 1px solid var(--ac-line-hairline);
    border-radius: var(--ac-radius-xl) var(--ac-radius-xl) 0 0;
    padding: var(--ac-space-4);
    max-height: 85vh;
    overflow-y: auto;
  }

  #panel-tab-market-structure[data-ac-ui="v2"] .ac-metric-grid,
  #panel-tab-market-structure[data-ac-ui="v2"] .ac-research-detail-grid {
    grid-template-columns: 1fr;
  }
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-filter-bar {
  border-color: var(--ac-line-hairline);
  background: var(--ac-surface-sunken, transparent);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-search-input {
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-line-hairline);
  color: var(--ac-ink);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-search-input:focus {
  border-color: var(--ac-border-focus);
  outline: none;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-search-input::placeholder {
  color: var(--ac-text-muted);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-filter-select {
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-line-hairline);
  color: var(--ac-ink);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-filter-select:focus {
  border-color: var(--ac-border-focus);
  outline: none;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-icon-btn {
  background: var(--ac-surface-2);
  border: 1px solid var(--ac-line-hairline);
  color: var(--ac-text-muted);
  cursor: pointer;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-icon-btn:hover {
  color: var(--ac-accent);
  border-color: var(--ac-border-focus);
}

#panel-tab-market-structure[data-ac-ui="v2"] th {
  color: var(--ac-text-muted);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-cell-ticker,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-cell-value {
  color: var(--ac-ink);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-cell-date,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-table-empty,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-label-muted,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sub {
  color: var(--color-text-secondary);
}

#panel-tab-market-structure[data-ac-ui="v2"] p.ac-label-muted {
  line-height: 1.45 !important;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-section-title,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-title,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-sheet-title,
#panel-tab-financial[data-ac-ui="v2"] .ac-empty-title {
  color: var(--ac-ink);
}

#panel-tab-financial[data-ac-ui="v2"] .ac-empty-desc {
  color: var(--ac-text-muted);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-close {
  color: var(--ac-text-muted);
  cursor: pointer;
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-close:hover {
  color: var(--ac-ink);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sheet-close {
  background: var(--ac-surface-raised, transparent);
  border: 1px solid var(--ac-line-hairline, transparent);
  border-radius: var(--ac-radius-md, 8px);
  color: var(--ac-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ac-touch-target, 44px);
  height: var(--ac-touch-target, 44px);
  min-width: var(--ac-touch-target, 44px);
  min-height: var(--ac-touch-target, 44px);
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  transition: background var(--motion-hover) var(--ease-standard),
              color var(--motion-hover) var(--ease-standard),
              border-color var(--motion-hover) var(--ease-standard);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sheet-close:hover {
  background: var(--ac-surface-hover);
  color: var(--ac-ink);
  border-color: var(--ac-line);
}

#panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sheet-close:focus-visible {
  outline: 2px solid var(--ac-focus, var(--ac-brand));
  outline-offset: 2px;
}

#panel-tab-financial[data-ac-ui="v2"] .ac-refresh-banner-text.is-error,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-refresh-banner-text.is-error {
  color: var(--ac-danger);
}

/* Touch & Tablet Form Controls (<=1023px) */
/* D1: semua kontrol market-structure (termasuk .fchip filter + .btn.sm sort
   toggle yang dirender di dalam #panel-tab-market-structure) wajib >=44px
   agar lolos audit sentuh 320px kapan saja, bukan hanya saat CSS kebetulan
   termuat penuh. */
@media (max-width: 1023px) {
  #panel-tab-market-structure[data-ac-ui="v2"] .ac-filter-chip,
  #panel-tab-market-structure[data-ac-ui="v2"] #marketStructureRefreshBtn,
  #panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-close,
  #panel-tab-market-structure[data-ac-ui="v2"] .ac-detail-sheet-close,
  #panel-tab-financial[data-ac-ui="v2"] .ac-research-load-btn,
  #panel-tab-market-structure[data-ac-ui="v2"] #marketStructureSearchInput,
  #panel-tab-market-structure[data-ac-ui="v2"] #marketStructureSortSelect,
  #panel-tab-financial[data-ac-ui="v2"] #financialTickerInput,
  #panel-tab-market-structure .fchip,
  #panel-tab-market-structure .btn.sm,
  #panel-tab-market-structure #marketStructureSortToggleBtn,
  #panel-tab-market-structure #marketStructureSectorSelect,
  #panel-tab-market-structure #marketStructureSortSelect,
  #panel-tab-market-structure #marketStructureSearchInput {
    min-height: var(--ac-touch-target, 44px) !important;
    min-width: var(--ac-touch-target, 44px) !important;
  }

  #panel-tab-market-structure[data-ac-ui="v2"] .ac-table tr.ac-table-row {
    min-height: var(--ac-touch-target, 44px);
  }

  #panel-tab-market-structure[data-ac-ui="v2"] .ac-table td,
  #panel-tab-market-structure[data-ac-ui="v2"] .ac-cell-date {
    padding-top: var(--ac-space-3) !important;
    padding-bottom: var(--ac-space-3) !important;
  }

  #marketStructureSearchInput,
  #marketStructureSortSelect,
  #financialTickerInput {
    font-size: 16px !important;
  }

  #panel-tab-financial[data-ac-ui="v2"] .ac-financial-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #panel-tab-financial[data-ac-ui="v2"] .ac-financial-grid {
    grid-template-columns: 1fr;
  }

  #panel-tab-financial[data-ac-ui="v2"] .ac-financial-source-rail {
    grid-template-columns: 1fr;
  }
}

/* Financial keeps metric cells compact; source details share the same ink. */
#panel-tab-financial[data-ac-ui="v2"] :is(.ac-financial-heading h2, .ac-financial-identity h3) {
  color: var(--ac-ink);
}
#panel-tab-financial[data-ac-ui="v2"] :is(.ac-financial-heading p, .ac-financial-identity p, .ac-financial-coverage span, .ac-financial-source span, .ac-financial-trust-note p, .ac-refresh-banner-text) {
  color: var(--ac-text-secondary);
  font-size: 12px;
}
#panel-tab-financial[data-ac-ui="v2"] .ac-financial-head {
  flex-wrap: wrap;
  gap: var(--ac-space-3);
}
#panel-tab-financial[data-ac-ui="v2"] .ac-research-ticker-tools {
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}
#panel-tab-financial[data-ac-ui="v2"] #financialTickerInput {
  background: var(--ac-surface);
  color: var(--ac-ink);
  border: 1px solid var(--ac-control-border);
  border-radius: var(--ac-radius-md, 8px);
  width: 104px;
  min-height: 44px;
  font-size: 16px;
}
#panel-tab-financial[data-ac-ui="v2"] #financialTickerInput:focus {
  border-color: var(--ac-brand);
}
#panel-tab-financial[data-ac-ui="v2"] .ac-financial-search-label {
  color: var(--ac-text-secondary);
  font-size: 12px;
}
#panel-tab-financial[data-ac-ui="v2"] .ac-research-load-btn {
  background: var(--ac-brand);
  color: var(--ac-surface);
  border: 1px solid var(--ac-brand);
  border-radius: var(--ac-radius-md, 8px);
  min-height: 44px;
}
#panel-tab-financial[data-ac-ui="v2"] :is(#financialTickerInput, .ac-research-load-btn):focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: 2px;
}
#panel-tab-financial[data-ac-ui="v2"] .ac-financial-metric-card {
  min-width: 0;
  min-height: 0;
}
#panel-tab-financial[data-ac-ui="v2"] :is(#financialPbv, #financialBvps, #financialMarketCap, #financialShares, .ac-financial-source span, .ac-financial-source strong) {
  overflow-wrap: anywhere;
}
#panel-tab-financial[data-ac-ui="v2"] .ac-financial-source {
  min-width: 0;
}
#panel-tab-financial[data-ac-ui="v2"] .ac-financial-source strong {
  font-size: 12px;
}
#panel-tab-financial[data-ac-ui="v2"] .ac-financial-state {
  min-height: 0;
  padding: var(--ac-space-4);
}
@media (max-width: 640px) {
  #panel-tab-financial[data-ac-ui="v2"] .ac-financial-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  #panel-tab-financial[data-ac-ui="v2"] .ac-financial-metric-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
    align-items: baseline;
    padding: var(--ac-space-3) 0;
    background: var(--ac-surface);
    border: 0;
    border-bottom: 1px solid var(--ac-line-hairline);
    border-radius: 0;
  }
  #panel-tab-financial[data-ac-ui="v2"] .ac-financial-metric-card strong {
    text-align: right;
    line-height: 1.2;
  }
  #panel-tab-financial[data-ac-ui="v2"] .ac-financial-metric-card small {
    grid-column: 1 / -1;
    line-height: 1.4;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .action-card:hover { transform: none; }
  .panel table tbody tr { transition: none; }
  #panel-tab-financial[data-ac-ui="v2"] *,
  #panel-tab-market-structure[data-ac-ui="v2"] * {
    transition: none !important;
    animation: none !important;
  }
}

#page-screener .ac-screener-result-action {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 2px;
  border: 0;
  border-radius: var(--ac-radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
#page-screener .ac-screener-result-action:focus-visible {
  outline: 2px solid var(--ac-focus);
  outline-offset: 2px;
}
@media (max-width: 1023px), (pointer: coarse) {
  #page-screener :is(.ac-segment, .screener-tab, .nk-screener-tab, .dt-screener-tab, .ac-screener-result-action) {
    min-height: 44px;
  }
  #page-screener :is(select, input:not([type="checkbox"]), .scr-filter-grid label, #patternFilterContainer label:has(input)) {
    min-height: 44px;
  }
  #page-screener #screenerContent :is(select, input:not([type="checkbox"])),
  #page-screener #filter-pattern-personality {
    font-size: 16px !important;
    min-width: 0;
  }
  #page-screener #patternFilterContainer > div:first-child {
    min-width: 0;
    max-width: 100%;
  }
}

/* UX-002: component-owned contrast. Preserve geometry and semantic hierarchy
   while outranking private utility colors in the later workstation sheets. */
#page-analisis #insiderRosterSection :is(button, input, select),
#page-analisis #insiderMobileTabs .ac-tab-btn {
  color: var(--ac-text-muted) !important;
  background-color: var(--ac-surface-2) !important;
  border-color: var(--ac-control-border-hover, var(--ac-text-muted)) !important;
  box-shadow: inset 0 0 0 1px var(--ac-control-border-hover, var(--ac-text-muted)) !important;
}
#page-analisis #insiderRosterSection button.bg-emerald-500,
#page-analisis #insiderMobileTabs .ac-tab-active {
  color: var(--ac-bull) !important;
  background-color: var(--ac-accent-soft) !important;
  border-color: var(--ac-bull) !important;
  box-shadow: inset 0 0 0 1px var(--ac-bull) !important;
}
#page-analisis #insiderRosterSection input::placeholder {
  color: var(--ac-text-muted) !important;
  opacity: 1;
}
#page-analisis #insiderRosterSection :is(button, input, select):focus-visible,
#page-analisis #insiderMobileTabs .ac-tab-btn:focus-visible,
#page-watchlist .wl-filter-btn:focus-visible {
  outline: 2px solid var(--ac-bull) !important;
  outline-offset: 3px;
}
#page-dashboard .ac-section-hint {
  color: var(--ac-text-muted) !important;
}

/* Broker origin is informational; both legend states keep their existing tint. */
#panel-tab-hunter .ac-hunter-legend-foreign {
  color: var(--pw-info, var(--info));
}
#panel-tab-hunter .ac-hunter-legend-local {
  color: var(--ac-bull);
}

/* D8: graph quick-picks own their theme and selection colors. */
#insiderGraphSection .ac-insider-quick-chip {
  color: var(--color-text-secondary) !important;
  background-color: var(--ac-surface-2) !important;
  border-color: var(--ac-control-border-hover) !important;
}
#insiderGraphSection .ac-insider-quick-chip:hover,
#insiderGraphSection .ac-insider-quick-chip-selected {
  color: var(--ac-bull) !important;
  background-color: var(--ac-accent-soft) !important;
  border-color: var(--ac-bull) !important;
}
#insiderGraphSection .ac-insider-quick-chip:focus-visible {
  outline: 2px solid var(--ac-bull) !important;
  outline-offset: 3px;
}


/* =========================================================================
   CANONICAL WAVE 1 FOUNDATIONS — SCOPED V2 LAYER EXTENSIONS
   ========================================================================= */

html:not(.light),
[data-theme="dark"] {
  --ac-canvas: #090D16;
  --ac-surface: #10151F;
  --ac-ink: #F4F6F8;
  --ac-positive: #34D399;
}

[data-ac-ui="v2"] .ac-title-page,
.ac-ui-v2.ac-title-page {
  font-family: var(--ac-font-sans);
  font-size: clamp(28px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-title-section,
.ac-ui-v2.ac-title-section {
  font-family: var(--ac-font-sans);
  font-size: clamp(20px, 1.8vw, 24px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-title-component,
.ac-ui-v2.ac-title-component {
  font-family: var(--ac-font-sans);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-body,
.ac-ui-v2.ac-body {
  font-family: var(--ac-font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-dense-ui,
.ac-ui-v2.ac-dense-ui {
  font-family: var(--ac-font-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-table-text,
.ac-ui-v2.ac-table-text {
  font-family: var(--ac-font-sans);
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ac-ink);
}

[data-ac-ui="v2"] .ac-meta-evidence,
.ac-ui-v2.ac-meta-evidence {
  font-family: var(--ac-font-sans);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ac-text-secondary);
}

[data-ac-ui="v2"] .ac-meta-auxiliary,
.ac-ui-v2.ac-meta-auxiliary {
  font-family: var(--ac-font-sans);
  font-size: 11.5px;
  line-height: 1.4;
  color: var(--ac-text-muted);
}

/* Numerals */
[data-ac-ui="v2"] .ac-num,
[data-ac-ui="v2"] [data-ac-num],
.ac-ui-v2.ac-num {
  font-family: var(--ac-font-sans);
  font-variant-numeric: tabular-nums lining-nums;
  -moz-font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

/* Form input border */
[data-ac-ui="v2"] .ac-input,
.ac-ui-v2 .ac-input {
  border: 1px solid var(--ac-control-border);
}
[data-ac-ui="v2"] .ac-input:focus-visible,
.ac-ui-v2 .ac-input:focus-visible {
  border-color: var(--ac-focus);
}

/* Button outline offset */
.ac-btn-primary:focus-visible {
  outline-offset: 2px;
}

/* Table wrap & sticky th */
[data-ac-ui="v2"] .ac-table-wrap,
.ac-ui-v2 .ac-table-wrap {
  width: 100%;
  overflow-x: auto;
}
[data-ac-ui="v2"] .ac-table th,
.ac-ui-v2 .ac-table th {
  position: sticky;
  top: 0;
  z-index: 10;
}
[data-ac-ui="v2"] .ac-table tbody tr.is-selected,
.ac-ui-v2 .ac-table tbody tr.is-selected {
  box-shadow: inset 3px 0 0 var(--ac-brand);
}

/* Surfaces */
[data-ac-ui="v2"] .ac-surface-bounded,
.ac-ui-v2 .ac-surface-bounded {
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-lg, 12px);
}
[data-ac-ui="v2"] .ac-surface-floating,
.ac-ui-v2 .ac-surface-floating {
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-xl, 16px);
  box-shadow: var(--ac-shadow-level-2);
}
[data-ac-ui="v2"] .ac-metric-strip,
.ac-ui-v2 .ac-metric-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
}

/* Reduced motion for v2 */
@media (prefers-reduced-motion: reduce) {
  [data-ac-ui="v2"] .fade-in,
  .ac-ui-v2 .fade-in {
    opacity: 1 !important;
    animation: none !important;
    transition: none !important;
  }
}

/*    WAVE 6D: FINAL GEOMETRY CORRECTION — DESKTOP + MOBILE + LIGHT/DARK
   ========================================================================= */

/* 1. Desktop: Completely remove .app-header from desktop layout flow */
@media (min-width: 1024px) {
  #appMain > .app-header {
    display: none !important;
  }

  /* Single canonical owner of desktop outer page gutter */
  #appContent {
    padding-top: 14px !important;
    padding-bottom: 32px !important;
    padding-inline: 18px !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Eliminate accumulated nested padding on all authenticated pages */
  .page-content,
  #page-dashboard,
  #page-screener,
  #page-sektor,
  #page-analisis,
  #page-chart,
  #page-news,
  #page-portofolio,
  #page-trackrecord,
  #page-watchlist,
  #page-subscription {
    padding-inline: 0 !important;
    padding-top: 0 !important;
    margin-inline: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* 2. Mobile & Tablet: Header remains; Drawer footer separates strictly */
@media (max-width: 1023px) {
  #appMain > .app-header {
    display: block !important;
  }

  #appSidebar .sidebar-footer {
    padding: 10px 12px !important;
  }

  /* Mobile: Single outer gutter (12px) without nested multiplication */
}

@media (max-width: 767px) {
  /* Screener mobile density (Wave 10, Task 1 and Final Blocker Closure) */
  #page-screener.page-content {
    padding-top: 4px;
  }
  #page-screener.page-content .page-header {
    display: block;
    margin-bottom: 4px;
    padding: 0;
  }
  #page-screener.page-content .page-header .page-title {
    font-size: 15px;
    line-height: 1.25;
    margin: 0;
    font-weight: 700;
  }
  #page-screener.page-content #screenerContent.space-y-4 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-y-reverse: 0;
    margin-top: 4px;
    margin-bottom: 0;
  }
  #page-screener.page-content #screenerKongloPane.space-y-3 > :not([hidden]) ~ :not([hidden]),
  #page-screener.page-content #screenerNonKongloPane.space-y-3 > :not([hidden]) ~ :not([hidden]),
  #page-screener.page-content #screenerDayTradePane.space-y-3 > :not([hidden]) ~ :not([hidden]) {
    --tw-space-y-reverse: 0;
    margin-top: 4px;
    margin-bottom: 0;
  }
  #page-screener.page-content .page-subtitle,
  #page-screener.page-content #screenerSubtitle,
  #page-screener.page-content #nkScreenerSubtitle,
  #page-screener.page-content #dtScreenerSubtitle {
    display: none;
  }
  #page-screener.page-content .ac-segmented {
    margin-bottom: 4px;
  }
  #page-screener.page-content .scr-info-bar {
    padding: 3px 6px;
    margin-bottom: 3px;
    font-size: 9.5px;
    line-height: 1.3;
  }
  #page-screener.page-content #patternFilterContainer {
    padding: 3px 6px;
    margin-bottom: 3px;
    gap: 3px;
  }
  #page-screener.page-content #patternFilterContainer select {
    min-height: 30px;
    padding: 2px 6px;
    font-size: 11px;
  }
  #page-screener.page-content #screenerStats,
  #page-screener.page-content #nkScreenerStats,
  #page-screener.page-content #dtScreenerStats {
    gap: 4px;
    margin-bottom: 3px;
  }
  #page-screener.page-content #screenerStats > div,
  #page-screener.page-content #nkScreenerStats > div,
  #page-screener.page-content #dtScreenerStats > div {
    padding: 2px 4px;
  }
  #page-screener.page-content #screenerStats p:last-child,
  #page-screener.page-content #nkScreenerStats p:last-child,
  #page-screener.page-content #dtScreenerStats p:last-child {
    font-size: 12px;
    line-height: 1.2;
  }
  #page-screener.page-content .scr-filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 4px 6px;
    gap: 4px;
    margin-bottom: 3px;
  }
  #page-screener.page-content #kgTickerSearch,
  #page-screener.page-content #nkTickerSearch,
  #page-screener.page-content #dtTickerSearch {
    grid-column: span 2;
    min-height: 32px;
    font-size: 11px;
    padding: 2px 8px;
  }
  #page-screener.page-content #kgStatusFilter,
  #page-screener.page-content #kgRiskFilter,
  #page-screener.page-content #nkStatusFilter,
  #page-screener.page-content #nkRiskFilter,
  #page-screener.page-content #dtStatusFilter,
  #page-screener.page-content #dtRiskFilter {
    min-height: 30px;
    font-size: 10.5px;
    padding: 2px 4px;
  }
  #page-screener.page-content .flex.items-center.overflow-x-auto,
  #page-screener.page-content .overflow-x-auto.scrollbar-hide {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    white-space: nowrap;
    gap: 4px;
    padding-bottom: 3px;
    margin-bottom: 3px;
  }
  #page-screener.page-content .screener-tab,
  #page-screener.page-content .nk-screener-tab,
  #page-screener.page-content .dt-screener-tab {
    min-height: 30px;
    padding: 4px 8px;
    font-size: 11px;
    flex-shrink: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .action-card:hover { transform: none; }
  .panel table tbody tr { transition: none !important; }
  .ac-broker-bubble,
  #insiderNetworkSvg *,
  .dashboard-decision-row {
    animation: none !important;
    transition: none !important;
  }
}


/* Screener sticky ticker cell — theme-aware background so the frozen column
   follows Light/Dark tokens instead of a hardcoded dark surface. */
.ac-ticker-sticky-cell {
  background: var(--ac-surface-raised, var(--ac-surface, #ffffff));
  color: var(--ac-ink, inherit);
}

html:not(.light) .ac-ticker-sticky-cell {
  background: var(--ac-surface-raised, #1e293b);
  color: var(--ac-ink, #e2e8f0);
}

/* Mobile Detail Sheet (§76.12, §76.13, §49) */
@media (max-width: 1023px) {
  [data-ac-ui="v2"] .ac-split-view,
  .ac-ui-v2.ac-split-view,
  .ac-ui-v2 .ac-split-view {
    display: block;
    width: 100%;
  }

  [data-ac-ui="v2"] .ac-split-view__main,
  .ac-ui-v2.ac-split-view__main,
  .ac-ui-v2 .ac-split-view__main {
    width: 100%;
    min-width: 0;
  }

  /* On tablet & mobile, docked side pane is transitioned to overlay sheet so dataset is never crushed (§2346) */
  [data-ac-ui="v2"] .ac-split-view__pane,
  .ac-ui-v2.ac-split-view__pane,
  .ac-ui-v2 .ac-split-view__pane {
    display: none;
  }

  [data-ac-ui="v2"] .ac-detail-sheet,
  .ac-ui-v2.ac-detail-sheet,
  .ac-ui-v2 .ac-detail-sheet {
    position: fixed;
    inset: 0;
    z-index: var(--ac-z-modal, 100);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: transparent;
    pointer-events: none;
    visibility: hidden;
    transition: visibility 0s 190ms;
  }

  [data-ac-ui="v2"] .ac-detail-sheet.is-open,
  .ac-ui-v2.ac-detail-sheet.is-open,
  .ac-ui-v2 .ac-detail-sheet.is-open {
    pointer-events: auto;
    visibility: visible;
    transition: visibility 0s 0s;
  }

  [data-ac-ui="v2"] .ac-sheet-backdrop,
  .ac-ui-v2 .ac-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    transition: opacity var(--motion-state, 190ms) var(--ease-standard);
  }

  [data-ac-ui="v2"] .ac-detail-sheet.is-open .ac-sheet-backdrop,
  .ac-ui-v2 .ac-detail-sheet.is-open .ac-sheet-backdrop {
    opacity: 1;
  }

  [data-ac-ui="v2"] .ac-sheet-content,
  .ac-ui-v2 .ac-sheet-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    background: var(--ac-surface);
    border-top: 1px solid var(--ac-line-hairline);
    border-radius: var(--ac-radius-xl, 16px) var(--ac-radius-xl, 16px) 0 0;
    box-shadow: var(--ac-shadow-level-3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: max(var(--ac-space-4, 16px), env(safe-area-inset-bottom, 16px));
    transform: translateY(100%);
    transition: transform var(--motion-panel, 260ms) var(--ease-emphasized);
  }

  [data-ac-ui="v2"] .ac-detail-sheet.is-open .ac-sheet-content,
  .ac-ui-v2 .ac-detail-sheet.is-open .ac-sheet-content {
    transform: translateY(0);
  }

  [data-ac-ui="v2"] .ac-sheet-handle,
  .ac-ui-v2 .ac-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--ac-control-border);
    border-radius: 2px;
    margin: 8px auto 4px auto;
    flex-shrink: 0;
  }

  [data-ac-ui="v2"] .ac-detail-pane__close,
  .ac-ui-v2 .ac-detail-pane__close {
    min-width: var(--ac-touch-target, 44px);
    min-height: var(--ac-touch-target, 44px);
  }
}


/* DESIGN.md §76.16 & §84.3: Quiet Topbar in Workstation Shell.
   The workstation sidebar footer owns the single primary account entry.
   Duplicate permanent profile, subscription, and logout chrome is suppressed on desktop. */
@media (min-width: 1024px) {
  .app-shell .app-header #headerAccountSection {
    display: none !important;
  }
}
@media (max-width: 1023px) {
  .app-shell .app-header #headerAccountSection {
    display: none !important;
  }
}

/* Remove duplicated permanent subscription and logout buttons from topbar */
.app-header #headerAccountSection .account-subscription-control,
.app-header #headerAccountSection #logoutBtn {
  display: none !important;
}

/* Polished Workstation Account Entry Card (DESIGN.md §76.16) */
#appSidebar .sidebar-profile-button {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  min-width: 0 !important;
  width: 100% !important;
  padding: 8px 10px !important;
  border: 1px solid var(--ac-border, var(--color-border-subtle, rgba(0,0,0,0.08))) !important;
  border-radius: var(--ac-radius-md, 8px) !important;
  background: var(--ac-surface, var(--color-bg-elevated, #ffffff)) !important;
  color: var(--ac-text, var(--color-text-primary, #111827)) !important;
  cursor: pointer !important;
  text-align: left !important;
  box-shadow: var(--ac-shadow-xs, 0 1px 2px rgba(0,0,0,0.04)) !important;
  transition: background-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)),
              border-color var(--motion-fast, 180ms) var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1)) !important;
}

#appSidebar .sidebar-profile-button:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.04)) !important;
  border-color: var(--ac-border-strong, var(--color-border-default, rgba(0,0,0,0.15))) !important;
}

#appSidebar .sidebar-profile-button:focus-visible {
  outline: 2px solid var(--ac-brand, #0B6BCB) !important;
  outline-offset: 2px !important;
}

#appSidebar .sidebar-profile-button .user-avatar {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  background: var(--ac-brand, #0B6BCB) !important;
  color: #ffffff !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}

#appSidebar .sidebar-profile-button .user-info {
  display: flex !important;
  flex-direction: column !important;
  min-width: 0 !important;
  line-height: 1.2 !important;
  text-align: left !important;
}

#appSidebar .sidebar-profile-button .user-name {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: var(--ac-text, var(--color-text-primary, #111827)) !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#appSidebar .sidebar-profile-button .user-role {
  font-size: 10px !important;
  font-weight: 700 !important;
  letter-spacing: 0.04em !important;
  color: var(--ac-text-muted, var(--color-text-muted, #6B7280)) !important;
}

#appSidebar .sidebar-profile-button .sidebar-profile-chevron {
  margin-left: auto !important;
  font-size: 16px !important;
  color: var(--ac-text-muted, var(--color-text-muted, #6B7280)) !important;
  line-height: 1 !important;
  flex-shrink: 0 !important;
}

/* =========================================================================
   WAVE 4 — FINANCIAL & STRUKTUR PASAR STYLES (§79.2, §79.3, §26, §27)
   ========================================================================= */

[hidden] {
  display: none !important;
}

[data-ac-ui="v2"] .ac-financial-content-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

[data-ac-ui="v2"] .ac-financial-container {
  display: flex;
  flex-direction: column;
  gap: var(--ac-space-3, 12px);
  padding: var(--ac-space-4, 16px);
  border-radius: var(--ac-radius-xl, 16px);
  background: var(--ac-surface);
  border: 1px solid var(--ac-line-hairline);
  box-shadow: var(--ac-shadow-level-1);
}

[data-ac-ui="v2"] .ac-financial-header {
  display: none !important;
}

[data-ac-ui="v2"] .ac-financial-title {
  font-family: var(--ac-font-sans);
  font-size: 18px;
  font-weight: 700;
  color: var(--ac-text);
  margin: 0;
  line-height: 1.25;
}

[data-ac-ui="v2"] .ac-financial-subtitle {
  font-size: 12px;
  color: var(--ac-text-secondary);
  margin: 3px 0 0;
  line-height: 1.4;
  max-width: 640px;
}

[data-ac-ui="v2"] .ac-financial-ticker-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-ac-ui="v2"] .ac-financial-state-box {
  background: var(--ac-surface-sunken);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--ac-text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

[data-ac-ui="v2"] .ac-financial-ticker-context {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
}

[data-ac-ui="v2"] .ac-financial-symbol {
  font-family: var(--ac-font-mono, monospace);
  font-weight: 800;
  font-size: 16px;
  color: var(--ac-brand);
  letter-spacing: 0.04em;
}

[data-ac-ui="v2"] .ac-financial-company-name {
  font-size: 12.5px;
  color: var(--ac-text-secondary);
  font-weight: 500;
}

[data-ac-ui="v2"] .ac-financial-metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 1024px) {
  [data-ac-ui="v2"] .ac-financial-metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}

@media (max-width: 480px) {
  [data-ac-ui="v2"] .ac-financial-metric-strip {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

[data-ac-ui="v2"] .ac-financial-metric-item {
  background: var(--ac-surface-raised);
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

[data-ac-ui="v2"] .ac-financial-metric-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ac-text-secondary);
}

[data-ac-ui="v2"] .ac-financial-metric-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--ac-text);
  font-variant-numeric: tabular-nums lining-nums;
  -moz-font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

[data-ac-ui="v2"] .ac-financial-metric-sub {
  font-size: 11px;
  color: var(--ac-text-muted);
}

[data-ac-ui="v2"] .ac-financial-provenance {
  padding: 10px 14px;
  background: var(--ac-surface-sunken);
  border-radius: var(--ac-radius-md, 8px);
  border: 1px solid var(--ac-line-hairline);
  flex-wrap: wrap;
  gap: 8px 12px;
}

[data-ac-ui="v2"] .ac-financial-note {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ac-text-secondary);
  padding: 8px 12px;
  border-left: 3px solid var(--ac-brand);
  background: var(--ac-surface-raised);
  border-radius: 0 var(--ac-radius-sm, 6px) var(--ac-radius-sm, 6px) 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

#marketStructureTable tbody tr {
  cursor: pointer;
  transition: background var(--motion-hover, 140ms) var(--ease-standard);
}

#marketStructureTable tbody tr:hover {
  background: var(--ac-surface-hover, rgba(0, 0, 0, 0.03));
}

#marketStructureTable tbody tr.is-selected {
  background: var(--ac-surface-selected, rgba(16, 185, 129, 0.08));
  box-shadow: inset 3px 0 0 var(--ac-brand);
}

#marketStructureTable td {
  font-variant-numeric: tabular-nums lining-nums;
  -moz-font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
  font-feature-settings: "tnum" 1, "lnum" 1;
}

#marketStructureTable .ac-ticker-symbol {
  font-family: var(--ac-font-mono, monospace);
  font-weight: 700;
  color: var(--ac-brand);
  font-size: 13px;
}

#marketStructureTable .ac-company-sub {
  font-size: 11px;
  color: var(--ac-text-secondary);
  font-weight: 400;
  display: block;
}

.ac-research-note {
  background: var(--ac-surface-raised);
  padding: 8px 10px;
  border-radius: var(--ac-radius-sm, 6px);
  border: 1px solid var(--ac-line-hairline);
}

/* ===== FINANCIAL STATEMENTS WORKSTATION (WAVE 4B, §79.2, §26) ===== */
[data-ac-ui="v2"] .ac-financial-statements {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--ac-line-hairline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

[data-ac-ui="v2"] .ac-financial-statements-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

[data-ac-ui="v2"] .ac-financial-statements-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ac-text);
  margin: 0;
  line-height: 1.25;
}

[data-ac-ui="v2"] .ac-financial-statements-subtitle {
  font-size: 11.5px;
  color: var(--ac-text-secondary);
  margin: 2px 0 0;
}

[data-ac-ui="v2"] .ac-financial-statements-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Local Mode Button Groups & Canonical v2 Active States */
[data-ac-ui="v2"] .ac-fin-mode-group,
[data-ac-ui="v2"] .ac-fin-period-group {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--ac-surface-sunken);
  padding: 3px;
  border-radius: var(--ac-radius-md, 8px);
  border: 1px solid var(--ac-line-hairline);
}

[data-ac-ui="v2"] .ac-fin-tab-btn,
[data-ac-ui="v2"] .ac-fin-period-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ac-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ac-radius-sm, 6px);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

[data-ac-ui="v2"] .ac-fin-tab-btn:hover,
[data-ac-ui="v2"] .ac-fin-period-btn:hover {
  color: var(--ac-text);
  background: var(--ac-surface-hover);
}

[data-ac-ui="v2"] .ac-fin-tab-btn:focus-visible,
[data-ac-ui="v2"] .ac-fin-period-btn:focus-visible {
  outline: 2px solid var(--ac-brand);
  outline-offset: 1px;
}

[data-ac-ui="v2"] .ac-fin-tab-btn.is-active,
[data-ac-ui="v2"] .ac-fin-tab-btn[aria-selected="true"],
[data-ac-ui="v2"] .ac-fin-period-btn.is-active,
[data-ac-ui="v2"] .ac-fin-period-btn[aria-pressed="true"] {
  background: var(--ac-brand-soft, rgba(5, 150, 105, 0.08));
  color: var(--ac-brand, #059669);
  border-color: rgba(5, 150, 105, 0.28);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}



/* Table Scroll Container & Subtle Affordance */
[data-ac-ui="v2"] .ac-fin-table-scroll-container {
  position: relative;
  width: 100%;
}

[data-ac-ui="v2"] .ac-fin-scroll-hint {
  display: none;
  font-size: 11px;
  color: var(--ac-text-muted);
  text-align: right;
  margin-bottom: 4px;
  transition: opacity 0.25s ease;
  user-select: none;
}

@media (max-width: 768px) {
  [data-ac-ui="v2"] .ac-fin-scroll-hint {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
  }
}

[data-ac-ui="v2"] .ac-fin-scroll-hint.is-scrolled {
  opacity: 0;
  pointer-events: none;
}

[data-ac-ui="v2"] .ac-fin-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--ac-line-hairline);
  border-radius: var(--ac-radius-md, 8px);
  background: var(--ac-surface);
  -webkit-overflow-scrolling: touch;
}

[data-ac-ui="v2"] .ac-table--financial {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

[data-ac-ui="v2"] .ac-table--financial thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ac-surface-raised);
  border-bottom: 1px solid var(--ac-line-hairline);
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ac-text-secondary);
  white-space: nowrap;
  text-align: right;
}

[data-ac-ui="v2"] .ac-table--financial thead th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 4;
  text-align: left;
  background: var(--ac-surface-raised);
  min-width: 220px;
  max-width: 320px;
  box-shadow: 1px 0 0 var(--ac-line-hairline);
}

[data-ac-ui="v2"] .ac-table--financial td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--ac-line-hairline);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
  -moz-font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
  font-feature-settings: "tnum" 1, "lnum" 1;
  color: var(--ac-text);
}

[data-ac-ui="v2"] .ac-table--financial td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  text-align: left;
  background: var(--ac-surface);
  min-width: 220px;
  max-width: 320px;
  box-shadow: 1px 0 0 var(--ac-line-hairline);
}

[data-ac-ui="v2"] .ac-table--financial tr:hover td {
  background: var(--ac-surface-hover, rgba(0, 0, 0, 0.02));
}

[data-ac-ui="v2"] .ac-table--financial tr:hover td:first-child {
  background: var(--ac-surface-hover, rgba(0, 0, 0, 0.02));
}

[data-theme="dark"] [data-ac-ui="v2"] .ac-table--financial tr:hover td,
[data-theme="dark"] [data-ac-ui="v2"] .ac-table--financial tr:hover td:first-child {
  background: var(--ac-surface-hover, rgba(255, 255, 255, 0.03));
}

/* Row Hierarchies & Safe Sticky Group Labels */
[data-ac-ui="v2"] .ac-table--financial .ac-fin-row-group td {
  background: var(--ac-surface-sunken);
  padding: 0;
  border-top: 1px solid var(--ac-line-hairline);
  border-bottom: 1px solid var(--ac-line-hairline);
  text-align: left;
}

[data-ac-ui="v2"] .ac-table--financial .ac-fin-group-label-sticky {
  position: sticky;
  left: 0;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ac-text);
  white-space: nowrap;
  z-index: 3;
  background: var(--ac-surface-sunken);
}

[data-theme="dark"] [data-ac-ui="v2"] .ac-table--financial .ac-fin-group-label-sticky {
  background: var(--ac-surface-sunken);
  color: var(--ac-text);
}

[data-ac-ui="v2"] .ac-table--financial .ac-fin-row-child td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  padding-left: 28px;
  color: var(--ac-text-secondary);
  background: var(--ac-surface);
}

[data-ac-ui="v2"] .ac-table--financial .ac-fin-row-total td {
  font-weight: 700;
  color: var(--ac-text);
  background: var(--ac-surface-raised);
  border-top: 1px solid var(--ac-line-hairline);
  border-bottom: 2px solid var(--ac-line-hairline);
}

[data-ac-ui="v2"] .ac-table--financial .ac-fin-row-total td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--ac-surface-raised);
}

@media (max-width: 480px) {
  [data-ac-ui="v2"] .ac-table--financial thead th:first-child,
  [data-ac-ui="v2"] .ac-table--financial td:first-child {
    min-width: 160px;
    max-width: 190px;
    font-size: 11.5px;
    padding-left: 8px;
    padding-right: 8px;
  }
  [data-ac-ui="v2"] .ac-table--financial .ac-fin-row-child td:first-child {
    padding-left: 20px;
  }
  [data-ac-ui="v2"] .ac-table--financial .ac-fin-group-label-sticky {
    display: block;
    white-space: normal;
    word-break: break-word;
    max-width: 185px;
    line-height: 1.35;
  }
}

/* Semantic Value Restraint */
[data-ac-ui="v2"] .ac-fin-negative {
  color: var(--ac-negative, #E11D48) !important;
  font-weight: 600;
}



/* ==========================================================================
   Wave 5: Screener Table-First Workstation & Sektor Hot (§82, §83.2)
   ========================================================================== */
[data-ac-ui="v2"] #screenerTableBody tr.is-selected,
[data-ac-ui="v2"] #nkScreenerTableBody tr.is-selected,
[data-ac-ui="v2"] #dtScreenerTableBody tr.is-selected,
[data-ac-ui="v2"] #sektorGroupsTableBody tr.is-selected {
  background-color: rgba(16, 185, 129, 0.12);
  outline: 1px solid rgba(16, 185, 129, 0.35);
}

[data-ac-ui="v2"] #screenerTableBody tr.is-selected td.sticky,
[data-ac-ui="v2"] #nkScreenerTableBody tr.is-selected td.sticky,
[data-ac-ui="v2"] #dtScreenerTableBody tr.is-selected td.sticky {
  background-color: rgba(20, 24, 33, 0.98);
}

[data-ac-ui="v2"] #sektorTableWrap table,
[data-ac-ui="v2"] #sektorDetailTable table {
  font-variant-numeric: tabular-nums;
}

[data-ac-ui="v2"] #sektorBtnTable.is-active,
[data-ac-ui="v2"] #sektorBtnGrid.is-active,
[data-ac-ui="v2"] #kgBtnTable.is-active,
[data-ac-ui="v2"] #kgBtnCard.is-active,
[data-ac-ui="v2"] #nkBtnTable.is-active,
[data-ac-ui="v2"] #nkBtnCard.is-active,
[data-ac-ui="v2"] #dtBtnTable.is-active,
[data-ac-ui="v2"] #dtBtnCard.is-active {
  color: var(--ac-brand, #10b981);
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}



/* ==========================================================================
   Wave 6: Dashboard & Research Lenses (DESIGN.md §15, §18-§25, §82)
   ========================================================================== */

/* 1. Continuous Calm Market-Condition Strip */
#page-dashboard[data-ac-ui="v2"] .market-band-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  background: var(--ac-surface, #131922);
  border: 1px solid var(--ac-border-subtle, rgba(255, 255, 255, 0.08));
  border-radius: var(--ac-radius-lg, 12px);
  overflow: hidden;
  gap: 0;
}

#page-dashboard[data-ac-ui="v2"] .market-tile {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 1rem 1.25rem;
  border-right: 1px solid var(--ac-border-subtle, rgba(255, 255, 255, 0.08)) !important;
  min-height: auto;
}

#page-dashboard[data-ac-ui="v2"] .market-tile:last-child {
  border-right: none !important;
}

@media (max-width: 768px) {
  #page-dashboard[data-ac-ui="v2"] .market-band-grid {
    grid-template-columns: 1fr;
  }
  #page-dashboard[data-ac-ui="v2"] .market-tile {
    border-right: none !important;
    border-bottom: 1px solid var(--ac-border-subtle, rgba(255, 255, 255, 0.08)) !important;
  }
  #page-dashboard[data-ac-ui="v2"] .market-tile:last-child {
    border-bottom: none !important;
  }
}

html.light #page-dashboard[data-ac-ui="v2"] .market-band-grid {
  background: #ffffff;
  border-color: #e2e8f0;
}

html.light #page-dashboard[data-ac-ui="v2"] .market-tile {
  border-right-color: #e2e8f0 !important;
  border-bottom-color: #e2e8f0 !important;
}

/* 2. Compact Top 5 Decision Rows */
#page-dashboard[data-ac-ui="v2"] .dashboard-decision-row {
  outline: none;
  border-color: var(--ac-border-subtle, rgba(255, 255, 255, 0.08));
  background: var(--ac-surface-2, rgba(255, 255, 255, 0.02));
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

#page-dashboard[data-ac-ui="v2"] .dashboard-decision-row:hover,
#page-dashboard[data-ac-ui="v2"] .dashboard-decision-row:focus-visible {
  background: var(--ac-surface-3, rgba(255, 255, 255, 0.04));
  border-color: rgba(16, 185, 129, 0.35);
}

html.light #page-dashboard[data-ac-ui="v2"] .dashboard-decision-row {
  background: #ffffff;
  border-color: #e2e8f0;
}

html.light #page-dashboard[data-ac-ui="v2"] .dashboard-decision-row:hover,
html.light #page-dashboard[data-ac-ui="v2"] .dashboard-decision-row:focus-visible {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* 3. Subtle Low-Noise Excluded Disclosure */
#page-dashboard[data-ac-ui="v2"] .dashboard-excluded-disclosure {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--ac-border-subtle, rgba(255, 255, 255, 0.06));
}

#page-dashboard[data-ac-ui="v2"] .dashboard-excluded-disclosure[open] {
  background: rgba(255, 255, 255, 0.03);
}

html.light #page-dashboard[data-ac-ui="v2"] .dashboard-excluded-disclosure {
  background: #f8fafc;
  border-color: #e2e8f0;
}

/* 4. Top 5 History Table */
#page-dashboard[data-ac-ui="v2"] #top5HistoryList table {
  border-collapse: collapse;
}

#page-dashboard[data-ac-ui="v2"] #top5HistoryList thead th {
  position: sticky;
  top: 0;
  background: var(--ac-surface-1, #101620);
  z-index: 10;
}

html.light #page-dashboard[data-ac-ui="v2"] #top5HistoryList thead th {
  background: #f1f5f9;
  color: #475569;
}

/* 5. Ranking Spreadsheet Table */
#rankingTableWrap table {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums lining-nums;
}

#rankingTableWrap thead th {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* 6. Research Lenses Motion Restraint */
@media (prefers-reduced-motion: reduce) {
  .action-card:hover { transform: none; }
  .panel table tbody tr { transition: none !important; }
  .ac-broker-bubble,
  #insiderNetworkSvg *,
  .dashboard-decision-row {
    animation: none !important;
    transition: none !important;
  }
}

/* =========================================================================
   WAVE 6D: FINAL GEOMETRY CORRECTION — DESKTOP + MOBILE + LIGHT/DARK
   ========================================================================= */

/* 1. Desktop: Completely remove .app-header from desktop layout flow */
@media (min-width: 1024px) {
  #appMain > .app-header {
    display: none !important;
  }

  /* Single canonical owner of desktop outer page gutter */
  #appContent {
    padding-top: 14px !important;
    padding-bottom: 32px !important;
    padding-inline: 18px !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Eliminate accumulated nested padding on all authenticated pages */
  .page-content,
  #page-dashboard,
  #page-screener,
  #page-sektor,
  #page-analisis,
  #page-chart,
  #page-news,
  #page-portofolio,
  #page-trackrecord,
  #page-watchlist,
  #page-subscription {
    padding-inline: 0 !important;
    padding-top: 0 !important;
    margin-inline: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* 2. Mobile & Tablet: Header remains; Drawer footer separates strictly */
@media (max-width: 1023px) {
  #appMain > .app-header {
    display: block !important;
  }

  #appSidebar .sidebar-footer {
    padding: 10px 12px !important;
  }

  /* Mobile: Single outer gutter (12px) without nested multiplication */
  #appContent {
    padding-inline: 12px !important;
    padding-top: 10px !important;
    padding-bottom: 32px !important;
    max-width: 100% !important;
  }
  .page-content,
  #page-dashboard,
  #page-screener,
  #page-sektor,
  #page-analisis,
  #page-portofolio,
  #page-trackrecord,
  #page-watchlist {
    padding-inline: 0 !important;
    padding-top: 0 !important;
    margin-inline: 0 !important;
    max-width: 100% !important;
  }
}

/* 3. Mobile Dashboard Density & Market Condition Surface */
@media (max-width: 640px) {
  .dashboard-hero {
    padding: 12px 14px !important;
    margin-bottom: 12px !important;
    border-radius: 12px !important;
  }
  .dashboard-hero h2,
  .dashboard-hero h1 {
    font-size: 18px !important;
    margin-top: 6px !important;
    margin-bottom: 4px !important;
  }
  .dashboard-hero p {
    font-size: 11px !important;
    line-height: 1.4 !important;
    margin-top: 4px !important;
  }
  #page-dashboard .ac-section,
  #page-dashboard .space-y-4 > * + * {
    margin-top: 14px !important;
  }
  #page-dashboard[data-ac-ui="v2"] .market-tile {
    padding: 8px 12px !important;
  }
  #page-dashboard[data-ac-ui="v2"] .market-tile .market-tile-value {
    font-size: 18px !important;
    line-height: 1.1 !important;
  }
}

/* 4. Research Routes: Remove decorative page-sized white sheets and black frames */
.analisis-tab-panel > .unified-card,
html.light .analisis-tab-panel > .unified-card,
html:not(.light) .analisis-tab-panel > .unified-card {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
}

#analisisPartialMount,
html.light #analisisPartialMount,
html:not(.light) #analisisPartialMount {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

/* 5. Desktop Page Headings sit clean and high */
#page-analisis .page-header,
.page-header {
  margin-top: 0 !important;
  margin-bottom: 12px !important;
}
#page-analisis .page-title,
.page-title {
  font-size: 20px !important;
  line-height: 1.2 !important;
  margin-bottom: 2px !important;
}
#page-analisis .page-subtitle,
.page-subtitle {
  font-size: 11px !important;
  line-height: 1.4 !important;
}

/* 6. Dark Mode: Flat matte clean surfaces without noisy radial gradients or glows */
html:not(.light) .dashboard-hero {
  background: var(--color-bg-surface, #11161d) !important;
  border-color: var(--color-border-subtle, #1e2632) !important;
  box-shadow: none !important;
}
html:not(.light) .dashboard-hero::after {
  display: none !important;
}

/* 7. Compact Local Error States (Requirement 16) */
.ac-error-state,
#brokerHunterContent .border-red-500\/20,
#bandarmologiIntelContent .border-red-500\/20 {
  max-width: 520px !important;
  margin: 16px auto !important;
  padding: 14px 18px !important;
}

/* ===== WAVE 8: AUTH, ACCOUNT, ACCESS & SYSTEM LIFECYCLE STATES ===== */

/* System States & Maintenance in Light Mode */


html.light #maintenanceScreen,
html.light #serviceStatusScreen,
html.light #blockedScreen {
  background-color: #f3f5f4 !important;
}

html.light .maintenance-card {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06) !important;
}

html.light .maintenance-brand {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
}

html.light .maintenance-brand strong {
  color: #0f172a !important;
}

html.light .maintenance-brand small {
  color: #64748b !important;
}

html.light .maintenance-eyebrow {
  color: #b45309 !important; /* amber-700 / WCAG AA 4.8:1 on white */
}

html.light .maintenance-title {
  color: #0f172a !important;
}

html.light .maintenance-message {
  color: #334155 !important;
}

html.light .maintenance-facts {
  background: #f8fafc !important;
  border: 1px solid rgba(15, 23, 42, 0.07) !important;
}

html.light .maintenance-facts li {
  color: #334155 !important;
}

html.light .maintenance-foot {
  color: #64748b !important;
}

html.light .maintenance-admin {
  border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
}

html.light .maintenance-admin-btn {
  color: #64748b !important;
}

html.light .maintenance-admin-btn:hover {
  color: #0f172a !important;
  background: rgba(15, 23, 42, 0.04) !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
}

html.light #blockedScreen > div {
  background: #ffffff !important;
  border: 1px solid rgba(239, 68, 68, 0.25) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06) !important;
}

html.light #blockedScreen h2 {
  color: #0f172a !important;
}

html.light #blockedScreen p.text-red-300 {
  color: #b91c1c !important;
}

html.light #blockedScreen #blockedCountdown {
  color: #475569 !important;
}

html.light #blockedScreen p.text-gray-600 {
  color: #64748b !important;
}

/* System States & Maintenance in Dark Mode */
html:not(.light) .maintenance-title,
html.dark .maintenance-title {
  color: #f1f5f9 !important;
}

html:not(.light) .maintenance-message,
html.dark .maintenance-message {
  color: #cbd5e1 !important;
}

html:not(.light) .maintenance-facts li,
html.dark .maintenance-facts li {
  color: #94a3b8 !important;
}

html:not(.light) .maintenance-foot,
html.dark .maintenance-foot {
  color: #6b7a90 !important;
}

/* Legacy Gmail Completion Dialog */
html.light .legacy-gmail-dialog {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12) !important;
}

html.light .legacy-gmail-dialog h2 {
  color: #0f172a !important;
}

html.light .legacy-gmail-dialog p {
  color: #334155 !important;
}

html.light .legacy-gmail-dialog label {
  color: #334155 !important;
}

html.light .legacy-gmail-dialog input {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html.light .legacy-gmail-dialog input:focus {
  border-color: #059669 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

html.light .legacy-gmail-dialog button[type=button] {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}

html.light .legacy-gmail-dialog #legacyGmailError {
  color: #b91c1c !important;
}

html:not(.light) .legacy-gmail-dialog h2,
html.dark .legacy-gmail-dialog h2 {
  color: #f1f5f9 !important;
}

/* Account Center Light Mode Contrast & Registration Terms */
html.light #acAccountCenter .ac-card span[style*="6ee7b7"],
html.light #acAccountCenter span[style*="#6ee7b7"] {
  color: #047857 !important;
}

html.light #acAccountCenter .ac-card span[style*="93c5fd"],
html.light #acAccountCenter span[style*="#93c5fd"] {
  color: #1d4ed8 !important;
}

html.light #acAccountCenter div[style*="94a3b8"],
html.light #acAccountCenter p[style*="94a3b8"] {
  color: #475569 !important;
}

html.light #acAccountCenter span[style*="fde68a"] {
  color: #b45309 !important;
}

html.light #acAccountCenter label[style*="cbd5e1"] {
  color: #334155 !important;
}

html.light #acTermsRegistration {
  background: rgba(15, 116, 88, 0.05) !important;
  border-color: rgba(15, 116, 88, 0.16) !important;
}

html.light .ac-reg-terms-copy {
  color: #334155 !important;
}

html.light .ac-reg-terms-link {
  color: #0f7458 !important;
  text-decoration-color: rgba(15, 116, 88, 0.35) !important;
}

/* AI BYOK Settings Modal in Light Mode */
html.light #aiApiKeyModal > div {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.12) !important;
  color: #0f172a !important;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.14) !important;
}

html.light #aiApiKeyModal h3 {
  color: #0f172a !important;
}

html.light #aiApiKeyModal p,
html.light #aiApiKeyModal .text-gray-300,
html.light #aiApiKeyModal .text-gray-400 {
  color: #334155 !important;
}

html.light #aiApiKeyModal .bg-\[\#0b0e14\] {
  background: #f8fafc !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
}

html.light #aiApiKeyModal .font-semibold.text-gray-200 {
  color: #0f172a !important;
}

html.light #aiApiKeyModal input {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.16) !important;
  color: #0f172a !important;
}

html.light #aiApiKeyModal button[onclick*="closeAiApiKeyModal"] {
  background: #e2e8f0 !important;
  color: #1e293b !important;
}



/* =========================================================================
   Wave 8B — Login refinements, Google placeholder, approval states,
   Auth-choice session-expiry emphasis, Account Center compact,
   System state mobile text compression
   ========================================================================= */

/* --- Auth choice modal: session expiry emphasis --- */
/* When data-context="expiry", the Login card is visually emphasized.    */
/* The Daftar card is de-emphasized — user already has an account.       */
#authChoiceModal[data-context="expiry"] .landing-auth-card:first-of-type {
  border-color: rgba(16, 185, 129, 0.45) !important;
  background: rgba(16, 185, 129, 0.09) !important;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.12);
}
#authChoiceModal[data-context="expiry"] .landing-auth-card:first-of-type > span:first-child {
  color: #a7f3d0 !important;
}
#authChoiceModal[data-context="expiry"] .landing-auth-card:last-of-type {
  opacity: 0.52;
}

/* --- Approval state reference cards --- */
.approval-states-ref {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  margin-top: 4px;
}
.approval-state-card {
  display: grid;
  grid-template-columns: 20px 1fr;
  grid-template-rows: auto auto;
  gap: 2px 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 12px;
  background: rgba(10, 17, 27, 0.55);
  align-items: start;
}
.approval-state-icon {
  grid-row: 1 / 3;
  font-size: 14px;
  line-height: 1.4;
  align-self: center;
  text-align: center;
}
.approval-state-label {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}
.approval-state-note {
  font-size: 10px;
  line-height: 1.5;
  color: #7f91aa;
}

/* Pending (current step) */
.approval-state-pending {
  border-color: rgba(245, 158, 11, 0.30);
  background: rgba(245, 158, 11, 0.06);
}
.approval-state-pending .approval-state-icon { color: #fbbf24; }
.approval-state-pending .approval-state-label { color: #fde68a; }
.approval-state-pending[aria-current="true"] {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.10);
}

/* Approved */
.approval-state-approved {
  border-color: rgba(16, 185, 129, 0.20);
  background: rgba(16, 185, 129, 0.04);
  opacity: 0.60;
}
.approval-state-approved .approval-state-icon { color: #34d399; }
.approval-state-approved .approval-state-label { color: #a7f3d0; }

/* Rejected / not yet approved */
.approval-state-rejected {
  border-color: rgba(148, 163, 184, 0.12);
  background: rgba(2, 6, 12, 0.40);
  opacity: 0.55;
}
.approval-state-rejected .approval-state-icon { color: #64748b; }
.approval-state-rejected .approval-state-label { color: #94a3b8; }

/* Light mode: approval cards */
html.light .approval-state-card {
  background: rgba(241, 245, 249, 0.75);
  border-color: rgba(15, 23, 42, 0.10);
}
html.light .approval-state-note { color: #64748b; }
html.light .approval-state-pending {
  background: rgba(245, 158, 11, 0.07);
  border-color: rgba(245, 158, 11, 0.30);
}
html.light .approval-state-pending .approval-state-label { color: #92400e; }
html.light .approval-state-approved {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.22);
}
html.light .approval-state-approved .approval-state-label { color: #065f46; }
html.light .approval-state-rejected .approval-state-label { color: #475569; }

/* --- Account Center: compact desktop --- */
/* Reduce max width from 1040px to 880px. Grid tighter. */
html:not([class*="mobile"]) .ac-center-shell {
  width: min(880px, 100%);
  max-height: min(84dvh, 800px);
}
/* Denser grid on desktop */
@media (min-width: 761px) {
  .ac-center-grid { gap: 10px; }
  .ac-center-head { padding: 18px 22px 13px; }
  .ac-center-body { padding: 16px 22px 22px; }
  .ac-card { padding: 14px; }
  .ac-fact { padding: 9px 11px; }
}

/* --- System state: mobile text compression --- */
/* Maintenance/serviceStatus screens: shorten fact list on small screens */
@media (max-width: 640px) {
  .maintenance-facts {
    font-size: 12px;
    line-height: 1.5;
  }
  .maintenance-message {
    font-size: 13px;
  }
  .maintenance-foot {
    font-size: 11px;
  }
  /* Compact the card padding */
  .maintenance-card {
    padding: 22px 18px 20px !important;
  }
}

/* Light mode: auth choice modal divider text */
html.light #authChoiceModal[data-context="expiry"] .landing-auth-card:first-of-type > span:first-child {
  color: #065f46 !important;
}
html.light #authChoiceModal[data-context="expiry"] .landing-auth-card:first-of-type {
  border-color: rgba(16, 185, 129, 0.45) !important;
  background: rgba(16, 185, 129, 0.07) !important;
}


/* --- Login & Register primary CTA buttons: ensure crisp brand emerald and white text in BOTH modes --- */
:is(#loginModal, #registerModal, #selfResetModal, #resetPasswordModal) #loginBtn,
:is(#loginModal, #registerModal, #selfResetModal, #resetPasswordModal) #registerBtn,
:is(#loginModal, #registerModal, #selfResetModal, #resetPasswordModal) button[type="submit"] {
  background: linear-gradient(135deg, #059669, #10b981) !important;
  color: #ffffff !important;
  border: 1px solid rgba(16, 185, 129, 0.35) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.22) !important;
  font-weight: 700 !important;
}
:is(#loginModal, #registerModal, #selfResetModal, #resetPasswordModal) #loginBtn:hover,
:is(#loginModal, #registerModal, #selfResetModal, #resetPasswordModal) #registerBtn:hover,
:is(#loginModal, #registerModal, #selfResetModal, #resetPasswordModal) button[type="submit"]:hover {
  background: linear-gradient(135deg, #10b981, #059669) !important;
  color: #ffffff !important;
}


/* =========================================================================
   Wave 8D — Final Visual QC: Mobile Account Center readability &
   single-line Google button & active approval status presentation
   ========================================================================= */

/* --- Task 1: Prominent single active approval status --- */
.approval-active-status {
  margin: 4px 0 2px;
}
.approval-active-status .approval-state-card {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  background: rgba(245, 158, 11, 0.08) !important;
  text-align: left !important;
}
.approval-active-status .approval-state-icon {
  font-size: 16px !important;
  line-height: 1.2 !important;
  color: #fbbf24 !important;
  flex-shrink: 0 !important;
  margin-top: 1px !important;
}
.approval-active-status .approval-state-content {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  min-width: 0 !important;
}
.approval-active-status .approval-state-label {
  font-size: 12px !important;
  font-weight: 800 !important;
  color: #fde68a !important;
}
.approval-active-status .approval-state-note {
  font-size: 11px !important;
  line-height: 1.5 !important;
  color: #cbd5e1 !important;
}

/* Light mode active approval status */
html.light .approval-active-status .approval-state-card {
  background: rgba(254, 243, 199, 0.65) !important;
  border-color: rgba(217, 119, 6, 0.35) !important;
}
html.light .approval-active-status .approval-state-icon {
  color: #d97706 !important;
}
html.light .approval-active-status .approval-state-label {
  color: #92400e !important;
}
html.light .approval-active-status .approval-state-note {
  color: #475569 !important;
}

/* --- Task 2: Mobile Account Center readability, wrapping tabs & touch targets --- */
@media (max-width: 760px) {
  #acAccountCenter .ac-center-tabs {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 0 16px 14px !important;
    overflow-x: visible !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12) !important;
  }
  #acAccountCenter .ac-center-tab {
    flex: 1 1 calc(50% - 4px) !important;
    justify-content: center !important;
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 0 12px !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    text-align: center !important;
    border: 1px solid rgba(148, 163, 184, 0.22) !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }
  #acAccountCenter .ac-center-tab[data-ac-tab="terms"] {
    flex: 1 1 100% !important;
  }
  #acAccountCenter .ac-center-close {
    width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    min-width: 44px !important;
    flex: 0 0 44px !important;
    box-sizing: border-box !important;
    display: grid !important;
    place-items: center !important;
    font-size: 22px !important;
  }
  #acAccountCenter .ac-section-kicker {
    font-size: 11px !important;
    letter-spacing: 0.12em !important;
  }
  #acAccountCenter .ac-section-title {
    font-size: 16px !important;
  }
  #acAccountCenter .ac-fact {
    padding: 11px 13px !important;
  }
  #acAccountCenter .ac-fact dt {
    font-size: 12px !important;
    font-weight: 600 !important;
  }
  #acAccountCenter .ac-fact dd {
    font-size: 13px !important;
    font-weight: 700 !important;
  }
}

/* Light mode mobile Account Center readability & tabs */
html.light #acAccountCenter .ac-fact dt {
  color: #475569 !important;
}
html.light #acAccountCenter .ac-fact dd {
  color: #0f172a !important;
}
html.light #acAccountCenter .ac-section-kicker {
  color: #475569 !important;
}
html.light #acAccountCenter .ac-center-tab {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}
html.light #acAccountCenter .ac-center-tab:hover {
  background: #f8fafc !important;
  color: #0f172a !important;
}
html.light #acAccountCenter .ac-center-tab[aria-selected="true"] {
  color: #065f46 !important;
  background: rgba(16, 185, 129, 0.10) !important;
  border-color: rgba(16, 185, 129, 0.40) !important;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.15) !important;
}
html.light #acAccountCenter .ac-chip {
  color: #1e293b !important;
}
html.light #acAccountCenter .ac-chip-ok {
  color: #065f46 !important;
  background: rgba(16, 185, 129, 0.14) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

/* Dark mode mobile Account Center tabs */
[data-theme="dark"] #acAccountCenter .ac-center-tab,
html.dark #acAccountCenter .ac-center-tab {
  background: rgba(15, 23, 42, 0.65) !important;
  border-color: rgba(148, 163, 184, 0.20) !important;
  color: #94a3b8 !important;
}
[data-theme="dark"] #acAccountCenter .ac-center-tab:hover,
html.dark #acAccountCenter .ac-center-tab:hover {
  background: rgba(30, 41, 59, 0.85) !important;
  color: #ffffff !important;
}
[data-theme="dark"] #acAccountCenter .ac-center-tab[aria-selected="true"],
html.dark #acAccountCenter .ac-center-tab[aria-selected="true"] {
  color: #a7f3d0 !important;
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.45) !important;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.15) !important;
}

/* Extra small mobile screens (<= 360px) */
@media (max-width: 360px) {
  #acAccountCenter .ac-center-head {
    padding: 14px 14px 10px !important;
  }
  #acAccountCenter .ac-center-tabs {
    padding: 0 12px 12px !important;
    gap: 6px !important;
  }
  #acAccountCenter .ac-center-tab {
    padding: 0 8px !important;
    font-size: 11.5px !important;
  }
  #acAccountCenter .ac-center-body {
    padding: 12px 14px 20px !important;
  }
}

/* Touch / Coarse pointer screener inputs and mode buttons (D3 audit contract) */
@media (pointer: coarse) {
  #page-screener select,
  #page-screener input:not([type="checkbox"]) {
    min-height: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }
  #page-screener :is(#scrTypeKonglo, #scrTypeNonKonglo, #scrTypeDayTrade) {
    min-height: 44px !important;
    height: 44px !important;
  }
  #page-screener.page-content select,
  #page-screener.page-content input:not([type="checkbox"]) {
    min-height: 44px !important;
    height: 44px !important;
    font-size: 16px !important;
    box-sizing: border-box !important;
  }
  #page-screener.page-content :is(#scrTypeKonglo, #scrTypeNonKonglo, #scrTypeDayTrade) {
    min-height: 44px !important;
    height: 44px !important;
  }
}

@media (max-width: 768px) {
  #wlRefreshBtn,
  #trackRecordRefreshBtn {
    min-height: 44px !important;
    height: 44px !important;
  }
}


/* Market Structure Isolated Scroll & Sticky Header (Batch 3) */
#marketStructureTableContainer {
  max-height: min(65vh, 680px);
  overflow-y: auto;
  border-radius: var(--ac-radius-sm, 6px);
  position: relative;
}

#marketStructureTableContainer {
  max-height: min(65vh, 680px) !important;
  overflow-y: auto !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
  touch-action: pan-y pinch-zoom !important;
  overscroll-behavior: contain !important;
}

.ac-market-structure-layout,
.ac-market-structure-main {
  overflow: visible !important;
  min-height: 0 !important;
}

#marketStructureTable thead,
#marketStructureTableContainer thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 40 !important;
  background-color: #111827 !important;
}

#marketStructureTableContainer thead th,
#marketStructureTable thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 40 !important;
  background-color: #111827 !important;
  box-shadow: inset 0 -1px 0 rgba(51, 65, 85, 0.6) !important;
}

#marketStructureTableContainer thead th:first-child,
#marketStructureTable thead th:first-child {
  position: sticky !important;
  top: 0 !important;
  left: 0 !important;
  z-index: 50 !important;
  background-color: #111827 !important;
  box-shadow: inset 0 -1px 0 rgba(51, 65, 85, 0.6) !important;
}

#marketStructureTable tbody td:first-child,
#marketStructureTable .ac-ticker-sticky-cell {
  position: sticky !important;
  left: 0 !important;
  z-index: 10 !important;
  background-color: #0f172a !important;
}

.ac-research-shareholders table {
  table-layout: auto;
}

.ac-research-shareholders table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}


/* Track Record Table Layout Alignment (Batch 4) */
#trTableWrap table {
  table-layout: fixed !important;
  min-width: 1040px !important;
  width: 100% !important;
}
#trTableWrap th,
#trTableWrap td {
  box-sizing: border-box !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
.tr-subtext-line {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}


/* BATCH 5: Global Layout & Screener Responsive Optimization */
#page-analisis,
.unified-cockpit-shell {
  max-width: 1600px !important;
  width: 100% !important;
}

[data-ac-ui="v2"] .ac-financial-container,
#panel-tab-market-structure[data-ac-ui="v2"] .ac-market-structure-layout {
  max-width: 1600px !important;
  width: 100% !important;
}

#page-analisis,
.unified-cockpit-shell,
.ac-financial-container,
.ac-market-structure-layout {
  max-width: 1600px !important;
  width: 100% !important;
  margin-left: auto;
  margin-right: auto;
}

.ac-split-view.is-card-mode {
  display: block !important;
}

.ac-split-view.is-card-mode .ac-split-view__main {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100% !important;
}

.ac-split-view.is-card-mode .ac-split-view__pane {
  display: none !important;
}

[data-ac-ui="v2"] .ac-split-view.is-card-mode,
.ac-split-view.is-card-mode {
  display: block !important;
  width: 100% !important;
}

[data-ac-ui="v2"] .ac-split-view.is-card-mode .ac-split-view__main,
.ac-split-view.is-card-mode .ac-split-view__main {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 1 100% !important;
}

[data-ac-ui="v2"] .ac-split-view.is-card-mode .ac-split-view__pane,
.ac-split-view.is-card-mode .ac-split-view__pane,
.ac-split-view.is-card-mode #screenerDetailPane,
.ac-split-view.is-card-mode #dtDetailPane,
.ac-split-view.is-card-mode #kgSplitPane,
.ac-split-view.is-card-mode #dtSplitPane,
.ac-split-view.is-card-mode .ac-detail-pane {
  display: none !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  flex: 0 0 0% !important;
  visibility: hidden !important;
}

.ac-split-view.is-card-mode #kgCardGrid,
.ac-split-view.is-card-mode #nkCardGrid,
.ac-split-view.is-card-mode #dtCardGrid {
  width: 100% !important;
  display: grid !important;
}

#appContent {
  padding-top: 8px !important;
}

@media (min-width: 1024px) {
  #appContent {
    padding-top: 8px !important;
  }
}

:root {
  --ac-page-max: 1600px;
}

#appContent {
  max-width: 1600px !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: calc(100vh - 10px) !important;
  box-sizing: border-box !important;
}

.page-content,
#page-dashboard,
#page-screener,
#page-sektor,
#page-analisis,
#page-chart,
#page-news,
#page-portofolio,
#page-trackrecord,
#page-watchlist,
#page-subscription,
#page-financial,
#page-struktur-pasar,
#page-track-record,
#panel-tab-market-structure,
#panel-tab-financial,
.ac-financial-container,
.ac-market-structure-layout,
.unified-cockpit-shell {
  max-width: 100% !important;
  width: 100% !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box !important;
}

.page-content {
  flex: 1 0 auto !important;
  min-height: calc(100vh - 80px) !important;
  padding-bottom: 48px !important;
  padding-top: 14px !important;
}

#bandarSearchBarContainer {
  display: none !important;
}

@media (max-width: 640px) {
  #marketStructureDataPeriodBadge {
    display: inline-flex !important;
    max-width: 100% !important;
    font-size: 10.5px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }
}

/* Financial & generic data table typography & padding */
.ac-financial-table,
.ac-table,
.ac-table-dense {
  font-size: 13px !important;
}
.ac-financial-table th,
.ac-financial-table td,
.ac-table th,
.ac-table td,
.ac-table-dense th,
.ac-table-dense td {
  padding-top: 0.625rem !important;
  padding-bottom: 0.625rem !important;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

/* Risk guard & status badge whitespace fixes — no broken words */
.ac-badge,
.ac-badge-warning,
.ac-badge-good,
.ac-badge-neutral,
.ac-badge-dim,
#marketStructureGuard,
#marketStructureSheetGuard,
.risk-guard-badge,
.status-struktur-badge,
.ac-metric-tile strong {
  white-space: nowrap !important;
  letter-spacing: normal !important;
  word-break: keep-all !important;
  overflow-wrap: normal !important;
}



#marketStructureAccordionContainer {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  display: none !important;
}

/* Theme-aware accordion surface: dark mode keeps the graph-paper panel, light
   mode switches to a raised white surface so badges keep AA contrast. */
.ac-accordion-card {
  background: var(--ac-surface-raised, rgba(15, 23, 42, 0.75));
  border: 1px solid var(--ac-line-hairline, rgba(51, 65, 85, 0.5));
  border-radius: 0.5rem;
  margin-bottom: 0.5rem;
  transition: all 0.15s ease-in-out;
  overflow: hidden;
}

.ac-accordion-card:hover {
  border-color: var(--ac-line-strong, rgba(71, 85, 105, 0.8));
  background: var(--ac-surface-raised, rgba(15, 23, 42, 0.9));
}

.ac-accordion-card.is-expanded {
  border-color: rgba(16, 185, 129, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* Light mode: the warning badge sits on a near-white card, so the amber tint is
   reduced to keep the label above the 4.5:1 AA floor. Dark mode is untouched. */
html.light #marketStructureAccordionContainer .ac-badge-warning,
[data-theme="light"] #marketStructureAccordionContainer .ac-badge-warning {
  background: rgba(169, 109, 19, 0.03);
  border-color: rgba(169, 109, 19, 0.28);
}

html.light #marketStructureAccordionContainer .ac-badge-neutral,
html.light #marketStructureAccordionContainer .ac-badge-dim,
[data-theme="light"] #marketStructureAccordionContainer .ac-badge-neutral,
[data-theme="light"] #marketStructureAccordionContainer .ac-badge-dim {
  background: rgba(18, 35, 29, 0.04);
  border-color: rgba(18, 35, 29, 0.18);
}

.ac-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  user-select: none;
  gap: 0.75rem;
}

.ac-accordion-chevron {
  transition: transform 0.2s ease;
}

.ac-accordion-card.is-expanded .ac-accordion-chevron {
  transform: rotate(180deg);
}

.ac-accordion-content {
  border-top: 1px solid var(--ac-line-hairline, rgba(51, 65, 85, 0.4));
  background: var(--ac-surface, rgba(11, 17, 33, 0.85));
  padding: 0.75rem;
}

.ac-accordion-empty {
  color: var(--ac-text-secondary, #94a3b8);
}

/* Roster table inside an expanded card. Sized for a dense financial read and
   inherits the current theme surface instead of a fixed dark palette. */
.ac-roster-wrap {
  overflow-x: auto;
  border: 1px solid var(--ac-line-hairline, rgba(51, 65, 85, 0.6));
  border-radius: 0.375rem;
  margin: 0.5rem 0;
}

.ac-roster-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 12px;
}

.ac-roster-table thead th {
  background: var(--ac-surface, rgba(15, 23, 42, 0.95));
  color: var(--ac-text-muted, #94a3b8);
  border-bottom: 1px solid var(--ac-line-hairline, rgba(51, 65, 85, 0.8));
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.5rem 0.75rem;
  white-space: nowrap;
}

.ac-roster-row {
  border-bottom: 1px solid var(--ac-line-hairline, rgba(51, 65, 85, 0.35));
}

.ac-roster-row:last-child {
  border-bottom: none;
}

.ac-roster-num,
.ac-roster-name,
.ac-roster-type,
.ac-roster-center,
.ac-roster-shares,
.ac-roster-pct {
  padding: 0.5rem 0.75rem;
  vertical-align: middle;
}

.ac-roster-num {
  color: var(--ac-text-muted, #94a3b8);
  font-family: var(--ac-font-mono, monospace);
  font-size: 11px;
  width: 2.5rem;
}

.ac-roster-name {
  color: var(--ac-text-strong, #f1f5f9);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ac-roster-type {
  color: var(--ac-text, #cbd5e1);
}

.ac-roster-center {
  text-align: center;
}

.ac-roster-shares,
.ac-roster-pct {
  text-align: right;
  font-family: var(--ac-font-mono, monospace);
  white-space: nowrap;
}

.ac-roster-shares {
  color: var(--ac-text, #e2e8f0);
}

.ac-roster-pct {
  color: var(--ac-bull, #34d399);
  font-weight: 700;
}

.ac-origin-badge {
  display: inline-block;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  line-height: 1.4;
}

.ac-origin-d {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.ac-origin-f {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

html:not(.light) .ac-origin-d,
html[data-theme="dark"] .ac-origin-d {
  color: #34d399;
}

html:not(.light) .ac-origin-f,
html[data-theme="dark"] .ac-origin-f {
  color: #fbbf24;
}

/* ===== FASE 3 REMEDIATION: MARKET STRUCTURE VISUAL & MOBILE FIXES ===== */

/* 1. Mobile Bottom Sheet Stacking Context Fix (Bug #1) */
#marketStructureDetailSheet {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-end !important;
  pointer-events: none !important;
  background: transparent !important;
}

#marketStructureDetailSheet.is-open {
  pointer-events: auto !important;
}

#marketStructureDetailSheet[hidden],
#marketStructureDetailSheet:not(.is-open) {
  display: none !important;
}

#marketStructureDetailSheet #marketStructureSheetBackdrop,
#marketStructureDetailSheet .ac-sheet-backdrop {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10 !important;
  background: rgba(0, 0, 0, 0.65) !important;
  backdrop-filter: blur(3px) !important;
  -webkit-backdrop-filter: blur(3px) !important;
  touch-action: none !important;
}

#marketStructureDetailSheet .ac-sheet-content {
  position: relative !important;
  z-index: 20 !important;
  width: 100% !important;
  max-height: 85vh !important;
  max-height: 85dvh !important;
  background: #0b1120 !important;
  background-color: #0b1120 !important;
  border-top: 1px solid rgba(51, 65, 85, 0.8) !important;
  border-radius: 16px 16px 0 0 !important;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
}

#marketStructureDetailSheet .ac-detail-sheet-body {
  background: #0b1120 !important;
  background-color: #0b1120 !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

/* 2. Mobile Emiten Card View <= 640px (Bug #2) */
.ac-emiten-card {
  transition: all 0.15s ease-in-out;
  touch-action: manipulation;
}
.ac-emiten-card:hover,
.ac-emiten-card:focus-visible {
  border-color: rgba(16, 185, 129, 0.5) !important;
  outline: none;
}
.ac-emiten-card.is-selected {
  border-color: rgba(16, 185, 129, 0.7) !important;
  background: rgba(30, 41, 59, 0.95) !important;
}

/* 3. Responsive Viewport Switch: Desktop Table vs Mobile Cards (Bug #1) */
@media (min-width: 641px) {
  #marketStructureTableWrap:not([hidden]):not(.is-empty-hidden),
  .ac-market-structure-table-wrap:not([hidden]):not(.is-empty-hidden) {
    display: block !important;
  }
  #marketStructureCardsContainer,
  .ac-market-structure-cards {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .maintenance-facts {
    font-size: 12px;
    line-height: 1.5;
  }
  #marketStructureTableWrap,
  .ac-market-structure-table-wrap {
    display: none !important;
  }
  #marketStructureCardsContainer:not([hidden]):not(.is-empty-hidden),
  .ac-market-structure-cards:not([hidden]):not(.is-empty-hidden) {
    display: flex !important;
    flex-direction: column !important;
  }
}

#marketStructureTableWrap.is-empty-hidden,
#marketStructureCardsContainer.is-empty-hidden,
#marketStructurePaginationBar.is-empty-hidden {
  display: none !important;
}

/* 4. Market Structure Toolbar & Search Input (Bug #4) */
@media (max-width: 768px) {
  .ac-filter-bar {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    padding: 10px 12px !important;
  }
  .ac-market-structure-search-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  #marketStructureSearchInput,
  #marketStructureSectorSelect {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
  }
}

/* Table Layout Invariant: Fixed, 100% width, No Column Overflow (Fase 3R Polishing) */
#marketStructureTable {
  border-collapse: separate !important;
  border-spacing: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
}

#marketStructureTable th,
#marketStructureTable td {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

/* Tablet Responsiveness: Hide secondary columns on tablet <= 1024px to preserve Pemegang Saham Terbesar */
@media (min-width: 641px) and (max-width: 1024px) {
  #marketStructureTable colgroup {
    display: none !important;
  }
  #marketStructureTable {
    width: 100% !important;
  }
  #marketStructureTable th.col-sektor,
  #marketStructureTable td.col-sektor,
  #marketStructureTable th.col-kelengkapan,
  #marketStructureTable td.col-kelengkapan,
  #marketStructureTable th.col-as-of,
  #marketStructureTable td.col-as-of {
    display: none !important;
  }
  #marketStructureTable th:nth-child(1),
  #marketStructureTable td:nth-child(1) {
    width: 75px !important;
  }
  #marketStructureTable th:nth-child(2),
  #marketStructureTable td:nth-child(2) {
    width: 25% !important;
  }
  #marketStructureTable th:nth-child(4),
  #marketStructureTable td:nth-child(4) {
    width: 15% !important;
  }
  #marketStructureTable th:nth-child(5),
  #marketStructureTable td:nth-child(5) {
    width: 18% !important;
  }
  #marketStructureTable th:nth-child(6),
  #marketStructureTable td:nth-child(6) {
    width: 38% !important;
  }
}

@media (min-width: 769px) {
  .ac-market-structure-search-wrap {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
  }
  #marketStructureSearchInput {
    min-width: 380px !important;
    flex: 1 1 380px !important;
    box-sizing: border-box !important;
  }
  #marketStructureSectorSelect {
    flex-shrink: 0 !important;
    min-width: 180px !important;
    box-sizing: border-box !important;
  }
}

#marketStructureFilterGroup.ac-filter-chips {
  width: auto !important;
}

/* 5. Detail Pane Expansion & Metric Tiles (Bugs #3, #5) */
#marketStructureDetailPane {
  width: 440px !important;
  min-width: 420px !important;
  max-width: 460px !important;
  flex: 0 0 440px !important;
}

#marketStructureDetailPane .ac-metric-tile,
#marketStructureDetailSheet .ac-metric-tile {
  padding: 10px 8px !important;
  min-width: 0 !important;
  overflow: hidden !important;
}

#marketStructureDetailPane .ac-metric-tile strong,
#marketStructureDetailSheet .ac-metric-tile strong,
#marketStructureFreeFloat,
#marketStructureHsc,
#marketStructureGuard,
#marketStructureSheetFreeFloat,
#marketStructureSheetHsc,
#marketStructureSheetGuard {
  font-size: 13px !important;
  line-height: 1.25 !important;
  font-weight: 700 !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  word-wrap: normal !important;
  hyphens: none !important;
}

/* 6. Shareholder 2-Level Card Rows in Detail Pane & Mobile Sheet (Bug #2) */
#marketStructureRosterWrap table {
  width: 100% !important;
  min-width: 100% !important;
  table-layout: fixed !important;
}

.ac-roster-item-card {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(51, 65, 85, 0.5);
  transition: background-color 0.15s ease;
}
.ac-roster-item-card:last-child {
  border-bottom: none;
}
.ac-roster-item-card:hover {
  background-color: rgba(30, 41, 59, 0.5);
}

/* 7. Hide duplicate horizontal 9-button analysis lens strip (all lenses are now in the left sidebar) */
#analisisLensesNav,
.analisis-lens-bar {
  display: none !important;
}

/* ==========================================================================
   FASE 6: CHART WORKSTATION TOOLBAR & DRAWER STYLING
   ========================================================================== */
.chart-workstation-toolbar {
  background-color: #0f1319;
  border-bottom: 1px solid #1c2333;
}

.chart-workstation-toolbar button {
  min-height: 32px;
  min-width: 36px;
  touch-action: manipulation;
}

@media (max-width: 640px) {
  .chart-workstation-toolbar {
    padding: 8px;
    gap: 6px;
  }
  .chart-workstation-toolbar button {
    min-height: 44px; /* WCAG 44px touch target on mobile */
    padding: 8px 10px;
  }
}

.chart-workstation-drawer {
  background-color: #0a0d14;
  border-bottom: 1px solid #1e2638;
}

.chart-workstation-drawer input[type="checkbox"] {
  min-width: 16px;
  min-height: 16px;
  cursor: pointer;
}

/* Drawer contrast: Title white, subtitle slate */
.chart-workstation-drawer h3,
[id$="_drawer"] h3,
.chart-workstation-drawer .text-slate-100 {
  color: #ffffff !important;
  font-weight: 700 !important;
}

.chart-workstation-drawer p,
[id$="_drawer"] p,
.chart-workstation-drawer .text-gray-400 {
  color: #94a3b8 !important;
}

/* High contrast for active tab (WCAG AA compliant >= 4.5:1) */
#tabAnalisisVision.active,
#tabAnalisisText.active,
#subTabBtnAnalisisChart.tab-active,
#subTabBtnAnalisisAI.tab-active,
.analisis-subtab.active,
.analisis-subtab.tab-active {
  color: #ffffff !important;
  font-weight: 700 !important;
  background-color: #059669 !important;
}

/* Mobile responsive chart actions wrap and button sizing */
.unified-card-header,
.chart-card-actions,
#analisisChartHeader,
.chart-header-actions {
  flex-wrap: wrap !important;
}

/* ==========================================================================
   FASE 7: COMMAND PALETTE, MARKET BREADTH, SMART BROKSUM, & 8 PRESETS
   ========================================================================== */

/* Command Palette Floating Modal */
.ac-command-palette-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background-color: rgba(3, 7, 18, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 100px 16px 40px;
}

.ac-command-palette-container {
  width: 100%;
  max-width: 680px;
  background-color: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(16, 185, 129, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: paletteScaleIn 0.15s ease-out;
}

@keyframes paletteScaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.ac-command-palette-header {
  padding: 14px 18px;
  border-bottom: 1px solid #1e293b;
  background-color: #0d1526;
}

.ac-command-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ac-command-palette-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 15px;
  outline: none;
  font-weight: 500;
}

.ac-command-palette-input::placeholder {
  color: #64748b;
  font-size: 14px;
}

.ac-command-palette-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.ac-command-palette-close:hover {
  color: #ffffff;
}

.ac-command-palette-body {
  max-height: 420px;
  overflow-y: auto;
  padding: 8px 12px;
}

.ac-command-palette-hint {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  color: #64748b;
  padding: 6px 10px 10px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}

.ac-command-palette-results {
  padding-top: 6px;
}

.ac-palette-section-title {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 10px;
}

.ac-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.12s ease;
  margin-bottom: 3px;
}

.ac-palette-item:hover,
.ac-palette-item.is-selected {
  background-color: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.ac-palette-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.ac-palette-ticker-badge {
  font-family: monospace;
  font-weight: 700;
  font-size: 13px;
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.15);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(16, 185, 129, 0.3);
  min-width: 58px;
  text-align: center;
}

.ac-palette-item-info {
  min-width: 0;
}

.ac-palette-company-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-palette-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}

.ac-palette-board-badge {
  padding: 1px 6px;
  border-radius: 4px;
  background-color: #1e293b;
  color: #94a3b8;
  font-size: 10px;
  font-weight: 600;
}

.ac-palette-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.ac-palette-price {
  font-family: monospace;
  font-weight: 700;
  font-size: 12px;
  color: #38bdf8;
}

.ac-palette-action-hint {
  font-size: 11px;
  color: #10b981;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.ac-palette-item:hover .ac-palette-action-hint,
.ac-palette-item.is-selected .ac-palette-action-hint {
  opacity: 1;
}

.ac-palette-empty {
  text-align: center;
  padding: 32px 16px;
}

.ac-command-palette-footer {
  padding: 10px 18px;
  border-top: 1px solid #1e293b;
  background-color: #0d1526;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Global Top Search Bar Button */
.ac-top-search-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 8px;
  background-color: #111827;
  border: 1px solid #1f2937;
  color: #9ca3af;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 34px;
}

.ac-top-search-trigger:hover {
  background-color: #1f2937;
  border-color: #374151;
  color: #ffffff;
}

.ac-top-search-trigger kbd {
  background-color: #0b0f19;
  border: 1px solid #374151;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
  color: #cbd5e1;
}

/* Market Breadth Card */
.ac-market-breadth-card {
  background-color: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.ac-breadth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.ac-breadth-sentiment-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.ac-breadth-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.ac-breadth-stat-tile {
  background-color: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 10px 12px;
}

.ac-stat-label {
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 4px;
}

.ac-stat-value {
  font-family: monospace;
  font-size: 16px;
  font-weight: 700;
}

.ac-breadth-bar-wrap {
  margin-bottom: 10px;
}

.ac-breadth-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background-color: #1e293b;
}

.ac-bar-gainer {
  background-color: #10b981;
  transition: width 0.3s ease;
}

.ac-bar-flat {
  background-color: #64748b;
  transition: width 0.3s ease;
}

.ac-bar-loser {
  background-color: #f43f5e;
  transition: width 0.3s ease;
}

.ac-breadth-bar-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 11px;
  font-family: monospace;
  font-weight: 600;
}

.ac-breadth-footer-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 11px;
  color: #94a3b8;
  border-top: 1px solid rgba(30, 41, 59, 0.6);
  padding-top: 8px;
  flex-wrap: wrap;
}

.ac-breadth-footer-meta strong {
  color: #ffffff;
}

/* Smart Broker Summary 2-Column */
.ac-smart-broksum-wrap {
  background-color: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 16px;
}

.ac-smart-broksum-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.ac-bandar-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.ac-bandar-status-badge.accum-strong {
  background-color: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.ac-bandar-status-badge.accum-moderate {
  background-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.ac-bandar-status-badge.distrib-strong {
  background-color: rgba(244, 63, 94, 0.2);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

.ac-bandar-status-badge.neutral {
  background-color: rgba(100, 116, 139, 0.2);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.4);
}

.ac-broksum-concentration-row {
  display: grid;
  grid-template-columns: repeat(3, 140px) 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.ac-conc-tile {
  background-color: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 12px;
}

.ac-conc-tile.is-highlight {
  border-color: rgba(16, 185, 129, 0.4);
  background-color: rgba(16, 185, 129, 0.08);
}

.ac-conc-label {
  display: block;
  font-size: 10px;
  color: #94a3b8;
  margin-bottom: 2px;
}

.ac-conc-val {
  font-family: monospace;
  font-size: 15px;
  font-weight: 700;
}

.ac-conc-narrative {
  background-color: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
}

.ac-smart-broksum-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ac-broksum-column {
  background-color: #0a0f1d;
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: hidden;
}

.ac-broksum-column.is-buyer {
  border-top: 2px solid #10b981;
}

.ac-broksum-column.is-seller {
  border-top: 2px solid #f43f5e;
}

.ac-col-header {
  padding: 10px 14px;
  background-color: #0e1628;
  border-bottom: 1px solid #1e293b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ac-broksum-table-scroll {
  max-height: 380px;
  overflow-y: auto;
}

.ac-broksum-table {
  width: 100%;
  border-collapse: collapse;
}

.ac-broksum-table th {
  padding: 8px 12px;
  font-size: 11px;
  color: #64748b;
  background-color: #0b1120;
  border-bottom: 1px solid #1e293b;
  position: sticky;
  top: 0;
  z-index: 1;
}

.ac-broksum-table td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(30, 41, 59, 0.4);
}

.ac-broksum-table tr:hover {
  background-color: rgba(30, 41, 59, 0.4);
}

.ac-broker-origin {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
}

.ac-broker-origin.is-foreign {
  background-color: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.ac-broker-origin.is-domestic {
  background-color: rgba(148, 163, 184, 0.15);
  color: #cbd5e1;
}

/* 8 Screener Presets & Popovers */
.ac-presets-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ac-preset-pill-wrap {
  display: inline-flex;
  align-items: center;
  background-color: #0f172a;
  border: 1px solid #1e293b;
  border-radius: 8px;
  transition: all 0.15s ease;
}

.ac-preset-pill-wrap:hover {
  border-color: #3b82f6;
}

.ac-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ac-preset-btn.is-active {
  color: #34d399;
}

.ac-preset-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.ac-preset-info-btn {
  background: transparent;
  border: none;
  border-left: 1px solid #1e293b;
  color: #64748b;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.ac-preset-info-btn:hover {
  color: #38bdf8;
}

.ac-preset-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  width: 320px;
  background-color: #0b1120;
  border: 1px solid #334155;
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.7);
  padding: 12px 14px;
  animation: paletteScaleIn 0.12s ease-out;
}

.ac-popover-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #1e293b;
}

.ac-preset-results-card {
  background-color: #0b1120;
  border: 1px solid #1e293b;
  border-radius: 12px;
  padding: 14px;
}

@media (max-width: 640px) {
  .unified-card-header {
    padding: 8px 10px !important;
  }
  .unified-card-header > div:last-child {
    flex-wrap: wrap !important;
    gap: 4px !important;
  }
  .unified-card-header button,
  .chart-card-actions button,
  #analisisChartHeader button {
    padding: 5px 8px !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }
  .ac-breadth-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .ac-smart-broksum-grid {
    grid-template-columns: 1fr !important;
  }
  .ac-broksum-concentration-row {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  .ac-conc-narrative {
    grid-column: span 3 !important;
  }
  .ac-command-palette-backdrop {
    padding: 20px 10px !important;
  }
  .maintenance-facts {
    font-size: 12px;
    line-height: 1.5;
  }
}

/* 1366x768 laptop sidebar alignment */
@media (min-width: 1024px) and (max-width: 1440px) {
  #appSidebar,
  .app-sidebar {
    padding-top: 8px;
  }
}

/* ==========================================================================
   FASE 8R REMEDIATION: 10 VISUAL BUGS & CONTRAST HARMONIZATION
   ========================================================================== */

/* 1. Market Breadth High Contrast Force */
.ac-market-breadth-card {
  background-color: #0b1120 !important;
  border: 1px solid #1e293b !important;
}
.ac-market-breadth-card h2,
.ac-breadth-header h2 {
  color: #f8fafc !important;
}
.ac-market-breadth-card .ac-breadth-narrative,
.ac-market-breadth-card .ac-stat-label,
.ac-market-breadth-card .ac-breadth-footer-meta,
.ac-breadth-header .font-mono {
  color: #cbd5e1 !important;
}
.ac-market-breadth-card .ac-breadth-stat-tile {
  background-color: #0f172a !important;
  border: 1px solid #1e293b !important;
}

/* 2. Screener Preset Popover High Contrast */
.ac-preset-popover {
  background-color: #0f172a !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.8), 0 8px 10px -6px rgba(0, 0, 0, 0.8) !important;
}
.ac-preset-popover .text-white,
.ac-preset-popover h4,
.ac-preset-popover .ac-popover-title {
  color: #f8fafc !important;
}
.ac-preset-popover p,
.ac-preset-popover .ac-popover-desc,
.ac-preset-popover .text-gray-200,
.ac-preset-popover .text-gray-300 {
  color: #e2e8f0 !important;
}
.ac-preset-popover .ac-popover-formula,
.ac-preset-popover p.font-mono {
  background-color: #1e293b !important;
  color: #34d399 !important;
  border: 1px solid #334155 !important;
  padding: 6px 8px !important;
  border-radius: 6px !important;
}
.ac-preset-popover span.font-semibold {
  color: #94a3b8 !important;
}

/* 3. Smart Broker Summary High Contrast */
.ac-smart-broksum-wrap {
  background-color: #0b1120 !important;
  border: 1px solid #1e293b !important;
}
.ac-smart-broksum-top-header span.text-white,
.ac-smart-broksum-wrap h3 {
  color: #f8fafc !important;
}
.ac-broksum-table thead,
.ac-broksum-table th {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid #334155 !important;
}
.ac-broksum-table tbody tr td,
.ac-broksum-table tbody td strong,
.ac-broksum-table tbody td.text-white,
.ac-broksum-table tbody td.text-gray-300 {
  color: #f8fafc !important;
}
.ac-conc-tile {
  background-color: #0f172a !important;
  border: 1px solid #1e293b !important;
}
.ac-conc-tile .ac-conc-val {
  color: #f8fafc !important;
}
.ac-conc-narrative {
  background-color: #0f172a !important;
  border: 1px solid #1e293b !important;
}
.ac-conc-narrative p {
  color: #cbd5e1 !important;
}

/* 4. Struktur Pasar High Contrast Theme Shield */
#marketStructureTable,
#marketStructureTableContainer,
#marketStructureDetailPane,
#marketStructureDetailSheet {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}
#marketStructureTable thead,
#marketStructureTable thead th {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border-bottom: 1px solid #334155 !important;
}
#marketStructureTable tbody tr {
  background-color: #0f172a !important;
}
#marketStructureTable tbody tr:hover {
  background-color: #1e293b !important;
}
#marketStructureTable td {
  color: #f8fafc !important;
  border-bottom: 1px solid rgba(51, 65, 85, 0.4) !important;
}
#marketStructureTable .ac-ticker-symbol {
  color: #38bdf8 !important;
}
#marketStructureTable .ac-company-sub {
  color: #94a3b8 !important;
}
#marketStructureDetailPane {
  background-color: #0f172a !important;
  border: 1px solid #1e293b !important;
  color: #f8fafc !important;
}
#marketStructureDetailPane .ac-metric-tile {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
  color: #f8fafc !important;
}
#marketStructureDetailPane .ac-metric-tile .text-slate-400 {
  color: #94a3b8 !important;
}
#marketStructureRosterWrap {
  background-color: #0f172a !important;
  color: #f8fafc !important;
}
#marketStructureRosterWrap .ac-roster-item-card {
  border-bottom: 1px solid rgba(51, 65, 85, 0.5) !important;
}
#marketStructureRosterWrap .ac-roster-item-card strong {
  color: #f8fafc !important;
}
#marketStructureRosterWrap .ac-roster-item-card span {
  color: #94a3b8 !important;
}

/* 5. Sidebar Collapsed Cleanup (Shot 02) */
#appSidebar.is-collapsed #sidebarLogoutBtn,
.app-sidebar.is-collapsed #sidebarLogoutBtn,
#appSidebar.is-collapsed .sidebar-utility-button,
#appSidebar.is-collapsed .user-info {
  display: none !important;
}
#appSidebar.is-collapsed #currentUserBadge {
  justify-content: center !important;
  padding: 0 !important;
}
#appSidebar.is-collapsed #sidebarAccountEntry {
  justify-content: center !important;
  width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}
#appSidebar.is-collapsed .user-avatar {
  margin: 0 auto !important;
}

/* 6. Mobile Sidebar Compact Scaling (Shots 05 & 06) */
@media (max-height: 850px) {
  #appSidebar.mobile-open .sidebar-item {
    min-height: 28px !important;
    padding: 3px 8px !important;
    font-size: 11px !important;
    gap: 8px !important;
  }
  #appSidebar.mobile-open .sidebar-item > svg {
    width: 14px !important;
    height: 14px !important;
    flex: 0 0 14px !important;
  }
  #appSidebar.mobile-open .sidebar-group-label {
    padding: 4px 8px 2px !important;
    font-size: 8px !important;
  }
  #appSidebar.mobile-open .sidebar-nav-group {
    padding-bottom: 2px !important;
  }
  #appSidebar.mobile-open .sidebar-nav-group:last-child {
    padding-bottom: 6px !important;
  }
  #appSidebar.mobile-open > .sidebar-brand {
    padding: 8px 10px !important;
  }
  #appSidebar.mobile-open > .sidebar-footer {
    padding: 6px 10px !important;
  }
}

/* 7. Command Palette Input & Results Styling (Shots 17 & 18) */
.ac-command-palette-input {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}
.ac-command-palette-input::placeholder {
  color: #94a3b8 !important;
}
.ac-command-palette-results {
  padding-bottom: 36px !important;
  max-height: 380px !important;
}
.ac-palette-item:last-child {
  margin-bottom: 24px !important;
}

/* 8. Analisis Subtab Button Padding (Shot 04, 10, 22) */
.analisis-subtab {
  padding: 6px 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
}

/* 9. Trading Plan Detail Pane Dark Shield */
.ac-detail-pane,
#screenerDetailPane {
  background-color: #0b1120 !important;
  color: #f8fafc !important;
  border-left: 1px solid #1e293b !important;
}
.ac-detail-pane__header {
  background-color: #0f172a !important;
  border-bottom: 1px solid #1e293b !important;
}
.ac-detail-pane__title {
  color: #f8fafc !important;
}
.ac-detail-pane__close {
  color: #94a3b8 !important;
}
.ac-detail-pane__body {
  background-color: #0b1120 !important;
  color: #f8fafc !important;
}

/* 10. Subtab Active Contrast (Shot 10, 11, 22) */
.analisis-subtab.active,
#tabAnalisisVision.active,
#tabAnalisisText.active {
  color: #ffffff !important;
  font-weight: 700 !important;
  background-color: #059669 !important;
}
.analisis-subtab.active svg,
#tabAnalisisVision.active svg,
#tabAnalisisText.active svg {
  color: #ffffff !important;
}

/* 11. Market Structure Detail Pane & Pagination Bar Contrast (Shot 14) */
#marketStructureDetailPane,
#marketStructureDetailSheet,
html.light #marketStructureDetailPane,
html.light #marketStructureDetailSheet {
  background-color: #0b1120 !important;
  color: #f8fafc !important;
}
#marketStructureDetailPane #marketStructureDetailTitle,
#marketStructureDetailPane #marketStructureDetailCompany,
#marketStructureDetailPane #marketStructureDetailSubtitle,
#marketStructureDetailPane h3,
#marketStructureDetailPane h4,
#marketStructureDetailPane .ac-detail-title,
html.light #marketStructureDetailPane #marketStructureDetailTitle,
html.light #marketStructureDetailPane #marketStructureDetailCompany,
html.light #marketStructureDetailPane #marketStructureDetailSubtitle,
html.light #marketStructureDetailPane h3,
html.light #marketStructureDetailPane h4,
html.light #marketStructureDetailPane .ac-detail-title {
  color: #f8fafc !important;
  font-weight: 700 !important;
}
#marketStructureDetailPane .ac-detail-sub,
html.light #marketStructureDetailPane .ac-detail-sub {
  color: #94a3b8 !important;
}
#marketStructureDetailPane .ac-metric-tile,
#marketStructureDetailPane .ac-research-detail,
html.light #marketStructureDetailPane .ac-metric-tile,
html.light #marketStructureDetailPane .ac-research-detail {
  background-color: #1e293b !important;
  border: 1px solid #334155 !important;
}
#marketStructureDetailPane .ac-metric-tile span,
#marketStructureDetailPane .ac-metric-tile small,
#marketStructureDetailPane .ac-research-detail span,
html.light #marketStructureDetailPane .ac-metric-tile span,
html.light #marketStructureDetailPane .ac-metric-tile small,
html.light #marketStructureDetailPane .ac-research-detail span {
  color: #94a3b8 !important;
  font-weight: 500 !important;
}
#marketStructureDetailPane .ac-metric-tile strong,
#marketStructureDetailPane #marketStructureFreeFloat,
#marketStructureDetailPane #marketStructureHscStatus,
#marketStructureDetailPane #marketStructureDetailGuardBadge,
#marketStructureDetailPane #marketStructureHsc,
#marketStructureDetailPane #marketStructureGuard,
#marketStructureDetailPane .ac-research-detail strong,
#marketStructureDetailPane #marketStructureNote,
html.light #marketStructureDetailPane .ac-metric-tile strong,
html.light #marketStructureDetailPane #marketStructureFreeFloat,
html.light #marketStructureDetailPane #marketStructureHscStatus,
html.light #marketStructureDetailPane #marketStructureDetailGuardBadge,
html.light #marketStructureDetailPane #marketStructureHsc,
html.light #marketStructureDetailPane #marketStructureGuard,
html.light #marketStructureDetailPane .ac-research-detail strong,
html.light #marketStructureDetailPane #marketStructureNote {
  color: #f8fafc !important;
  font-weight: 700 !important;
}
#marketStructurePaginationBar,
html.light #marketStructurePaginationBar {
  background-color: #0f172a !important;
  border-top: 1px solid #334155 !important;
  color: #f8fafc !important;
}
#marketStructurePaginationBar #marketStructureCountText,
html.light #marketStructurePaginationBar #marketStructureCountText {
  color: #f8fafc !important;
  font-weight: 600 !important;
}
#marketStructurePaginationBar .ac-btn-pag,
html.light #marketStructurePaginationBar .ac-btn-pag {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border: 1px solid #334155 !important;
}
#marketStructurePaginationBar span,
html.light #marketStructurePaginationBar span,
#marketStructurePaginationBar button,
html.light #marketStructurePaginationBar button {
  color: #f8fafc !important;
  font-weight: 600 !important;
}

/* 12. Final Polish for Market Structure Detail Boxes & Subtab Active (Shot 11 & 14) */
#marketStructureDetailPane .ac-research-note,
#marketStructureDetailPane .ac-research-footnote,
#marketStructureDetailPane #marketStructureNote,
#marketStructureDetailPane .mt-3.p-2\.5,
#marketStructureDetailPane div[class*="bg-slate-800"],
#marketStructureDetailPane .ac-roster-item-card,
html.light #marketStructureDetailPane .ac-research-note,
html.light #marketStructureDetailPane .ac-research-footnote,
html.light #marketStructureDetailPane #marketStructureNote,
html.light #marketStructureDetailPane .mt-3.p-2\.5,
html.light #marketStructureDetailPane div[class*="bg-slate-800"],
html.light #marketStructureDetailPane .ac-roster-item-card {
  background-color: #1e293b !important;
  color: #f8fafc !important;
  border-color: #334155 !important;
}

#marketStructureDetailPane #marketStructureInsiderTotal,
#marketStructureDetailPane #marketStructureMajorHoldingPct,
#marketStructureDetailPane #marketStructurePublicHoldingPct,
#marketStructureDetailPane strong,
html.light #marketStructureDetailPane #marketStructureInsiderTotal,
html.light #marketStructureDetailPane #marketStructureMajorHoldingPct,
html.light #marketStructureDetailPane #marketStructurePublicHoldingPct,
html.light #marketStructureDetailPane strong {
  color: #f8fafc !important;
}

#marketStructureDetailPane #marketStructureOwnershipSummaryNote,
#marketStructureDetailPane span,
#marketStructureDetailPane p,
html.light #marketStructureDetailPane #marketStructureOwnershipSummaryNote,
html.light #marketStructureDetailPane span,
html.light #marketStructureDetailPane p {
  color: #94a3b8 !important;
}

#tabAnalisisVision.active,
#tabAnalisisVision[aria-selected="true"],
.analisis-subtab.active#tabAnalisisVision,
html.light #tabAnalisisVision.active,
html.light #tabAnalisisVision[aria-selected="true"],
html.light .analisis-subtab.active#tabAnalisisVision {
  color: #ffffff !important;
  font-weight: 700 !important;
}

/* ---- 9. Redesign v2 foundation -------------------------------------------
   Shared pieces of the v2 canvas (handoff design/project/ac.css) that every
   migrated page uses. Values are the canvas values; colours always go
   through the v2 tokens (fallbacks are the canvas light values for the rare
   case a state renders outside a v2 scope). */

/* 9a. Data states: empty / loading / error (canvas .stp-box, .stp-load,
   .spin2, .stp-sk). Rendered in place by public/ac-states.js, not as a
   fixed overlay. */
.ac-state {
  max-width: 460px;
  margin: 0 auto;
  padding: 48px 16px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 8px;
}
.ac-state svg {
  width: 40px;
  height: 40px;
  stroke: var(--ac-text-muted, #5E6A65);
  margin-bottom: 6px;
}
.ac-state-error svg { stroke: var(--ac-negative, #AD3F52); }
.ac-state b {
  font-size: 18px;
  letter-spacing: -.01em;
  color: var(--ac-ink, #1D2724);
}
.ac-state p {
  margin: 0 0 10px;
  color: var(--ac-text-secondary, #535F5A);
  font-size: 14px;
  line-height: 1.55;
}
.ac-state-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
/* Canvas .btn.p.sm, with the 44px touch floor on coarse pointers. */
.ac-btn-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--ac-brand, #13785D);
  background: var(--ac-brand, #13785D);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--motion-hover, 140ms) var(--ease-standard, ease), border-color var(--motion-hover, 140ms);
}
.ac-btn-state:hover { background: var(--ac-brand-hover, #0D634C); border-color: var(--ac-brand-hover, #0D634C); }
.ac-btn-state:focus-visible { outline: 2px solid var(--ac-brand, #13785D); outline-offset: 2px; }
.ac-btn-state-quiet {
  background: var(--ac-surface, #FCFCFA);
  border-color: var(--ac-control-border, #848D88);
  color: var(--ac-ink, #1D2724);
}
.ac-btn-state-quiet:hover { background: var(--ac-surface-hover, #EAEEE8); border-color: var(--ac-control-border-hover, #68746E); }
html.is-dark .ac-btn-state:not(.ac-btn-state-quiet) { color: #06140E; }
@media (pointer: coarse) { .ac-btn-state { min-height: 44px; padding: 0 14px; } }
.ac-state-loading { padding: 24px 0; }
.ac-state-load {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ac-text-secondary, #535F5A);
  margin-bottom: 18px;
}
.ac-spin {
  width: 14px;
  height: 14px;
  border: 2px solid var(--ac-line-hairline, #DFE4DE);
  border-top-color: var(--ac-brand, #13785D);
  border-radius: 50%;
  animation: ac-rot 700ms linear infinite;
}
.ac-state-sk { display: grid; gap: 10px; width: 100%; }
/* The canvas shimmer animates background-position; the performance budget
   allows only transform/opacity, so the skeleton breathes with opacity. */
.ac-state-sk i {
  display: block;
  height: 44px;
  border-radius: 8px;
  background: var(--ac-surface-hover, #EAEEE8);
  animation: ac-sk 1.4s ease-in-out infinite alternate;
}
.ac-state-sk i:first-child { height: 120px; }
@keyframes ac-rot { to { transform: rotate(360deg); } }
@keyframes ac-sk { from { opacity: 1; } to { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .ac-spin, .ac-state-sk i { animation: none; }
}

/* 9b. App shell (canvas .side / .top / .mtab, HANDOFF §4).
   Widths: phone <=760px, rail 761-1099px, wide >=1100px. The sidebar stays
   position:fixed with the document as the scroller, which keeps the canvas
   result (sidebar never moves, only content scrolls) without breaking code
   that reads window.scrollY. Selectors are anchored on #appShell so they win
   over the earlier shell layers, several of which use !important. */
body #appShell > #appSidebar.app-sidebar {
  background: var(--ac-surface) !important;
  border-right: 1px solid var(--ac-line-hairline) !important;
  padding: 16px 12px 12px;
  gap: 2px;
  box-shadow: none;
  color: var(--ac-ink);
  font-family: var(--ac-font-sans);
  transform: none;
  transition: width 320ms var(--ease-emphasized), padding 320ms var(--ease-emphasized);
}
body #appShell > #appSidebar > .sidebar-brand {
  min-height: 0;
  padding: 2px 10px 8px !important;
  border-bottom: 0 !important;
  gap: 10px;
}
body #appShell > #appSidebar .sidebar-brand-lockup { gap: 10px; }
body #appShell > #appSidebar .brand-mark {
  width: 26px !important;
  height: 26px !important;
  flex: 0 0 26px;
  border-radius: 7px;
  border: 0;
  background: var(--ac-inv) !important;
  display: grid;
  place-items: center;
}
body #appShell > #appSidebar .brand-mark svg {
  color: #ffffff !important;
  stroke: #ffffff !important;
}
html.is-dark body #appShell > #appSidebar .brand-mark { background: #24302C !important; }
body #appShell > #appSidebar .sidebar-brand-text strong {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--ac-ink);
  line-height: 1.2;
}
body #appShell > #appSidebar .sidebar-brand-text > span {
  font-size: 11px;
  font-weight: 500;
  color: var(--ac-text-muted);
  letter-spacing: 0;
}
body #appShell > #appSidebar .sidebar-collapse-toggle {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  color: var(--ac-text-secondary);
  background: transparent;
  transition: background 140ms var(--ease-standard), color 140ms var(--ease-standard);
}
body #appShell > #appSidebar .sidebar-collapse-toggle:hover { background: var(--ac-surface-hover); color: var(--ac-ink); }
body #appShell > #appSidebar .sidebar-collapse-toggle svg { transition: transform 320ms var(--ease-spring); }
body #appShell > #appSidebar .sidebar-menu-label { display: none; }
body #appShell > #appSidebar > .sidebar-nav { padding: 8px 0 12px; }
body #appShell > #appSidebar .sidebar-nav-group { display: flex; flex-direction: column; gap: 1px; margin: 0; padding: 0; border: 0; }
body #appShell > #appSidebar .sidebar-group-label {
  margin: 0;
  padding: 6px 10px 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ac-text-muted);
}
body #appShell > #appSidebar .sidebar-admin-group .sidebar-group-label { color: var(--ac-info); }
body #appShell > #appSidebar .sidebar-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 28px;
  min-height: 28px;
  padding: 0 8px;
  border: 0 !important;
  border-radius: 6px;
  background: transparent;
  color: var(--ac-text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 140ms var(--ease-standard), color 140ms var(--ease-standard);
}
body #appShell > #appSidebar .sidebar-item svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  stroke: currentColor;
  transition: transform 320ms var(--ease-spring);
}
body #appShell > #appSidebar .sidebar-item:hover { background: var(--ac-surface-hover); color: var(--ac-ink); }
body #appShell > #appSidebar .sidebar-item:hover svg { transform: translateX(2px) scale(1.08); }
body #appShell > #appSidebar .sidebar-item.active {
  background: var(--ac-brand-soft) !important;
  color: var(--ac-ink) !important;
  font-weight: 600;
}
body #appShell > #appSidebar .sidebar-item.active svg { color: var(--ac-brand); transform: scale(1.06); }
/* The left bar marks the real active state, not decoration. */
body #appShell > #appSidebar .sidebar-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 2px;
  background: var(--ac-brand);
  animation: ac-edge 360ms var(--ease-spring) both;
}
body #appShell > #appSidebar .sidebar-item:focus-visible { outline: 2px solid var(--ac-brand); outline-offset: 2px; }
body #appShell > #appSidebar .sidebar-item .nav-icon { display: contents; }
body #appShell > #appSidebar .sidebar-badge {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  color: var(--ac-text-muted);
}
body #appShell > #appSidebar .sidebar-footer {
  border-top: 1px solid var(--ac-line-hairline);
  margin: 8px -12px -12px;
  padding: 12px 22px;
  background: var(--ac-surface);
}
/* The sun/moon switch lives in the top bar on every page (HANDOFF §3a). */
body #appShell > #appSidebar .sidebar-footer .theme-toggle-compact { display: none !important; }
body #appShell > #appSidebar .user-profile-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ac-ink);
  text-align: left;
}
body #appShell > #appSidebar .user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ac-inv);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  flex: none;
}
html.is-dark body #appShell > #appSidebar .user-avatar { background: #24302C; }
body #appShell > #appSidebar .user-name { font-size: 13px; font-weight: 700; line-height: 1.2; color: var(--ac-ink); }
body #appShell > #appSidebar .user-role { font-size: 11px; color: var(--ac-text-muted); letter-spacing: 0; text-transform: none; }
body #appShell > #appSidebar .sidebar-profile-chevron { color: var(--ac-text-secondary); margin-left: auto; }
body #appShell > #appSidebar #sidebarLogoutBtn {
  color: var(--ac-negative);
  background: transparent;
  border-color: var(--ac-line-hairline);
  border-radius: 6px;
  min-height: 30px;
}
body #appShell > #appSidebar #sidebarLogoutBtn:hover { background: var(--ac-negative-soft); }

/* Collapsed rail (wide screens on request, 761-1099px by default). */
body #appShell > #appSidebar.app-sidebar.is-collapsed { width: 68px !important; padding-left: 10px; padding-right: 10px; }
body #appShell > #appSidebar.is-collapsed > .sidebar-brand { flex-direction: column; gap: 10px; padding: 2px 0 12px !important; }
body #appShell > #appSidebar.is-collapsed:not(.mobile-open) .sidebar-brand-text,
body #appShell > #appSidebar.is-collapsed:not(.mobile-open) .sidebar-label,
body #appShell > #appSidebar.is-collapsed:not(.mobile-open) .sidebar-badge,
body #appShell > #appSidebar.is-collapsed:not(.mobile-open) .user-info,
body #appShell > #appSidebar.is-collapsed:not(.mobile-open) .sidebar-profile-chevron,
body #appShell > #appSidebar.is-collapsed:not(.mobile-open) #sidebarLogoutBtn { display: none !important; }
body #appShell > #appSidebar.is-collapsed .sidebar-collapse-toggle { margin: 0; }
body #appShell > #appSidebar.is-collapsed .sidebar-collapse-icon { transform: scaleX(-1); }
body #appShell > #appSidebar.is-collapsed .sidebar-item { justify-content: center; padding: 0; gap: 0; height: 38px; }
body #appShell > #appSidebar.is-collapsed .sidebar-item svg { width: 19px; height: 19px; flex-basis: 19px; }
body #appShell > #appSidebar.is-collapsed .sidebar-group-label { font-size: 0; height: 1px; padding: 0; margin: 9px 8px; background: var(--ac-line-hairline); }
body #appShell > #appSidebar.is-collapsed .sidebar-footer { padding: 12px 0; margin: 8px -10px -12px; display: flex; justify-content: center; }
body #appShell > #appSidebar.is-collapsed .user-profile-badge { justify-content: center; flex: 0 0 auto !important; }

/* Content column offsets follow the rail width. */
@media (min-width: 761px) {
  /* The older <=1023px drawer rules hid the rail; from 761px it is always
     on screen (68px rail or full sidebar). */
  body #appShell > #appSidebar.app-sidebar:not(.hidden) {
    display: flex !important;
    position: fixed !important;
    transform: none !important;
    width: 240px;
    max-width: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
    box-shadow: none !important;
  }
  body #appShell > #appMain { margin-left: 240px !important; width: calc(100% - 240px) !important; }
  body #appShell[data-sidebar-state="collapsed"] > #appMain { margin-left: 68px !important; width: calc(100% - 68px) !important; }
}

/* Top bar (canvas .top): search, data freshness, theme switch. */
body #appShell #appMain > .app-header {
  display: block !important;
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ac-surface) !important;
  border-bottom: 1px solid var(--ac-line-hairline);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  color: var(--ac-ink);
}
body #appShell #appMain > .app-header > .header-shell { padding: 0 32px; max-width: none; }
body #appShell #appMain > .app-header > .header-shell > .flex { width: 100%; height: 52px; gap: 16px; }
body #appShell #appMain > .app-header .workspace-header-brand { display: none !important; }
body #appShell #appMain > .app-header .desktop-header-chips { display: flex !important; order: 2; margin-left: auto !important; gap: 8px; min-width: 0; }
body #appShell #appMain > .app-header .desktop-header-chips > .header-status-chip:not(#globalLiveRadarChip) { display: none !important; }
body #appShell #appMain > .app-header #globalSearchBtn { order: 1; }
body #appShell #appMain > .app-header #topThemeToggle { order: 3; }
body #appShell #appMain > .app-header .header-account { order: 4; margin-left: 0 !important; }
/* Signed in, everything in this cluster is hidden; drop the empty slot so it
   does not open an extra row on phones. Guests still see Masuk / Daftar. */
body #appShell #appMain > .app-header .header-account:not(:has(#headerLoginBtn:not(.hidden), #headerRegisterBtn:not(.hidden), #reviewBadge:not(.hidden))) { display: none !important; }
body #appShell #appMain > .app-header #headerAccountSection,
body #appShell #appMain > .app-header #wibClock { display: none !important; }
body #appShell #appMain > .app-header > .mobile-nav-row { display: none !important; }
body #appShell #appMain > .app-header .ac-top-search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  width: min(420px, 100%);
  padding: 0 12px;
  border: 1px solid var(--ac-control-border);
  border-radius: 8px;
  background: var(--ac-surface);
  color: var(--ac-text-muted);
  font-size: 13px;
  transition: border-color 140ms;
}
body #appShell #appMain > .app-header .ac-top-search-trigger:hover { border-color: var(--ac-control-border-hover); }
body #appShell #appMain > .app-header .ac-top-search-trigger svg { width: 15px; height: 15px; color: var(--ac-text-muted); }
body #appShell #appMain > .app-header .ac-top-search-text { display: inline !important; color: var(--ac-text-muted); font-size: 13px; }
body #appShell #appMain > .app-header #globalSearchKbd {
  display: inline-flex !important;
  margin-left: auto;
  font: 600 11px var(--ac-font-mono);
  border: 1px solid var(--ac-line-hairline);
  border-radius: 4px;
  padding: 1px 5px;
  background: transparent;
  color: var(--ac-text-muted);
}
body #appShell #appMain > .app-header #globalLiveRadarChip {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0 !important;
  background: transparent !important;
  color: var(--ac-text-secondary) !important;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
body #appShell #appMain > .app-header #globalLiveRadarDot { width: 7px; height: 7px; border-radius: 50%; box-shadow: none !important; }
.thm {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--ac-line-hairline);
  background: var(--ac-surface);
  color: var(--ac-text-secondary);
  cursor: pointer;
  flex: none;
  transition: background 140ms var(--ease-standard), color 140ms;
}
.thm:hover { background: var(--ac-surface-hover); color: var(--ac-ink); }
.thm:focus-visible { outline: 2px solid var(--ac-brand); outline-offset: 2px; }
.thm svg { width: 16px; height: 16px; }
.thm .sun { display: none; }
html.is-dark .thm .sun { display: block; }
html.is-dark .thm .moon { display: none; }

/* Phone bottom tabs: the existing #acBottomBar (built by mobile-nav.js, with
   its "Lainnya" sheet) takes the canvas .mtab look. From 761px the rail
   replaces it, so the bar and its reserved space go away. */
@media (min-width: 761px) {
  #acBottomBar[data-ac-ui="v2"], #acMoreSheet, #acMoreSheetBackdrop { display: none !important; }
  #dashboardScreen #appShell > #appMain { padding-bottom: 0 !important; }
}

@media (max-width: 760px) {
  /* The sidebar becomes the compact sticky top bar: logo + "Menu". */
  :is(#dashboardScreen, body) #appShell { flex-direction: column; }
  #acBottomBar[data-ac-ui="v2"] {
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    z-index: 90;
    background: var(--ac-surface);
    border-top: 1px solid var(--ac-line-hairline);
  }
  #acBottomBar .ac-bottom-nav-item { font-size: 11px; font-weight: 600; color: var(--ac-text-secondary); gap: 3px; }
  #acBottomBar .ac-bottom-nav-item svg { width: 20px; height: 20px; stroke-width: 1.7; }
  #acBottomBar .ac-bottom-nav-item.active,
  #acBottomBar .ac-bottom-nav-item[aria-current="page"] { color: var(--ac-brand); }
  #acBottomBar .ac-bottom-nav-item:focus-visible { outline: 2px solid var(--ac-brand); outline-offset: -4px; border-radius: 8px; }
  /* The full-screen menu covers the tabs, as on the canvas (z 120 over 90).
     The bar is a <body> child outside the menu's stacking context, so it is
     taken out while the menu is open. */
  html.workspace-menu-open #acBottomBar[data-ac-ui="v2"] { visibility: hidden; pointer-events: none; }
  body #appShell > #appSidebar.app-sidebar:not(.hidden) {
    display: flex !important;
    position: sticky !important;
    top: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: auto !important;
    max-height: none !important;
    visibility: visible !important;
    pointer-events: auto !important;
    z-index: 50;
    padding: 8px 12px;
    border-right: 0 !important;
    border-bottom: 1px solid var(--ac-line-hairline);
    transform: none !important;
    box-shadow: none;
  }
  body #appShell > #appSidebar > .sidebar-brand { padding: 2px 4px !important; }
  body #appShell > #appSidebar:not(.mobile-open) > .sidebar-nav,
  body #appShell > #appSidebar:not(.mobile-open) > .sidebar-footer { display: none !important; }
  body #appShell > #appSidebar .sidebar-collapse-toggle { width: auto; height: auto; min-height: 44px; padding: 0; }
  body #appShell > #appSidebar .sidebar-collapse-icon { display: none; }
  body #appShell > #appSidebar .sidebar-menu-label {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ac-ink);
    padding: 6px 12px;
    border: 1px solid var(--ac-line-hairline);
    border-radius: 8px;
    background: var(--ac-surface-raised);
  }
  /* Full-screen menu. */
  :is(#dashboardScreen, body) #appShell > #appSidebar.app-sidebar.mobile-open,
  #appSidebar.app-sidebar.mobile-open {
    position: fixed !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 120 !important;
    padding: 8px 12px 10px !important;
    box-sizing: border-box !important;
  }
  :is(#dashboardScreen, body) #appShell > #appSidebar.mobile-open > .sidebar-brand {
    flex-shrink: 0 !important;
    margin: 0 !important;
  }
  :is(#dashboardScreen, body) #appShell > #appSidebar.mobile-open > .sidebar-nav {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    padding: 0 0 8px 0 !important;
    margin: 0 !important;
  }
  :is(#dashboardScreen, body) #appShell > #appSidebar.mobile-open > .sidebar-footer {
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 8px 0 0 0 !important;
  }
  body #appShell > #appSidebar.mobile-open .sidebar-item { height: 44px; min-height: 44px; font-size: 15px; }
  body #appShell > #appMain { margin-left: 0 !important; width: 100% !important; }
  #sidebarScrim { display: none !important; }
  /* Search and freshness scroll away with the page on phones. */
  body #appShell #appMain > .app-header { position: static; height: auto !important; min-height: 0 !important; }
  body #appShell #appMain > .app-header > .header-shell { padding: 8px 16px; height: auto !important; align-items: stretch; }
  body #appShell #appMain > .app-header > .header-shell > .flex { height: auto; min-height: 52px; flex-wrap: wrap; gap: 8px 12px; }
  body #appShell #appMain > .app-header #globalSearchBtn { order: 3; width: 100%; }
  body #appShell #appMain > .app-header .desktop-header-chips { order: 1; margin-left: 0; flex: 1 1 160px; min-width: 0; }
  body #appShell #appMain > .app-header #globalLiveRadarChip { white-space: normal; font-size: 11px; }
  body #appShell #appMain > .app-header #topThemeToggle { order: 2; }
}

@keyframes ac-edge { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) {
  body #appShell > #appSidebar .sidebar-item,
  body #appShell > #appSidebar .sidebar-item svg,
  body #appShell > #appSidebar.app-sidebar,
  body #appShell > #appSidebar .sidebar-collapse-toggle svg { transition: none !important; }
  body #appShell > #appSidebar .sidebar-item.active::before { animation: none; }
}

/* 9c. Motion layer and Si Mata (canvas ac.css "motion layer v1" + "Si Mata
   mini", HANDOFF §7). Driven by public/ac-motion.js. Only transform and
   opacity animate; reduced motion turns all of it off. */
[data-mag] { transition: translate 360ms var(--ease-spring, cubic-bezier(.34,1.45,.64,1)); }
[data-rip] { position: relative; overflow: hidden; }
[data-rip]::before {
  content: "";
  position: absolute;
  left: var(--rx, 50%);
  top: var(--ry, 50%);
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .22;
  pointer-events: none;
  animation: ac-rip 620ms var(--ease-emphasized, cubic-bezier(.16,1,.3,1)) forwards;
  z-index: 0;
}
@keyframes ac-rip { from { transform: scale(0); opacity: .28; } to { transform: scale(28); opacity: 0; } }
/* Number flash: a tinted overlay fades out (canvas animates `color`). */
[data-ac-flash] { position: relative; }
[data-ac-flash].ac-flash-up::after,
[data-ac-flash].ac-flash-dn::after {
  content: "";
  position: absolute;
  inset: -1px -3px;
  border-radius: 4px;
  pointer-events: none;
  animation: ac-flash 900ms var(--ease-standard, ease) forwards;
}
[data-ac-flash].ac-flash-up::after { background: var(--ac-positive-soft, rgba(42,122,75,.10)); }
[data-ac-flash].ac-flash-dn::after { background: var(--ac-negative-soft, rgba(185,71,90,.10)); }
@keyframes ac-flash { from { opacity: 1; } to { opacity: 0; } }

.mm { position: fixed; right: 20px; bottom: 20px; z-index: 95; background: none; display: flex; align-items: flex-end; gap: 10px; flex-direction: row-reverse; pointer-events: none; }
.mm[hidden] { display: none !important; }
.mm > * { pointer-events: auto; }
.mm-eye { width: 62px; height: 62px; padding: 0; border: 0; background: transparent; border-radius: 50%; cursor: pointer; animation: mmIn 700ms var(--ease-spring) 600ms both; filter: drop-shadow(0 10px 18px rgba(14,23,20,.3)); }
.mm-eye:focus-visible { outline: 2px solid var(--ac-brand); outline-offset: 2px; }
.mm-eye svg { display: block; width: 100%; height: 100%; }
.mm-body { transform-origin: 60px 60px; transition: transform 360ms var(--ease-spring); }
.mm-eye:hover .mm-body { transform: scale(1.08) rotate(-4deg); }
.mm-lid { transform-origin: 60px 56px; transform: scaleY(0); animation: mmBlink 6.2s infinite 3s; }
.mm-mouth { opacity: 0; transform-origin: 60px 86px; }
.mm.talk .mm-smile { opacity: 0; }
.mm.talk .mm-mouth { opacity: 1; animation: mmTalk 260ms ease-in-out infinite alternate; }
@keyframes mmTalk { from { transform: scaleY(.35); } to { transform: scaleY(1.1); } }
.mm-bub { order: 2; }
.mm.near .mm-lid { animation: none; transform: scaleY(.3); transition: transform 180ms var(--ease-standard); }
.mm-brow path, .m-big, .m-flat, .m-frown, .m-sweat { opacity: 0; transition: opacity 220ms var(--ease-standard); }
.mm-brow path { fill: none; stroke: #CFE9DD; stroke-width: 3.2; stroke-linecap: round; }
.m-big { fill: #34D399; }
.m-flat, .m-frown { fill: none; stroke: #34D399; stroke-width: 3.5; stroke-linecap: round; }
.m-sweat { fill: #86ADE3; }
.mm[data-mood="up2"] .b-up, .mm[data-mood="up2"] .m-big, .mm[data-mood="flat"] .m-flat, .mm[data-mood="down"] .b-wo, .mm[data-mood="down"] .m-frown, .mm[data-mood="down2"] .b-wo, .mm[data-mood="down2"] .m-frown, .mm[data-mood="down2"] .m-sweat { opacity: 1; }
.mm[data-mood="up2"] .mm-smile, .mm[data-mood="flat"] .mm-smile, .mm[data-mood="down"] .mm-smile, .mm[data-mood="down2"] .mm-smile, .mm.talk .m-big, .mm.talk .m-flat, .mm.talk .m-frown { opacity: 0; }
.mm-eye.hop { animation: mmHop 820ms var(--ease-spring) 1; }
@keyframes mmHop { 0% { transform: none; } 28% { transform: translateY(-9px) rotate(-3deg); } 55% { transform: none; } 75% { transform: translateY(-3px); } 100% { transform: none; } }
.mm-bub { max-width: 240px; background: #0E1714; color: #EAF1EE; font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 12px 12px 4px 12px; box-shadow: 0 14px 30px -12px rgba(14,23,20,.45); opacity: 0; transform: translateY(6px) scale(.96); transform-origin: right bottom; transition: opacity 220ms var(--ease-standard), transform 360ms var(--ease-spring); margin-bottom: 14px; pointer-events: none; }
.mm-bub.on { opacity: 1; transform: none; pointer-events: auto; }
.mm-x { position: absolute; right: -4px; top: -8px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--ac-line-hairline); background: var(--ac-surface); color: var(--ac-text-secondary); font-size: 12px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 180ms; }
.mm:hover .mm-x, .mm-x:focus-visible { opacity: 1; }
.mm-x:focus-visible, .mm-mini:focus-visible { outline: 2px solid var(--ac-brand); outline-offset: 2px; }
.mm-mini { display: none; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--ac-line-hairline); background: var(--ac-surface); font: 600 12px var(--ac-font-sans); color: var(--ac-text-secondary); cursor: pointer; box-shadow: 0 6px 16px -8px rgba(0,0,0,.25); }
.mm.off .mm-eye, .mm.off .mm-bub, .mm.off .mm-x { display: none; }
.mm.off .mm-mini { display: inline-flex; align-items: center; }
@keyframes mmIn { from { opacity: 0; transform: translateY(16px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes mmBlink { 0%, 94%, 100% { transform: scaleY(0); } 96% { transform: scaleY(1); } }
@media (max-width: 760px) { .mm { right: 12px; bottom: 72px; } }
@media (max-width: 560px) { .mm { right: 12px; bottom: 70px; } .mm-eye { width: 46px; height: 46px; } .mm-bub { max-width: 200px; } }
/* The blink pauses while the tab is in the background (HANDOFF §2.4). */
html.ac-tab-hidden .mm-lid, html.ac-tab-hidden .mm.talk .mm-mouth { animation-play-state: paused; }
/* Not on the auth screens (HANDOFF §2.4): focus stays on the form. */
/* Child combinators keep this check off ordinary DOM changes: a body:has() with
   a descendant argument is re-checked on every mutation in the page (it cost
   about half of each chart hover frame). Same elements, same meaning. */
body:has(> #loginModal:not(.hidden), > #registerModal:not(.hidden), > #selfResetModal:not(.hidden), > #authV2ResetModal:not(.hidden), > #dashboardScreen > #resetPasswordModal:not(.hidden), > #googleCompleteProfileModal:not(.hidden), > dialog.legacy-gmail-dialog[open]) .mm { display: none !important; }
html.is-dark .mm-bub { background: #22302B; border: 1px solid #33433D; }
html.is-dark .mm-body > path:first-child { fill: #2A3C35; stroke: #48C797; stroke-opacity: .7; stroke-width: 2.5; }
html.is-dark .mm-lid path { fill: #2A3C35; }
html.is-dark .mm-eye svg [fill="#F6F7F5"] { fill: #EEF3F0; }
html.is-dark .mm-eye { filter: drop-shadow(0 0 10px rgba(72,199,151,.28)) drop-shadow(0 8px 16px rgba(0,0,0,.55)); }
@media (prefers-reduced-motion: reduce) {
  [data-mag] { transition: none; }
  [data-rip]::before, [data-ac-flash]::after { animation: none; display: none; }
  .mm-eye, .mm-lid, .mm.talk .mm-mouth, .mm-eye.hop { animation: none !important; }
  .mm-body, .mm-bub { transition: none; }
}

/* ==========================================================================
   M-P1b Chart Workstation drawer: compact categorized layout.
   Desktop: side panel with INTERNAL scroll; the chart canvas keeps its size
   and is never pushed down the page by drawer content.
   Mobile: collapsible sheet, closable, 44px touch targets, no horizontal
   overflow, never permanently full-height.
   ========================================================================== */
.cw-drawer {
  max-height: min(60vh, 520px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cw-drawer[hidden],
.cw-drawer.hidden { display: none; }
.cw-drawer-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
  padding-bottom: 12px;
  scrollbar-width: thin;
}
.cw-drawer-scroll::-webkit-scrollbar { width: 6px; height: 6px; }
.cw-drawer-scroll::-webkit-scrollbar-track { background: #0b0e14; }
.cw-drawer-scroll::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }

/* Collapsible categories */
.cw-drawer-cat {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  margin: 0 0 8px 0;
  background: rgba(15, 20, 28, 0.6);
  overflow: hidden;
}
.cw-drawer-cat-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
  user-select: none;
  list-style: none;
  background: rgba(21, 27, 38, 0.8);
}
.cw-drawer-cat-summary::-webkit-details-marker { display: none; }
.cw-drawer-cat-summary::after {
  content: '\25BE';
  color: #64748b;
  font-size: 12px;
  margin-left: auto;
}
.cw-drawer-cat[open] .cw-drawer-cat-summary::after { transform: rotate(180deg); }
.cw-drawer-cat-title {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e2e8f0;
}
.cw-drawer-cat-count {
  font-size: 10px;
  font-family: ui-monospace, monospace;
  color: #64748b;
  margin-left: auto;
  margin-right: 8px;
}
.cw-drawer-cat-body { padding-top: 8px; }

/* Per-item rows: active-state visibility + 44px touch target */
.cw-layer-row {
  min-height: 40px;
  border-radius: 8px;
  transition: background-color 120ms ease;
}
.cw-layer-row.active {
  background: rgba(16, 185, 129, 0.08);
  box-shadow: inset 2px 0 0 #10b981;
}
.cw-layer-row.active > div > div > span { color: #f1f5f9; }

/* Drawing tool buttons */
.cw-tool-btn { min-height: 36px; }
.cw-tool-btn.on {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
  font-weight: 700;
}

/* Mobile: sheet, closable, never permanently full-height */
@media (max-width: 640px) {
  .cw-drawer { max-height: 72vh; }
  .cw-drawer-head { flex-wrap: wrap; gap: 8px; }
  .cw-drawer-head > div:last-child { flex-wrap: wrap; }
  .cw-drawer-head button { min-height: 44px; padding: 8px 12px; }
  .cw-drawer-cat-summary { min-height: 44px; padding: 10px 12px; }
  .cw-layer-row { min-height: 44px; }
  .cw-drawer-scroll { padding-left: 12px; padding-right: 12px; }
  .cw-drawer-cat-body { padding-left: 12px; padding-right: 12px; }
}
