* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: #0b0e11;
    color: #e8eaed;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    overflow: hidden;
    font-size: 13px;
}
button, input { font: inherit; }
button { color: inherit; }
button:focus, input:focus { outline: none; }

.app-shell { height: 100vh; display: flex; flex-direction: column; }
.topbar {
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    border-bottom: 1px solid #2a2f35;
    background: #0d1014;
    z-index: 20;
}
.brand-area, .top-actions { display: flex; align-items: center; gap: 8px; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: -.3px; padding: 0 5px; }
.brand span { color: #4f8cff; }
.symbol-picker-wrap { position: relative; }
.symbol-picker, .toolbar-btn, .trade-btn, .publish-btn {
    border: 0;
    background: transparent;
    height: 34px;
    border-radius: 5px;
    padding: 0 10px;
    cursor: pointer;
}
.symbol-picker:hover, .toolbar-btn:hover { background: #1a1f25; }
.symbol-picker { font-weight: 700; min-width: 92px; text-align: left; }
.caret { color: #8d96a0; margin-left: 7px; }
.toolbar-btn { color: #c5cbd2; }
.trade-btn { border: 1px solid #3b4651; background: #17202a; font-weight: 700; }
.publish-btn { background: #2962ff; color: white; font-weight: 700; }
.icon-btn, .mini-btn, .tool {
    border: 0;
    background: transparent;
    cursor: pointer;
}
.icon-btn { width: 34px; height: 34px; }
.mobile-only { display: none; }

.symbol-search-dropdown {
    display: none;
    position: absolute;
    top: 40px;
    left: 0;
    width: 320px;
    background: #151a20;
    border: 1px solid #2a2f35;
    border-radius: 7px;
    box-shadow: 0 18px 45px rgba(0,0,0,.45);
    padding: 8px;
    z-index: 100;
}
.symbol-search-dropdown.open { display: block; }
#symbolSearch {
    width: 100%;
    background: #0d1014;
    color: #e8eaed;
    border: 1px solid #2a2f35;
    border-radius: 5px;
    padding: 9px 10px;
}
.search-results { margin-top: 6px; max-height: 280px; overflow: auto; }
.search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px;
    border-radius: 5px;
    cursor: pointer;
}
.search-result:hover { background: #20262d; }
.search-result strong { display: block; }
.search-result small { color: #8d96a0; }

.main-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 48px minmax(0, 1fr) 315px; }
.left-toolbar {
    border-right: 1px solid #2a2f35;
    background: #0d1014;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 7px;
}
.tool { width: 40px; height: 40px; color: #aeb6bf; font-size: 18px; border-radius: 5px; }
.tool:hover, .tool.active { background: #1a1f25; color: white; }
.tool-spacer { flex: 1; }
.workspace { min-width: 0; display: flex; flex-direction: column; background: #0f1317; }
.chart-header {
    min-height: 73px;
    padding: 10px 15px 8px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #20252b;
}
.instrument-title { display: flex; align-items: center; gap: 10px; }
.instrument-icon {
    width: 32px; height: 32px; border-radius: 50%;
    background: #1c2947; display: grid; place-items: center;
    color: #fff; font-size: 11px; font-weight: 800;
}
.instrument-name-row { display: flex; align-items: center; gap: 7px; }
.instrument-name-row strong { font-size: 14px; }
.market-badge { color: #ffae00; font-size: 10px; }
.exchange-text, .instrument-subtitle { color: #8d96a0; font-size: 11px; }
.instrument-subtitle { margin-top: 3px; }
.quote-summary { display: flex; align-items: center; gap: 9px; }
.quote-price { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; }
.quote-change { font-weight: 650; font-variant-numeric: tabular-nums; }
.quote-state { color: #26a69a; font-size: 11px; }
.positive { color: #26a69a !important; }
.negative { color: #ef5350 !important; }
.neutral { color: #8d96a0 !important; }

.chart-toolbar {
    height: 42px; display: flex; align-items: center; justify-content: space-between;
    padding: 0 10px; border-bottom: 1px solid #20252b; background: #0f1317;
}
.timeframes, .chart-actions { display: flex; align-items: center; gap: 2px; }
.timeframes button, .chart-actions button, .bottom-tabs button {
    border: 0; background: transparent; color: #9ea7b0; cursor: pointer; border-radius: 4px;
}
.timeframes button { padding: 6px 8px; }
.timeframes button:hover, .timeframes button.active, .chart-actions button:hover { background: #20262c; color: white; }
.chart-actions button { padding: 6px 9px; }

.chart-area {
    position: relative;
    flex: 1;
    min-height: 260px;
    overflow: hidden;

    /* Alternating GREEN / RED chart background.
       Change 10% values below to make each zone wider/narrower. */
    /*background:
        repeating-linear-gradient(
            90deg,
            rgba(0, 180, 70, 0.72) 0%,
            rgba(0, 180, 70, 0.72) 10%,
            rgba(235, 45, 45, 0.72) 10%,
            rgba(235, 45, 45, 0.72) 20%
        );*/
}


.chart-area {
    position: relative;
    flex: 1;
    min-height: 260px;
    overflow: hidden;
}
#chartBackground {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* Lightweight Charts is transparent so the alternating background remains visible. */
#chart {
    position: absolute;
    inset: 0;
    background: transparent !important;
    z-index: 1;
}
#chart canvas {
    background: transparent !important;
}

.watermark { position: absolute; left: 13px; bottom: 12px; color: rgba(255,255,255,.16); font-size: 13px; font-weight: 800; pointer-events: none; z-index: 3; }
.chart-loading {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 10px;
    color: #ffffff; background: rgba(0,0,0,.20); z-index: 4;
}
.spinner { width: 18px; height: 18px; border: 2px solid #444; border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.chart-error {
    display: none; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
    max-width: 430px; padding: 14px 16px; border: 1px solid #5b3030; background: #241516;
    color: #ffb4b2; border-radius: 6px; z-index: 5; text-align: center;
}
.bottom-tabs { height: 37px; border-top: 1px solid #2a2f35; display: flex; align-items: center; gap: 3px; padding: 0 9px; }
.bottom-tabs button { height: 30px; padding: 0 10px; }
.bottom-tabs button.active { color: white; border-bottom: 2px solid #4f8cff; border-radius: 0; }

.right-sidebar { background: #0d1014; border-left: 1px solid #2a2f35; overflow-y: auto; }
.watchlist-head { height: 48px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; border-bottom: 1px solid #2a2f35; }
.watchlist-head strong { font-size: 13px; }
.mini-btn { width: 28px; height: 28px; color: #aeb6bf; border-radius: 4px; }
.mini-btn:hover { background: #1b2026; color: white; }
.watchlist-columns { display: grid; grid-template-columns: 1fr 86px 62px; padding: 8px 10px; color: #707a85; font-size: 10px; text-transform: uppercase; }
.watchlist-columns span:nth-child(n+2) { text-align: right; }
.watch-item { display: grid; grid-template-columns: 1fr 86px 62px; align-items: center; min-height: 43px; padding: 0 10px; border-top: 1px solid #171c21; cursor: pointer; }
.watch-item:hover, .watch-item.active { background: #171c21; }
.watch-symbol { display: flex; gap: 7px; align-items: center; min-width: 0; }
.watch-dot { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: #273654; font-size: 8px; font-weight: 800; flex: 0 0 auto; }
.watch-label { min-width: 0; }
.watch-label strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.watch-label small { color: #707a85; }
.watch-number { text-align: right; font-variant-numeric: tabular-nums; }
.watch-change { text-align: right; font-variant-numeric: tabular-nums; }

.details-panel { margin-top: 8px; border-top: 1px solid #2a2f35; padding: 16px 13px; }
.details-symbol { font-weight: 800; font-size: 17px; }
.details-name { color: #8d96a0; margin-top: 3px; }
.details-price { font-size: 25px; font-weight: 800; margin-top: 18px; font-variant-numeric: tabular-nums; }
.details-change { margin-top: 3px; font-weight: 650; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 20px; margin-top: 22px; }
.detail-grid span { display: block; color: #707a85; font-size: 10px; text-transform: uppercase; margin-bottom: 4px; }
.detail-grid strong { font-variant-numeric: tabular-nums; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #20262d; border: 1px solid #39424c; padding: 10px 14px; border-radius: 6px; opacity: 0; pointer-events: none; transition: .2s; z-index: 999; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1050px) {
    .main-layout { grid-template-columns: 42px minmax(0, 1fr); }
    .right-sidebar { display: none; }
    .right-sidebar.open { display: block; position: fixed; right: 0; top: 54px; bottom: 0; width: 315px; z-index: 30; box-shadow: -20px 0 50px rgba(0,0,0,.4); }
    .mobile-only { display: inline-block; }
}
@media (max-width: 720px) {
    .topbar { height: 50px; }
    .brand { font-size: 15px; }
    .hide-small { display: none; }
    .main-layout { grid-template-columns: 0 minmax(0,1fr); }
    .left-toolbar { display: none; }
    .chart-header { min-height: 65px; padding: 8px 10px; }
    .quote-summary { gap: 5px; }
    .quote-price { font-size: 16px; }
    .quote-state { display: none; }
    .instrument-name-row strong { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .chart-toolbar { height: 40px; overflow-x: auto; }
    .timeframes { flex: 1; }
    .timeframes button { padding: 6px 7px; }
    .chart-actions { display: none; }
    .symbol-search-dropdown { width: min(320px, calc(100vw - 20px)); }
}



#chartBackground {
    z-index: 0;
}

#chart {
    z-index: 1;
}

#chartPriceLines {
    z-index: 2;
    pointer-events: none;
}


.price-line {
    position: absolute;
    height: 2px;
    pointer-events: none;
}

#chartPriceLines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: none;
}