/* ── TradingView Rectangle Drawing Tool Styles ── */

/* ── 1. Floating Toolbar ── */
.tv-floating-drawing-toolbar {
  position: absolute;
  background: #1e222d;
  border-radius: 8px;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  z-index: 80;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  user-select: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  color: #d1d4dc;
  font-size: 13px;
  animation: tvFbarDrop 0.12s ease-out;
}

@keyframes tvFbarDrop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tv-fbar-drag-handle {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 5px;
  color: #787b86;
  cursor: grab;
}

.tv-fbar-item {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tv-fbar-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  box-sizing: border-box;
  border: 0;
  border-radius: 6px;
  outline: none;
  background: none;
  color: inherit;
  font: inherit;
  line-height: 1;
  cursor: pointer;
}

.tv-fbar-btn:hover {
  background: #2a2e39;
}

.tv-fbar-btn.active {
  color: #2962ff;
}

/* Color line under the pencil, bucket and T icons */
.tv-fbar-underline {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 3px;
  height: 3px;
  border-radius: 1px;
}

/* Line preview on the width and style buttons */
.tv-fbar-line {
  display: block;
  width: 18px;
  border-top: 2px solid currentColor;
}

/* Dropdown popups for toolbar */
.tv-fbar-more-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  background: #1e222d;
  border: 1px solid #363a45;
  border-radius: 6px;
  z-index: 1000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
}

.tv-fbar-more-dropdown.active {
  display: block;
}

.tv-fbar-more-dropdown {
  left: auto;
  right: 0;
  min-width: 170px;
  padding: 4px;
}

.tv-fbar-menu-btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.tv-fbar-menu-btn:hover {
  background: #2a2e39;
}

.tv-fbar-width-dropdown {
  left: 0;
  right: auto;
  min-width: 110px;
}

.tv-fbar-width-dropdown .tv-fbar-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tv-fbar-menu-btn.active {
  color: #2962ff;
  font-weight: 600;
}

/* Templates menu (first button on the drawing toolbar) */
.tv-fbar-tpl-dropdown {
  left: 0;
  right: auto;
  min-width: 230px;
  max-width: min(320px, calc(100vw - 24px));
}

.tv-fbar-tpl-list:not(:empty) {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid #363a45;
  max-height: 260px;
  overflow-y: auto;
}

.tv-fbar-tpl-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-right: 4px;
}

.tv-fbar-tpl-row span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tv-fbar-tpl-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
  opacity: 0;
  cursor: pointer;
}

.tv-fbar-tpl-row:hover .tv-fbar-tpl-del,
.tv-fbar-tpl-del:focus-visible {
  opacity: 0.7;
}

.tv-fbar-tpl-del:hover {
  opacity: 1;
  background: #363a45;
}

/* Phones have no mouse to hover with, so the X is always there */
@media (hover: none) {
  .tv-fbar-tpl-del { opacity: 0.7; }
}

/* "Save drawing template" window */
#tv-dtpl-save {
  position: fixed;
  inset: 0;
  z-index: 100001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.35);
}

.tv-dtpl-box {
  position: relative;
  width: 380px;
  max-width: 100%;
  padding: 26px 30px 24px;
  box-sizing: border-box;
  border-radius: 12px;
  background: #1e222d;
  color: #d1d4dc;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
}

.tv-dtpl-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  cursor: pointer;
}

.tv-dtpl-close:hover {
  background: #2a2e39;
}

.tv-dtpl-title {
  margin: 0 32px 22px 0;
  font-size: 20px;
  font-weight: 600;
}

.tv-dtpl-label {
  display: block;
  margin-bottom: 6px;
  color: #787b86;
  font-size: 13px;
}

#tv-dtpl-name {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  box-sizing: border-box;
  border: 1px solid #434651;
  border-radius: 8px;
  outline: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px; /* 16px so iPhone does not zoom in */
}

#tv-dtpl-name:focus {
  border-color: #2962ff;
  box-shadow: 0 0 0 1px #2962ff;
}

.tv-dtpl-btns {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 26px;
}

