/* CryptoCoinProp chart workspace: top bar, drawing tool bar, pane grid, legends, drawing and indicator dialogs.
 * Neutral colours come from the theme tokens (html.dark swaps them); brand red, candle green/red and
 * the tool accent stay literal. Motion runs for everyone. Phones (< 768px) get one chart at a time,
 * a scrolling top bar, a pencil button that opens the tools as a bottom sheet and 44px targets. */

@keyframes nvcPop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes nvcSheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes nvcFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes nvcSpin { to { transform: rotate(360deg); } }
@keyframes nvcFlash { 0% { background: rgba(22,163,106,.18); } 100% { background: transparent; } }

.nvc-ws { --nvc-accent: #DD3D4F; --nvc-line: var(--nv-e6e6ef); --nvc-soft: var(--nv-f4f4f8); --nvc-hover: var(--nv-f0f0f7);
  display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; flex: 1 1 auto; color: var(--nv-0e0f1f-text); }
.nvc-ws *, .nvc-pop *, .nvc-modal-root * { box-sizing: border-box; }
.nvc-ws button, .nvc-pop button, .nvc-modal-root button { font-family: inherit; }
.nvc-ws :focus-visible, .nvc-pop :focus-visible, .nvc-modal-root :focus-visible { outline: 2px solid var(--nvc-accent, #DD3D4F); outline-offset: 1px; }

/* ------------------------------------------------------------------ top bar */
.nvc-topbar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--nvc-line); min-width: 0;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.nvc-topbar::-webkit-scrollbar { display: none; }
.nvc-top-sep { flex: none; width: 1px; height: 20px; margin: 0 4px; background: var(--nvc-line); }
.nvc-top-right { display: flex; align-items: center; gap: 2px; margin-left: auto; padding-left: 6px; }
.nvc-top-btn { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; min-width: 30px; padding: 0 7px;
  border: 0; border-radius: 7px; background: transparent; color: var(--nv-3a3b4f); font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .16s, color .16s, transform .12s; }
.nvc-top-btn:hover { background: var(--nvc-hover); color: var(--nv-0e0f1f-text); }
.nvc-top-btn:active { transform: scale(.95); }
.nvc-top-btn:disabled { opacity: .38; cursor: default; background: transparent; transform: none; }
.nvc-top-btn.nvc-on, .nvc-top-btn[aria-expanded="true"] { background: var(--nv-fff5f6); color: var(--nv-b4202f); }
.nvc-sym-btn { padding: 0 9px 0 7px; }
.nvc-sym-name { font-size: 13px; font-weight: 800; color: var(--nv-0e0f1f-text); letter-spacing: -.01em; }
.nvc-venue { font-size: 9.5px; font-weight: 700; padding: 1px 5px; border-radius: 4px; }
.nvc-venue-perp { background: var(--nv-fff8e6); color: var(--nv-7a5b0c); }
.nvc-venue-spot { background: var(--nv-e8f7f0); color: var(--nv-0f7a4f); }
.nvc-intervals { display: flex; align-items: center; gap: 1px; flex: none; }
.nvc-iv { flex: none; height: 28px; min-width: 32px; padding: 0 6px; border: 0; border-radius: 6px; background: transparent; color: var(--nv-3a3b4f);
  font-size: 11.5px; font-weight: 700; font-family: 'JetBrains Mono', ui-monospace, monospace; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 2px;
  transition: background .16s, color .16s, transform .12s; }
.nvc-iv:hover { background: var(--nvc-hover); color: var(--nv-0e0f1f-text); }
.nvc-iv:active { transform: scale(.94); }
.nvc-iv.nvc-on { background: var(--nvc-hover); color: var(--nv-0e0f1f-text); box-shadow: inset 0 -2px 0 var(--nvc-accent); }
.nvc-iv-more { min-width: 26px; padding: 0 4px; }

/* phone pane switcher */
.nvc-panetabs { display: none; gap: 4px; padding: 6px; border-bottom: 1px solid var(--nvc-line); overflow-x: auto; scrollbar-width: none; }
.nvc-panetabs::-webkit-scrollbar { display: none; }
.nvc-panetab { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--nvc-line);
  background: transparent; color: var(--nv-3a3b4f); font-size: 12px; font-weight: 600; cursor: pointer; transition: all .18s; }
