/* ══════════════════════════════════════════════════════════════
   TradingView-Style Drawing Toolbar v2
   Split-button design: [tool icon | ▾ chevron] per row
   ══════════════════════════════════════════════════════════════ */

/* ── Toolbar Container ──────────────────────────────────────── */
.tv-drawing-toolbar {
    width: 48px;
    min-width: 48px;
    flex-shrink: 0;
    background: #131722;
    border-right: 1px solid #2a2e39;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 2px 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 20;
    position: relative;
    user-select: none;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tv-drawing-toolbar::-webkit-scrollbar { display: none; }

/* ── Cursor / Cross Button (top, full width) ────────────────── */
.tv-toolbar-cursor-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 40px;
    margin: 1px 2px;
    border: none;
    background: transparent;
    color: #b2b5be;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

.tv-toolbar-cursor-btn:hover {
    background: #2a2e39;
    color: #e0e3eb;
}

/* Active state: cursor tool selected (no drawing tool active) */
.tv-toolbar-cursor-btn.active {
    background: rgba(41, 98, 255, 0.12);
    color: #2962ff;
}

.tv-toolbar-cursor-btn.active:hover {
    background: rgba(41, 98, 255, 0.2);
    color: #4d79ff;
}

.tv-toolbar-cursor-btn .tv-tbico img {
    width: 18px;
    height: 18px;
    display: block;
    filter: brightness(0) invert(0.75);
    transition: filter 0.12s;
}

.tv-toolbar-cursor-btn:hover .tv-tbico img {
    filter: brightness(0) invert(0.92);
}

/* ── Split-button row (tool + chevron) ──────────────────────── */
.tv-toolbar-row {
    display: flex;
    align-items: center;
    width: 44px;
    height: 34px;
    margin: 1px 2px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.tv-toolbar-row:hover {
    background: #2a2e39;
}

.tv-toolbar-row.active {
    /* no special bg; active state shown on tool-btn part */
}

/* Left part: tool icon button */
.tv-tb-tool {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #b2b5be;
    padding: 0;
    transition: color 0.12s;
    min-width: 0;
    border-radius: 4px 0 0 4px;
}

.tv-tb-tool:hover {
    color: #e0e3eb;
    background: transparent; /* row handles bg */
}

.tv-toolbar-row.active .tv-tb-tool {
    color: #2962ff;
}

.tv-tb-tool .tv-tbico img {
    width: 18px;
    height: 18px;
    display: block;
    filter: brightness(0) invert(0.72);
    transition: filter 0.12s;
}

.tv-toolbar-row:hover .tv-tb-tool .tv-tbico img {
    filter: brightness(0) invert(0.90);
}

.tv-toolbar-row.active .tv-tb-tool .tv-tbico img {
    /* blue tint for active tool */
    filter: brightness(0) saturate(100%) invert(35%) sepia(90%) saturate(1600%)
            hue-rotate(210deg) brightness(105%) contrast(102%);
}

/* Right part: chevron button */
.tv-tb-chevron {
    width: 14px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #545e77;
    padding: 0;
    flex-shrink: 0;
    transition: color 0.12s, background 0.12s;
    border-left: 1px solid transparent;
    border-radius: 0 4px 4px 0;
}

.tv-toolbar-row:hover .tv-tb-chevron {
    color: #787b86;
    border-left-color: #2a2e39;
    background: rgba(255,255,255,0.04);
}

.tv-toolbar-row.dropdown-open .tv-tb-chevron {
    color: #b2b5be;
    background: rgba(255,255,255,0.08);
    border-left-color: #363a45;
}

/* Chevron SVG icon */
.tv-tb-chevron svg {
    width: 8px;
    height: 8px;
    display: block;
    transition: transform 0.18s ease;
}

.tv-toolbar-row.dropdown-open .tv-tb-chevron svg {
    transform: rotate(180deg);
}

/* ── Separator ──────────────────────────────────────────────── */
.tv-toolbar-separator {
    width: 32px;
    height: 1px;
    background: #2a2e39;
    margin: 4px auto;
    flex-shrink: 0;
}

/* ── Toggle buttons (below separator) ──────────────────────── */
.tv-toolbar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 34px;
    margin: 1px 2px;
    border: none;
    background: transparent;
    color: #787b86;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
}

.tv-toolbar-toggle:hover {
    background: #2a2e39;
    color: #d1d4dc;
}

.tv-toolbar-toggle.active {
    color: #2962ff;
}

.tv-tbico {
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.tv-tbico img {
    display: block;
}

/* ══════════════════════════════════════════════════════════════
   Flyout Dropdown
   ══════════════════════════════════════════════════════════════ */
.tv-toolbar-dropdown {
    position: fixed;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 6px;
    box-shadow: 0 4px 28px rgba(0, 0, 0, 0.6), 0 1px 6px rgba(0, 0, 0, 0.4);
    width: 290px;
    max-height: 75vh;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 200;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: #363a45 transparent;

    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    pointer-events: none;
}

.tv-toolbar-dropdown.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.tv-toolbar-dropdown::-webkit-scrollbar { width: 4px; }
.tv-toolbar-dropdown::-webkit-scrollbar-track { background: transparent; }
.tv-toolbar-dropdown::-webkit-scrollbar-thumb { background: #363a45; border-radius: 3px; }

/* ── Section Header ─────────────────────────────────────────── */
.tv-dropdown-section {
    padding: 10px 14px 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: #6b7280;
    user-select: none;
}

/* ── Dropdown Separator ─────────────────────────────────────── */
.tv-dropdown-sep {
    height: 1px;
    background: #2a2e39;
    margin: 4px 14px;
}

/* ── Tool Item ──────────────────────────────────────────────── */
.tv-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    cursor: pointer;
    transition: background 0.1s;
    color: #d1d4dc;
    font-size: 13px;
    font-weight: 400;
    min-height: 34px;
    position: relative;
}

.tv-dropdown-item:hover {
    background: #2a2e39;
}

.tv-dropdown-item.selected {
    color: #fff;
    background: rgba(41, 98, 255, 0.15);
}

.tv-dropdown-item.selected:hover {
    background: rgba(41, 98, 255, 0.22);
}

/* Icon in dropdown */
.tv-ddi-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tv-ddi-icon img {
    width: 28px;
    height: 28px;
    display: block;
    object-fit: contain;
    filter: brightness(0) invert(0.78);
    transition: filter 0.1s;
}

.tv-dropdown-item:hover .tv-ddi-icon img { filter: brightness(0) invert(0.95); }
.tv-dropdown-item.selected .tv-ddi-icon img {
    filter: brightness(0) invert(0.95);
}

/* Tool name */
.tv-ddi-name { flex: 1; }

/* Shortcut */
.tv-ddi-shortcut {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Backdrop ───────────────────────────────────────────────── */
.tv-toolbar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 199;
    background: transparent;
}

/* ══════════════════════════════════════════════════════════════
   Settings Popup Panel
   ══════════════════════════════════════════════════════════════ */
.tv-toolbar-settings-panel {
    position: fixed;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
    width: 280px;
    z-index: 210;
    padding: 0;
    overflow: hidden;

    /* Animation */
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    pointer-events: none;
}

.tv-toolbar-settings-panel.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Panel header */
.tv-settings-header {
    display: flex;
    align-items: center;
    padding: 12px 14px 10px;
    border-bottom: 1px solid #2a2e39;
    font-size: 12px;
    font-weight: 600;
    color: #787b86;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    user-select: none;
}

/* Settings row */
.tv-settings-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid #1a1d2a;
}

.tv-settings-row:last-child {
    border-bottom: none;
}

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

.tv-settings-row-text {
    flex: 1;
    min-width: 0;
}

.tv-settings-row-label {
    font-size: 13px;
    font-weight: 500;
    color: #d1d4dc;
    line-height: 1.3;
    margin-bottom: 3px;
}

.tv-settings-row-desc {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
}

/* Toggle switch */
.tv-toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 1px;
    cursor: pointer;
}