.tv-dtpl-btns button {
  height: 36px;
  padding: 0 16px;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.tv-dtpl-cancel {
  border: 1px solid #434651;
  background: none;
  color: inherit;
}

.tv-dtpl-cancel:hover {
  background: #2a2e39;
}

.tv-dtpl-ok {
  border: 1px solid #2962ff;
  background: #2962ff;
  color: #ffffff;
}

.tv-dtpl-ok:hover {
  background: #1e53e5;
}

.tv-dtpl-ok:disabled {
  border-color: transparent;
  background: #2a2e39;
  color: #5d606b;
  cursor: default;
}

body.theme-light .tv-fbar-tpl-list:not(:empty) {
  border-top-color: #e0e3eb;
}

body.theme-light .tv-fbar-tpl-del:hover,
body.theme-light .tv-dtpl-close:hover,
body.theme-light .tv-dtpl-cancel:hover {
  background: #f0f3fa;
}

body.theme-light .tv-dtpl-box {
  background: #ffffff;
  color: #131722;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
}

body.theme-light #tv-dtpl-name,
body.theme-light .tv-dtpl-cancel {
  border-color: #d1d4dc;
}

body.theme-light .tv-dtpl-ok:disabled {
  background: #f0f3fa;
  color: #b2b5be;
}

/* Color picker */
#tv-draw-color-picker,
#tv-swatch-popup {
  position: fixed;
  z-index: 100000;
  display: none;
  width: 236px;
  padding: 10px;
  box-sizing: border-box;
  border-radius: 8px;
  background: #1e222d;
  color: #d1d4dc;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  font: 12px -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
}

.tv-dcp-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
}

.tv-dcp-swatch {
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid rgba(128, 128, 128, 0.35);
  border-radius: 3px;
  cursor: pointer;
}

.tv-dcp-swatch:hover {
  transform: scale(1.15);
}

.tv-dcp-swatch.active {
  outline: 2px solid #2962ff;
  outline-offset: 1px;
}

.tv-dcp-custom {
  position: relative;
  display: block;
  width: 24px;
  margin-top: 6px;
  font-size: 20px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
}

.tv-dcp-custom input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.tv-dcp-opacity {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(128, 128, 128, 0.3);
}

.tv-dcp-opacity input {
  flex: 1;
  min-width: 0;
  accent-color: #2962ff;
  cursor: pointer;
}

.tv-dcp-value {
  width: 34px;
  text-align: right;
}

/* ── 2. Modal Settings Dialog ── */
.tv-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  user-select: none;
}

.tv-dialog-box {
  background: #1e222d;
  border: 1px solid #363a45;
  border-radius: 8px;
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  color: #d1d4dc;
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  animation: tvModalPop 0.15s ease-out;
  overflow: hidden;
}

.tv-alert-dialog {
  width: 440px;
}

@keyframes tvModalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.tv-dialog-header {
  padding: 12px 18px;
  border-bottom: 1px solid #2a2e39;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tv-dialog-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.tv-dialog-close {
  background: transparent;
  border: none;
  color: #787b86;
  font-size: 16px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}

.tv-dialog-close:hover {
  color: #ffffff;
  background: #2a2e39;
}

.tv-dialog-tabs {
  display: flex;
  background: #1a1e29;
  border-bottom: 1px solid #2a2e39;
  padding: 0 14px;
  gap: 4px;
}

.tv-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: #787b86;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.tv-tab-btn:hover {
  color: #d1d4dc;
}

.tv-tab-btn.active {
  color: #2962ff;
  border-bottom-color: #2962ff;
}

.tv-dialog-body {
  padding: 18px 20px;
  overflow-y: auto;
  max-height: calc(85vh - 130px);
}

.tv-form-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tv-form-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.tv-form-row-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tv-form-subgroup {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv-form-label {
  font-size: 12px;
  font-weight: 600;
  color: #9b9eb5;
}

.tv-form-divider {
  height: 1px;
  background: #2a2e39;
  margin: 4px 0;
}

/* Inputs & Selects */
.tv-checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  cursor: pointer;
  color: #d1d4dc;
}

.tv-checkbox-wrap input[type="checkbox"] {
  accent-color: #2962ff;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.tv-color-input {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #363a45;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
}