.nvc-panetab b { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: var(--nvc-soft); font-size: 10px; }
.nvc-panetab.nvc-on { border-color: var(--nv-f3c4ca); background: var(--nv-fff5f6); color: var(--nv-b4202f); }
.nvc-panetab.nvc-on b { background: #DD3D4F; color: #fff; }

/* -------------------------------------------------------------------- body */
.nvc-body { position: relative; display: flex; flex: 1 1 auto; min-height: 0; min-width: 0; }
.nvc-drawbar { flex: none; width: 42px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0; border-right: 1px solid var(--nvc-line);
  overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.nvc-drawbar::-webkit-scrollbar { display: none; }
.nvc-drawbar-sep { flex: none; width: 24px; height: 1px; margin: 4px 0; background: var(--nvc-line); }
.nvc-tool-cell { position: relative; flex: none; }
.nvc-tool { flex: none; position: relative; display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent;
  color: var(--nv-3a3b4f); cursor: pointer; transition: background .16s, color .16s, transform .12s; }
.nvc-tool:hover { background: var(--nvc-hover); color: var(--nv-0e0f1f-text); }
.nvc-tool:active { transform: scale(.92); }
.nvc-tool.nvc-on { background: var(--nv-fff5f6); color: var(--nv-b4202f); }
.nvc-tool.nvc-strong::after { content: ''; position: absolute; right: 6px; top: 6px; width: 5px; height: 5px; border-radius: 50%; background: #DD3D4F; }
.nvc-tool-more { position: absolute; right: -1px; bottom: 1px; width: 12px; height: 12px; padding: 0; display: grid; place-items: end; border: 0; background: transparent;
  color: var(--nv-9a9cb4); cursor: pointer; border-radius: 3px; }
.nvc-tool-more:hover, .nvc-tool-more[aria-expanded="true"] { color: var(--nvc-accent); }

.nvc-grid { position: relative; flex: 1 1 auto; min-width: 0; min-height: 0; display: grid; gap: 1px; background: var(--nvc-line); grid-template-columns: 1fr; grid-template-rows: 1fr; }
.nvc-grid[data-grid="2v"] { grid-template-columns: 1fr 1fr; }
.nvc-grid[data-grid="2h"] { grid-template-rows: 1fr 1fr; }
.nvc-grid[data-grid="3"] { grid-template-columns: 1.4fr 1fr; grid-template-rows: 1fr 1fr; }
.nvc-grid[data-grid="3"] > .nvc-pane:first-child { grid-row: span 2; }
.nvc-grid[data-grid="4"] { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.nvc-grid[data-grid="6"] { grid-template-columns: 1fr 1fr 1fr; grid-template-rows: 1fr 1fr; }
.nvc-grid.nvc-maxed { grid-template-columns: 1fr !important; grid-template-rows: 1fr !important; }
.nvc-grid.nvc-maxed > .nvc-pane:not(.nvc-maxpane) { display: none; }
.nvc-grid.nvc-maxed > .nvc-pane { grid-row: auto !important; }

.nvc-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--nvc-bg, var(--nv-fff-bg)); }
.nvc-grid[data-grid="1"] .nvc-pane-head { display: none; }
.nvc-pane-head { flex: none; display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 8px; font-size: 11px; font-weight: 700; color: var(--nv-9a9cb4);
  border-bottom: 1px solid var(--nvc-line); cursor: pointer; transition: color .18s, background .18s; }
.nvc-pane-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nvc-pane.nvc-active .nvc-pane-head { color: var(--nv-0e0f1f-text); background: linear-gradient(90deg, var(--nv-fff5f6), transparent 70%); }
.nvc-grid:not([data-grid="1"]) .nvc-pane.nvc-active::after { content: ''; position: absolute; inset: 0; border: 1.5px solid rgba(221,61,79,.55); pointer-events: none; z-index: 6;
  animation: nvcFade .2s ease both; }
.nvc-pane-max { width: 22px; height: 22px; }
.nvc-pane-body { position: relative; flex: 1 1 auto; min-height: 0; }

.nvc-fab { display: none; }

/* full screen */
.nvc-ws.nvc-fs { position: fixed !important; inset: 0; z-index: 90; background: var(--nv-fff-bg); height: 100vh !important; max-height: none !important; }
.nvc-ws:fullscreen { background: var(--nv-fff-bg); }
body.nvc-noscroll { overflow: hidden; }

/* ------------------------------------------------------------------- chart */
.nvc-chart { position: absolute; inset: 0; overflow: hidden; }
.nvc-canvas { position: absolute; inset: 0; }
.nvc-ws.nvc-placing .nvc-canvas { cursor: crosshair; }
.nvc-legend { position: absolute; left: 8px; top: 6px; right: 70px; z-index: 5; pointer-events: none; font-size: 11px; line-height: 1.5; }
.nvc-lg-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
.nvc-lg-sym { pointer-events: auto; border: 0; padding: 0 4px; margin-left: -4px; border-radius: 5px; background: transparent; font-size: 12.5px; font-weight: 800;
  color: var(--nv-0e0f1f-text); cursor: pointer; transition: background .16s; }
.nvc-lg-sym:hover { background: var(--nvc-hover, var(--nv-f0f0f7)); }
.nvc-lg-meta { font-size: 11px; font-weight: 600; color: var(--nv-9a9cb4); }
.nvc-lg-ohlc { display: inline-flex; flex-wrap: wrap; gap: 0 3px; color: var(--nv-9a9cb4); font-size: 10.5px; }
.nvc-lg-ohlc b { font-weight: 600; margin-right: 6px; }
.nvc-up { color: #0ECB81; }
.nvc-down { color: #F6465D; }
html:not(.dark) .nvc-up { color: #0B9F66; }
html:not(.dark) .nvc-down { color: #E0304A; }
.nvc-lg-rows { display: flex; flex-direction: column; align-items: flex-start; margin-top: 1px; }
.nvc-lg-row { display: inline-flex; align-items: center; gap: 6px; min-height: 19px; padding: 0 4px; margin-left: -4px; border-radius: 5px; pointer-events: none;
  max-width: 100%; transition: background .16s; }
/* Legend text never takes the pointer, so drawings and handles underneath stay grabbable; only its buttons do. */
.nvc-lg-actions, .nvc-lg-btn, .nvc-lg-toggle { pointer-events: auto; }
.nvc-lg-name { color: var(--nv-3a3b4f); font-weight: 600; white-space: nowrap; font-size: 10.5px; }
.nvc-lg-vals { display: inline-flex; gap: 6px; font-size: 10.5px; white-space: nowrap; overflow: hidden; }
.nvc-lg-actions { display: inline-flex; gap: 1px; opacity: 0; transition: opacity .16s; }
.nvc-chart:hover .nvc-lg-actions { opacity: .55; }
.nvc-lg-actions:hover, .nvc-lg-actions:focus-within { opacity: 1 !important; }
.nvc-lg-btn { display: grid; place-items: center; width: 20px; height: 18px; border: 0; border-radius: 4px; background: transparent; color: var(--nv-3a3b4f); cursor: pointer; }
.nvc-lg-btn:hover { background: var(--nv-f0f0f7); color: var(--nv-0e0f1f-text); }
.nvc-dim .nvc-lg-name, .nvc-dim .nvc-lg-vals { opacity: .45; }
.nvc-placing .nvc-lg-row, .nvc-placing .nvc-lg-sym { pointer-events: none; }
.nvc-sublegends { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.nvc-sublegend { position: absolute; left: 8px; right: 70px; display: flex; flex-direction: column; align-items: flex-start; font-size: 11px; }
.nvc-status { position: absolute; inset: 0; z-index: 7; display: grid; place-items: center; background: rgba(var(--nv-glass-rgb), .62); animation: nvcFade .2s ease both; }
.nvc-status-box { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; background: var(--nv-fff-bg); border: 1px solid var(--nv-e6e6ef);
  font-size: 12px; font-weight: 600; color: var(--nv-3a3b4f); box-shadow: 0 12px 30px -18px rgba(14,15,31,.4); max-width: calc(100% - 24px); }
.nvc-spinner { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--nv-e6e6ef); border-top-color: #DD3D4F; animation: nvcSpin .8s linear infinite; }

/* floating selection toolbar */
.nvc-selbar { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 2px; padding: 3px;
  max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; border-radius: 10px; background: var(--nv-fff-bg); border: 1px solid var(--nv-e6e6ef);
  box-shadow: 0 14px 34px -18px rgba(14,15,31,.45); animation: nvcPop .18s cubic-bezier(.2,.7,.2,1) both; }
.nvc-selbar::-webkit-scrollbar { display: none; }
.nvc-selbar-name { flex: none; padding: 0 6px 0 8px; font-size: 11px; font-weight: 700; color: var(--nv-9a9cb4); white-space: nowrap; }
.nvc-icon-btn { flex: none; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--nv-3a3b4f);
  cursor: pointer; transition: background .16s, color .16s, transform .12s; }
.nvc-icon-btn:hover { background: var(--nv-f0f0f7); color: var(--nv-0e0f1f-text); }
.nvc-icon-btn:active { transform: scale(.92); }
.nvc-icon-btn[aria-pressed="true"] { color: var(--nv-b4202f); background: var(--nv-fff5f6); }
.nvc-icon-btn.nvc-danger:hover, .nvc-menu-item.nvc-danger:hover { color: var(--nv-b4202f); background: var(--nv-fff5f6); }
.nvc-text-btn { flex: none; height: 30px; padding: 0 8px; border: 0; border-radius: 7px; background: transparent; color: var(--nv-3a3b4f); font-size: 11.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.nvc-text-btn:hover { background: var(--nv-f0f0f7); color: var(--nv-0e0f1f-text); }
.nvc-swatch-btn { flex: none; width: 22px; height: 22px; margin: 0 4px; padding: 0; border-radius: 6px; border: 2px solid var(--nv-fff-bg); box-shadow: 0 0 0 1px var(--nv-dcdce6); cursor: pointer; transition: transform .12s; }
.nvc-swatch-btn:hover { transform: scale(1.08); }
.nvc-text-editor { position: absolute; z-index: 9; width: 220px; min-height: 58px; padding: 6px 8px; border-radius: 8px; border: 1.5px solid #DD3D4F; background: var(--nv-fff-bg);
  font: 600 13px/1.35 Inter, system-ui, sans-serif; resize: both; outline: none; box-shadow: 0 16px 34px -18px rgba(14,15,31,.5); animation: nvcPop .16s ease both; }
.nvc-anchor { position: fixed; width: 1px; height: 1px; pointer-events: none; }

/* ----------------------------------------------------------------- tooltip */
.nvc-tip { position: fixed; z-index: 120; max-width: 260px; padding: 5px 9px; border-radius: 7px; background: #0E0F1F; color: #fff; font: 600 11.5px/1.35 Inter, system-ui, sans-serif;
  pointer-events: none; opacity: 0; transform: translateY(3px); transition: opacity .14s, transform .14s; white-space: normal; }
html.dark .nvc-tip { background: #2A2B3F; }
.nvc-tip.nvc-tip-on { opacity: 1; transform: none; }

/* --------------------------------------------------------- popovers & menus */
.nvc-pop { position: fixed; z-index: 110; min-width: 180px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto; padding: 5px; border-radius: 12px;
  background: var(--nv-fff-bg); color: var(--nv-0e0f1f-text); border: 1px solid var(--nv-e6e6ef); box-shadow: 0 22px 48px -22px rgba(14,15,31,.5);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif; animation: nvcPop .18s cubic-bezier(.2,.7,.2,1) both; }
.nvc-pop:focus { outline: none; }   /* focused as a whole on touch screens (chart-ui.js popover focus trap) */
.nvc-pop.nvc-pop-out { opacity: 0; transform: translateY(-3px); transition: opacity .15s, transform .15s; }
.nvc-pop-wide { width: 380px; }
.nvc-menu { display: flex; flex-direction: column; gap: 1px; }
.nvc-menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border: 0; border-radius: 8px; background: transparent;
  color: var(--nv-0e0f1f-text); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; transition: background .15s, color .15s; }
.nvc-menu-item:hover, .nvc-menu-item:focus-visible { background: var(--nv-f4f4f8); outline: none; }
.nvc-menu-item:disabled { opacity: .55; cursor: default; }
.nvc-menu-item[aria-checked="true"] { background: var(--nv-fff5f6); color: var(--nv-b4202f); }
.nvc-menu-item[aria-checked="true"] .nvc-menu-label::after { content: ' \2713'; }
.nvc-menu-icon { flex: none; display: grid; place-items: center; width: 20px; color: var(--nv-3a3b4f); }
.nvc-menu-item[aria-checked="true"] .nvc-menu-icon { color: inherit; }
.nvc-menu-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nvc-menu-hint { flex: none; font-size: 11px; font-weight: 600; color: var(--nv-9a9cb4); font-family: 'JetBrains Mono', ui-monospace, monospace; }
.nvc-menu-sep { height: 1px; margin: 4px 6px; background: var(--nv-eeeef4); }
.nvc-menu-heading { padding: 7px 10px 3px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--nv-9a9cb4); }

.nvc-sheet-backdrop { position: fixed; inset: 0; z-index: 109; background: rgba(14,15,31,.42); animation: nvcFade .2s ease both; }
.nvc-sheet-backdrop.nvc-pop-out { opacity: 0; transition: opacity .16s; }
.nvc-pop.nvc-pop-sheet { left: 0 !important; right: 0; bottom: 0; top: auto !important; width: 100%; max-width: none; max-height: min(82vh, 640px); border-radius: 18px 18px 0 0;
  padding: 6px 12px calc(14px + env(safe-area-inset-bottom)); animation: nvcSheet .26s cubic-bezier(.2,.7,.2,1) both; }
.nvc-pop.nvc-pop-sheet.nvc-pop-out { transform: translateY(100%); transition: transform .18s ease-in; }
.nvc-sheet-head { position: sticky; top: -6px; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -12px 6px; padding: 8px 8px 6px 16px;
  background: var(--nv-fff-bg); border-bottom: 1px solid var(--nv-eeeef4); }
.nvc-sheet-head::before { content: ''; position: absolute; left: 50%; top: 3px; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--nv-dcdce6); }
.nvc-sheet-title { font-size: 15px; font-weight: 800; }
.nvc-pop-sheet .nvc-icon-btn, .nvc-pop-sheet .nvc-menu-item { min-height: 44px; min-width: 44px; }

/* ------------------------------------------------------------------ dialogs */
.nvc-modal-root { position: fixed; inset: 0; z-index: 115; display: grid; place-items: center; padding: 16px; font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
.nvc-modal-backdrop { position: absolute; inset: 0; background: rgba(14,15,31,.42); animation: nvcFade .22s ease both; }
.nvc-modal { position: relative; display: flex; flex-direction: column; width: min(100%, 440px); max-height: calc(100vh - 32px); border-radius: 18px; background: var(--nv-fff-bg);
  color: var(--nv-0e0f1f-text); border: 1px solid var(--nv-e6e6ef); box-shadow: 0 40px 80px -30px rgba(14,15,31,.55); animation: nvcPop .22s cubic-bezier(.2,.7,.2,1) both; }
.nvc-modal-wide { width: min(100%, 560px); }
.nvc-modal-root.nvc-modal-out .nvc-modal { opacity: 0; transform: translateY(6px) scale(.98); transition: opacity .16s, transform .16s; }
.nvc-modal-root.nvc-modal-out .nvc-modal-backdrop { opacity: 0; transition: opacity .16s; }
.nvc-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 12px 10px 20px; border-bottom: 1px solid var(--nv-eeeef4); }
.nvc-modal-title { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: -.01em; }
.nvc-modal-body { padding: 14px 20px; overflow: auto; }
.nvc-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--nv-eeeef4); }
.nvc-modal-foot .nvc-btn:first-child:not(:last-child):not(.nvc-btn-primary) { margin-right: auto; }
.nvc-modal-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--nv-1c1d2e-text); }
.nvc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--nv-e6e6ef);
  background: var(--nv-fff-bg); color: var(--nv-0e0f1f-text); font-size: 13px; font-weight: 700; cursor: pointer; transition: background .16s, border-color .16s, transform .12s, box-shadow .16s; }