.tv-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.tv-toggle-track {
    position: absolute;
    inset: 0;
    background: #2a2e39;
    border-radius: 10px;
    border: 1px solid #363a45;
    transition: background 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.tv-toggle-switch input:checked + .tv-toggle-track {
    background: #2962ff;
    border-color: #2962ff;
}

.tv-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
    transition: transform 0.2s ease;
    pointer-events: none;
}

.tv-toggle-switch input:checked ~ .tv-toggle-track .tv-toggle-knob {
    transform: translateX(16px);
}

/* ══════════════════════════════════════════════════════════════
   Confirm Modal — "Clear All Drawings"
   ══════════════════════════════════════════════════════════════ */

/* Overlay */
.tv-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);

    opacity: 0;
    transition: opacity 0.2s ease;
}

.tv-confirm-overlay.visible {
    opacity: 1;
}

/* Dialog box */
.tv-confirm-dialog {
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 12px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7),
                0 4px 16px rgba(0, 0, 0, 0.5),
                inset 0 1px 0 rgba(255, 255, 255, 0.04);
    width: 360px;
    max-width: calc(100vw - 32px);
    padding: 0;
    overflow: hidden;
    position: relative;

    transform: translateY(16px) scale(0.97);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tv-confirm-overlay.visible .tv-confirm-dialog {
    transform: translateY(0) scale(1);
}