.tv-select-sm,
.tv-select-md,
.tv-select-full {
  background: #2a2e39;
  color: #d1d4dc;
  border: 1px solid #363a45;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
}

.tv-select-md {
  padding: 5px 10px;
}

.tv-select-full {
  width: 100%;
  padding: 7px 10px;
}

.tv-input-num {
  background: #2a2e39;
  color: #ffffff;
  border: 1px solid #363a45;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 12px;
  width: 120px;
  outline: none;
}

.tv-textarea {
  background: #2a2e39;
  color: #ffffff;
  border: 1px solid #363a45;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
  resize: vertical;
  outline: none;
  font-family: inherit;
}

.tv-textarea:focus,
.tv-input-num:focus {
  border-color: #2962ff;
}

.tv-slider-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #9b9eb5;
}

.tv-slider-group input[type="range"] {
  width: 85px;
  accent-color: #2962ff;
}

.tv-btn-toggle-group {
  display: inline-flex;
  border: 1px solid #363a45;
  border-radius: 4px;
  overflow: hidden;
}

.tv-btn-toggle {
  background: #2a2e39;
  color: #787b86;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

.tv-btn-toggle.active {
  background: #2962ff;
  color: #ffffff;
}

/* Coordinates box */
.tv-coord-box {
  background: #1a1e29;
  border: 1px solid #2a2e39;
  border-radius: 6px;
  padding: 10px 14px;
}

.tv-path-coord-row {
  transition: background 0.15s ease;
  border-radius: 4px;
  padding: 4px;
}

.tv-path-coord-row:hover {
  background: rgba(41, 98, 255, 0.08);
}

.tv-coord-title {
  font-size: 12px;
  font-weight: 700;
  color: #2962ff;
  margin-bottom: 8px;
}

/* Visibility Grid */
.tv-tf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* Only the timeframe boxes in a drawing's settings. Before 2026-11-18 this also put boxes around the
   items of the timeframe menu at the top, which uses the same class name. */
.tv-tf-grid .tv-tf-item {
  background: #2a2e39;
  padding: 8px 12px;
  border-radius: 4px;
  border: 1px solid #363a45;
}

/* Dialog Footer */
.tv-dialog-footer {
  padding: 12px 18px;
  border-top: 1px solid #2a2e39;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1a1e29;
}

.tv-dialog-template-wrap {
  position: relative;
}

.tv-template-btn {
  background: #2a2e39;
  color: #d1d4dc;
  border: 1px solid #363a45;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.tv-template-btn:hover {
  background: #363a45;
  color: #ffffff;
}

.tv-template-menu {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 6px;
  background: #1e222d;
  border: 1px solid #363a45;
  border-radius: 6px;
  padding: 4px 0;
  min-width: 190px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.7);
  z-index: 1000;
}

.tv-template-item {
  padding: 7px 14px;
  font-size: 12px;
  cursor: pointer;
  color: #d1d4dc;
}

.tv-template-item:hover {
  background: #2a2e39;
  color: #ffffff;
}

.tv-template-divider {
  height: 1px;
  background: #2a2e39;
  margin: 4px 0;
}

/* The settings window's Template menu looks like the toolbar's, and opens upward from the button */
.tv-dlg-tpl-menu {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: auto;
  font-size: 13px;
  text-align: left;
}

.tv-dialog-footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tv-dialog-cancel {
  background: #2a2e39;
  color: #d1d4dc;
  border: 1px solid #363a45;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
}

.tv-dialog-cancel:hover {
  background: #363a45;
}

