/* Ask Tradinity (ADR-0365). Uses the shared site tokens (--tx-*) so both themes work without a second palette. */
:root { --ask-sig: #c77800; --ask-violet: #5a4bb5; --ask-code: #eef3f7; --ask-warn-bg: #fff4dd; --ask-warn-line: #e7c580; }
html[data-theme="dark"] { --ask-sig: #f2a63b; --ask-violet: #a99cff; --ask-code: #0c1520; --ask-warn-bg: #2b2413; --ask-warn-line: #6b5a26; }

.ask { max-width: 980px; margin: 0 auto; padding-bottom: 32px; }
.ask h1, .ask-shell h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin: 4px 0 8px; text-wrap: balance; }
.ask .lede, .ask-shell .lede { color: var(--tx-muted); max-width: 64ch; margin: 0 0 18px; line-height: 1.6; }
.ask .eyebrow, .ask-shell .eyebrow { font: 600 .75rem ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--tx-accent); }

.ask-form { display: flex; gap: 8px; }
.ask-form input[type=search], .ask-form input[type=text] { flex: 1; min-width: 0; font-size: 1.0625rem; color: var(--tx-text); background: var(--tx-surface); border: 1.5px solid var(--tx-border); border-radius: 12px; padding: 14px 16px; outline: none; }
.ask-form input:focus { border-color: var(--tx-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tx-accent) 22%, transparent); }
.ask-form button { font-weight: 700; font-size: .9375rem; background: var(--tx-brand); color: var(--tx-brand-ink); border: 0; border-radius: 12px; padding: 0 22px; cursor: pointer; }
.ask-form button:disabled { opacity: .6; cursor: default; }
.ask-loading { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 12px 16px; background: var(--tx-surface); border: 1px solid var(--tx-border); border-radius: 12px; }
.ask-loading[hidden] { display: none; }
.ask-loading-spinner { width: 16px; height: 16px; flex-shrink: 0; border-radius: 50%; border: 2.5px solid var(--tx-border); border-top-color: var(--tx-accent); animation: ask-spin .7s linear infinite; }
.ask-loading-text { font-size: .875rem; color: var(--tx-muted); }
@keyframes ask-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ask-loading-spinner { animation: none; } }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.ask-chips a { font-size: .8125rem; color: var(--tx-text); border: 1px solid var(--tx-border); border-radius: 999px; padding: 6px 12px; background: var(--tx-surface); }
.ask-chips a:hover { border-color: var(--tx-accent); color: var(--tx-accent); }
.ask-group { margin: 22px 0 0; }
.ask-group h2 { font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tx-muted); margin: 0 0 8px; }

/* ---- Shell: a ChatGPT-style fixed, collapsible left dock + a wide, independent content column ---- */
.ask-shell { padding-bottom: 32px; }
.ask-main { min-width: 0; max-width: 1480px; margin-left: 272px; padding: 0 40px 40px; transition: margin-left .18s ease; }
.ask-crumb { font-size: .75rem; color: var(--tx-muted); margin-bottom: 6px; }
.ask-title { font-size: clamp(1.35rem, 3.2vw, 1.75rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.3; margin: 0 0 4px; text-wrap: balance; }

.ask-history-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.ask-sidebar-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; color: var(--tx-muted); cursor: pointer; flex-shrink: 0; }
.ask-sidebar-icon-btn:hover { background: var(--tx-surface-2); color: var(--tx-text); }
.ask-sidebar-icon-btn svg { width: 18px; height: 18px; }
#ask-history-open { display: none; }
body.ask-sidebar-collapsed #ask-history-open { display: inline-flex; }
.ask-history-toggle { display: none; }