/* Top danger accent bar */
.tv-confirm-dialog::before {
    content: '';
    display: block;
    height: 3px;
    background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

/* Icon area */
.tv-confirm-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 24px 0;
}

.tv-confirm-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ef4444;
    flex-shrink: 0;
}

.tv-confirm-icon svg {
    width: 24px;
    height: 24px;
}

/* Body text */
.tv-confirm-body {
    padding: 16px 24px 0;
    text-align: center;
}

.tv-confirm-title {
    font-size: 16px;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 8px;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.tv-confirm-msg {
    font-size: 13px;
    color: #8892a4;
    line-height: 1.6;
}

/* Actions */
.tv-confirm-actions {
    display: flex;
    gap: 10px;
    padding: 20px 24px 24px;
    margin-top: 4px;
}

.tv-confirm-btn {
    flex: 1;
    height: 38px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
    letter-spacing: 0.01em;
    outline: none;
    user-select: none;
}

.tv-confirm-btn:active {
    transform: scale(0.97);
}

/* Cancel button */
.tv-confirm-btn-cancel {
    background: #2a2e39;
    color: #9ca3af;
    border: 1px solid #363a45;
}

.tv-confirm-btn-cancel:hover {
    background: #343a4a;
    color: #d1d5db;
    border-color: #4b5563;
}

/* Confirm / danger button */
.tv-confirm-btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

.tv-confirm-btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.45);
}

/* Focus ring */
.tv-confirm-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}
. t v - t o o l b a r - r o w [ d a t a - g r o u p = " m a g n e t " ] . a c t i v e   {   b a c k g r o u n d :   # e 0 e 3 e b ;   }   . t v - t o o l b a r - r o w [ d a t a - g r o u p = " m a g n e t " ] . a c t i v e   . t v - t b - t o o l ,   . t v - t o o l b a r - r o w [ d a t a - g r o u p = " m a g n e t " ] . a c t i v e   . t v - t b - c h e v r o n   {   c o l o r :   # 1 3 1 7 2 2 ;   }   . t v - t o o l b a r - r o w [ d a t a - g r o u p = " m a g n e t " ] . a c t i v e : h o v e r   {   b a c k g r o u n d :   # f 0 f 3 f a ;   }   . t v - t o o l b a r - r o w [ d a t a - g r o u p = " m a g n e t " ] . a c t i v e   . t v - t b i c o   i m g ,   . t v - t o o l b a r - r o w [ d a t a - g r o u p = " m a g n e t " ] . a c t i v e   . t v - t b i c o   s v g   {   f i l t e r :   n o n e   ! i m p o r t a n t ;   c o l o r :   # 1 3 1 7 2 2   ! i m p o r t a n t ;   }  
 