/* ==========================================================================
   BigBreakingWire Prime — Chart terminal (Professional Redesign)
   --------------------------------------------------------------------------
   Scoped under .pc-app. Light-only, like the rest of the theme: the four
   dialogs use the same tokens, scrim and card treatment as the site's modals.
   All chart controls remain visible and functional in fullscreen.
   ========================================================================== */

/* ---------------- Design tokens ---------------- */

.pc-app {
    /* Every token is an ALIAS of the Prime theme's own :root tokens (the
       values templates/chart/chart.php ships, identical on screener, stock
       analysis, technical levels/patterns, fii-dii, live-blog, slbm, mtf-data
       and stocks-in-news), with the literal value as fallback so this file
       still renders identically when it is loaded without the page block.
       The chart used to ship a private palette (--pc-accent: #2563eb,
       --pc-bg: #f0f2f5, …) that made its controls read as a different
       website; it now inherits the one design system the site uses. */
    --pc-bg: var(--bg-canvas, #eef1f5);
    --pc-surface: var(--card-bg, #ffffff);
    --pc-surface-2: var(--surface-2, #f7f9fb);
    --pc-surface-3: var(--surface-3, #f0f3f7);
    --pc-border: var(--card-border, #e2e7ee);
    --pc-border-2: var(--border-strong, #cfd8e3);
    --pc-text: var(--text-main, #0b1526);
    --pc-muted: var(--ink-2, #46556c);
    --pc-dim: var(--text-muted, #5c6b80);
    --pc-accent: var(--accent-blue, #1e56e0);
    --pc-accent-hover: var(--blue-strong, #1745b5);
    --pc-accent-soft: var(--blue-soft, #eef3ff);
    --pc-up: var(--accent-green, #0e9f6e);
    --pc-up-soft: var(--green-soft, #e8f8f1);
    --pc-down: var(--accent-red, #d90429);
    --pc-down-soft: var(--red-soft, #fdeef1);
    --pc-warn: #d97706;
    --pc-grid: rgba(11, 21, 38, .05);
    --pc-cross: rgba(11, 21, 38, .3);
    --pc-radius: var(--radius, 12px);
    --pc-radius-sm: var(--radius-sm, 8px);
    --pc-shadow-sm: var(--shadow-sm, 0 1px 2px rgba(11,21,38,.05));
    --pc-shadow-md: var(--shadow, 0 1px 3px rgba(11,21,38,.06), 0 5px 16px rgba(11,21,38,.05));
    --pc-shadow-lg: 0 10px 34px rgba(11,21,38,.14);
    --pc-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --pc-mono: 'SF Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --pc-ease: cubic-bezier(.2, .7, .3, 1);
    --pc-dur-fast: .14s;
    --pc-dur: .22s;
    color-scheme: light;
    font-family: var(--pc-font);
    color: var(--pc-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.pc-app *, .pc-app *::before, .pc-app *::after { box-sizing: border-box; }

/* [hidden] must always be display:none */
.pc-app [hidden] { display: none !important; }

/* Keyboard focus must read differently from hover. */
.pc-btn:focus-visible,
.pc-draw-btn:focus-visible,
.pc-chip:focus-visible,
.pc-select:focus-visible,
.pc-modal-close:focus-visible,
.pc-pop-close:focus-visible,
.pc-back:focus-visible,
.pc-cell-sym:focus-visible {
    outline: 2px solid var(--pc-accent);
    outline-offset: 2px;
}
.pc-btn, .pc-draw-btn, .pc-chip, .pc-select,
.pc-modal-close, .pc-pop-close { touch-action: manipulation; }

/* ---------------- Shell / page chrome ---------------- */

.pc-shell {
    background: var(--pc-bg);
    border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius);
    overflow: hidden;
    position: relative;
}

/* ======================  SEARCH LANDING  ====================== */

.pc-landing { max-width: 780px; margin: 0 auto; padding: 12px 0 28px; }
.pc-landing-card {
    background: var(--pc-surface);
    border: 1px solid var(--pc-border);
    border-radius: 16px;
    padding: 36px 36px 30px;
    box-shadow: var(--pc-shadow-sm);
}
.pc-landing-title {
    font-size: 1.5rem; font-weight: 800; letter-spacing: -.4px; margin: 0 0 8px;
    display: flex; align-items: center; gap: 10px; color: var(--pc-text);
}
.pc-landing-sub { font-size: 13px; color: var(--pc-muted); font-weight: 600; margin: 0 0 22px; line-height: 1.6; }

/* Search input */
.pc-search-field { position: relative; }
.pc-search-field input {
    width: 100%; height: 48px; padding: 0 16px 0 44px;
    background: var(--pc-surface); border: 1px solid var(--pc-border-2);
    border-radius: var(--pc-radius); color: var(--pc-text); font-size: 14.5px; font-weight: 600;
    font-family: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
.pc-search-field input:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 3px var(--pc-accent-soft); }
.pc-search-field input::placeholder { color: var(--pc-dim); font-weight: 500; }
.pc-search-field .pc-search-ico {
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    font-size: 16px; color: var(--pc-dim); pointer-events: none;
}
.pc-search-spin {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    width: 16px; height: 16px; border: 2px solid var(--pc-border-2);
    border-top-color: var(--pc-accent); border-radius: 50%;
    animation: pc-spin .7s linear infinite; display: none;
}
.pc-search-field.loading .pc-search-spin { display: block; }
@keyframes pc-spin { to { transform: translateY(-50%) rotate(360deg); } }

/* Search results */
.pc-results {
    position: relative; z-index: 50;
    margin-top: 8px; background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-radius: 12px; overflow: hidden; max-height: 400px; overflow-y: auto;
    box-shadow: var(--pc-shadow-lg);
}
.pc-results[hidden] { display: none; }
.pc-result {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    cursor: pointer; border-bottom: 1px solid var(--pc-surface-3); transition: background .1s;
}
.pc-result:last-child { border-bottom: none; }
.pc-result:hover, .pc-result.active { background: var(--pc-accent-soft); }
.pc-result-sym { font-weight: 800; font-size: 13px; min-width: 90px; letter-spacing: .2px; color: var(--pc-text); }
.pc-result-name { flex: 1; font-size: 12.5px; color: var(--pc-muted); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-result-meta { font-size: 10px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase; letter-spacing: .5px; }
/* Unified-search F&O groups: labeled section headers + contract rows that
   share the result treatment (keyboard nav stays on equity rows). */
.pc-result-group { font-size: 10px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase; letter-spacing: .6px; padding: 8px 14px 4px; background: var(--pc-surface-3); }
.pc-result-fno { display: flex; align-items: center; gap: 12px; padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--pc-surface-3); transition: background .1s; }
.pc-result-fno:hover { background: var(--pc-accent-soft); }
.pc-result-fno .pc-result-sym { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-up { color: var(--pc-up); }
.pc-down { color: var(--pc-down); }

/* Chips */
.pc-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.pc-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pc-chip-row-label { font-size: 10px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase; letter-spacing: .7px; width: 100%; margin-bottom: 2px; }
.pc-chip {
    background: var(--pc-surface-2); border: 1px solid var(--pc-border); color: var(--pc-text);
    font-size: 12px; font-weight: 800; padding: 6px 12px; border-radius: 50px;
    cursor: pointer; font-family: inherit; transition: all .15s;
}
.pc-chip:hover { border-color: var(--pc-accent); background: var(--pc-accent-soft); color: var(--pc-accent); }
.pc-empty-note { margin-top: 12px; font-size: 12px; color: var(--pc-dim); font-weight: 600; line-height: 1.5; }

/* ======================  CHART HEADER  ====================== */

.pc-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 12px; flex-wrap: wrap; padding: 10px 14px;
    border-bottom: 1px solid var(--pc-border); background: var(--pc-surface);
}
.pc-head-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pc-back {
    background: none; border: none; color: var(--pc-dim); font-size: 11px; font-weight: 700;
    cursor: pointer; padding: 0 0 4px; font-family: inherit; display: inline-flex; gap: 4px; align-items: center;
}
.pc-back:hover { color: var(--pc-accent); }
.pc-sym-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pc-sym { font-size: 1.25rem; font-weight: 800; letter-spacing: -.3px; }
.pc-cname { font-size: 12px; color: var(--pc-muted); font-weight: 600; }
.pc-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.pc-tag {
    font-size: 9px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase;
    padding: 2px 6px; border-radius: 4px; background: var(--pc-surface-3); color: var(--pc-dim);
}
/* Cross-module bridge links share the tag treatment (pointer + accent hover). */
a.pc-tag-link { text-decoration: none; cursor: pointer; }
a.pc-tag-link:hover { color: var(--pc-accent); }
.pc-head-quote { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pc-quote-price { font-family: var(--pc-mono); font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.pc-quote-chg { font-family: var(--pc-mono); font-size: 13px; font-weight: 700; }
.pc-quote-asof { font-size: 10.5px; color: var(--pc-dim); font-weight: 600; }

/* ======================  TOOLBARS  ====================== */

.pc-bar {
    display: flex; align-items: center; gap: 6px; padding: 6px 10px;
    background: var(--pc-surface); border-bottom: 1px solid var(--pc-border);
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-height: 38px;
}
.pc-bar::-webkit-scrollbar { display: none; }
.pc-bar + .pc-bar { border-top: none; }
.pc-group { display: flex; gap: 3px; align-items: center; flex: 0 0 auto; }
.pc-group-label {
    font-size: 9px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase;
    letter-spacing: .6px; margin-right: 2px; white-space: nowrap;
}
.pc-sep { width: 1px; height: 20px; background: var(--pc-border); margin: 0 3px; flex: 0 0 auto; }
.pc-btn {
    height: 28px; padding: 0 10px; border-radius: var(--pc-radius-sm); background: var(--pc-surface-2);
    border: 1px solid var(--pc-border); color: var(--pc-text); font-size: 11px;
    font-weight: 800; cursor: pointer; font-family: inherit; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 4px;
    transition: border-color var(--pc-dur-fast), background var(--pc-dur-fast), color var(--pc-dur-fast), box-shadow var(--pc-dur-fast);
}
.pc-btn:hover { border-color: var(--pc-accent); background: var(--pc-accent-soft); color: var(--pc-accent); }
.pc-btn.active { background: var(--pc-accent); border-color: var(--pc-accent); color: #fff; box-shadow: 0 1px 4px rgba(30,86,224,.25); }
@media (prefers-reduced-motion: no-preference) {
    .pc-btn:active { transform: scale(.97); }
}
.pc-btn:disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }
.pc-btn-glyph { font-size: 11px; line-height: 1; }
.pc-btn-sm { height: 24px; padding: 0 7px; font-size: 10.5px; }
.pc-select {
    height: 28px; padding: 0 24px 0 8px; border-radius: var(--pc-radius-sm); background: var(--pc-surface);
    border: 1px solid var(--pc-border); color: var(--pc-text); font-size: 11px;
    font-weight: 700; font-family: inherit; cursor: pointer; outline: none;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2346556c'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
}
.pc-select:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 2px var(--pc-accent-soft); }
.pc-status { margin-left: auto; font-size: 10.5px; font-weight: 700; color: var(--pc-dim); white-space: nowrap; flex: 0 0 auto; }
.pc-status.err { color: var(--pc-down); }
.pc-status.ok { color: var(--pc-up); }
.pc-toolbar-hint { font-size: 10px; color: var(--pc-dim); font-weight: 600; white-space: nowrap; }

/* ======================  CHART BODY / GRID  ====================== */

.pc-body {
    display: grid; grid-template-columns: minmax(0, 1fr) 0;
    transition: grid-template-columns var(--pc-dur) var(--pc-ease); background: var(--pc-bg);
    position: relative; min-height: 560px;
}
.pc-body.panel-open { grid-template-columns: minmax(0, 1fr) 300px; }
@media (prefers-reduced-motion: reduce) {
    .pc-body { transition: none; }
}
.pc-main { position: relative; min-width: 0; display: flex; flex-direction: column; }

/* Chart canvas wrapper — the chart is the product, so it gets the room. */
.pc-canvas-wrap {
    position: relative; width: 100%; height: 640px;
    background: linear-gradient(180deg, #ffffff, #f5f7fb);
    border-radius: 0;
}
.pc-canvas { display: block; width: 100%; cursor: crosshair; touch-action: none; }
.pc-canvas.drawing { cursor: copy; }

/* Legend (OHLC info bar) — positioned at top-left inside canvas wrap.
   Uses a semi-transparent background so it never overlaps candles unreadably. */
.pc-legend {
    position: absolute; top: 4px; left: 6px; right: 6px;
    display: flex; flex-wrap: wrap; gap: 4px 10px;
    pointer-events: none; font-size: 11px; font-weight: 700;
    font-family: var(--pc-mono); z-index: 5;
    background: rgba(255,255,255,.82); backdrop-filter: blur(2px);
    padding: 2px 6px; border-radius: 4px;
}
.pc-legend-item { display: inline-flex; gap: 4px; align-items: center; color: var(--pc-dim); }
/* The indicator the user selected, named with its parameters. */
.pc-legend-inst { color: var(--pc-text); font-weight: 800; margin-right: 2px; }
.pc-legend-swatch { width: 12px; height: 2px; border-radius: 2px; display: inline-block; }
.pc-legend-value { color: var(--pc-text); font-variant-numeric: tabular-nums; }

/* ==========================================================================
   CHART OPTIONS STRIP
   The receipt for Chart settings: every selected option, named, under the
   toolbar. It is a button, so clicking reopens the modal that set it.
   Kept in normal flow (never over the candles) and flex: 0 0 auto in
   fullscreen, where #pcChartArea is a column.
   ========================================================================== */
.pc-options {
    display: flex; align-items: baseline; gap: 8px; width: 100%;
    margin: 0 0 8px; padding: 6px 10px;
    background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-sm); color: var(--pc-muted);
    font-family: var(--pc-font); font-size: 11px; font-weight: 700; line-height: 1.5;
    text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.pc-options[hidden] { display: none; }
.pc-options:hover { border-color: var(--pc-accent); background: var(--pc-accent-soft); }
.pc-options:focus-visible { outline: 2px solid var(--pc-accent); outline-offset: 1px; }
.pc-options-ico { flex: 0 0 auto; color: var(--pc-dim); font-size: 11px; }
.pc-options-text { flex: 1 1 auto; min-width: 0; }
.pc-options-text b { color: var(--pc-text); font-weight: 800; }
.pc-options-text .pc-opt-on { color: var(--pc-up); font-weight: 800; }
.pc-options-text .pc-opt-off { color: var(--pc-dim); font-weight: 700; }
.pc-options-text .pc-opt-sep { color: var(--pc-border-2); }
.pc-options-hint {
    flex: 0 0 auto; color: var(--pc-dim); font-size: 9.5px; font-weight: 800;
    letter-spacing: .5px; text-transform: uppercase; white-space: nowrap;
}
.pc-options:hover .pc-options-hint { color: var(--pc-accent); }
/* "3 event boxes pinned to their date — click any box for the full details" */
.pc-options-note { display: block; color: var(--pc-accent); font-weight: 700; }

/* Source overlay note — positioned below the time axis labels.
   The canvas has padB=28px for the time axis. Place this at the
   very bottom of the canvas-wrap so it doesn't overlap candles. */
/* Formation readout — always BELOW the canvas, never over the candles. */
.pc-pattern-read-out {
    flex: 0 0 auto;
    padding: 9px 12px;
    border-top: 1px solid var(--pc-border);
    background: var(--pc-surface-2);
}
.pc-pattern-read-out:empty { display: none; }
.pc-pattern-read {
    position: static;
    width: 100%;
    background: transparent; color: var(--pc-muted);
    font-size: 11.5px; font-weight: 600; line-height: 1.55;
    padding: 0; border-radius: 0; pointer-events: auto;
}
.pc-pattern-read b { color: var(--pc-text); font-weight: 800; }
.pc-pattern-read-note { color: var(--pc-dim); font-weight: 600; }

/* Find patterns — the legend under the chart. Same slot pattern as the
   readout: outside the canvas, so it can never cover a candle. */
.pc-pattern-legend {
    flex: 0 0 auto;
    padding: 10px 12px 11px;
    border-top: 1px solid var(--pc-border);
    background: var(--pc-surface-2);
    color: var(--pc-muted);
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.5;
}
.pc-pattern-legend[hidden] { display: none; }
.pcl-head {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    margin-bottom: 8px;
}
.pcl-title { color: var(--pc-text); font-weight: 800; font-size: 12px; }
.pcl-meta { color: var(--pc-dim); font-size: 11px; }
.pcl-actions { margin-left: auto; display: flex; gap: 6px; }
.pcl-act {
    appearance: none; cursor: pointer;
    border: 1px solid var(--pc-border); background: var(--pc-surface);
    color: var(--pc-text); font: inherit; font-size: 10.5px; font-weight: 700;
    padding: 4px 9px; border-radius: 6px; line-height: 1.2;
}
.pcl-act:hover, .pcl-act:focus-visible { border-color: var(--pc-accent); color: var(--pc-accent); }
.pcl-chips {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin: 0 -2px 8px; padding: 2px;
}
.pcl-chip {
    appearance: none; cursor: pointer; text-align: left;
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--pc-border); background: var(--pc-surface);
    color: var(--pc-text); font: inherit; font-size: 11px; font-weight: 600;
    padding: 5px 9px 5px 6px; border-radius: 8px; max-width: 100%;
    border-left: 3px solid var(--pcl-c, var(--pc-accent));
}
.pcl-chip:hover, .pcl-chip:focus-visible { border-color: var(--pcl-c, var(--pc-accent)); box-shadow: 0 1px 3px rgba(15,23,42,.08); }
.pcl-chip.is-off { opacity: .45; }
.pcl-chip.is-off .pcl-name { text-decoration: line-through; }
.pcl-num {
    flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
    background: var(--pcl-c, var(--pc-accent)); color: #fff;
    font-size: 9px; font-weight: 800; line-height: 16px; text-align: center;
}
.pcl-txt { display: inline-flex; flex-direction: column; min-width: 0; }
.pcl-name { font-weight: 800; white-space: nowrap; }
.pcl-sub { color: var(--pc-dim); font-size: 10px; font-weight: 600; white-space: nowrap; }
.pcl-status {
    flex: 0 0 auto; font-size: 9px; font-weight: 800; letter-spacing: .4px;
    text-transform: uppercase; color: var(--pcl-c, var(--pc-accent));
    background: rgba(15, 23, 42, .05);
    background: color-mix(in srgb, var(--pcl-c, var(--pc-accent)) 10%, transparent);
    border-radius: 4px; padding: 2px 5px;
}
.pcl-out { flex: 0 0 auto; font-size: 9px; font-weight: 700; color: var(--pc-dim); }
.pcl-candles { color: var(--pc-muted); font-size: 11px; margin: 2px 0 6px; }
.pcl-candles b { color: var(--pc-text); font-weight: 800; }
.pcl-empty { color: var(--pc-muted); font-size: 11.5px; margin: 2px 0 6px; }
.pcl-error { color: var(--pc-down, #b91c1c); font-size: 11.5px; margin: 2px 0 6px; }
.pcl-upsell { color: var(--pc-muted); font-size: 11.5px; }
.pcl-upsell a { color: var(--pc-accent); font-weight: 800; text-decoration: none; }
.pcl-upsell a:hover { text-decoration: underline; }
.pcl-foot { color: var(--pc-dim); font-size: 10px; font-weight: 600; border-top: 1px dashed var(--pc-border); padding-top: 6px; margin-top: 2px; }

/* ==========================================================================
   PATTERN HISTORY DECK — the past occurrences of the formation on screen
   --------------------------------------------------------------------------
   Sits in the same below-canvas stack as the readout and the scan legend.
   Indigo is the history colour everywhere (canvas bands + this deck): amber
   stays the CURRENT formation, scan hues stay "these drawings".
   ========================================================================== */

.pc-pattern-history {
    flex: 0 0 auto;
    padding: 12px;
    border-top: 1px solid var(--pc-border);
    background:
        radial-gradient(900px 160px at 8% 0%, rgba(99, 102, 241, .07), transparent 70%),
        var(--pc-surface-2);
}
.pc-pattern-history[hidden] { display: none; }

.pch-card {
    position: relative; overflow: hidden;
    background: var(--pc-surface);
    border: 1px solid var(--pc-border);
    border-radius: 12px;
    box-shadow: var(--pc-shadow-sm);
    padding: 13px 14px 11px;
    contain: layout style;
}
.pch-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: linear-gradient(90deg, #6366f1, #a855f7 48%, var(--pc-accent));
}

.pch-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.pch-kicker {
    font-size: 9.5px; font-weight: 800; letter-spacing: .7px;
    text-transform: uppercase; color: #6366f1;
}
.pch-title { font-size: 12.5px; font-weight: 800; color: var(--pc-text); }
.pch-count {
    font-size: 10px; font-weight: 700; color: var(--pc-dim);
    background: var(--pc-surface-3); border-radius: 20px; padding: 2px 8px;
}
.pch-actions { margin-left: auto; display: flex; gap: 6px; }
.pch-btn {
    appearance: none; cursor: pointer;
    border: 1px solid var(--pc-border); background: var(--pc-surface);
    color: var(--pc-text); font: inherit; font-size: 10.5px; font-weight: 700;
    padding: 4px 9px; border-radius: 6px; line-height: 1.2;
}
.pch-btn:hover, .pch-btn:focus-visible { border-color: #6366f1; color: #4f46e5; }

/* Scan mode: every scanned formation, same numbering as the scan legend. */
.pch-patterns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pch-pattern {
    appearance: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 7px;
    border: 1px solid var(--pc-border); border-left: 3px solid var(--pch-c, var(--pc-accent));
    background: var(--pc-surface); color: var(--pc-text);
    font: inherit; font-size: 10.5px; font-weight: 700;
    padding: 4px 9px 4px 6px; border-radius: 8px;
}
.pch-pattern:hover, .pch-pattern:focus-visible { border-color: var(--pch-c, var(--pc-accent)); }
.pch-pattern.is-on {
    background: color-mix(in srgb, var(--pch-c, var(--pc-accent)) 9%, var(--pc-surface));
    border-color: var(--pch-c, var(--pc-accent));
}
.pch-pattern-num {
    width: 15px; height: 15px; border-radius: 50%;
    background: var(--pch-c, var(--pc-accent)); color: #fff;
    font-size: 8.5px; font-weight: 800; line-height: 15px; text-align: center;
    flex: 0 0 auto;
}

.pch-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-top: 10px; }
.pch-controls-label {
    font-size: 9px; font-weight: 800; letter-spacing: .6px;
    text-transform: uppercase; color: var(--pc-dim);
}
.pch-chips { display: inline-flex; gap: 3px; background: var(--pc-surface-3); padding: 3px; border-radius: 8px; }
.pch-chip {
    appearance: none; cursor: pointer; border: 0; background: transparent;
    color: var(--pc-muted); font: inherit; font-size: 10.5px; font-weight: 800;
    padding: 3px 9px; border-radius: 6px; line-height: 1.2;
}
.pch-chip:hover { color: #4f46e5; }
.pch-chip.is-on { background: var(--pc-surface); color: #4f46e5; box-shadow: var(--pc-shadow-sm); }
.pch-key {
    margin-left: auto; display: inline-flex; align-items: center; gap: 5px;
    font-size: 9.5px; font-weight: 700; color: var(--pc-dim);
}
.pch-key i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.pch-key i.up { background: var(--pc-up, #0e9f6e); }
.pch-key i.down { background: var(--pc-down, #dc2626); margin-left: 6px; }

/* The rail: one node per past occurrence, positioned by its end date. */
.pch-rail-wrap { display: flex; align-items: center; gap: 8px; margin: 12px 0 2px; }
.pch-rail-date {
    flex: 0 0 auto; font-size: 9.5px; font-weight: 700;
    font-family: var(--pc-mono); color: var(--pc-dim); white-space: nowrap;
}
.pch-rail {
    position: relative; flex: 1 1 auto; height: 24px; margin: 0 4px;
    background: linear-gradient(90deg, rgba(99,102,241,.07), rgba(99,102,241,.16));
    border-radius: 20px;
}
.pch-rail::before {
    content: ""; position: absolute; left: 7px; right: 7px; top: 50%;
    height: 1px; background: rgba(99,102,241,.35); transform: translateY(-50%);
}
.pch-node {
    position: absolute; top: 50%; transform: translate(-50%, -50%);
    width: 16px; height: 18px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.pch-node i {
    display: block; width: 9px; height: 9px; margin: 4.5px auto;
    border-radius: 50%; background: #94a3b8;
    border: 1.5px solid #fff; box-shadow: 0 1px 2px rgba(11,21,38,.25);
    transition: transform .12s ease;
}
.pch-node.up i { background: var(--pc-up, #0e9f6e); }
.pch-node.down i { background: var(--pc-down, #dc2626); }
.pch-node.flat i { background: #94a3b8; }
.pch-node:hover i, .pch-node:focus-visible i { transform: scale(1.5); }
.pch-node.is-active i { box-shadow: 0 0 0 3px rgba(99,102,241,.28), 0 1px 2px rgba(11,21,38,.3); }
.pch-node.is-now { pointer-events: none; }
.pch-node.is-now i {
    width: 11px; height: 11px; margin: 3.5px auto; background: #d97706;
    box-shadow: 0 0 0 3px rgba(245,158,11,.25), 0 1px 2px rgba(11,21,38,.3);
}

.pch-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 10px; }
.pch-stat {
    display: flex; flex-direction: column; gap: 2px;
    background: var(--pc-surface-2); border: 1px solid var(--pc-border);
    border-radius: 8px; padding: 6px 9px; min-width: 0;
}
.pch-stat span {
    font-size: 8.5px; font-weight: 800; letter-spacing: .5px;
    text-transform: uppercase; color: var(--pc-dim); white-space: nowrap;
}
.pch-stat b {
    font-size: 13px; font-weight: 800; font-family: var(--pc-mono);
    font-variant-numeric: tabular-nums; color: var(--pc-text);
}
.pch-stat b.up { color: var(--pc-up, #0e9f6e); }
.pch-stat b.down { color: var(--pc-down, #dc2626); }

.pch-note {
    margin-top: 9px; padding: 6px 9px; border-radius: 6px;
    background: var(--pc-accent-soft); color: var(--pc-muted);
    font-size: 10.5px; font-weight: 600;
}
.pch-foot {
    margin-top: 9px; padding-top: 7px;
    border-top: 1px dashed var(--pc-border);
    color: var(--pc-dim); font-size: 9.5px; font-weight: 600; line-height: 1.5;
}

@media (max-width: 720px) {
    .pch-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pch-rail-date, .pch-key { display: none; }
    .pch-head { gap: 3px 8px; }
    .pch-actions { width: 100%; margin-left: 0; }
}


#pcFindPatterns.active { border-color: var(--pc-accent); color: var(--pc-accent); background: color-mix(in srgb, var(--pc-accent) 8%, transparent); }
#pcFindPatterns.is-busy { opacity: .7; pointer-events: none; }
.pc-overlay-note {
    position: absolute; left: 8px; bottom: 2px;
    font-size: 10px; font-weight: 700; color: var(--pc-dim);
    pointer-events: none; z-index: 2;
    background: rgba(255,255,255,.9); backdrop-filter: blur(2px);
    padding: 1px 6px; border-radius: 3px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    max-width: 95%; line-height: 1.3;
}

/* ======================  LOADING / ERROR  ======================
   The overlay is quiet glass: the chart stays faintly legible beneath it,
   and a native <progress> (indeterminate by omission) carries the state to
   assistive tech. Entry fades via @starting-style; the app's global
   `[hidden] { display: none !important }` keeps the exit instant. */
.pc-loading, .pc-error {
    position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
    align-items: center; justify-content: center; text-align: center; padding: 24px;
    background: rgba(255,255,255,.84);
    background: color-mix(in srgb, var(--pc-surface) 82%, transparent);
    backdrop-filter: blur(7px) saturate(1.15); z-index: 8;
    border-radius: var(--pc-radius-sm);
    opacity: 1;
    transition: opacity .2s ease, display .2s;
    transition-behavior: allow-discrete;
}
@starting-style {
    .pc-loading, .pc-error { opacity: 0; }
}
.pc-loading[hidden], .pc-error[hidden] { display: none !important; opacity: 0; pointer-events: none; }
.pc-loading-text { font-size: 12px; font-weight: 700; color: var(--pc-muted); }
.pc-error-title { font-size: 14px; font-weight: 800; color: var(--pc-text); text-wrap: balance; }
.pc-error-sub { font-size: 12px; color: var(--pc-muted); font-weight: 600; max-width: 400px; line-height: 1.6; text-wrap: pretty; }
.pc-error .pc-btn { margin-top: 8px; }

/* ---------------- Native indeterminate spinner ----------------
   The <progress> is the semantic source of truth (no `value`), but Chrome
   157 still paints its native indeterminate square over an appearance:none
   progress — the ::-webkit-progress-* reset no longer matches. So the ring
   is drawn by the wrapper's ::before with the intended conic-gradient
   trail, hollowed by background-clip: border-area (mask-image where that
   is unsupported, system colors in forced-colors mode), while the progress
   itself stays transparent and in the accessibility tree. The dash rides
   an @property whose initial value only exists where it is supported, so
   the fallback is a plain rotation with no JavaScript. */
@property --pc-spin-from { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --pc-spin-to { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --pc-spin-dash { syntax: "*"; inherits: false; initial-value: , pc-spinner-dash 3s ease-in-out infinite; }

.pc-spinner {
    --pc-spinner-size: 30px;
    --pc-spinner-thickness: 3px;
    --pc-spinner-color: var(--pc-accent);
    --pc-spinner-track: var(--pc-border);
    --pc-spinner-duration: 1.2s;
    position: relative; display: inline-block;
    width: var(--pc-spinner-size); height: var(--pc-spinner-size);
    flex: 0 0 auto;
}
.pc-spinner > progress {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; pointer-events: none;
    appearance: none; -webkit-appearance: none;
}
.pc-spinner::before {
    content: ""; position: absolute; inset: 0;
    border-radius: 50%;
    --_spin-from: calc(90deg + var(--pc-spin-from, 0deg));
    --_spin-to: calc(90deg + var(--pc-spin-to, 158deg));
    --_spin-duration: var(--pc-spinner-duration);
    background: conic-gradient(
        from var(--_spin-from),
        var(--pc-spinner-color) calc(var(--_spin-to) - var(--_spin-from)),
        transparent 0
    ) var(--pc-spinner-track);
    animation:
        pc-spinner-spin var(--_spin-duration) linear infinite
        var(--pc-spin-dash, );
}
@supports (background-clip: border-area) {
    .pc-spinner::before {
        background-clip: border-area;
        border: var(--pc-spinner-thickness) solid transparent;
        background-origin: border-box;
    }
}
@supports not (background-clip: border-area) {
    .pc-spinner::before {
        --clip-boundary: calc(100% - var(--pc-spinner-thickness));
        mask-image: radial-gradient(farthest-side, transparent var(--clip-boundary), #000 var(--clip-boundary));
        border: 0;
    }
}
@media (forced-colors: active) {
    .pc-spinner::before {
        forced-color-adjust: none;
        --pc-spinner-color: CanvasText;
        --pc-spinner-track: Canvas;
    }
}
@keyframes pc-spinner-spin { to { rotate: 1turn; } }
@keyframes pc-spinner-dash {
    from { --pc-spin-from: 0deg; --pc-spin-to: 3deg; }
    50% { --pc-spin-from: 100deg; --pc-spin-to: 358deg; }
    to { --pc-spin-from: 360deg; --pc-spin-to: 363deg; }
}
@media (prefers-reduced-motion: reduce) {
    .pc-spinner::before {
        /* Slow rather than stop: activity stays legible without the dash. */
        --_spin-duration: 6s;
        --pc-spin-dash: ;
        --pc-spin-to: 158deg;
    }
}
.pc-spinner-sm {
    --pc-spinner-size: 18px;
    --pc-spinner-thickness: 2px;
    --pc-spinner-duration: 1.4s;
}

/* ---------------- Chart-shaped skeleton ----------------
   The ghost of the canvas: legend chips, grid, candles, axis labels and
   the last-price pill, at the same proportions the first frame will
   paint. Decorative only; the sheen opts in with motion preference. */
.pc-skeleton {
    position: absolute; inset: 0; z-index: 6; overflow: hidden;
    background: linear-gradient(180deg, #ffffff, #f5f7fb);
    contain: layout style paint;
    opacity: 1;
    transition: opacity .25s ease, display .25s;
    transition-behavior: allow-discrete;
}
@starting-style {
    .pc-skeleton { opacity: 0; }
}
.pc-skeleton[hidden] { display: none !important; opacity: 0; pointer-events: none; }
.pc-skeleton::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.55) 50%, transparent 62%);
    translate: -100% 0;
}
@media (prefers-reduced-motion: no-preference) {
    .pc-skeleton::after { animation: pc-sk-sheen 1.6s cubic-bezier(.4, 0, .2, 1) infinite; }
}
@keyframes pc-sk-sheen { from { translate: -100% 0; } 60%, to { translate: 100% 0; } }

.pc-sk-plot { position: absolute; inset: 12px 60px 42px 14px; }
.pc-sk-legend { position: absolute; top: 2px; left: 2px; z-index: 1; display: flex; gap: 8px; }
.pc-sk-legend i { width: 72px; height: 10px; border-radius: 4px; background: var(--pc-surface-3); }
.pc-sk-legend i.w2 { width: 46px; }
.pc-sk-legend i.w3 { width: 58px; }
.pc-sk-grid {
    position: absolute; inset: 0; border-radius: 8px; opacity: .8;
    background-image:
        linear-gradient(var(--pc-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--pc-grid) 1px, transparent 1px);
    background-size: 100% 20%, 12.5% 100%;
}
.pc-sk-candles { position: absolute; inset: 0; }
.pc-sk-candle {
    position: absolute; left: var(--x); bottom: calc(100% - var(--y));
    width: clamp(3px, .9%, 8px); height: var(--h);
    translate: -50% 0;
    border-radius: 2px;
    background: var(--c, rgba(11, 21, 38, .12));
}
.pc-sk-candle::before {
    content: ""; position: absolute; left: 50%; top: -34%; bottom: -34%; width: 1px;
    background: inherit; translate: -50% 0; opacity: .65; border-radius: 1px;
}
.pc-sk-axis-y {
    position: absolute; top: 0; bottom: 0; right: -54px; width: 42px;
    display: flex; flex-direction: column; justify-content: space-between; align-items: flex-end;
}
.pc-sk-axis-x {
    position: absolute; left: 0; right: -54px; bottom: -30px; height: 10px;
    display: flex; justify-content: space-between; align-items: center;
}
.pc-sk-label { height: 9px; border-radius: 4px; background: var(--pc-surface-3); }
.pc-sk-axis-y .pc-sk-label { width: 32px; }
.pc-sk-axis-x .pc-sk-label { width: 26px; }
.pc-sk-price {
    position: absolute; right: -56px; top: 20%; width: 44px; height: 18px;
    border-radius: 5px; background: var(--pc-accent-soft);
    border: 1px solid color-mix(in srgb, var(--pc-accent) 22%, transparent);
}
@media (max-width: 720px) {
    .pc-sk-plot { inset: 10px 44px 38px 10px; }
    .pc-sk-axis-y { right: -38px; width: 30px; }
    .pc-sk-axis-x { right: -38px; bottom: -27px; }
    .pc-sk-axis-y .pc-sk-label { width: 24px; }
    .pc-sk-axis-x .pc-sk-label { width: 20px; }
    .pc-sk-price { right: -40px; width: 32px; }
}

/* ======================  TOOLTIP  ====================== */

.pc-tip {
    position: absolute; z-index: 15; pointer-events: none; min-width: 200px; max-width: 300px;
    background: rgba(11,21,38,.92); border: 1px solid rgba(255,255,255,.1); border-radius: var(--pc-radius);
    padding: 10px 12px; box-shadow: 0 12px 32px rgba(11,21,38,.4); font-size: 11px; font-weight: 600;
    color: #e2e8f0; backdrop-filter: blur(8px);
}
.pc-tip[hidden] { display: none; }
.pc-tip-date { font-size: 10.5px; font-weight: 800; color: #94a3b8; letter-spacing: .3px; margin-bottom: 6px; text-transform: uppercase; }
.pc-tip-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; }
.pc-tip-k { color: #94a3b8; }
.pc-tip-v { text-align: right; font-family: var(--pc-mono); font-variant-numeric: tabular-nums; color: #f1f5f9; }
.pc-tip-head { grid-column: 1 / -1; font-size: 9.5px; font-weight: 800; color: #64748b; text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }

/* ======================  EVENT POPOVER  ====================== */

.pc-pop {
    position: absolute; z-index: 16; min-width: 220px; max-width: 320px;
    background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius); box-shadow: var(--pc-shadow-lg); padding: 12px 14px;
}
.pc-pop[hidden] { display: none; }
.pc-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.pc-pop-title { font-size: 12px; font-weight: 800; letter-spacing: .2px; }
.pc-pop-close { background: none; border: none; color: var(--pc-dim); font-size: 16px; cursor: pointer; line-height: 1; padding: 2px; }
.pc-pop-close:hover { color: var(--pc-text); }
.pc-pop-rows { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 11px; }
/* A marker box can hold several records (a date with two deals, say): each one
   gets its own titled block with the real Prime values under it. */
.pc-pop-items { max-height: 280px; overflow-y: auto; }
.pc-pop-item + .pc-pop-item { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--pc-border); }
.pc-pop-item-head {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 800; color: var(--pc-text); margin-bottom: 6px;
}
.pc-pop-dot { width: 8px; height: 8px; border-radius: 2px; flex: 0 0 auto; }
.pc-pop-k { color: var(--pc-muted); }
.pc-pop-v { text-align: right; font-family: var(--pc-mono); font-weight: 700; }
.pc-pop-sub {
    font-size: 10px; font-weight: 800; color: var(--pc-dim);
    letter-spacing: .4px; text-transform: uppercase; margin: -3px 0 8px;
}

/* ======================  RIGHT PANEL (Technical Snapshot)  ====================== */

.pc-panel {
    border-left: 1px solid var(--pc-border); background: var(--pc-surface);
    overflow-y: auto; max-height: 100%; display: none;
    overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--pc-border-2) transparent;
    scrollbar-gutter: stable;
}
.pc-body.panel-open .pc-panel { display: block; }
@media (prefers-reduced-motion: no-preference) {
    .pc-body.panel-open .pc-panel { animation: pc-panel-in var(--pc-dur) var(--pc-ease); }
}
@keyframes pc-panel-in { from { opacity: 0; translate: 8px 0; } }
.pc-panel-inner { padding: 12px 14px 22px; }
.pc-panel-title {
    font-size: 10px; font-weight: 800; text-transform: uppercase;
    letter-spacing: .7px; color: var(--pc-dim); margin: 14px 0 8px;
    padding-bottom: 4px; border-bottom: 1px solid var(--pc-surface-3);
}
.pc-panel-title:first-child { margin-top: 0; }
.pc-kv { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; font-size: 11.5px; font-weight: 600; }
.pc-kv dt { color: var(--pc-muted); }
.pc-kv dd { margin: 0; text-align: right; font-family: var(--pc-mono); font-variant-numeric: tabular-nums; font-weight: 700; }
.pc-sig { display: flex; flex-direction: column; gap: 4px; }
.pc-sig-item { display: flex; align-items: flex-start; gap: 6px; font-size: 11px; font-weight: 600; color: var(--pc-muted); }
.pc-sig-mark { flex: 0 0 auto; font-weight: 800; }
.pc-sig-item.pass .pc-sig-mark { color: var(--pc-up); }
.pc-sig-item.fail .pc-sig-mark { color: var(--pc-down); }
.pc-sig-item.neutral .pc-sig-mark { color: var(--pc-dim); }
.pc-sig-item.pass { color: var(--pc-text); }
.pc-pos-bar { height: 6px; border-radius: 4px; background: var(--pc-surface-3); overflow: hidden; margin: 6px 0 4px; }
.pc-pos-fill { height: 100%; background: linear-gradient(90deg, var(--pc-down), var(--pc-warn), var(--pc-up)); border-radius: 4px; }
.pc-perf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.pc-perf { background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-radius: var(--pc-radius-sm); padding: 5px 6px; text-align: center; }
.pc-perf-l { font-size: 9px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase; letter-spacing: .3px; }
.pc-perf-v { font-family: var(--pc-mono); font-size: 11px; font-weight: 700; margin-top: 1px; }

/* ======================  MODALS  ======================
   The SAME modal system the rest of the terminal ships: a white card on a
   rgba(11,21,38,.55) / blur(4px) scrim, 16px radius, the site's shadow, a
   16/22 header split by a hairline, a 1.05rem/800 title and an ink-3 close
   glyph — the values dashboard.css (.modal-overlay / .modal-card /
   .modal-header), screener.php (.sc-modal-*) and demo-trading.php
   (.modal-overlay / .modal-card) all converge on. This block used to paint
   the four chart dialogs DARK (#1a1f2e card, #0f1520 inputs) on a light-only
   site; the dark overrides are gone, so every control inside a chart modal is
   now the light control the toolbars already used. */

/* Key fix: modals use position:fixed with high z-index so they appear
   above everything including fullscreen charts. Clicking backdrop closes. */
.pc-modal {
    position: fixed; inset: 0; z-index: 9000;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 16px; background: rgba(11, 21, 38, .55);
    backdrop-filter: blur(4px); overflow-y: auto;
    overscroll-behavior: contain;
}
.pc-modal[hidden] { display: none; }
.pc-modal-card {
    width: 100%; max-width: 580px;
    background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-radius: 16px; box-shadow: 0 24px 60px rgba(11, 21, 38, .28);
    overflow: hidden; color: var(--pc-text);
}
@media (prefers-reduced-motion: no-preference) {
    .pc-modal { animation: pc-scrim-in .2s ease-out; }
    .pc-modal-card { animation: pc-modal-in .18s var(--pc-ease); }
}
@keyframes pc-scrim-in { from { opacity: 0; } }
@keyframes pc-modal-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } }
.pc-modal-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--pc-border);
}
.pc-modal-title { font-size: 1.05rem; font-weight: 800; color: var(--pc-text); }
.pc-modal-close {
    background: none; border: none; color: var(--pc-dim); font-size: 22px;
    cursor: pointer; padding: 4px 6px; line-height: 1; border-radius: var(--pc-radius-sm);
    transition: background .12s, color .12s;
}
.pc-modal-close:hover { color: var(--pc-text); background: var(--pc-surface-3); }
.pc-modal-body {
    padding: 22px 24px; max-height: 65vh; overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--pc-border-2) transparent;
}
.pc-modal-body::-webkit-scrollbar { width: 6px; }
.pc-modal-body::-webkit-scrollbar-track { background: transparent; }
.pc-modal-body::-webkit-scrollbar-thumb { background: var(--pc-border-2); border-radius: 3px; }
.pc-modal-foot { padding: 14px 22px; border-top: 1px solid var(--pc-border); display: flex; gap: 8px; justify-content: flex-end; }
.pc-field { margin-bottom: 12px; position: relative; }

/* "Clear all" sits on its own at the left of the modal footer, away from Save,
   and takes the site's danger treatment (.btn-danger / .sc-remove: soft red
   field, red ink, solid red on hover). */
.pc-modal .pc-btn-clear { margin-right: auto; background: var(--pc-down-soft); border-color: transparent; color: var(--pc-down); }
.pc-modal .pc-btn-clear:hover { background: var(--pc-down); border-color: var(--pc-down); color: #fff; }
.pc-field-label { display: block; font-size: 10px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase; letter-spacing: .7px; margin-bottom: 6px; }
.pc-input, .pc-field select {
    width: 100%; height: 34px; padding: 0 10px; border-radius: var(--pc-radius-sm);
    background: var(--pc-surface); border: 1px solid var(--pc-border); color: var(--pc-text);
    font-size: 12.5px; font-weight: 600; font-family: inherit; outline: none;
}
.pc-input:focus, .pc-field select:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 2px var(--pc-accent-soft); }
.pc-check { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--pc-text); cursor: pointer; padding: 3px 0; }
.pc-check input[type="checkbox"] { accent-color: var(--pc-accent); width: 15px; height: 15px; }
/*
 * A marker category list whose master toggle is off. The boxes stay clickable
 * (ticking one is what switches the group on), but the group is dimmed so a
 * saved-but-not-drawn selection can never be mistaken for a chart bug.
 */
.pc-cats-muted { opacity: .5; }

/* Live, named preview of the pending selection inside Chart settings. */
.pc-opt-preview {
    margin: 0 0 14px; padding: 9px 11px;
    background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-radius: var(--pc-radius);
    color: var(--pc-muted); font-size: 11.5px; font-weight: 600; line-height: 1.75;
}
.pc-opt-live-label {
    display: block; color: var(--pc-dim); font-size: 9.5px; font-weight: 800;
    letter-spacing: .7px; text-transform: uppercase; margin-bottom: 3px;
}
.pc-opt-preview .pc-opt-on { color: var(--pc-up); font-weight: 800; }
.pc-opt-preview .pc-opt-off { color: var(--pc-dim); font-weight: 700; }
.pc-opt-preview b { color: var(--pc-text); font-weight: 800; }
.pc-opt-preview .pc-opt-sep { color: var(--pc-border-2); }
.pc-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Compare modal: search results overlay */
#pcCompareModal .pc-field { position: relative; }
#pcCompareModal .pc-field > .pc-results {
    position: absolute; left: 0; right: 0; z-index: 10;
    box-shadow: 0 10px 34px rgba(11,21,38,.14); max-height: 280px;
}

/* Indicator menu */
.pc-ind-search { margin-bottom: 10px; }
.pc-ind-search input {
    width: 100%; height: 36px; padding: 0 12px 0 34px;
    background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: var(--pc-radius-sm);
    color: var(--pc-text); font-size: 13px; font-weight: 600; font-family: inherit; outline: none;
}
.pc-ind-search input:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 2px var(--pc-accent-soft); }
.pc-ind-search input::placeholder { color: var(--pc-dim); }
.pc-ind-cat {
    font-size: 10px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase;
    letter-spacing: .7px; margin: 14px 0 7px; padding-bottom: 4px;
    border-bottom: 1px solid var(--pc-surface-3);
}
.pc-ind-cat:first-child { margin-top: 0; }
.pc-ind-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 5px; }
.pc-ind-item {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    padding: 7px 10px; border-radius: var(--pc-radius-sm); background: var(--pc-surface-2);
    border: 1px solid var(--pc-border); cursor: pointer; font-size: 11.5px; font-weight: 700;
    color: var(--pc-text); transition: border-color .12s, background .12s;
}
.pc-ind-item:hover { border-color: var(--pc-accent); background: var(--pc-accent-soft); }
.pc-ind-item.on { border-color: var(--pc-accent); background: var(--pc-accent-soft); color: var(--pc-accent); }
.pc-ind-badge { font-size: 9px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase; letter-spacing: .4px; }
.pc-ind-added { color: var(--pc-up); font-weight: 800; font-size: 12px; }
.pc-ind-item.on .pc-ind-added { color: var(--pc-accent); }

/* Active indicator list with parameter editors */
.pc-active-list { display: flex; flex-direction: column; gap: 6px; }
.pc-active-row {
    background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-radius: var(--pc-radius-sm);
    padding: 8px 10px; transition: border-color .12s;
}
.pc-active-row:hover { border-color: var(--pc-border-2); }
.pc-active-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-active-name { font-size: 12px; font-weight: 800; color: var(--pc-text); flex: 1; min-width: 60px; }
.pc-params { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pc-param { display: flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: var(--pc-muted); }
.pc-param input {
    width: 64px; height: 26px; padding: 0 6px; border-radius: var(--pc-radius-sm);
    background: var(--pc-surface); border: 1px solid var(--pc-border); color: var(--pc-text);
    font-family: var(--pc-mono); font-size: 11px; outline: none;
}
.pc-param input:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 2px var(--pc-accent-soft); }
.pc-param select {
    height: 26px; padding: 0 6px; border-radius: var(--pc-radius-sm); background: var(--pc-surface);
    border: 1px solid var(--pc-border); color: var(--pc-text); font-size: 11px; font-weight: 600;
    font-family: inherit; outline: none;
}

/* Compare chips — the same pill the landing search and the site's badges use */
.pc-cmp-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pc-cmp-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-radius: 50px;
    padding: 5px 10px; font-size: 11px; font-weight: 800; color: var(--pc-text);
    transition: border-color .12s;
}
.pc-cmp-chip:hover { border-color: var(--pc-border-2); }
.pc-cmp-chip-primary {
    background: var(--pc-accent-soft); border-color: var(--pc-accent);
    color: var(--pc-accent); cursor: default;
}
.pc-cmp-chip button { background: none; border: none; color: var(--pc-dim); cursor: pointer; font-size: 13px; line-height: 1; padding: 0 2px; border-radius: 4px; transition: color .12s; }
.pc-cmp-chip button:hover { color: var(--pc-down); }

/* Compare search input */
#pcCompareModal .pc-search-field input {
    background: var(--pc-surface); border: 1px solid var(--pc-border); color: var(--pc-text);
    height: 38px; font-size: 13px;
}
#pcCompareModal .pc-search-field input:focus { border-color: var(--pc-accent); }
#pcCompareModal .pc-search-field input::placeholder { color: var(--pc-dim); }

/* ======================  DRAWING TOOLBAR  ====================== */

.pc-drawbar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pc-draw-btn {
    width: 30px; height: 28px; border-radius: var(--pc-radius-sm); background: var(--pc-surface-2);
    border: 1px solid var(--pc-border); color: var(--pc-text); cursor: pointer;
    font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
    font-family: inherit; transition: all .12s;
}
.pc-draw-btn:hover { border-color: var(--pc-accent); background: var(--pc-accent-soft); }
.pc-draw-btn.active { background: var(--pc-accent); border-color: var(--pc-accent); color: #fff; }

/* ======================  REPLAY BAR  ====================== */

.pc-replay {
    display: flex; align-items: center; gap: 8px; padding: 6px 10px;
    background: var(--pc-surface-2); border-top: 1px solid var(--pc-border);
    flex-wrap: wrap;
}
.pc-replay[hidden] { display: none; }
.pc-replay input[type="range"] {
    flex: 1 1 240px; min-width: 140px; accent-color: var(--pc-accent);
    height: 20px; cursor: pointer;
}
.pc-replay input[type="range"]:disabled { opacity: .5; cursor: default; }
.pc-replay-date { font-family: var(--pc-mono); font-size: 11px; font-weight: 700; min-width: 92px; }
.pc-replay-lbl { font-size: 10px; font-weight: 800; color: var(--pc-dim); text-transform: uppercase; letter-spacing: .5px; }
.pc-replay-meta {
    font-family: var(--pc-mono); font-size: 10.5px; font-weight: 600; color: var(--pc-dim);
    white-space: nowrap; min-width: 132px;
}

/* Play button reads as the primary action while the replay bar is open. */
.pc-replay .pc-btn-play {
    background: var(--pc-accent); border-color: var(--pc-accent); color: #fff; font-weight: 800;
}
.pc-replay .pc-btn-play:hover { background: var(--pc-accent-hover); border-color: var(--pc-accent-hover); }

/* Speed presets */
.pc-replay-speed { display: inline-flex; align-items: center; gap: 2px; }
.pc-replay-speed button {
    height: 24px; padding: 0 7px; border-radius: var(--pc-radius-sm); cursor: pointer;
    background: var(--pc-surface); border: 1px solid var(--pc-border-2);
    color: var(--pc-muted); font-family: var(--pc-mono); font-size: 10.5px; font-weight: 700;
}
.pc-replay-speed button:hover { border-color: var(--pc-accent); color: var(--pc-accent); }
.pc-replay-speed button.active {
    background: var(--pc-accent-soft); border-color: var(--pc-accent); color: var(--pc-accent); font-weight: 800;
}
/* The speed presets hide on the narrowest screens; the keyboard/next-prev
   controls remain. */
@media (max-width: 620px) {
    .pc-replay-speed { display: none; }
    .pc-replay-meta { min-width: 0; }
}

/* ======================  MULTI-CHART GRID  ====================== */

.pc-grid {
    display: grid; gap: 6px; padding: 6px; background: var(--pc-bg);
}
.pc-grid[data-layout="1"] { grid-template-columns: 1fr; }
.pc-grid[data-layout="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pc-grid[data-layout="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pc-grid[data-layout="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Chart cells */
.pc-cell {
    background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-sm); overflow: visible; display: flex; flex-direction: column;
    min-width: 0; position: relative; transition: border-color .15s, box-shadow .15s;
    /* Isolate each chart's reflow/repaint from the grid around it. */
    contain: layout style;
}
/* Active cell: subtle blue border + shadow so user knows which chart the toolbar targets */
.pc-cell.active {
    border-color: var(--pc-accent);
    box-shadow: 0 0 0 1px var(--pc-accent), 0 2px 8px rgba(30,86,224,.12);
}
/* Single chart hides the cell header since the page header shows the symbol */
.pc-grid[data-layout="1"] .pc-cell-head { display: none; }

.pc-cell-head {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; border-bottom: 1px solid var(--pc-border); flex-wrap: nowrap;
    background: var(--pc-surface-2); border-radius: var(--pc-radius-sm) var(--pc-radius-sm) 0 0;
}
.pc-cell-sym {
    font-size: 11.5px; font-weight: 800; cursor: pointer; white-space: nowrap;
    padding: 2px 6px; border-radius: 4px; transition: background .12s;
}
.pc-cell-sym:hover { color: var(--pc-accent); background: var(--pc-accent-soft); }
.pc-cell-sub { font-size: 10.5px; font-family: var(--pc-mono); font-weight: 700; color: var(--pc-dim); }
.pc-cell-tools { margin-left: auto; display: flex; gap: 3px; }
.pc-cell-body { position: relative; overflow: hidden; flex: 1; }

.pc-cell-state {
    position: absolute; inset: 0; z-index: 4;
    display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center;
    background: var(--pc-surface); color: var(--pc-dim);
    font-size: 13px; font-weight: 600; text-align: center; padding: 16px;
}
.pc-cell-state[hidden] { display: none !important; }
.pc-cell-state.loading { color: var(--pc-muted); }
.pc-cell-progress { display: none; }
.pc-cell-state.loading .pc-cell-progress { display: block; }
.pc-cell-state.error, .pc-cell-state.err { color: var(--pc-down); }
.pc-cell-state-text { max-width: 280px; line-height: 1.45; }

/* Canvas wrap in multi-chart cells */
.pc-grid[data-layout="2"] .pc-canvas-wrap,
.pc-grid[data-layout="3"] .pc-canvas-wrap,
.pc-grid[data-layout="4"] .pc-canvas-wrap { height: 420px; }

/* Single chart canvas gets more vertical space */
.pc-grid[data-layout="1"] .pc-canvas-wrap { height: 680px; }

/* Inline cell search for multi-chart layout — z-index above canvas */
.pc-cell-search {
    position: relative; flex: 1; min-width: 100px;
}
.pc-cell-search-input {
    width: 100%; height: 24px; padding: 0 7px; border-radius: var(--pc-radius-sm);
    background: var(--pc-surface); border: 1px solid var(--pc-border-2);
    color: var(--pc-text); font-size: 10.5px; font-weight: 600;
    font-family: inherit; outline: none;
}
.pc-cell-search-input:focus { border-color: var(--pc-accent); box-shadow: 0 0 0 2px var(--pc-accent-soft); }
.pc-cell-search-input::placeholder { color: var(--pc-dim); }
.pc-cell-search-drop {
    position: absolute; top: calc(100% + 3px); left: 0; right: 0;
    z-index: 9999; background: var(--pc-surface); border: 1px solid var(--pc-border);
    border-radius: var(--pc-radius-sm); max-height: 220px; overflow-y: auto;
    box-shadow: var(--pc-shadow-lg); margin-top: 2px;
}
.pc-cell-search-item {
    padding: 6px 10px; font-size: 10.5px; font-weight: 600;
    color: var(--pc-text); cursor: pointer; border-bottom: 1px solid var(--pc-surface-3);
    transition: background .1s;
}
.pc-cell-search-item:last-child { border-bottom: none; }
.pc-cell-search-item:hover { background: var(--pc-accent-soft); }

/* ======================  FULLSCREEN  ====================== */

/* 
 * CRITICAL FIX: Fullscreen targets .pc-app but we must NOT hide the
 * toolbar controls. The chart controls (#pcIndicators, #pcCompare, etc.)
 * live inside pc-chartArea > .pc-bar, not in the topbar/sidebar.
 * 
 * We hide the topbar and sidebar (navigation), keep all chart controls,
 * and make the chart area fill the full viewport.
 */
.pc-app:fullscreen,
.pc-app:-webkit-full-screen {
    background: var(--pc-bg);
}

/* Hide navigation chrome in fullscreen (topbar is the site nav, sidebar is the Prime nav).
   The winning declaration for each of these lives in the single authoritative
   fullscreen block below; the copies that used to sit here were dead. */

/* Make the shell borderless in fullscreen. (`overflow: visible` used to sit here
   too, but the authoritative block below sets `overflow: hidden` on the same
   selector, so the earlier declaration never won for any element — see the
   "same-selector duplicate declarations" check in
   _work/css-duplicate-conflict-audit.py.) */
.pc-app:fullscreen .pc-shell,
.pc-app:-webkit-full-screen .pc-shell { border-radius: 0; border: none; }

/* Fullscreen heights, z-indexes and modal stacking are owned by the single
   authoritative block at the end of this file (see "FULLSCREEN: FILL THE
   VIEWPORT"). Four competing copies used to live across the file; only the
   last one ever won, so only the last one is kept. */

/* Compact grid in fullscreen. */
.pc-app:fullscreen .pc-grid,
.pc-app:-webkit-full-screen .pc-grid { padding: 4px; gap: 4px; }

/* ======================  RESPONSIVE  ====================== */

@media (max-width: 1100px) {
    .pc-body.panel-open { grid-template-columns: minmax(0, 1fr) 260px; }
}

@media (max-width: 900px) {
    .pc-canvas-wrap { height: 460px; }
    .pc-grid[data-layout="1"] .pc-canvas-wrap { height: 520px; }
    .pc-grid[data-layout="2"] .pc-canvas-wrap,
    .pc-grid[data-layout="3"] .pc-canvas-wrap,
    .pc-grid[data-layout="4"] .pc-canvas-wrap { height: 360px; }
    .pc-head { padding: 8px 10px; gap: 8px; }
    .pc-sym { font-size: 1.1rem; }
    .pc-quote-price { font-size: 1.2rem; }
    /* Stack panel below chart on tablets */
    .pc-body, .pc-body.panel-open { grid-template-columns: minmax(0, 1fr); }
    .pc-panel { display: none; border-left: none; border-top: 1px solid var(--pc-border); max-height: 50vh; }
    .pc-body.panel-open .pc-panel { display: block; }
    /* Single column grids on tablets */
    .pc-grid[data-layout="2"],
    .pc-grid[data-layout="3"],
    .pc-grid[data-layout="4"] { grid-template-columns: 1fr; }
    .pc-modal { padding: 12px 8px; }
    .pc-modal-card { max-width: 100%; }
    .pc-modal-body { max-height: 70vh; padding: 20px 18px; }
    .pc-landing-card { padding: 24px 20px 22px; }
    .pc-landing-title { font-size: 1.25rem; }
    .pc-perf-grid { grid-template-columns: repeat(2, 1fr); }
    .pc-legend { font-size: 10px; gap: 5px 10px; }
}

@media (max-width: 600px) {
    .pc-app { max-width: 100%; overflow-x: hidden; }
    .pc-shell { border-radius: 10px; }
    .pc-landing { padding: 0; }
    .pc-landing-card { padding: 18px 14px 16px; border-radius: 12px; }
    .pc-search-field input { height: 42px; font-size: 13px; }
    .pc-head { align-items: flex-start; }
    .pc-head-left, .pc-head-quote { width: 100%; }
    .pc-sym { font-size: 1.15rem; }
    /* Every control stays visible: wrap the toolbars instead of hiding
       commands in a sideways-scrolling strip on a phone. */
    .pc-bar { flex-wrap: wrap; overflow-x: visible; gap: 5px; padding: 6px; min-height: 0; }
    /* A group is one flex item that refuses to shrink (flex: 0 0 auto), so
       its max-content width (8 range buttons ≈ 410px) used to spill past a
       phone. Cap it at the bar and let the buttons wrap onto a second line —
       every control stays visible without a sideways-scrolling toolbar. */
    .pc-group { flex-wrap: wrap; max-width: 100%; }
    .pc-sep { display: none; }
    .pc-status { margin-left: 0; width: 100%; white-space: normal; }
    .pc-btn { height: 28px; padding: 0 8px; font-size: 10.5px; }
    .pc-select { height: 28px; font-size: 10.5px; }
    .pc-toolbar-hint { display: none; }
    .pc-grid { padding: 4px; }
    .pc-canvas-wrap { height: 340px; }
    .pc-grid[data-layout="1"] .pc-canvas-wrap { height: 400px; }
    .pc-grid[data-layout="2"] .pc-canvas-wrap,
    .pc-grid[data-layout="3"] .pc-canvas-wrap,
    .pc-grid[data-layout="4"] .pc-canvas-wrap { height: 300px; }
    .pc-overlay-note { font-size: 9px; max-width: 70%; }
    .pc-pattern-read { font-size: 10.5px; }
    .pc-pattern-read-out { padding: 8px 10px; }
    /* The legend is a list of names, not a toolbar: let it wrap under the
       head and scroll sideways one chip at a time on a phone. */
    .pc-pattern-legend { padding: 8px 10px; font-size: 10.5px; }
    .pcl-head { flex-direction: column; align-items: flex-start; gap: 4px; }
    .pcl-meta { white-space: normal; }
    .pcl-actions { margin-left: 0; width: 100%; }
    .pcl-act { height: 24px; padding: 0 8px; font-size: 9.5px; }
    .pcl-chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 2px; }
    .pcl-chips::-webkit-scrollbar { display: none; }
    .pcl-chip { flex: 0 0 auto; max-width: 240px; }
    .pcl-candles, .pcl-foot { line-height: 1.45; }
    .pc-options { font-size: 10px; }
    .pc-options-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .pc-app *, .pc-app *::before, .pc-app *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

/* =================================================================
   FULLSCREEN  (authoritative — keep last)
   -----------------------------------------------------------------
   ONE block, not four. This section used to repeat the same selectors in four
   places: an early "hide the chrome" group, a second "hide the chrome again"
   group, a "compact grid" group, and this final viewport-filling group — with
   the later copies silently overriding the earlier ones (`.pc-layout` was set
   to `display:block !important` and then to `display:flex`; `.pc-bar` got
   z-index 10 and then 100; `.pc-content` got `padding:0` and then
   `padding:0 !important`). The rules below are exactly the values that WON at
   the cascade, so the rendering is unchanged while the file no longer carries
   dead declarations. `_work/css-cascade-equivalence.py` proves the equivalence
   by resolving every (media, selector, property) winner before and after.

   Hide page chrome (topbar is the site nav, sidebar is the Prime nav) but keep
   ALL chart controls — they live inside #pcChartArea, not in the chrome.

   The canvas sizes itself from the height of .pc-canvas-wrap, so every
   ancestor between the fullscreen element and the canvas needs a definite
   height. This chain does exactly that: viewport → layout → content → shell
   → chart area → body → main → grid → cell → cell body → canvas wrap.
   The toolbars/replay bar are flex items that keep their natural height, so
   the chart claims every remaining pixel — no dead band at the bottom.
   ================================================================= */
.pc-app:fullscreen .top-header,
.pc-app:-webkit-full-screen .top-header { display: none !important; }

.pc-app:fullscreen sidebar.side,
.pc-app:-webkit-full-screen sidebar.side { display: none !important; }

/* The chart toolbar stays visible and above the charts (z-index 100 is the
   value the old cascade resolved to; an earlier copy set 10). */
.pc-app:fullscreen .pc-bar,
.pc-app:-webkit-full-screen .pc-bar {
    position: relative;
    z-index: 100;
}

/* Modals live inside .pc-app so they render in the top layer — keep them above
   the fullscreen content (this replaces the earlier z-index: 9999 copy). */
.pc-app:fullscreen .pc-modal,
.pc-app:-webkit-full-screen .pc-modal {
    position: fixed;
    z-index: 10000;
}

/* .shell-body is the one ratio the old cascade did NOT resolve the way it read:
   an early rule forced `display: block !important; min-height: auto !important`
   while this later rule asked for `flex` / `0`. `!important` beats a normal
   declaration no matter how specific the later one is, so the browser always
   painted `display: block` and the flex request never took effect. The values
   below are the ones that actually won, kept verbatim so the cleanup stays a
   no-op; `main.content` carries its own flex column + 100vh height, so the only
   visible child still fills the viewport.

   (Selectors follow the Prime shell: .pc-layout -> .shell-body and
   .pc-content -> main.content. .shell-body keeps `display: block` because the
   sidebar is display:none in fullscreen and a `222px 1fr` grid would otherwise
   leave main.content in the 222px column.) */
.pc-app:is(:fullscreen, :-webkit-full-screen) .shell-body {
    display: block !important;
    min-height: auto !important;
    height: 100vh;
    overflow: hidden;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 0;
    padding: 0 !important;
    overflow: hidden;
}

/* Page content below the shell (the Historical Performance section when the
   chart is opened from a Technical Patterns link) must not join the
   fullscreen flex column: its unsinkable min-height:auto content height was
   squeezing #pcShell down to its toolbars and crushing the chart canvas to
   zero on mobile. Fullscreen is chart-only; the section returns on exit. */
.pc-app:is(:fullscreen, :-webkit-full-screen) .content > *:not(.pc-shell) {
    display: none !important;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-shell {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* The chart shell (head + toolbars + chart) is itself a column that stretches */
.pc-app:is(:fullscreen, :-webkit-full-screen) #pcChartArea {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-bar,
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-bar-wrap,
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-head,
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-replay,
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-options {
    flex: 0 0 auto;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-body {
    flex: 1 1 auto;
    height: auto !important;
    min-height: 0 !important;
    overflow: hidden;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-grid {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    grid-auto-rows: minmax(0, 1fr);
    overflow: hidden;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-cell {
    min-height: 0;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-cell-body {
    flex: 1 1 auto;
    min-height: 0;
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-canvas-wrap {
    height: 100% !important;
    min-height: 0 !important;
}

/* A single chart gets the whole column; multi-chart layouts split it in rows */
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-grid[data-layout="1"] {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-grid[data-layout="2"],
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-grid[data-layout="3"] {
    grid-template-rows: minmax(0, 1fr);
}

.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-grid[data-layout="4"] {
    grid-template-rows: repeat(2, minmax(0, 1fr));
}

/* The side panel scrolls on its own instead of stretching the row */
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-panel {
    min-height: 0;
    overflow-y: auto;
}

/* In-page fullscreen fallback for browsers with no element Fullscreen API
   (notably iPhone Safari): same chrome hiding as native fullscreen, no API
   required. Toggled by chart.js (.pc-fs-fallback on .pc-app). */
.pc-app.pc-fs-fallback { position: fixed; inset: 0; z-index: 99990; background: var(--bg-canvas, #eef1f5); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pc-app.pc-fs-fallback .top-header,
.pc-app.pc-fs-fallback .side,
.pc-app.pc-fs-fallback .sidebar-overlay { display: none !important; }
.pc-app.pc-fs-fallback .shell-body { display: block; }
.pc-app.pc-fs-fallback .content { max-width: none; padding: 10px; overflow: visible; }
.pc-app.pc-fs-fallback .pc-grid[data-layout="1"] .pc-canvas-wrap { height: calc(100vh - 170px); height: calc(100dvh - 170px); min-height: 420px; }

/* Loading / error overlays stay centred over the full-height chart */
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-loading,
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-error,
.pc-app:is(:fullscreen, :-webkit-full-screen) .pc-skeleton {
    position: absolute;
    inset: 0;
}

/* ==================== Technical Patterns · Historical Performance ====================
   Rendered under the chart when the page was opened from a Technical Patterns
   link (/prime/chart/?symbol=..&pattern=..&pattern_date=..). The module's own
   numbers: previous occurrences with forward returns counted in trading
   sessions, plus the aggregate statistics. */
.ph-wrap { margin: 18px 16px 30px; }
.ph-card { background: var(--pc-surface); border: 1px solid var(--pc-border); border-radius: 16px; padding: 18px 20px; box-shadow: 0 4px 15px rgba(11,21,38,.03); contain: layout style; }
.ph-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 14px; }
.ph-kicker { font-size: 10px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: var(--pc-dim); }
.ph-title { font-size: 16px; font-weight: 800; color: var(--pc-text); margin-top: 3px; }
.ph-sub { font-size: 12.5px; font-weight: 600; color: var(--pc-muted); margin-top: 4px; line-height: 1.6; }
.ph-sub b { color: var(--pc-text); font-weight: 800; }
.ph-pattern-note { max-width: 46ch; font-size: 12px; font-weight: 600; color: var(--pc-muted); line-height: 1.6; background: var(--pc-surface-2); border: 1px solid var(--pc-border); border-radius: var(--pc-radius); padding: 11px 13px; }
.ph-table-scroll { overflow-x: auto; border: 1px solid var(--pc-border); border-radius: var(--pc-radius); }
.ph-table { width: 100%; border-collapse: collapse; min-width: 460px; }
.ph-table th { text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; color: var(--pc-dim); padding: 9px 14px; background: var(--pc-surface-2); border-bottom: 1px solid var(--pc-border); white-space: nowrap; }
.ph-table th.num, .ph-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ph-table td { padding: 11px 14px; font-size: 13px; font-weight: 700; color: var(--pc-text); border-bottom: 1px solid var(--pc-surface-3); white-space: nowrap; }
.ph-table tr:last-child td { border-bottom: none; }
.ph-table tr:hover td { background: var(--pc-surface-2); }
.ph-table tr.ph-pending td { color: var(--pc-dim); }
.ph-table td.pos { color: var(--pc-up); }
.ph-table td.neg { color: var(--pc-down); }
.ph-table td.muted { color: var(--pc-border-2); }
.ph-date { color: var(--pc-accent); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }
.ph-date:hover { color: var(--pc-accent-hover); }
.ph-tag { display: inline-block; margin-left: 6px; font-size: 9.5px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; color: var(--pc-dim); background: var(--pc-surface-3); border: 1px solid var(--pc-border); border-radius: 4px; padding: 1px 5px; text-decoration: none; }
.ph-stats { margin-top: 16px; }
.ph-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 9px; }
.ph-stat { border: 1px solid var(--pc-border); border-radius: var(--pc-radius); padding: 12px 14px; background: var(--pc-surface-2); }
.ph-stat-h { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--pc-dim); margin-bottom: 7px; }
.ph-stat-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--pc-muted); padding: 2px 0; }
.ph-stat-row b { font-weight: 800; color: var(--pc-text); }
.ph-stat-row b.pos { color: var(--pc-up); }
.ph-stat-row b.neg { color: var(--pc-down); }
.ph-foot { font-size: 11.5px; font-weight: 600; color: #6b778c; line-height: 1.6; margin-top: 12px; }
@media (max-width: 720px) {
    .ph-wrap { margin: 14px 10px 24px; }
    .ph-card { padding: 15px; }
    .ph-pattern-note { max-width: none; }
    /* Four columns (date + close + horizons) must fit a phone. The table used
       to keep a 460px floor, so the last horizons sat behind a sideways swipe
       inside the card. */
    .ph-table { min-width: 0; }
    .ph-table th, .ph-table td { padding: 8px 6px; font-size: 11px; }
    .ph-table th { letter-spacing: .3px; }
    .ph-tag { margin-left: 4px; padding: 1px 4px; font-size: 8.5px; letter-spacing: 0; }
}
