 

.chart-widget {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #ffffff;
    font-family: Inter, system-ui, sans-serif;
}

 
.cw-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    row-gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
    background: #fafaf8;
}
.cw-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0;
    flex-shrink: 0;
}
.cw-toolbar-spacer { flex: 1; }
.cw-period-group {
    gap: 0;
    margin-left: auto;    
}
.cw-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: #e5e7eb;
    margin: 0 2px;
    flex-shrink: 0;
}
.cw-group-label {
    font-size: 9px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-right: 4px;
    user-select: none;
}

 
.cw-compare-inline {
    flex: 0 1 auto;
    flex-wrap: nowrap;               
    gap: 4px;
    padding: 2px 6px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    min-height: 26px;
    max-width: 540px;
    overflow: hidden;
}
.cw-compare-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 2px 1px 6px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}
.cw-chip-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 1px;
}
.cw-chip-x {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    padding: 0 3px;
    border-radius: 50%;
}
.cw-chip-x:hover { color: #dc2626; background: #fef2f2; }

.cw-compare-input {
     
    width: 190px;
    font-size: 11px;
    padding: 3px 8px;
    flex-shrink: 0;
}
.cw-compare-input.cw-compare-input-narrow {
     
    width: 70px;
}
.cw-norm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    cursor: pointer;
    padding: 2px 6px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #ffffff;
}
.cw-norm-toggle:hover { background: #f3f4f6; }
.cw-norm-toggle input { cursor: pointer; }

 
.cw-input {
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 12px;
    outline: none;
    background: #fff;
    transition: border-color 120ms, box-shadow 120ms;
}
.cw-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.cw-input-ticker {
    width: 90px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.cw-select {
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 3px 6px;
    font-size: 11px;
    background: #fff;
    outline: none;
    cursor: pointer;
}
.cw-btn {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #4b5563;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 100ms, color 100ms, border-color 100ms;
}
.cw-btn:hover { background: #f3f4f6; }
.cw-btn-active {
    background: #1f2937;
    color: #ffffff;
    border-color: #1f2937;
}
.cw-btn-active:hover { background: #111827; }

.cw-period-group .cw-btn {
    border-radius: 0;
    border-right-width: 0;
}
.cw-period-group .cw-btn:first-child { border-radius: 4px 0 0 4px; }
.cw-period-group .cw-btn:last-child  { border-radius: 0 4px 4px 0; border-right-width: 1px; }

 
.cw-indicator-group,
.cw-compare-group { position: relative; }

.cw-indicator-popover {
    position: absolute;
    top: 110%;
    left: 0;
    z-index: 50;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    padding: 8px 4px;
    min-width: 200px;
    font-size: 12px;
}
.cw-compare-popover { min-width: 220px; }

 
.cw-layout-popover {
    left: auto;
    right: 0;
    min-width: 280px;
    padding: 10px 10px 8px;
}
.cw-lp-title {
    font-size: 10px;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}
.cw-lp-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.cw-lp-name {
    flex: 1;
    font-size: 12px;
    padding: 4px 8px;
}
.cw-lp-save { flex-shrink: 0; }
.cw-lp-hint {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 6px;
}
.cw-lp-empty {
    font-size: 11px;
    color: #9ca3af;
    padding: 8px 4px;
    text-align: center;
}
.cw-lp-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 280px;
    overflow-y: auto;
    margin-top: 4px;
}
.cw-lp-overwrite-row {
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: transparent;
    color: #4b5563;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.cw-lp-overwrite-row:hover { background: #f3f4f6; color: #111827; }
.cw-lp-row {
    display: flex;
    align-items: stretch;
    gap: 2px;
    border-radius: 4px;
}
.cw-lp-row:hover { background: #f9fafb; }
.cw-lp-row-main {
    flex: 1;
    min-width: 0;
    text-align: left;
    border: none;
    background: transparent;
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 4px;
}
.cw-lp-row-main:hover { background: #eef2ff; }
.cw-lp-row-name {
    font-size: 12px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cw-lp-row-meta {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    letter-spacing: 0.03em;
    margin-top: 1px;
}
.cw-lp-row-when {
    font-size: 9px;
    color: #9ca3af;
    font-weight: 500;
    margin-top: 1px;
}
.cw-lp-row-delete {
    flex-shrink: 0;
    width: 22px;
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
}
.cw-lp-row-delete:hover { color: #dc2626; background: #fef2f2; }
.cw-indicator-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    padding: 6px 10px 3px;
}
.cw-indicator-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    cursor: pointer;
    border-radius: 4px;
}
.cw-indicator-row:hover { background: #f3f4f6; }
.cw-indicator-row input { cursor: pointer; }

 
.chart-widget.cw-draw-mode { cursor: crosshair; }
.chart-widget.cw-draw-mode .cw-pane { cursor: crosshair; }

 
.cw-pane {
    position: relative;
    width: 100%;
    min-height: 0;
}
.cw-pane-price {
    flex: 1 1 auto;
    min-height: 280px;
}
.cw-subpanes {
    display: flex;
    flex-direction: column;
}
.cw-pane-sub {
    height: 120px;
    border-top: 1px solid #e5e7eb;
}
.cw-subpane-label {
    position: absolute;
    top: 4px;
    left: 8px;
    z-index: 5;
    font-size: 10px;
    font-weight: 700;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.88);
    padding: 1px 6px;
    border-radius: 3px;
    pointer-events: none;
}

 
.cw-legend {
    position: absolute;
    top: 8px;
    left: 10px;
    z-index: 4;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 11px;
    color: #374151;
     
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
     
    min-width: 260px;
}
 
.cw-legend.cw-legend-dense {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 1px 12px;
    min-width: 0;
    max-width: 72%;
    padding: 5px 8px;
}
.cw-legend.cw-legend-dense .cw-legend-row { gap: 4px; min-width: 0; }
.cw-legend.cw-legend-dense .cw-legend-row + .cw-legend-row { margin-top: 0; }
.cw-legend.cw-legend-dense .cw-legend-name { display: none; }
 
.cw-legend.cw-legend-dense .cw-legend-interval,
.cw-legend.cw-legend-dense .cw-legend-x { margin-left: 0; }
.cw-legend-row {
    display: flex;
    gap: 10px;
    align-items: baseline;
}
.cw-legend-row + .cw-legend-row { margin-top: 2px; }
.cw-legend-price { font-size: 11px; }
.cw-legend-compare { font-size: 11px; }

 
.cw-legend-interval { margin-left: auto; }
.cw-legend-x {
    margin-left: auto;
    pointer-events: auto;
    background: transparent;
    border: none;
    color: #9ca3af;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}
.cw-legend-x:hover { color: #dc2626; background: #fef2f2; }
.cw-legend-ticker,
.cw-legend-ticker-sub {
     
    pointer-events: auto;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    border-radius: 3px;
}
.cw-legend-ticker {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: #111827;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.cw-legend-ticker-sub {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 46px;
}
.cw-legend-ticker:hover,
.cw-legend-ticker-sub:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}
.cw-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cw-legend-interval {
    font-size: 10px;
    color: #9ca3af;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.cw-legend-name {
    font-size: 11px;
    color: #6b7280;
    font-weight: 500;
    letter-spacing: 0;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

 
.cw-hover-box {
    position: absolute;
    z-index: 8;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 6px 9px;
    font-size: 11px;
    line-height: 1.4;
    color: #111827;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
    min-width: 140px;
}
.cw-hover-date {
    font-size: 10px;
    color: #6b7280;
    font-weight: 600;
    margin-bottom: 3px;
    padding-bottom: 3px;
    border-bottom: 1px solid #f3f4f6;
}
.cw-hover-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 1px 0;
}
.cw-hover-ticker {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    color: #374151;
}
.cw-hover-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cw-hover-ohlc {
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
    padding-top: 2px;
    border-top: 1px solid #f3f4f6;
}
.cw-hover-trade {
    margin-top: 3px;
    padding-top: 3px;
    border-top: 1px solid #f3f4f6;
    font-size: 11px;
}

 
.cw-loading, .cw-message {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(1px);
    z-index: 10;
}

 
.mom-overlay {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;    
    z-index: 4;
}

 
.mom-line {
    position: absolute;
    top: 0;
    bottom: 22px;
    width: 1px;
    pointer-events: none;
    z-index: 1;
}
.mom-line.mom-t1 { background: rgba(220, 38, 38, 0.55); width: 1.5px; }
.mom-line.mom-t2 { background: rgba(217, 119, 6, 0.42); }
.mom-line.mom-t3 { background: rgba(107, 114, 128, 0.30); }

 
.mom-band {
    position: absolute;
    top: 0;
    bottom: 22px;
    pointer-events: none;    
    z-index: 0;
}
.mom-band.mom-t1 { background: rgba(220, 38, 38, 0.07);
    border-left: 1px solid rgba(220,38,38,0.30); border-right: 1px solid rgba(220,38,38,0.30); }
.mom-band.mom-t2 { background: rgba(217, 119, 6, 0.06); }
.mom-band.mom-t3 { background: rgba(107, 114, 128, 0.05); }

 
.mom-flag {
    position: absolute;
    top: 6px;
    max-width: 168px;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1.3;
    font-weight: 600;
    color: #374151;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid #e5e7eb;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: auto;
    cursor: pointer;
    z-index: 3;
    transition: box-shadow 0.1s ease, max-width 0.1s ease;
}
.mom-flag:hover { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16); z-index: 6; max-width: 320px; }
.mom-flag .mom-flag-yr { font-weight: 800; margin-right: 2px; }
.mom-flag.mom-t1 { border-left: 3px solid #dc2626; font-size: 10.5px; color: #1f2937; }
.mom-flag.mom-t1 .mom-flag-yr { color: #dc2626; }
.mom-flag.mom-t2 { border-left: 3px solid #d97706; }
.mom-flag.mom-t2 .mom-flag-yr { color: #b45309; }
.mom-flag.mom-t3 { border-left: 3px solid #9ca3af; color: #4b5563; }
.mom-flag.mom-t3 .mom-flag-yr { color: #6b7280; }

 
.mom-popover {
    position: fixed;
    z-index: 60;
    width: 280px;
    max-width: 88vw;
    background: #ffffff;
    border: 1px solid #e2e2dd;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    padding: 11px 13px;
    pointer-events: auto;
}

 
.mom-stat {
    background: #ffffff;
    border: 1px solid #e2e2dd;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    padding: 8px 11px;
    text-align: left;
    transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
button.mom-stat:hover { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.10); border-color: #c7d2fe; cursor: pointer; }
.mom-stat-k { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #9ca3af; }
.mom-stat-v { font-size: 17px; font-weight: 800; line-height: 1.25; font-variant-numeric: tabular-nums; }
.mom-stat-s { font-size: 10px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mom-drawer {
    width: 320px;
    flex: 0 0 320px;
    border-left: 1px solid #ecece8;
    padding: 4px 4px 4px 12px;
}

 
.mom-crosshair {
    position: absolute;
    z-index: 5;
    pointer-events: none;
    background: rgba(17, 24, 39, 0.86);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
}
.mom-crosshair b { font-weight: 700; }

 
.mom-flag.mom-flag-sel {
    z-index: 7;
    border-color: #4f46e5;
    box-shadow: 0 3px 12px rgba(79, 70, 229, 0.28);
    background: #eef2ff;
}
.mom-line.mom-line-sel { background: #4f46e5 !important; width: 2px !important; z-index: 2; }

 
.mom-sel-band {
    position: absolute;
    top: 0;
    bottom: 22px;
    background: rgba(79, 70, 229, 0.08);
    border-left: 1px dashed rgba(79, 70, 229, 0.5);
    border-right: 1px dashed rgba(79, 70, 229, 0.5);
    pointer-events: none;
    z-index: 2;
}
.mom-trough-dot {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.6);
    pointer-events: none;
    z-index: 8;
}
.mom-trough-label {
    position: absolute;
    z-index: 8;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    background: #dc2626;
    padding: 1px 4px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
}
