/* ESFX V79 — responsive charts, page-local back actions, optional crypto cap. */
/* Charts: parent width is always bounded by the content column. */
.market-detail-grid, .market-detail-grid > *, .market-chart-card, .signal-chart-card-live,
.esfx-market-chart, .esfx-signal-chart {min-width:0;max-width:100%;box-sizing:border-box}
.market-chart-card,.signal-chart-card-live {overflow:hidden}
/* ECharts canvas renders inside a predictable block, not an unbounded 430px strip. */
.esfx-market-chart,.esfx-signal-chart {display:block!important;width:100%!important; height:clamp(330px,32vw,450px);min-height:0!important;aspect-ratio:auto;overflow:hidden}
@media (min-width:861px){
 .market-detail-grid {grid-template-columns:minmax(0,.84fr) minmax(0,1.16fr)}
 .market-chart-card {align-self:stretch}
 .esfx-market-chart {height:clamp(320px,30vw,430px)}
 .esfx-signal-chart {height:clamp(340px,31vw,450px)}
}
@media (min-width:601px) and (max-width:860px){
 .market-detail-grid {grid-template-columns:1fr}
 .esfx-market-chart,.esfx-signal-chart{height:clamp(320px,53vw,400px)}
}
@media (max-width:600px){
 .market-detail-grid,.market-chart-card,.signal-chart-card-live {width:100%;max-width:100%;min-width:0}
 .market-chart-card {padding:12px 9px 9px!important}
 .signal-chart-card-live {padding:12px 9px 9px!important}
 .esfx-market-chart {height:clamp(248px,71vw,320px)!important;min-height:0!important}
 .esfx-signal-chart {height:clamp(260px,76vw,340px)!important;min-height:0!important}
 .market-chart-head{gap:8px;min-width:0}
 .market-chart-head h2{font-size:.94rem!important}
 .signal-chart-legend{flex-wrap:wrap;gap:8px 12px}
}
/* Mobile charts are read-only to the touch (page can be scrolled naturally).
   ECharts tooltip + pan/zoom mobile handlers are disabled by chart options. */
@media (pointer:coarse) and (max-width:700px){
 .esfx-market-chart,.esfx-signal-chart{touch-action:pan-y!important;user-select:none;-webkit-user-select:none}
}
/* Page-authored back links. Never inject a global AppBar back button. */
:is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action){
 display:inline-flex!important;align-items:center;justify-content:center;gap:8px;
 min-height:40px;padding:8px 13px;border-radius:12px;
 border:1px solid #c5e9d8;background:#e7f7ef;color:#087a50;
 font-weight:760;font-size:.82rem;line-height:1.2;text-decoration:none;
 box-shadow:none;transition:background .14s,border-color .14s,transform .14s;
}
:is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action):hover{
 background:#d6f2e4;border-color:#83d5ae;color:#086b45
}
:is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action):focus-visible{outline:2px solid #18a776;outline-offset:3px}
:is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action):active{transform:translateY(1px)}
:is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action) .ui-icon,
:is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action) .inline-link-icon{width:17px;height:17px;flex:0 0 17px}
.chat-back{width:42px;min-width:42px;height:42px;padding:0!important}
html[data-esfx-theme="dark"] :is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action){
 border:1px solid #366852!important;background:#234b3e!important;color:#bdf5d7!important;
 box-shadow:none!important;
}
html[data-esfx-theme="dark"] :is(.news-back,.market-back-link,.store-back,.signal-back,.chat-back,.esfx-back-action):hover{
 background:#2c624d!important;border-color:#4c8d6c!important;color:#f0fff7!important
}
/* Third-party market-cap panel only on /markets?type=crypto; never replace ESFX prices. */
.esfx-crypto-cap{margin:4px 0 22px;padding:17px;border:1px solid var(--line);border-radius:18px;background:var(--surface);min-width:0}
.esfx-crypto-cap-heading{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin-bottom:14px}
.esfx-crypto-cap-heading h2{margin:4px 0 4px;font-size:clamp(1.12rem,2.2vw,1.5rem)}
.esfx-crypto-cap-heading p{margin:0;font-size:.76rem;color:var(--muted)}
.esfx-crypto-cap-switch{display:flex;align-items:center;gap:3px;padding:4px;border-radius:11px;background:var(--surface-3);border:1px solid var(--line);flex:0 0 auto}
.esfx-crypto-cap-switch button{border:0;background:transparent;color:var(--text-mid);font:inherit;font-size:.74rem;font-weight:750;padding:8px 12px;border-radius:8px;cursor:pointer}
.esfx-crypto-cap-switch button.active{background:#168b62;color:#fff}
.esfx-crypto-cap-switch button:focus-visible{outline:2px solid #17ae79;outline-offset:2px}
.esfx-crypto-cap-widget{width:100%;height:clamp(390px,52vw,580px);min-width:0;position:relative;overflow:hidden;border-radius:12px;background:var(--surface-2);border:1px solid var(--line-soft)}
.esfx-crypto-cap-widget>.tradingview-widget-container,
.esfx-crypto-cap-widget .tradingview-widget-container__widget,
.esfx-crypto-cap-widget iframe{display:block;width:100%!important;height:100%!important;max-width:100%!important;min-width:0!important;border:0!important}
.esfx-crypto-cap-message{display:grid;place-items:center;position:absolute;inset:0;font-size:.8rem;color:var(--muted);text-align:center;padding:20px}
.esfx-crypto-cap-attribution{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:9px;font-size:.72rem;color:var(--muted)}
.esfx-crypto-cap-attribution a{color:var(--accent);text-decoration:underline;text-underline-offset:3px}
@media(max-width:600px){
 .esfx-crypto-cap{padding:12px;border-radius:15px}
 .esfx-crypto-cap-heading{display:grid;align-items:start;gap:10px}
 .esfx-crypto-cap-switch{width:max-content;max-width:100%}
 .esfx-crypto-cap-widget{height:clamp(370px,117vw,500px)}
}
/* TradingView widget workspace: predictable heights at tablet and mobile widths.
   Embedded widget internals remain owned by TradingView. */
.wp-card,.wp-body{min-width:0;max-width:100%}
@media (min-width:701px) and (max-width:1100px){
 .wp-body[style*="height:660px"],.wp-body[style*="height:620px"]{height:clamp(450px,51vw,530px)!important}
 .wp-body[style*="height:580px"]{height:clamp(410px,48vw,490px)!important}
}
@media (max-width:700px){
 .wp-body[style*="height:660px"],.wp-body[style*="height:620px"]{height:clamp(340px,105vw,470px)!important}
 .wp-body[style*="height:580px"]{height:clamp(340px,102vw,450px)!important}
 .wp-body[style*="height:550px"]{height:clamp(330px,102vw,420px)!important}
 .wp-body[style*="height:470px"],.wp-body[style*="height:425px"]{height:clamp(290px,87vw,365px)!important}
}