.nvc-btn:hover { background: var(--nv-f4f4f8); }
.nvc-btn:active { transform: scale(.97); }
.nvc-btn-primary { background: #DD3D4F; border-color: #DD3D4F; color: #fff; }
.nvc-btn-primary:hover { background: #B4202F; border-color: #B4202F; box-shadow: 0 10px 20px -10px rgba(221,61,79,.7); }
.nvc-btn-danger { background: var(--nv-fff5f6); border-color: var(--nv-f3c4ca); color: var(--nv-b4202f); }
.nvc-btn-danger:hover { background: #DD3D4F; border-color: #DD3D4F; color: #fff; }
.nvc-btn-sm { min-height: 30px; padding: 0 10px; font-size: 12px; border-radius: 8px; }

.nvc-input { width: 100%; min-height: 36px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--nv-e6e6ef); background: var(--nv-fff-bg); color: var(--nv-0e0f1f-text);
  font: 600 13px Inter, system-ui, sans-serif; outline: none; transition: border-color .16s, box-shadow .16s; }
.nvc-input:focus { border-color: #DD3D4F; box-shadow: 0 0 0 3px rgba(221,61,79,.14); }
.nvc-input.nvc-invalid { border-color: #DD3D4F; background: var(--nv-fff5f6); }
.nvc-input-sm { width: 84px; min-height: 30px; padding: 4px 8px; font-size: 12px; }
.nvc-textarea { resize: vertical; min-height: 64px; line-height: 1.4; }
.nvc-field { display: flex; flex-direction: column; gap: 5px; margin: 0 0 10px; font-size: 12px; }
.nvc-field-label { font-size: 11.5px; font-weight: 700; color: var(--nv-3a3b4f); }
.nvc-field-inline { flex-direction: row; align-items: center; gap: 8px; min-height: 30px; cursor: pointer; }
.nvc-field-row { flex-direction: row; align-items: center; justify-content: space-between; min-height: 30px; }
.nvc-check { width: 16px; height: 16px; margin: 0; accent-color: #DD3D4F; cursor: pointer; }
.nvc-muted { margin: 0; font-size: 12px; line-height: 1.5; color: var(--nv-9a9cb4); }
.nvc-empty { padding: 18px 8px; text-align: center; }

.nvc-colors { width: 212px; padding: 6px; }
.nvc-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; }
.nvc-swatch { width: 22px; height: 22px; padding: 0; border-radius: 6px; border: 1px solid rgba(14,15,31,.14); cursor: pointer; transition: transform .12s, box-shadow .12s; }
.nvc-swatch:hover { transform: scale(1.12); }
.nvc-swatch.nvc-swatch-on { box-shadow: 0 0 0 2px var(--nv-fff-bg), 0 0 0 4px #DD3D4F; }
.nvc-custom-color { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--nv-3a3b4f); cursor: pointer; }
.nvc-native-color { width: 30px; height: 26px; padding: 0; border: 1px solid var(--nv-e6e6ef); border-radius: 6px; background: transparent; cursor: pointer; }
.nvc-opacity { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 600; color: var(--nv-3a3b4f); }
.nvc-range { flex: 1; accent-color: #DD3D4F; }
.nvc-range-out { width: 36px; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 11px; }

.nvc-tabs, .nvc-chips { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.nvc-tab, .nvc-chip { flex: none; min-height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--nv-e6e6ef); background: transparent; color: var(--nv-3a3b4f);
  font-size: 12px; font-weight: 700; cursor: pointer; transition: all .16s; }
.nvc-tab:hover, .nvc-chip:hover { background: var(--nv-f4f4f8); }
.nvc-tab[aria-selected="true"], .nvc-chip[aria-selected="true"] { background: var(--nv-0e0f1f-bg); border-color: var(--nv-0e0f1f-bg); color: #fff; }
.nvc-tabpanel[hidden] { display: none; }
.nvc-style-row { display: flex; align-items: center; gap: 10px; min-height: 40px; border-bottom: 1px solid var(--nv-f4f4f8); }
.nvc-style-name { flex: 1; font-size: 13px; font-weight: 600; }

/* indicator picker */
.nvc-search { margin-bottom: 10px; }
.nvc-ind-list { display: flex; flex-direction: column; gap: 1px; max-height: min(52vh, 440px); overflow: auto; margin: 0 -8px; }
.nvc-ind-row { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px; border-radius: 9px; cursor: pointer; transition: background .15s; }
.nvc-ind-row:hover, .nvc-ind-row:focus-visible { background: var(--nv-f4f4f8); outline: none; }
.nvc-ind-row.nvc-ind-added { animation: nvcFlash .7s ease-out; }
.nvc-ind-name { flex: 1; font-size: 13px; font-weight: 600; }
.nvc-ind-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--nv-f0f0f7); color: var(--nv-3a3b4f); }
.nvc-star { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: var(--nv-c4c5d2); cursor: pointer; transition: color .16s, transform .16s; }
.nvc-star:hover { color: #E0B22B; transform: scale(1.1); }
.nvc-star.nvc-star-on { color: #E0B22B; }
.nvc-star.nvc-star-on svg { fill: currentColor; }

/* drawing editor */
.nvc-editor-section { padding: 2px 0 10px; }
.nvc-editor-section + .nvc-editor-section { border-top: 1px solid var(--nv-f4f4f8); padding-top: 12px; }
.nvc-editor-title { margin: 0 0 8px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--nv-9a9cb4); }
.nvc-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.nvc-levels { display: flex; flex-direction: column; gap: 4px; }
.nvc-level-row { display: flex; align-items: center; gap: 8px; }
.nvc-level-row .nvc-input-sm { width: 96px; }

/* symbol search */
.nvc-symsearch { padding: 6px; }
.nvc-symlist { display: flex; flex-direction: column; max-height: min(56vh, 420px); overflow: auto; margin: 0 -4px; }
.nvc-symrow { display: grid; grid-template-columns: auto 1fr auto 64px; align-items: center; gap: 6px; min-height: 36px; padding: 0 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--nv-0e0f1f-text); text-align: left; cursor: pointer; transition: background .14s; }
.nvc-symrow:hover, .nvc-symrow.nvc-on { background: var(--nv-f4f4f8); }
.nvc-symrow.nvc-current { box-shadow: inset 2px 0 0 #DD3D4F; }
.nvc-symrow-name { font-size: 13px; font-weight: 800; }
.nvc-symrow-quote { font-size: 11px; font-weight: 600; color: var(--nv-9a9cb4); }
.nvc-symrow-last { font-size: 12px; text-align: right; }
.nvc-symrow-chg { font-size: 11.5px; font-weight: 700; text-align: right; }

/* drawings list and help */
.nvc-dlist-head { margin-bottom: 8px; }
.nvc-dlist-items { display: flex; flex-direction: column; gap: 1px; max-height: min(56vh, 460px); overflow: auto; margin: 0 -8px; }
.nvc-dlist-row { display: flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px; border-radius: 9px; transition: background .14s; }
.nvc-dlist-row:hover { background: var(--nv-f4f4f8); }
.nvc-dlist-row.nvc-on { background: var(--nv-fff5f6); }
.nvc-dlist-row.nvc-dim .nvc-dlist-name { opacity: .5; }
.nvc-dlist-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 6px; border: 0; background: transparent;
  color: var(--nv-0e0f1f-text); font-size: 13px; font-weight: 600; text-align: left; cursor: pointer; }
.nvc-dlist-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nvc-help { width: 360px; max-width: 100%; padding: 8px 10px; }
.nvc-help-title { margin: 4px 0 8px; font-size: 13px; font-weight: 800; }
.nvc-help-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; margin-bottom: 12px; font-size: 12.5px; }
.nvc-kbd { justify-self: start; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--nv-e6e6ef); border-bottom-width: 2px; background: var(--nv-f6f6fa);
  font: 700 11px 'JetBrains Mono', ui-monospace, monospace; color: var(--nv-1c1d2e-text); white-space: nowrap; }

/* phone tool sheet */
.nvc-toolsheet { display: flex; flex-direction: column; }
.nvc-sheet-group { margin: 10px 2px 6px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--nv-9a9cb4); }
.nvc-sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.nvc-sheet-tool { width: auto !important; height: auto !important; min-height: 62px; display: flex !important; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px; border-radius: 12px !important; border: 1px solid var(--nv-e6e6ef) !important; background: var(--nv-fff-bg); color: var(--nv-1c1d2e-text); font-size: 11px; font-weight: 600;
  text-align: center; line-height: 1.2; cursor: pointer; }
.nvc-sheet-tool.nvc-on { border-color: var(--nv-f3c4ca) !important; background: var(--nv-fff5f6); color: var(--nv-b4202f); }
.nvc-toolsheet > .nvc-sheet-tool { flex-direction: row; min-height: 48px; }

/* ------------------------------------------------------------------- phones */
@media (max-width: 767px) {
  .nvc-drawbar { display: none; }
  .nvc-panetabs:not([hidden]) { display: flex; }
  .nvc-grid { display: block; }
  .nvc-grid > .nvc-pane { position: absolute; inset: 0; }
  .nvc-grid > .nvc-pane:not(.nvc-active) { visibility: hidden; pointer-events: none; }
  .nvc-grid .nvc-pane-head { display: none; }
  .nvc-grid .nvc-pane.nvc-active::after { display: none; }
  /* Drawing button: sits above the TradingView attribution logo (bottom-left of the pane), which must stay visible and clickable. */
  .nvc-fab { display: grid; place-items: center; position: absolute; left: 10px; bottom: 66px; z-index: 9; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--nv-e6e6ef);
    background: var(--nv-fff-bg); color: var(--nv-0e0f1f-text); box-shadow: 0 12px 26px -12px rgba(14,15,31,.5); cursor: pointer; transition: transform .14s; }
  .nvc-fab:active { transform: scale(.92); }
  .nvc-ws.nvc-placing .nvc-fab { background: #DD3D4F; border-color: #DD3D4F; color: #fff; }
  .nvc-top-btn { height: 44px; min-width: 44px; }
  .nvc-iv { height: 44px; min-width: 44px; }
  .nvc-top-wide span { display: none; }
  .nvc-hide-phone { display: none; }
  .nvc-legend { right: 58px; font-size: 10.5px; }
  .nvc-lg-ohlc b { margin-right: 4px; }
  .nvc-lg-actions { opacity: 1; }
  .nvc-icon-btn { width: 44px; height: 44px; }
  .nvc-text-btn { height: 44px; }
  .nvc-selbar { top: auto; bottom: 30px; left: 62px; right: 8px; transform: none; max-width: none; }
  .nvc-selbar-name { display: none; }
  .nvc-modal-root { place-items: end center; padding: 0; }
  .nvc-modal { width: 100% !important; max-height: 88vh; border-radius: 18px 18px 0 0; animation: nvcSheet .26s cubic-bezier(.2,.7,.2,1) both; padding-bottom: env(safe-area-inset-bottom); }
  .nvc-editor-grid { grid-template-columns: 1fr; }
  .nvc-btn { min-height: 44px; }
  .nvc-tab, .nvc-chip { min-height: 44px; }
  .nvc-ind-row, .nvc-symrow, .nvc-dlist-row { min-height: 46px; }
  .nvc-star { width: 44px; height: 44px; }
  .nvc-swatch { width: 32px; height: 32px; }
  .nvc-colors { width: 100%; }
  .nvc-swatches { grid-template-columns: repeat(8, minmax(32px, 1fr)); }
  .nvc-pop-wide, .nvc-help { width: 100%; }
}

/* Terminal: the chart card grows with a two-row grid so each pane keeps a usable height. */
@media (min-width: 1280px) {
  .nvc-terminal-panel:has(.nvc-grid[data-grid="2h"]:not(.nvc-maxed)),
  .nvc-terminal-panel:has(.nvc-grid[data-grid="3"]:not(.nvc-maxed)),
  .nvc-terminal-panel:has(.nvc-grid[data-grid="4"]:not(.nvc-maxed)),
  .nvc-terminal-panel:has(.nvc-grid[data-grid="6"]:not(.nvc-maxed)) { min-height: 50rem; }
}
@media (max-width: 767px) {
  .nvc-terminal-panel { min-height: 30rem !important; }
}
/* The terminal card keeps its own surface colour (white / ink-900). */
.nvc-terminal-panel .nvc-ws { --nvc-bg: #FFFFFF; }
html.dark .nvc-terminal-panel .nvc-ws { --nvc-bg: #0F1523; }
.nvc-lg-toggle { display: inline-flex; align-items: center; gap: 3px; height: 18px; padding: 0 6px 0 4px; border-radius: 999px; border: 1px solid var(--nv-e6e6ef);
  background: rgba(var(--nv-glass-rgb), .85); color: var(--nv-3a3b4f); font-size: 10px; font-weight: 700; cursor: pointer; align-self: center; transition: color .16s, border-color .16s; }
.nvc-lg-toggle[hidden] { display: none; }
.nvc-lg-toggle svg { transform: rotate(-90deg); transition: transform .2s cubic-bezier(.2,.7,.2,1); }
.nvc-lg-toggle.nvc-open svg { transform: none; }
.nvc-lg-toggle:hover { color: var(--nv-b4202f); border-color: var(--nv-f3c4ca); }
.nvc-lg-collapsed .nvc-lg-rows, .nvc-lg-collapsed .nvc-sublegends { display: none; }
/* Compact legend in short panes: one tight line per indicator, inputs truncated. */
.nvc-lg-compact .nvc-legend { line-height: 1.3; font-size: 10px; }
.nvc-lg-compact .nvc-lg-o { display: none; }
.nvc-lg-compact .nvc-lg-row { min-height: 15px; gap: 4px; }
.nvc-lg-compact .nvc-lg-name { max-width: 72px; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
.nvc-lg-compact .nvc-lg-vals { max-width: 150px; gap: 4px; font-size: 10px; }
.nvc-lg-compact .nvc-lg-vals span:nth-child(n+3) { display: none; }
.nvc-lg-compact .nvc-lg-btn { height: 15px; }
@media (max-width: 767px) {
  .nvc-lg-toggle:not([hidden]) { height: 32px; padding: 0 10px 0 8px; font-size: 11px; }
  .nvc-lg-toggle::before { content: ''; position: absolute; inset: -6px; }
  .nvc-lg-toggle { position: relative; }
  .nvc-lg-btn, .nvc-lg-compact .nvc-lg-btn { width: 44px; height: 44px; }
  .nvc-lg-sym { display: inline-flex; align-items: center; min-height: 44px; }
  .nvc-lg-main { align-items: center; }
  .nvc-lg-row { min-height: 44px; }
  .nvc-lg-o { display: none; }
  .nvc-terminal-panel { min-height: 40rem !important; }
}

/* ------------------------------------------------------ trade lines (terminal) */
@keyframes nvcPulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.nvc-tlines { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.nvc-tline { position: absolute; top: 0; right: 60px; display: inline-flex; align-items: stretch; height: 22px; max-width: calc(100% - 80px);
  border-radius: 6px; border: 1px solid var(--tl); background: var(--nvc-bg, var(--nv-fff-bg)); color: var(--nv-0e0f1f-text);
  font: 700 10.5px/1 Inter, system-ui, sans-serif; box-shadow: 0 6px 16px -10px rgba(14,15,31,.45); pointer-events: auto;
  transition: box-shadow .16s, opacity .16s; will-change: transform; }
.nvc-tline[hidden] { display: none; }
.nvc-tline button { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.nvc-tline-grip { min-width: 0; padding: 0 7px 0 5px; border-radius: 5px 0 0 5px; touch-action: none; }
.nvc-tline-drag .nvc-tline-grip { cursor: ns-resize; }
.nvc-tline-grip:not(:only-child) { border-right: 1px solid color-mix(in srgb, var(--tl) 35%, transparent); }
.nvc-tline-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; }
.nvc-tline-dots { display: inline-grid; grid-template-columns: repeat(2, 3px); gap: 2px; color: var(--tl); }
.nvc-tline-dots i { width: 3px; height: 10px; border-left: 1px dotted currentColor; border-right: 1px dotted currentColor; }
.nvc-tline-locked .nvc-tline-dots { display: inline-flex; grid-template-columns: none; color: var(--nv-9a9cb4); }
.nvc-tline-locked { opacity: .85; }
.nvc-tline-act, .nvc-tline-create { padding: 0 7px; border-left: 1px solid color-mix(in srgb, var(--tl) 25%, transparent) !important; }
.nvc-tline-act:hover, .nvc-tline-create:hover { background: color-mix(in srgb, var(--tl) 14%, transparent) !important; }
.nvc-tline-act.nvc-danger:hover { color: #DD3D4F !important; }
.nvc-tline-create { color: var(--tl) !important; touch-action: none; cursor: ns-resize !important; }
.nvc-tline-act:disabled, .nvc-tline-create:disabled { opacity: .45; cursor: not-allowed !important; }
.nvc-tline:hover, .nvc-tline-active { box-shadow: 0 0 0 2px color-mix(in srgb, var(--tl) 30%, transparent), 0 8px 18px -10px rgba(14,15,31,.5); z-index: 2; }
.nvc-tline-active { background: var(--tl); color: #fff; }
.nvc-tline-active .nvc-tline-dots { color: #fff; }
.nvc-tline-pending .nvc-tline-text, .nvc-tline-busy { animation: nvcPulse 1s ease-in-out infinite; }
.nvc-tline-dragging .nvc-canvas { cursor: ns-resize !important; }
.nvc-placing .nvc-tline, .nvc-drawing-edit .nvc-tline { pointer-events: none; opacity: .55; }
.nvc-tconfirm { width: 300px; max-width: 100%; padding: 8px 10px; }
.nvc-tconfirm-text { margin: 0 0 10px; font-size: 13px; font-weight: 700; line-height: 1.45; }
.nvc-tconfirm-row { display: flex; justify-content: flex-end; gap: 8px; }
.nvc-tconfirm-hint { margin-top: 8px; font-size: 11px; }
@media (max-width: 767px) {
  .nvc-tline { height: 30px; right: 52px; font-size: 11px; }
  .nvc-tline-grip { position: relative; padding: 0 9px 0 7px; }
  .nvc-tline-grip::before, .nvc-tline-act::before, .nvc-tline-create::before { content: ''; position: absolute; inset: -8px 0; }
  .nvc-tline-act, .nvc-tline-create { position: relative; min-width: 34px; justify-content: center; }
  .nvc-tconfirm { width: 100%; }
  .nvc-tconfirm .nvc-btn { min-height: 44px; flex: 1; }
}
.nvc-tline-tag { display: none; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; }
.nvc-tline-short .nvc-tline-text, .nvc-tline-short .nvc-tline-act { display: none !important; }
.nvc-tline-short .nvc-tline-tag { display: inline; }
.nvc-tline-short .nvc-tline-grip { border-right: 0; border-radius: 5px; }
