/* r317: right-click menu like pro charts - compact list, icons, short-cut hints, side menus on hover. */
.chart-context.ctx317 { width: 272px; padding: 5px; border-radius: 10px; font-size: 13px; overflow-y: auto; max-height: calc(100dvh - 16px); }
.chart-context.ctx317.ctx-fly { overflow: visible; max-height: none; }
.ctx317 .chart-context-head { min-height: 30px; padding: 2px 4px 2px 9px; font-size: 11px; font-weight: 600; color: var(--t3); background: transparent !important; }
.ctx317 .context-search { display: flex; align-items: center; gap: 7px; height: 32px; margin: 0 2px 4px; padding: 0 9px; border: 1px solid var(--hair); border-radius: 8px; background: var(--fill); }
.ctx317 .context-search svg { width: 15px; height: 15px; color: var(--t3); flex: none; }
.ctx317 .context-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--t1); font: inherit; font-size: 12.5px; outline: none; }
.ctx317 :is(button[data-context], summary) { min-height: 32px !important; padding: 0 9px !important; gap: 11px; border-radius: 6px; font-size: 13px !important; line-height: 1.2 !important; font-weight: 400; color: var(--t1); }
.ctx317 :is(button[data-context], summary) > svg:first-child { width: 17px !important; height: 17px !important; flex: 0 0 17px !important; color: var(--t2); stroke-width: 1.6; }
.ctx317 :is(button[data-context], summary) > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx317 button[data-context] small { margin-left: 8px; float: right; font-size: 11px; color: var(--t3); }
.ctx317 :is(button[data-context], summary):hover, .ctx317 details[open] > summary { background: var(--fill-2) !important; color: var(--t1); }
.ctx317 button[data-context]:disabled { opacity: .38; }
.ctx317 details { position: relative; }
.ctx317 details:first-of-type { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--hair); }
.ctx317 button[data-context="settings"] { margin-top: 4px; border-top: 1px solid var(--hair); border-radius: 0 0 6px 6px; }
.ctx317 .ctx-sub > button[data-context] { padding-left: 9px !important; }
/* tap-to-open (touch / small screens) */
.ctx317:not(.ctx-fly) details[open] > .ctx-sub { padding: 2px 0 4px 14px; }
/* side menus (mouse) */
.ctx-fly details > .ctx-sub { position: fixed; z-index: 1100; width: 264px; max-width: calc(100vw - 16px); overflow-y: auto; padding: 5px; border: 1px solid var(--hair); border-radius: 10px; background: var(--card); box-shadow: var(--shadow-3, 0 12px 32px rgba(0,0,0,.18)); }
.ctx-fly details:not([open]) > .ctx-sub { display: none; }
.ctx-fly details > summary > svg:last-child { transform: none !important; color: var(--t3); }
.ctx-fly details details { margin-left: 0; border-left: 0; padding-left: 0; }
/* search: flat list */
.ctx-fly.ctx-searching details > .ctx-sub { position: static; width: auto; border: 0; box-shadow: none; padding: 0; background: transparent; }
.ctx-fly.ctx-searching details > summary { display: none; }
.ctx-fly.ctx-searching { overflow-y: auto; max-height: calc(100dvh - 16px); }
@media (max-width: 767px) { .ctx317 :is(button[data-context], summary) { min-height: 42px !important; } }

/* floating Auto pill at the bottom of the price scale after a manual scale */
.scale-auto-pill { position: absolute; z-index: 9; right: 6px; bottom: 44px; height: 22px; padding: 0 9px; border: 1px solid var(--hair); border-radius: 6px; background: var(--card); color: var(--t1); font: 600 11px/1 var(--font); box-shadow: var(--shadow-1, 0 1px 4px rgba(0,0,0,.12)); cursor: pointer; }
.scale-auto-pill:hover { background: var(--fill-2); }
.scale-auto-pill[hidden] { display: none; }

/* ---------- r317 symbol search, pro style ---------- */
.modal-box.search317 { width: min(760px, calc(100vw - 32px)); height: min(660px, 86dvh); max-height: none; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.search317 .mh { padding: 14px 16px 10px; }
.search317 .mh b { font-size: 16px; font-weight: 600; }
.search317 .sbox { margin: 0 16px; height: 46px; border-radius: 10px; }
.search317 .sbox input { font-size: 16px; }
.search317 .s-tabs { gap: 2px; padding: 10px 12px 0; border-bottom: 1px solid var(--hair); }
.search317 .s-tabs .chip { flex: none; height: 34px; padding: 0 10px; border: 0 !important; border-radius: 0 !important; background: transparent !important; color: var(--t2); font-size: 13px; font-weight: 500; box-shadow: inset 0 -2px 0 transparent; }
.search317 .s-tabs .chip:hover { color: var(--t1); }
.search317 .s-tabs .chip.on { color: var(--t1) !important; box-shadow: inset 0 -2px 0 var(--t1); }
.search317 .results { padding: 4px 6px; }
.search317 .res { grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; min-height: 48px; padding: 6px 12px; border-radius: 8px; }
.search317 .s-main { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.search317 .s-main .s { flex: 0 0 auto; min-width: 120px; max-width: 46%; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search317 .s-main .n { flex: 1; min-width: 0; font-size: 12.5px; color: var(--t2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search317 .res .x { max-width: none; display: flex; align-items: center; gap: 10px; color: var(--t3); font-size: 11.5px; }
.search317 .s-type { text-transform: lowercase; }
.search317 .s-ex { min-width: 44px; text-align: right; font-weight: 600; color: var(--t2); }
.search317 .s-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px; border-top: 1px solid var(--hair); font-size: 11.5px; color: var(--t3); flex: none; }
.search317 .s-foot kbd { display: inline-block; min-width: 18px; margin: 0 2px; padding: 2px 4px; border: 1px solid var(--hair); border-radius: 4px; background: var(--fill); font: 500 10.5px/1 var(--font); text-align: center; }
.search317 .s-link { border: 0; background: transparent; color: var(--t2); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; padding: 4px 0; }
.search317 .s-link:hover { color: var(--t1); }
@media (max-width: 767px) {
  .modal-box.search317 { width: 100%; height: 100%; border-radius: 0; }
  .search317 .s-main { flex-direction: column; align-items: flex-start; gap: 2px; }
  .search317 .s-main .s { max-width: 100%; min-width: 0; }
  .search317 .s-foot > span { display: none; }
  .search317 .s-ex { min-width: 0; }
}