.tv-dialog-ok {
  background: #2962ff;
  color: #ffffff;
  border: 1px solid #2962ff;
  border-radius: 4px;
  padding: 6px 18px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tv-dialog-ok:hover {
  background: #1e53e5;
}

/* ── 3. Inline Text Editor Overlay ── */
.tv-inline-drawing-editor {
  position: absolute;
  z-index: 90;
  background: rgba(30, 34, 45, 0.95);
  border: 1.5px solid #2962ff;
  border-radius: 4px;
  padding: 6px 8px;
  outline: none;
  resize: none;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  font-family: -apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif;
  line-height: 1.25;
}

/* ── 4. Light Theme Overrides ── */
body.theme-light .tv-floating-drawing-toolbar {
  background: #ffffff;
  color: #1f2329;
  border: 1px solid #e8eaed;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

body.theme-light .tv-fbar-btn:hover,
body.theme-light .tv-fbar-menu-btn:hover {
  background: #f0f3fa;
}

body.theme-light .tv-fbar-more-dropdown {
  background: #ffffff;
  border-color: #e0e3eb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body.theme-light #tv-draw-color-picker,
body.theme-light #tv-swatch-popup {
  background: #ffffff;
  color: #131722;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.2);
}

body.theme-light .tv-dialog-box {
  background: #ffffff;
  border-color: #e0e3eb;
  color: #131722;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

body.theme-light .tv-dialog-header {
  border-bottom-color: #e0e3eb;
}

body.theme-light .tv-dialog-title {
  color: #131722;
}

body.theme-light .tv-dialog-tabs {
  background: #f0f3fa;
  border-bottom-color: #e0e3eb;
}

body.theme-light .tv-form-label {
  color: #787b86;
}

body.theme-light .tv-form-divider {
  background: #e0e3eb;
}

body.theme-light .tv-checkbox-wrap {
  color: #131722;
}

body.theme-light .tv-select-sm,
body.theme-light .tv-select-md,
body.theme-light .tv-select-full,
body.theme-light .tv-input-num,
body.theme-light .tv-textarea {
  background: #f0f3fa;
  border-color: #d1d4dc;
  color: #131722;
}

body.theme-light .tv-coord-box {
  background: #f0f3fa;
  border-color: #e0e3eb;
}

body.theme-light .tv-dialog-footer {
  background: #f0f3fa;
  border-top-color: #e0e3eb;
}

body.theme-light .tv-template-btn,
body.theme-light .tv-dialog-cancel {
  background: #ffffff;
  border-color: #d1d4dc;
  color: #131722;
}

/* Phones: zoom glass above the finger while placing a point (TouchLoupe.js) */
#tv-touch-loupe {
  display: none;
  position: absolute;
  z-index: 85; /* Above the drawing toolbar (80) while the finger is down */
  width: 120px;
  height: 120px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.8; /* See-through, so the chart behind the glass still shows */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Phones: Cancel and Done while drawing */
#tv-touch-draw-bar {
  display: none;
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 21;
  gap: 8px;
}

#tv-touch-draw-bar button {
  min-width: 84px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid #363a45;
  border-radius: 20px;
  color: #ffffff;
  background: rgba(26, 30, 42, 0.96);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  touch-action: manipulation;
}

#tv-touch-draw-bar button[data-act="done"] {
  border-color: #2962ff;
  background: #2962ff;
}

.tv-fbar-drag-handle {
  touch-action: none;
}

@media (pointer: coarse) {
  .tv-flyout-item {
    min-height: 40px;
  }

  #tv-rect-toolbar button {
    min-height: 40px;
  }
}