.ask-history { position: fixed; top: var(--tx-header-live); bottom: 0; left: 0; width: 272px; overflow-y: auto; background: var(--tx-surface); border-right: 1px solid var(--tx-border); padding: 10px 10px 16px; z-index: 20; transition: width .18s ease, padding .18s ease; }
body.ask-sidebar-collapsed .ask-history { width: 0; padding: 10px 0; overflow: hidden; border-right: 0; }
body.ask-sidebar-collapsed .ask-main { margin-left: 0; }
.ask-history-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 6px 10px; }
.ask-history-head span { font: 700 .6875rem ui-monospace, monospace; text-transform: uppercase; letter-spacing: .05em; color: var(--tx-muted); white-space: nowrap; }
.ask-history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; white-space: nowrap; }
.ask-history-list li { display: flex; align-items: center; gap: 2px; border-radius: 8px; }
.ask-history-list li.active { background: var(--tx-surface-2); }
.ask-history-list li:hover { background: var(--tx-surface-2); }
.ask-history-list a { flex: 1; min-width: 0; display: block; padding: 8px 8px; font-size: .8125rem; line-height: 1.4; color: var(--tx-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-history-list a:hover { color: var(--tx-accent); }
.ask-history-list form { flex-shrink: 0; opacity: 0; transition: opacity .1s ease; }
.ask-history-list li:hover form, .ask-history-list li.active form { opacity: 1; }
.ask-history-list form button { background: none; border: 0; color: var(--tx-muted); font-size: .9rem; cursor: pointer; padding: 4px 8px; line-height: 1; }
.ask-history-list form button:hover { color: var(--tx-down); }
.ask-history-empty { font-size: .78rem; color: var(--tx-muted); padding: 8px 6px; margin: 0; white-space: normal; }
.ask-history-backdrop { display: none; }

.ask-note { margin: 6px 0 0; color: var(--tx-muted); font-size: .8125rem; }
.ask-actions { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; font-size: .8125rem; }
.ask-actions a, .ask-actions button { color: var(--tx-accent); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.ask-actions a:hover, .ask-actions button:hover { text-decoration: underline; }

.ask-result { padding: 4px 0 16px; }
.ask-headline { font-size: 1.125rem; font-weight: 600; line-height: 1.55; margin: 0 0 12px; max-width: 76ch; text-wrap: pretty; }
.ask-line { margin: 0 0 12px; color: var(--tx-muted); }
.ask-warn { background: var(--ask-warn-bg); border: 1px solid var(--ask-warn-line); border-radius: 8px; padding: 8px 12px; font-size: .8125rem; margin: 0 0 12px; }
.ask .pos, .ask-shell .pos { color: var(--tx-up); }
.ask .neg, .ask-shell .neg { color: var(--tx-down); }
.ask .warn, .ask-shell .warn { color: var(--tx-muted); font-style: italic; }
.ask-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin: 0 0 16px; }
.ask-tile { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; background: var(--tx-surface); border: 1px solid var(--tx-border); border-radius: 12px; box-shadow: var(--tx-shadow); }
.ask-tile .l { font-size: .71rem; color: var(--tx-muted); }
.ask-tile .v { font: 700 1.3rem ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.ask-range { display: flex; align-items: center; gap: 10px; font: .75rem ui-monospace, monospace; color: var(--tx-muted); margin: 6px 0 10px; }
.ask-range .bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--tx-surface-2); min-width: 60px; }
.ask-range .bar i { position: absolute; top: -4px; width: 4px; height: 14px; background: var(--tx-accent); border-radius: 2px; transform: translateX(-2px); }
.ask-subhead { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--tx-muted); margin: 0 0 10px; }
.ask-tw { overflow-x: auto; margin: 0; }
.ask table, .ask-shell table { width: 100%; }
.ask th, .ask-shell th { text-align: right; }
.ask th:first-child, .ask td:first-child, .ask-shell th:first-child, .ask-shell td:first-child { text-align: left; }
.ask td, .ask-shell td { font-variant-numeric: tabular-nums; }

