/* Pranav Agro — shared page styles (008). Authoritative source:
   extracted from frontend/index.html's style block; loaded by BOTH
   /dashboard and /admin. Page-specific rules stay in each page. */
:root {
      --tone-red-bg: rgba(255,69,58,0.15);
      --tone-green-bg: rgba(48,209,88,0.15);
      --tone-amber-bg: rgba(255,159,10,0.15);
      --tone-purple-bg: rgba(191,90,242,0.15);
      --tone-blue-bg: rgba(10,132,255,0.15);
      --tone-yellow-bg: rgba(255,214,10,0.15);
      --tone-shipping-bg: rgba(172,142,104,0.15);

      --sku-388e3c: #388E3C;
      --sku-66bb6a: #66BB6A;
      --sku-7cb342: #7CB342;
      --sku-a4d65e: #A4D65E;
      --sku-e64a19: #E64A19;
      --sku-f9a825: #F9A825;
      --sku-fb8c00: #FB8C00;
      --sku-fbc02d: #FBC02D;
      --sku-ff5722: #FF5722;
      --sku-ff7043: #FF7043;
      --sku-ffa726: #FFA726;
      --sku-ffb300: #FFB300;
      --sku-ffee58: #FFEE58;

      --chart-0: #FF9F0A;
      --chart-1: #FFD60A;
      --chart-2: #30D158;
      --chart-3: #FF453A;
      --chart-4: #BF5AF2;
      --chart-5: #FF375F;
      --chart-6: #64D2FF;
      --chart-7: #FFB340;
      --chart-8: #30B0C7;
      --chart-9: #AC8E68;
      --chart-10: #FF6482;
      --chart-11: #5E5CE6;

      color-scheme: dark;
      --bg-primary: #0a0e17;
      --bg-card: #111827;
      --bg-card-hover: #181d2a;
      --border: #1f2937;
      --text-primary: #e5e7eb;
      --text-secondary: #9ca3af;
      --text-muted: #8b95a5;
      --accent: #FF9F0A;
      --accent-hover: #FFB340;
      --action-fill: var(--accent);
      --action-fill-hover: var(--accent-hover);
      --feed-header: var(--bg-card);
      --accent-yellow: #FFD60A;
      --green-bullish: #30D158;
      --red-bearish: #FF453A;
      --amber-signal: #FF9F0A;
      --bg-main: #111827;
      --bg-surface-alt: #181d2a;
      --pill-reference: rgba(251, 191, 36, 0.08);
      --brand-accent: #E8751A;
      --blue: #0A84FF;
      --purple: #BF5AF2;
      --shipping: #AC8E68;
      --chart-grid: rgba(255,255,255,0.04);
      --chart-border: rgba(255,255,255,0.08);
      --chart-crosshair: #4b5563;
      --selection-bg: rgba(255,159,10,0.15);
      --selection-soft: rgba(255,159,10,0.07);
      --brand-wordmark: var(--accent);
      /* Heatmap tiles (Intraday + Kandla). Hues are bare r,g,b so a tile's
         intensity can scale the alpha between --heat-alpha-min and -max;
         heatmapColor() in core.jsx emits var() references, never literals,
         so tiles re-colour the instant data-theme flips. */
      --heat-up-rgb: 48,209,88;
      --heat-down-rgb: 255,69,58;
      --heat-alpha-min: 0.12;
      --heat-alpha-max: 0.67;
      --heat-flat-bg: rgba(255,255,255,0.06);
      --heat-empty-bg: rgba(255,255,255,0.04);
      --heat-tile-border: rgba(255,255,255,0.06);
      /* Translucent panels, chips and DOM chart tooltips. */
      --surface-tint: rgba(255,255,255,0.03);
      --chip-bg: rgba(255,255,255,0.08);
      --tooltip-border: rgba(255,255,255,0.12);
      --tooltip-shadow: none;
      /* Scrollbars (global rule below the body styles). */
      --scrollbar-thumb: #4b5668;
      --scrollbar-thumb-hover: #7b8798;
      --scrollbar-track: rgba(148,163,184,0.08);
      --font-body: 'Sora', system-ui, sans-serif;
    }

    :root[data-theme="light"] {
      --tone-red-bg: rgba(180,61,58,0.07);
      --tone-green-bg: rgba(34,107,75,0.07);
      --tone-amber-bg: rgba(128,96,31,0.07);
      --tone-purple-bg: rgba(116,80,160,0.07);
      --tone-blue-bg: rgba(57,59,62,0.07);
      --tone-yellow-bg: rgba(128,96,31,0.07);
      --tone-shipping-bg: rgba(112,88,68,0.07);

      --sku-388e3c: #307a33;
      --sku-66bb6a: #407642;
      --sku-7cb342: #52772c;
      --sku-a4d65e: #597433;
      --sku-e64a19: #c53f16;
      --sku-f9a825: #956517;
      --sku-fb8c00: #a65d00;
      --sku-fbc02d: #876819;
      --sku-ff5722: #c5431a;
      --sku-ff7043: #b24e2f;
      --sku-ffa726: #996417;
      --sku-ffb300: #916600;
      --sku-ffee58: #766e2a;

      --chart-0: #a85532;
      --chart-1: #80601f;
      --chart-2: #226b4b;
      --chart-3: #b03835;
      --chart-4: #7450a0;
      --chart-5: #ac3e63;
      --chart-6: #176a82;
      --chart-7: #985b2a;
      --chart-8: #216f6b;
      --chart-9: #705844;
      --chart-10: #a24463;
      --chart-11: #545ba1;

      color-scheme: light;
      --accent: #393b3e;
      --accent-hover: #2c2e31;
      --action-fill: linear-gradient(180deg, #4b4d50 0%, #323437 100%);
      --action-fill-hover: linear-gradient(180deg, #404246 0%, #292b2e 100%);
      --feed-header: #e7e5e0;
      --accent-yellow: #80601f;
      --green-bullish: #226b4b;
      --red-bearish: #b03835;
      --amber-signal: #80601f;
      --brand-accent: #a14726;
      --blue: #555a60;
      --purple: #7450a0;
      --shipping: #705844;
      --chart-grid: rgba(65,58,45,0.07);
      --chart-border: rgba(65,58,45,0.18);
      --chart-crosshair: #545550;
      --bg-primary: #f4f1ea;
      --bg-card: #fcfaf5;
      --bg-card-hover: #efebe3;
      --border: #d8d3c9;
      --text-primary: #272725;
      --text-secondary: #545550;
      --text-muted: #62645e;
      --bg-main: #f4f1ea;
      --bg-surface-alt: #efebe3;
      --pill-reference: rgba(128,96,31,0.08);
      --selection-bg: rgba(57,59,62,0.10);
      --selection-soft: rgba(57,59,62,0.06);
      --brand-wordmark: var(--brand-accent);
      /* Light tiles stay pale: at --heat-alpha-max the strongest tile keeps
         --text-primary above 4.5:1 (checked by scripts/theme_smoke.mjs). */
      --heat-up-rgb: 34,107,75;
      --heat-down-rgb: 176,56,53;
      --heat-alpha-min: 0.08;
      --heat-alpha-max: 0.35;
      --heat-flat-bg: rgba(65,58,45,0.06);
      --heat-empty-bg: rgba(65,58,45,0.035);
      --heat-tile-border: rgba(65,58,45,0.14);
      --surface-tint: rgba(65,58,45,0.035);
      --chip-bg: rgba(65,58,45,0.07);
      --tooltip-border: rgba(0,0,0,0.12);
      --tooltip-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
      --scrollbar-thumb: #b5afa3;
      --scrollbar-thumb-hover: #8a857a;
      --scrollbar-track: rgba(65,58,45,0.08);
    }

    /* Smooth transitions for theme switching */
    body, .widget, .exchange-card, .kpi-card, .header-controls button {
      transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
    }

    @font-face {
      font-family: 'Futura Medium BT';
      src: url('/public/futura-medium-bt.ttf') format('truetype');
      font-weight: 500;
      font-style: normal;
      font-display: swap;
    }
    .brand-wordmark {
      font-family: 'Futura Medium BT', 'Sora', system-ui, sans-serif;
      letter-spacing: 0.08em;
    }
    body {
      background: var(--bg-primary);
      color: var(--text-primary);
      font-family: var(--font-body);
      margin: 0;
      padding: 0;
    }
    :root[data-theme="light"] body {
      background-image: url('/public/paper-grain.svg');
      background-size: 180px 180px;
      background-repeat: repeat;
    }
    /* Scrollbars: one fat, always-visible style for every scroll container
       (page, dashboard pane, Supplier Matrix, Broker Feed, admin tables), so
       horizontal and vertical scrolling has a real grab target. Do not set
       scrollbar-width: thin/none or a thinner ::-webkit-scrollbar on a
       container; the whole point is that they all look and feel the same.
       Firefox inherits scrollbar-color from html at its default (wide) size;
       Chrome and Safari take the WebKit pseudo-elements. */
    html { scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
    ::-webkit-scrollbar { width: 14px; height: 14px; }
    ::-webkit-scrollbar-track { background: var(--scrollbar-track); }
    ::-webkit-scrollbar-thumb {
      background: var(--scrollbar-thumb);
      border: 3px solid transparent;  /* gutter around the pill; the full 14px stays draggable */
      background-clip: padding-box;
      border-radius: 8px;
      min-width: 40px;
      min-height: 40px;
    }
    ::-webkit-scrollbar-thumb:hover { background-color: var(--scrollbar-thumb-hover); }
    ::-webkit-scrollbar-corner { background: var(--scrollbar-track); }
    .font-mono { font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; font-variant-numeric: tabular-nums; }
    .tabular-nums { font-variant-numeric: tabular-nums; }
    .bg-card { background: var(--bg-card); }
    .border-custom { border-color: var(--border); }
    .text-secondary { color: var(--text-secondary); }
    .text-muted { color: var(--text-muted); }
    .text-green { color: var(--green-bullish); }
    .text-red { color: var(--red-bearish); }
    .text-amber { color: var(--amber-signal); }
    .bg-primary { background: var(--bg-primary); }

    .stale { opacity: 0.45; }

    .parity-input::placeholder { color: var(--text-muted); opacity: 0.6; }

    .price-up { color: var(--green-bullish); }
    .price-down { color: var(--red-bearish); }

    table { border-collapse: collapse; width: 100%; }
    th, td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--border); }
    th:first-child, td:first-child { text-align: left; }
    th { color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }

    .upload-zone {
      border: 2px dashed var(--border);
      border-radius: 8px;
      padding: 20px;
      text-align: center;
      transition: border-color 0.2s, background 0.2s;
      cursor: pointer;
    }
    .upload-zone.dragover {
      border-color: var(--accent);
      background: rgba(255, 159, 10, 0.1);
    }

    .sentiment-dot {
      width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; flex-shrink: 0;
    }
    .sentiment-BULLISH { background: var(--green-bullish); }
    .sentiment-BEARISH { background: var(--red-bearish); }
    .sentiment-NEUTRAL { background: var(--text-muted); }

    /* Fall → flat → rise scale under the heatmaps; same tokens as the tiles. */
    .heat-legend-bar {
      background: linear-gradient(to right,
        rgba(var(--heat-down-rgb), var(--heat-alpha-max)),
        var(--heat-flat-bg),
        rgba(var(--heat-up-rgb), var(--heat-alpha-max)));
    }

    .kpi-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 12px 16px;
      min-width: 120px;
    }

    .info-tip {
      position: absolute;
      right: 2px;
      bottom: 1px;
      font-size: 0.65rem;
      color: var(--text-muted);
      cursor: help;
      line-height: 1;
      padding: 4px;
    }
    .info-tip .info-tip-text {
      display: none;
      position: absolute;
      bottom: 100%;
      right: 0;
      background: var(--bg-card);
      border: 1px solid var(--border);
      color: var(--text-primary);
      font-size: 0.58rem;
      font-weight: 400;
      padding: 4px 8px;
      border-radius: 4px;
      white-space: nowrap;
      pointer-events: none;
      z-index: 10;
      margin-bottom: 4px;
    }
    .info-tip:hover .info-tip-text {
      display: block;
    }

    .exchange-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 16px;
    }

    .widget {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 16px;
      min-width: 0; /* allow widget to shrink inside grid/flex parents */
    }

    /* Horizontal scroll container for wide tables (e.g. Supplier Matrix).
       Without this, a table wider than the widget blows out the whole
       dashboard and you get page-level horizontal scroll. */
    .matrix-wrap {
      overflow-x: auto;
      max-width: 100%;
      /* scrollbar: the global fat style above */
    }
    /* Let the table size naturally beyond the container width so the scroll
       actually has something to reveal. */
    .matrix-wrap > table { width: auto; min-width: 100%; }
    /* Supplier Offer Matrix (036): fluid, so it fits the widget instead of
       scrolling. Fixed layout gives the supplier column its <colgroup> share
       and splits the rest evenly between the SKU columns (auto layout dumped
       the slack into the text column). The widget sets an inline min-width so
       a price cell stays readable; only a many-column view scrolls past it. */
    .matrix-wrap > table.matrix-table { table-layout: fixed; width: 100%; }
    .matrix-table td { overflow-wrap: anywhere; }
    .matrix-quote-source {
      border: 0; padding: 0; background: none; color: inherit;
      font: inherit; text-align: inherit; cursor: pointer;
    }
    .matrix-quote-source:hover .font-mono, .matrix-quote-source:focus-visible .font-mono { text-decoration: underline; }
    .matrix-table th { word-break: normal; overflow-wrap: normal; }

    .widget-title {
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-muted);
      margin-bottom: 12px;
      font-weight: 600;
    }

    /* Keep the dates above the figures and leave the date picker its own row. */
    .data-day-note {
      display: grid;
      gap: 2px;
      margin-bottom: 10px;
      padding: 8px 12px;
      border-inline-start: 3px solid var(--amber-signal);
      border-radius: 4px;
      background: var(--tone-amber-bg);
      color: var(--text-primary);
      font-size: 0.85rem;
      line-height: 1.4;
    }

    .btn {
      padding: 6px 16px;
      border-radius: 6px;
      font-size: 0.8rem;
      cursor: pointer;
      border: 1px solid var(--border);
      background: var(--bg-card);
      color: var(--text-primary);
      transition: background 0.15s;
    }
    .btn:hover { background: var(--bg-card-hover); }
    .btn.active { background: var(--accent); border-color: var(--accent); color: var(--bg-primary); font-weight: 600; }

    .loading {
      display: flex; align-items: center; justify-content: center;
      padding: 40px; color: var(--text-muted);
    }

    .empty-state {
      text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.9rem;
    }

    .lang-toggle {
      display: flex;
      border-radius: 6px;
      border: 1px solid var(--border);
      overflow: hidden;
    }
    .lang-toggle button {
      padding: 4px 14px;
      font-size: 0.8rem;
      cursor: pointer;
      border: none;
      transition: background 0.15s, color 0.15s;
    }
    .lang-toggle button.active {
      background: var(--accent);
      color: var(--bg-primary);
      font-weight: 600;
    }
    .lang-toggle button:not(.active) {
      background: transparent;
      color: var(--text-muted);
    }
    .lang-toggle button:not(.active):hover {
      color: var(--text-secondary);
    }

    /* Onboarding */
    .onboard-overlay {
      position: fixed; inset: 0; z-index: 1000;
      background: rgba(0,0,0,0.88);
      display: flex; align-items: center; justify-content: center;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
    .onboard-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 20px;
      max-width: 580px; width: 92%;
      padding: 40px 36px;
      animation: onboardIn 0.35s ease;
    }
    @keyframes onboardIn {
      from { transform: translateY(24px) scale(0.97); opacity: 0; }
      to { transform: translateY(0) scale(1); opacity: 1; }
    }
    .onboard-dots {
      display: flex; gap: 8px; justify-content: center; margin-bottom: 28px;
    }
    .onboard-dot {
      width: 8px; height: 8px; border-radius: 50%;
      background: var(--border);
      transition: all 0.25s;
    }
    .onboard-dot.active { background: var(--accent); transform: scale(1.4); }
    .onboard-dot.done { background: var(--green-bullish); }
    .onboard-title {
      font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 6px;
    }
    .onboard-sub {
      font-size: 0.9rem; color: var(--text-secondary); text-align: center; margin-bottom: 28px;
    }
    .toggle-grid {
      display: grid; gap: 12px;
    }
    .toggle-grid.cols-2 { grid-template-columns: 1fr 1fr; }
    .toggle-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
    .toggle-card {
      background: var(--bg-primary);
      border: 2px solid var(--border);
      border-radius: 14px;
      padding: 18px 16px;
      cursor: pointer;
      transition: border-color 0.2s, background 0.2s, transform 0.15s;
      text-align: center;
      user-select: none;
    }
    .toggle-card:hover { border-color: var(--text-muted); transform: translateY(-1px); }
    .toggle-card.selected {
      border-color: var(--accent);
      background: var(--selection-soft);
    }
    .toggle-card .tc-icon { font-size: 1.6rem; margin-bottom: 6px; }
    .toggle-card .tc-label { font-size: 0.88rem; font-weight: 600; }
    .toggle-card .tc-desc { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; line-height: 1.35; }
    .toggle-card .tc-check {
      width: 20px; height: 20px; border-radius: 50%; margin: 8px auto 0;
      border: 2px solid var(--border); display: flex; align-items: center; justify-content: center;
      transition: all 0.2s; font-size: 0.7rem;
    }
    .toggle-card.selected .tc-check {
      border-color: var(--accent); background: var(--accent); color: var(--bg-primary);
    }
    .onboard-btn-primary {
      background: var(--action-fill); color: var(--bg-primary); border: none; border-radius: 12px;
      padding: 14px 32px; font-size: 1rem; font-weight: 600; cursor: pointer;
      transition: background 0.15s, transform 0.1s; width: 100%; margin-top: 24px;
    }
    .onboard-btn-primary:hover { background: var(--action-fill-hover); }
    .onboard-btn-primary:active { transform: scale(0.98); }
    .onboard-btn-back {
      background: none; border: none; color: var(--text-muted); font-size: 0.85rem;
      cursor: pointer; padding: 8px 0; transition: color 0.15s;
    }
    .onboard-btn-back:hover { color: var(--text-primary); }
    .onboard-footer {
      display: flex; justify-content: space-between; align-items: center; margin-top: 20px;
    }
    .customize-btn {
      background: var(--action-fill); border: 1px solid var(--accent);
      color: var(--bg-primary); border-radius: 8px; padding: 9px 20px; font-size: 0.9rem;
      font-weight: 600; cursor: pointer; transition: background 0.15s, transform 0.1s;
      box-shadow: 0 0 0 1px rgba(255,159,10,0.25), 0 2px 8px rgba(255,159,10,0.18);
    }
    .customize-btn:hover { background: var(--action-fill-hover); }
    .customize-btn:active { transform: scale(0.97); }

    /* Full-height app shell: header spans full width, panes below */
    .app-shell {
      display: flex;
      flex-direction: column;
      height: 100vh;
      overflow: hidden;
    }
    .app-topbar {
      flex-shrink: 0;
      padding: 16px 20px 0;
    }
    /* Two-pane layout: dashboard left, broker feed right */
    .two-pane {
      display: flex;
      flex: 1 1 0%;
      min-height: 0; /* allow children to scroll */
    }
    .pane-left {
      flex: 1 1 0%;
      min-width: 0;
      padding: 0 20px 16px;
      overflow-y: auto;               /* scrollbar: the global fat style */
    }
    /* A widget snapped to the top of the pane after its day picker changed
       (holdWidgetAtTop in core.jsx) keeps a little air above it. */
    .pane-left > * { scroll-margin-top: 12px; }
    .pane-right {
      flex: 0 0 30%;
      max-width: 480px;
      min-width: 320px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    /* 044 — CNF / CIF theatre view (CnfOffersBoard): the board widens to the
       whole dashboard and the other sections blur, as YouTube's theatre mode.
       The board sets `inert` and .pa-theatre-dim on the other sections, so a
       click on one reaches the pane, and the board leaves the theatre view.
       The transition sits on every section so the blur fades out as well. */
    body.pa-theatre .pane-right { display: none; }
    /* The pane is locked: wheel and keys do not scroll the board away. The
       board takes the pane height (set in JS) and scrolls inside itself. */
    body.pa-theatre .pane-left { overflow-y: hidden; }
    .cnf-offers.is-theatre { overflow-y: auto; overscroll-behavior: contain; }
    .pane-left > * { transition: filter 0.2s, opacity 0.2s; }
    .pane-left > .pa-theatre-dim {
      filter: blur(3px);
      opacity: 0.35;
      user-select: none;
    }
    .cnf-theatre-btn {
      display: inline-flex; align-items: center; justify-content: center;
      width: 28px; height: 28px; padding: 0;
      background: transparent; color: var(--text-muted);
      border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
    }
    .cnf-theatre-btn:hover { color: var(--text-primary); border-color: var(--text-muted); }
    .cnf-theatre-btn[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
    .cnf-theatre-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

    @media (max-width: 768px) {
      /* Phones have no broker-feed pane to give up: no theatre view. */
      .cnf-theatre-btn { display: none; }
      .app-shell { height: auto; overflow: visible; }
      .app-topbar { padding: 12px 10px 0; }
      .two-pane { flex-direction: column; }
      .pane-left { padding: 0 10px 12px; overflow-y: visible; }
      /* pane-right hidden on mobile via React conditional — no CSS needed */
      .grid-responsive { grid-template-columns: 1fr !important; }
      .toggle-grid.cols-3 { grid-template-columns: 1fr 1fr; }
      .onboard-card { padding: 28px 20px; }

      /* Header: stack title + controls */
      .dash-header { flex-direction: column !important; align-items: flex-start !important; gap: 8px !important; }
      .subtitle-text { display: none !important; }
      .header-controls { flex-wrap: wrap; gap: 6px !important; justify-content: flex-start; }

      /* Filter bar: stack controls vertically, wrap chips */
      .filter-bar { flex-direction: column !important; gap: 8px !important; }
      .filter-bar > div { flex-wrap: wrap; }
      .filter-chips { flex-wrap: wrap !important; }

      /* KPI cards: 2-column on tablet, 1-column on phone */
      .kpi-row { flex-wrap: wrap !important; }
      .kpi-card { min-width: 140px !important; flex: 1 1 45% !important; }

      /* Widget titles: tighter on mobile */
      .widget-title { font-size: 0.85rem !important; }
      .widget { padding: 14px 10px !important; }

      /* Parity calculator: single column inputs */
      .parity-grid { grid-template-columns: 1fr !important; }
    }

    @media (max-width: 480px) {
      .kpi-card { flex: 1 1 100% !important; }
    }

    /* News Ticker — C6.3 */
    .news-ticker {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: 8px;
      margin-bottom: 12px;
      overflow: hidden;
      display: flex;
      align-items: center;
      height: 34px;
      font-size: 0.72rem;
    }
    .news-ticker-label {
      flex-shrink: 0;
      padding: 0 10px;
      font-size: 0.62rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.1em;
      color: var(--accent);
      border-right: 1px solid var(--border);
      height: 100%;
      display: flex;
      align-items: center;
    }
    .news-ticker-scroll {
      flex: 1;
      overflow: hidden;
      height: 100%;
      cursor: pointer;
      display: flex;
      align-items: center;
    }
    .news-ticker-track {
      display: flex;
      align-items: center;
      white-space: nowrap;
      animation: ticker-scroll 180s linear infinite;
    }
    .news-ticker-track.paused,
    .news-ticker-track:hover { animation-play-state: paused; }
    @keyframes ticker-scroll {
      0%   { transform: translateX(0); }
      100% { transform: translateX(-50%); }
    }
    .news-ticker-item {
      display: inline-flex;
      align-items: center;
      padding: 0 32px;
      color: var(--text-primary);
      font-size: 0.74rem;
    }
    .news-ticker-sep {
      color: var(--text-muted);
      font-size: 0.65rem;
      padding: 0 4px;
      flex-shrink: 0;
      opacity: 0.4;
    }
    /* WhatsApp FAB — mobile only (rendered conditionally via React) */
    .broker-fab {
      position: fixed;
      bottom: 20px;
      right: 20px;
      z-index: 900;
      width: 56px;
      height: 56px;
      border-radius: 50%;
      background: #25D366;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 12px rgba(0,0,0,0.4);
      transition: transform 0.15s, box-shadow 0.15s;
    }
    .broker-fab:active { transform: scale(0.92); }
    .broker-fab svg { width: 28px; height: 28px; fill: #fff; }

    /* Backdrop behind feed overlay */
    .broker-feed-backdrop {
      position: fixed;
      inset: 0;
      z-index: 899;
      background: rgba(0,0,0,0.5);
      animation: fadeIn 0.2s ease;
    }

    /* Slide-up feed overlay */
    .broker-feed-overlay {
      position: fixed;
      bottom: 0; left: 0; right: 0;
      z-index: 901;
      height: 85vh;
      border-radius: 16px 16px 0 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      /* The feed paints the whole sheet; a locked card (021) does not. */
      background: var(--bg-primary);
      animation: feedSlideUp 0.3s ease;
    }
    .broker-feed-overlay.closing {
      animation: feedSlideDown 0.3s ease forwards;
    }

    /* Drag handle at top of overlay */
    .broker-feed-handle {
      background: var(--bg-card);
      padding: 10px 0 6px;
      display: flex;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
    }
    .handle-bar {
      width: 36px;
      height: 4px;
      border-radius: 2px;
      background: rgba(255,255,255,0.25);
    }

    @keyframes feedSlideUp {
      from { transform: translateY(100%); }
      to { transform: translateY(0); }
    }
    @keyframes feedSlideDown {
      from { transform: translateY(0); }
      to { transform: translateY(100%); }
    }
    @keyframes fadeIn {
      from { opacity: 0; }
      to { opacity: 1; }
    }
    @media (max-width: 768px) {
      .grid-2col { grid-template-columns: 1fr !important; }
    }
    .skeleton {
      background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
      background-size: 200% 100%;
      animation: shimmer 1.5s infinite;
      border-radius: 4px;
    }
    @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
    .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

    button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
      outline: 2px solid var(--accent); outline-offset: 3px;
    }
    @media (prefers-reduced-motion: reduce) {
      body, .widget, .exchange-card, .kpi-card, .header-controls button { transition: none; }
    }

    /* A subtle graphite sheen belongs to primary actions, not data surfaces. */
    :root[data-theme="light"] .onboard-btn-primary,
    :root[data-theme="light"] .customize-btn {
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.16), 0 2px 5px rgba(39,39,37,0.12);
    }
    .broker-feed-header { background: var(--feed-header); }
    .broker-feed-avatar { background: var(--action-fill); }
    .broker-feed-handle { background: var(--feed-header); }
    :root[data-theme="light"] .handle-bar { background: var(--text-muted); }

/* 015 — early-bird access hint on the dashboard while payments are off. */
.early-bird-note {
      display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
      margin: 0 0 12px; padding: 6px 10px; border-radius: 6px;
      border: 1px solid var(--border); background: var(--bg-card);
      color: var(--text-secondary); font-size: 0.8rem; line-height: 1.4;
}
.early-bird-badge {
      padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor;
      color: var(--brand-accent); font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}

/* Spec 012 — sign-in page + "sign-in unavailable / account disabled" notice
   (rendered by shared/auth.js into #root before any widget mounts). */
.pa-auth-page {
      min-height: 100vh; display: flex; flex-direction: column; align-items: center;
      justify-content: center; gap: 20px; padding: 24px 16px;
      background: var(--bg-primary); color: var(--text-primary);
}
.pa-auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.pa-auth-brand img { height: 36px; }
.pa-auth-message {
      max-width: 420px; margin: 15vh auto 0; padding: 24px; border-radius: 8px;
      border: 1px solid var(--border); background: var(--bg-card);
      color: var(--text-primary); text-align: center; line-height: 1.5;
}
.pa-auth-message p { margin: 0; }
.pa-auth-switch {
      margin-top: 18px; padding: 10px 16px; border: 1px solid var(--accent);
      border-radius: 6px; background: var(--accent); color: var(--bg-primary);
      font: inherit; font-weight: 600; cursor: pointer;
}
.pa-auth-switch:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.pa-auth-switch:disabled { opacity: 0.6; cursor: wait; }

/* Spec 017 — one calm preview banner and one shared upgrade destination. */
.pa-preview-banner {
      display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
      margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--border);
      border-radius: 8px; background: var(--selection-bg); color: var(--text-primary);
      font-size: 0.78rem; line-height: 1.4;
}
.pa-preview-banner-icon { color: var(--accent); font-size: 1.2rem; line-height: 1; }
.pa-preview-banner-copy { display: grid; flex: 1 1 260px; gap: 1px; }
.pa-preview-banner-copy span { color: var(--text-secondary); }
.pa-preview-explore, .pa-preview-dismiss,
.pa-upgrade-close, .pa-upgrade-continue {
      border: 1px solid var(--border); border-radius: 6px; background: transparent;
      color: var(--text-primary); font: inherit; cursor: pointer;
}
.pa-preview-explore { padding: 5px 10px; border-color: var(--accent); color: var(--accent); font-weight: 600; }
.pa-preview-dismiss, .pa-upgrade-close { width: 28px; height: 28px; font-size: 1.15rem; line-height: 1; }
.pa-preview-explore:hover,
.pa-upgrade-continue:hover { border-color: var(--accent); color: var(--accent); }
.pa-preview-dismiss:hover, .pa-upgrade-close:hover { background: var(--selection-bg); }
.pa-subscribe { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pa-subscribe-btn {
      padding: 5px 12px; border: 1px solid var(--accent); border-radius: 6px;
      background: var(--accent); color: var(--bg-primary);
      font: inherit; font-weight: 600; cursor: pointer;
}
.pa-subscribe-btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.pa-subscribe-btn:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
.pa-subscribe-btn:disabled { opacity: 0.6; cursor: wait; }
.pa-subscribe-msg { color: var(--text-primary); }
.pa-upgrade-backdrop {
      position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center;
      padding: 20px; background: rgba(4, 8, 16, 0.62);
}
.pa-upgrade-dialog {
      position: relative; width: min(100%, 490px); padding: 28px; border: 1px solid var(--border);
      border-radius: 12px; background: var(--bg-card); color: var(--text-primary);
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
}
.pa-upgrade-close { position: absolute; top: 12px; right: 12px; }
.pa-upgrade-eyebrow { color: var(--accent); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; }
.pa-upgrade-dialog h2 { margin: 8px 32px 8px 0; font-size: 1.2rem; }
.pa-upgrade-dialog p { margin: 0; color: var(--text-secondary); line-height: 1.55; }
.pa-upgrade-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.pa-upgrade-continue { padding: 5px 10px; }
.pa-preview-explore:focus-visible, .pa-preview-dismiss:focus-visible,
.pa-upgrade-close:focus-visible,
.pa-upgrade-continue:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* 021 — a locked section for the preview tier: a CSS-drawn skeleton (no data),
   blurred under a frosted card with the one upgrade action. Tokens only, so it
   follows the theme like every other widget. */
.pa-locked-body { position: relative; }
.pa-locked-skeleton {
      min-height: 160px; filter: blur(3px); opacity: 0.6;
      pointer-events: none; user-select: none;
}
.pa-sk-line, .pa-sk-cell, .pa-sk-box, .pa-sk-tile, .pa-sk-avatar, .pa-sk-card {
      background: var(--bg-surface-alt); border-radius: 4px;
}
.pa-sk-line { height: 8px; margin: 6px 0; }
.pa-sk-line.pa-sk-strong, .pa-sk-card .pa-sk-line, .pa-sk-bubble .pa-sk-line { background: var(--chip-bg); }
.pa-sk-line.pa-sk-strong { height: 10px; }
.pa-sk-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pa-sk-card { padding: 12px; border: 1px solid var(--border); background: var(--bg-card); }
.pa-sk-table { display: grid; gap: 8px; }
.pa-sk-row { display: flex; gap: 10px; }
.pa-sk-cell { height: 12px; }
.pa-sk-head .pa-sk-cell { height: 9px; background: var(--chip-bg); }
.pa-sk-chart { display: block; width: 100%; height: 160px; }
.pa-sk-grid { stroke: var(--border); stroke-width: 1; }
.pa-sk-series { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.pa-sk-series-2 { stroke: var(--purple); }
.pa-sk-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.pa-sk-box { height: 34px; padding: 10px; border: 1px solid var(--border); background: var(--bg-card); }
.pa-sk-box .pa-sk-line { margin: 0; }
.pa-sk-button { background: var(--action-fill); border-color: var(--action-fill); }
.pa-sk-tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.pa-sk-tile { height: 34px; border: 1px solid var(--heat-tile-border); background: var(--heat-flat-bg); }
.pa-sk-tile-up { background: rgba(var(--heat-up-rgb), var(--heat-alpha-max)); }
.pa-sk-tile-down { background: rgba(var(--heat-down-rgb), var(--heat-alpha-max)); }
.pa-sk-feed { display: grid; gap: 12px; }
.pa-sk-message { display: flex; gap: 10px; align-items: flex-start; }
.pa-sk-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; background: var(--chip-bg); }
.pa-sk-bubble { flex: 1; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-card); }
.pa-locked-card {
      position: absolute; inset: 0; display: grid; align-content: center; justify-items: center;
      gap: 6px; padding: 24px 16px; text-align: center; color: var(--text-primary);
      background: color-mix(in srgb, var(--bg-card) 55%, transparent);
}
.pa-locked-icon { color: var(--accent); }
.pa-locked-card strong { font-size: 0.9rem; }
.pa-locked-card span { max-width: 32ch; color: var(--text-secondary); font-size: 0.78rem; line-height: 1.4; }
.pa-locked-subscribe {
      margin-top: 6px; padding: 6px 14px; border: 1px solid var(--accent); border-radius: 6px;
      background: var(--accent); color: var(--bg-primary); font: inherit; font-weight: 600; cursor: pointer;
}
.pa-locked-subscribe:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.pa-locked-subscribe:focus-visible { outline: 2px solid var(--text-primary); outline-offset: 2px; }
@media (max-width: 640px) {
      .pa-preview-banner { align-items: flex-start; }
      .pa-preview-explore { margin-left: 0; }
      .pa-upgrade-dialog { padding: 24px 20px; }
      .pa-sk-cards { grid-template-columns: 1fr; }
      .pa-sk-tiles { grid-template-columns: repeat(4, 1fr); }
}

    /* 027 — CNF / CIF Import Offers (CnfOffersBoard) */
    .cnf-count {
      display: inline-block; min-width: 14px; margin-left: 4px; padding: 0 4px; border-radius: 7px;
      background: var(--chip-bg); color: var(--text-muted); font-size: 0.55rem; font-style: normal;
      font-weight: 500; line-height: 14px; text-align: center; vertical-align: middle;
    }
    .cnf-port {
      display: block; font-size: 0.55rem; font-style: normal; font-weight: 400; letter-spacing: 0.06em;
      text-transform: uppercase; color: var(--text-muted);
    }
    .cnf-other { font-variant-numeric: tabular-nums; min-width: 900px; }
    .cnf-other th, .cnf-other td { text-align: left; padding: 7px 10px; font-size: 0.8rem; white-space: nowrap; vertical-align: top; }
    .cnf-other th { font-size: 0.65rem; }
    .cnf-other .num { text-align: right; }
    .cnf-other td.notes { white-space: normal; min-width: 260px; font-size: 0.75rem; color: var(--text-secondary); }
    .cnf-view {
      padding: 0; border: none; background: none; cursor: pointer; font: inherit;
      font-size: 0.7rem; color: var(--accent); text-decoration: underline; text-underline-offset: 2px;
    }