/* Text tab of the drawing settings: same layout as TradingView */
.tvt-tab { display: flex; flex-direction: column; gap: 16px; padding: 4px 0; }
.tvt-row { display: flex; align-items: center; gap: 8px; }
.tvt-color { width: 34px; height: 34px; padding: 3px; border: 1px solid #d1d4dc; border-radius: 6px; background: #ffffff; cursor: pointer; }
.tvt-color::-webkit-color-swatch-wrapper { padding: 0; }
.tvt-color::-webkit-color-swatch { border: 0; border-radius: 3px; }
.tvt-select { height: 34px; min-width: 96px; padding: 0 10px; border: 1px solid #d1d4dc; border-radius: 6px; color: #131722; background: #ffffff; font: inherit; font-size: 14px; cursor: pointer; }
.tvt-size { min-width: 98px; }
.tvt-toggle { width: 34px; height: 34px; border: 1px solid #d1d4dc; border-radius: 6px; color: #131722; background: #ffffff; font-size: 15px; cursor: pointer; }
.tvt-toggle.active { border-color: #131722; color: #ffffff; background: #131722; }
.tvt-text { width: 100%; min-height: 96px; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d1d4dc; border-radius: 6px; color: #131722; background: #ffffff; font: inherit; font-size: 14px; resize: vertical; outline: none; }
.tvt-text:focus, .tvt-select:focus { border-color: #2962ff; outline: none; }
.tvt-align .tvt-label { flex: 1; color: #131722; font-size: 14px; }
body.theme-dark .tvt-color, body.theme-dark .tvt-select, body.theme-dark .tvt-toggle, body.theme-dark .tvt-text { border-color: #4a4a4a; color: #b8b8b8; background: #1e1e1e; }
body.theme-dark .tvt-toggle.active { border-color: #b8b8b8; color: #000000; background: #b8b8b8; }
body.theme-dark .tvt-align .tvt-label { color: #b8b8b8; }
@media (max-width: 480px) { .tvt-align { flex-wrap: wrap; } .tvt-align .tvt-label { flex-basis: 100%; } .tvt-align .tvt-select { flex: 1; } }

/* Drawing settings window: white, black underline on the open tab, black Ok, as on TradingView */
body .tv-dialog-box { border-radius: 12px; }
body .tv-dialog-header { border-bottom: 0; padding-top: 18px; }
body .tv-dialog-title { font-size: 18px; font-weight: 600; }
body.theme-light .tv-dialog-tabs { background: #ffffff; border-bottom: 1px solid #e0e3eb; }
body .tv-dialog-tabs { gap: 20px; padding: 0 20px; }
body .tv-tab-btn { padding: 8px 0; border-bottom: 2px solid transparent; font-weight: 600; font-size: 15px; opacity: 0.65; }
body .tv-tab-btn.active { opacity: 1; border-bottom-color: currentColor; color: inherit; }
body.theme-light .tv-tab-btn, body.theme-light .tv-tab-btn.active { color: #131722; }
body.theme-light .tv-dialog-footer { background: #ffffff; border-top: 1px solid #e0e3eb; }
body .tv-dialog-footer .tv-btn.tv-dialog-cancel, body .tv-dialog-footer .tv-btn.tv-template-btn { height: 36px; padding: 0 16px; border: 1px solid #d1d4dc; border-radius: 8px; font-weight: 500; }
body .tv-dialog-footer .tv-btn.tv-dialog-ok { height: 36px; min-width: 52px; padding: 0 18px; border: 1px solid #131722; border-radius: 8px; color: #ffffff; background: #131722; font-weight: 600; }
body .tv-dialog-footer .tv-btn.tv-dialog-ok:hover { background: #2a2e39; }
body.theme-dark .tv-dialog-footer .tv-btn.tv-dialog-ok { border-color: #ffffff; color: #000000; background: #ffffff; }
body.theme-dark .tv-dialog-footer .tv-btn.tv-dialog-ok:hover { background: #b8b8b8; }

/* The chart stays sharp behind the settings window, so a trader can read the drawing while changing it (as on TradingView) */
body .tv-dialog-overlay { background: rgba(0, 0, 0, 0.12); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* ── Drawing toolbar like TradingView's (read from tradingview.com on 2026-11-24). One toolbar serves every drawing tool.
   White (dark: #131313) with 6px corners and a soft edge shadow, no padding, 24px drag strip,
   38px square buttons, black icons (dark: #b8b8b8), #f2f2f2 hover (dark: #222), a 22x4 color bar under the pencil and T ── */
.tv-floating-drawing-toolbar,
body.theme-light .tv-floating-drawing-toolbar {
  gap: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: #000000;
  background: #ffffff;
  box-shadow: 0 0 2px 0 #dbdbdb, 0 3px 9px 0 #ebebeb;
  font-size: 14px;
}
body.theme-dark .tv-floating-drawing-toolbar {
  color: #b8b8b8;
  background: #131313;
  box-shadow: 0 0 2px 0 #000000, 0 3px 9px 0 #000000;
}
.tv-floating-drawing-toolbar .tv-fbar-drag-handle {
  justify-content: center;
  width: 24px;
  height: 38px;
  padding: 0;
  color: #b8b8b8;
}
body.theme-dark .tv-floating-drawing-toolbar .tv-fbar-drag-handle { color: #555555; }
.tv-floating-drawing-toolbar .tv-fbar-btn {
  gap: 4px;
  min-width: 38px;
  height: 38px;
  padding: 0 5px;
  border-radius: 0;
  font-size: 14px;
}
.tv-floating-drawing-toolbar .tv-fbar-btn svg { flex: none; display: block; }
.tv-floating-drawing-toolbar .tv-fbar-btn:hover,
body.theme-light .tv-floating-drawing-toolbar .tv-fbar-btn:hover,
.tv-floating-drawing-toolbar .tv-fbar-btn[aria-expanded="true"] { background: #f2f2f2; }
body.theme-dark .tv-floating-drawing-toolbar .tv-fbar-btn:hover,
body.theme-dark .tv-floating-drawing-toolbar .tv-fbar-btn[aria-expanded="true"] { background: #222222; }
.tv-floating-drawing-toolbar > :last-child .tv-fbar-btn,
.tv-floating-drawing-toolbar > .tv-fbar-btn:last-child { border-start-end-radius: 6px; border-end-end-radius: 6px; }
.tv-floating-drawing-toolbar .tv-fbar-btn.active { color: #2962ff; }
.tv-floating-drawing-toolbar .tv-fbar-underline {
  left: 50%;
  right: auto;
  bottom: 7px;
  width: 22px;
  height: 4px;
  border-radius: 2px;
  transform: translateX(-50%);
}
.tv-floating-drawing-toolbar .tv-fbar-line { width: 18px; border-top-width: 2px; border-radius: 1px; }
#fbar-style-btn .tv-fbar-line { width: 20px; border-top-width: 1px; }

/* The toolbar's menus (thickness, font size, more, templates) are TradingView's see-through glass menus */
.tv-floating-drawing-toolbar .tv-fbar-more-dropdown,
body.theme-light .tv-floating-drawing-toolbar .tv-fbar-more-dropdown {
  padding: 6px;
  border: 0;
  border-radius: 10px;
  color: #000000;
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(11px) saturate(0.25);
  backdrop-filter: blur(11px) saturate(0.25);
  box-shadow: inset 0 0 0 1px rgba(140, 140, 140, 0.1), 0 0 2px 0 #dbdbdb, 0 3px 9px 0 #ebebeb;
  font-size: 14px;
}
body.theme-dark .tv-floating-drawing-toolbar .tv-fbar-more-dropdown {
  color: #b8b8b8;
  background: rgba(19, 19, 19, 0.75);
  box-shadow: inset 0 0 0 1px rgba(140, 140, 140, 0.1), 0 0 2px 0 #000000, 0 3px 9px 0 #000000;
}
.tv-floating-drawing-toolbar .tv-fbar-menu-btn {
  display: flex;
  align-items: center;
  min-height: 32px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 14px;
}
.tv-floating-drawing-toolbar .tv-fbar-menu-btn:hover,
body.theme-light .tv-floating-drawing-toolbar .tv-fbar-menu-btn:hover { background: #f2f2f2; }
body.theme-dark .tv-floating-drawing-toolbar .tv-fbar-menu-btn:hover { background: #222222; }
.tv-floating-drawing-toolbar .tv-fbar-menu-btn.active,
.tv-floating-drawing-toolbar .tv-fbar-menu-btn.active:hover { color: #ffffff; background: #222222; font-weight: 400; }
body.theme-dark .tv-floating-drawing-toolbar .tv-fbar-menu-btn.active,
body.theme-dark .tv-floating-drawing-toolbar .tv-fbar-menu-btn.active:hover { color: #000000; background: #f2f2f2; }
.tv-floating-drawing-toolbar .tv-fbar-tpl-list:not(:empty) { border-top-color: rgba(128, 128, 128, 0.25); }
/* On TradingView the pencil, bucket and T sit a little higher, with the color bar under them */
#fbar-border-preview svg, #fbar-fill-preview svg, #fbar-stop-preview svg, #fbar-text-btn svg { transform: translateY(-4px); }