/* ---- Cards: one logical section per card, instead of one long flat block ---- */
.ask-card { border: 1px solid var(--tx-border); background: var(--tx-surface); border-radius: 14px; padding: 16px 18px; box-shadow: var(--tx-shadow); margin: 0 0 16px; }
.ask-card:last-child { margin-bottom: 0; }

/* ---- The canvas: one continuous white rounded surface every answer renders inside, sections divided by
   a plain rule instead of each stacking its own separate floating card (2026-10-11 redesign). ---- */
.ask-canvas { background: var(--tx-surface); border: 1px solid var(--tx-border); border-radius: 24px; box-shadow: var(--tx-shadow); padding: 28px clamp(18px, 4vw, 36px) 32px; }
.ask-canvas .ask-card, .ask-canvas .ask-compound-section {
    background: none; border: 0; box-shadow: none; border-radius: 0; margin: 0; padding: 20px 0; border-bottom: 1px solid var(--tx-border);
}
.ask-canvas .ask-card:first-child, .ask-canvas .ask-compound-section:first-child { padding-top: 0; }
.ask-canvas .ask-card:last-child, .ask-canvas .ask-compound-section:last-child { border-bottom: 0; padding-bottom: 0; }
.ask-canvas .ask-tile { background: var(--tx-surface-2); box-shadow: none; }
@media (max-width: 620px) { .ask-canvas { border-radius: 18px; padding: 20px 16px 24px; } }
.ask-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; }
.ask-card-head h2 { font-size: .8125rem; font-weight: 700; margin: 0; }
.ask-pill { font: 700 .6875rem ui-monospace, monospace; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; background: var(--tx-surface-2); color: var(--tx-muted); }
.ask-status.on .ask-pill { background: color-mix(in srgb, var(--tx-up) 16%, transparent); color: var(--tx-up); }
.ask-status.off .ask-pill { background: color-mix(in srgb, var(--tx-accent) 12%, transparent); color: var(--tx-accent); }
.ask-status-line { margin: 0; font-size: .875rem; font-weight: 600; }

/* Full width by default -- most intents (status, return, investigate, corrections, compound, ...) have no
   right rail at all, and a fixed second track reserved a real 300px of dead space their charts/tables never
   got to use. Only event_study's page actually renders `.ask-layout-rail`, so the two-column layout -- and
   the 300px it takes from the main column -- applies only when that rail is really there. */
.ask-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.ask-layout:has(.ask-layout-rail) { grid-template-columns: minmax(0, 1fr) 300px; }
.ask-layout-main { min-width: 0; }
.ask-layout-rail { min-width: 0; }

.ask-next-list { display: flex; flex-direction: column; gap: 2px; }
.ask-next { display: flex; justify-content: space-between; gap: 10px; padding: 9px 10px; margin: 0 -10px; border-radius: 8px; font-size: .8125rem; font-weight: 600; color: var(--tx-text); }
.ask-next:hover { background: var(--tx-surface-2); color: var(--tx-accent); }
.ask-next span { color: var(--tx-muted); }

.ask-episodes { display: flex; flex-direction: column; }
.ask-episode { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--tx-border); font-size: .8125rem; }
.ask-episode:last-child { border-bottom: 0; padding-bottom: 0; }
.ask-episode b { font-weight: 700; }
.ask-episode p { margin: 2px 0 0; color: var(--tx-muted); font-size: .75rem; }
.ask-episode-ret { font: 700 .875rem ui-monospace, monospace; white-space: nowrap; }

.ask-chart-wrap { margin: 0; }
.ask-canvas-wrap { position: relative; height: 240px; }
@media (min-width: 620px) { .ask-canvas-wrap { height: 300px; } }
.ask-canvas-wrap.bar { height: auto; }

/* ---- Investigate: the narrated "should I buy X" page ---- */
.ask-chapter { font: 700 .6875rem ui-monospace, monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--tx-accent); margin: 0 0 6px; }
.ask-chapter-title { font-size: 1.0625rem; font-weight: 700; margin: 0 0 10px; }
.ask-bullbear { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.ask-bull, .ask-bear { border-radius: 10px; padding: 12px 14px; }
.ask-bull { background: color-mix(in srgb, var(--tx-up) 8%, transparent); border: 1px solid color-mix(in srgb, var(--tx-up) 25%, transparent); }
.ask-bear { background: color-mix(in srgb, var(--tx-down) 8%, transparent); border: 1px solid color-mix(in srgb, var(--tx-down) 25%, transparent); }

/* ---- Compound questions: each sub-question's own section (canvas Phase 3) ---- */
.ask-compound-section { border: 1px dashed var(--tx-border); border-radius: 16px; padding: 14px 16px 2px; margin: 0 0 20px; }
.ask-compound-section:last-child { margin-bottom: 0; }
.ask-section-title { font-size: 1rem; font-weight: 700; margin: 0 0 10px; }
.ask-bullbear h3 { font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 8px; }
.ask-bull h3 { color: var(--tx-up); }
.ask-bear h3 { color: var(--tx-down); }
.ask-bullbear ul { margin: 0; padding-left: 18px; font-size: .8125rem; line-height: 1.55; }
.ask-bullbear li { margin: 0 0 6px; }
.ask-bullbear li:last-child { margin-bottom: 0; }
.ask-missing-box { background: var(--tx-surface-2); border-radius: 10px; padding: 12px 14px; font-size: .78rem; color: var(--tx-muted); }
.ask-missing-box ul { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 620px) { .ask-bullbear { grid-template-columns: 1fr; } }

.ask-foot { font-size: .78rem; color: var(--tx-muted); margin: 8px 0 0; }
.ask details.more { margin-top: 0; }
.ask details.more summary { cursor: pointer; color: var(--tx-accent); font-size: .8125rem; }
.ask-related { margin: 16px 0 0; }
.ask-related h2 { font-size: .6875rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--tx-muted); margin: 0 0 8px; }
.ask-options { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.ask-options a { border: 1px solid var(--tx-border); border-radius: 10px; padding: 8px 12px; background: var(--tx-surface); font-size: .875rem; }
.ask-options a:hover { border-color: var(--tx-accent); }
.ask-msg { border: 1px solid var(--tx-border); background: var(--tx-surface); border-radius: 14px; padding: 16px; margin-top: 18px; }
.ask-msg p { margin: 0; line-height: 1.6; }

@media (max-width: 620px) { .ask-form { flex-direction: column; } .ask-form button { padding: 12px; } }

@media (max-width: 980px) {
    .ask-layout { grid-template-columns: 1fr; }
    .ask-main { max-width: none; padding: 0 20px 32px; }
}

/* Below this width there's no room for a persistent dock -- it becomes an overlay drawer instead, same as
   ChatGPT's own mobile behavior; the desktop push/collapse rules above are overridden back to a closed,
   off-canvas default regardless of the user's saved desktop preference. */
@media (max-width: 860px) {
    .ask-main, body.ask-sidebar-collapsed .ask-main { margin-left: 0; }
    .ask-history, body.ask-sidebar-collapsed .ask-history { width: min(300px, 82vw); padding: 10px 10px 16px; }
    .ask-history-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; color: var(--tx-accent); background: var(--tx-surface); border: 1px solid var(--tx-border); border-radius: 999px; padding: 6px 12px; margin-bottom: 12px; cursor: pointer; }
    .ask-history { position: fixed; top: 0; max-height: none; border-right: 1px solid var(--tx-border); transform: translateX(-100%); transition: transform .2s ease; z-index: 60; padding-top: calc(var(--tx-header-live) + 10px); overflow: visible; }
    .ask-history.open { transform: translateX(0); overflow-y: auto; }
    #ask-history-open { display: none !important; }
    .ask-history-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 55; }
}
