:root {
    --macos-ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", sans-serif;
    --topbar-height: 50px;
}

body {
    margin: 0;
    background-color: #131722;
    overflow: hidden;
    font-family: var(--macos-ui-font);
    color: #d1d4dc;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* --- VIEWS --- */
/* --- VIEWS --- */
.view {
    position: absolute;
    top: var(--topbar-height);
    left: 0;
    width: 100%;
    height: calc(100% - var(--topbar-height));
    display: none;
    flex-direction: column;
}

#planner-global-controls {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    max-height: 50px;
    padding: 8px 10px;
    box-sizing: border-box;
    background: #131722;
    border-bottom: 1px solid #2a2e39;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    overflow: visible;
    z-index: 120;
}

.planner-global-bar {
    display: flex;
    align-items: center;
    height: 100%;
    flex: 1 1 auto;
    min-width: 0;
}

.planner-global-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: nowrap;
    overflow: visible;
}

.planner-balance {
    position: relative;
    flex: 0 0 auto;
    margin-left: auto;
    padding-left: 14px;
    font-size: 11px;
}

.planner-balance-trigger {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #d1d4dc;
    font: inherit;
    cursor: pointer;
}

.planner-balance-trigger:hover,
.planner-balance-trigger:focus-visible {
    border-color: #404657;
    background: #1e222d;
}

.planner-balance-trigger:focus-visible {
    outline: 2px solid #2962ff;
    outline-offset: 2px;
}

.planner-balance-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
    white-space: nowrap;
}

.planner-balance-label,
.planner-balance-updated {
    color: #959baa;
    font-size: 10px;
}

.planner-balance-value,
.planner-balance-details dd {
    font-variant-numeric: tabular-nums;
    color: #f0f3fa;
}

.planner-balance-indicator {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #787b86;
}

.planner-balance[data-status="live"] .planner-balance-indicator {
    background: #26a69a;
}

.planner-balance[data-status="stale"] .planner-balance-indicator {
    background: #f0b90b;
}

.planner-balance-popup {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 310px;
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    padding: 12px;
    background: #1e222d;
    border: 1px solid #404657;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    z-index: 140;
}

.planner-balance-popup[hidden] {
    display: none;
}

.planner-balance-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #2a2e39;
}

.planner-balance-account {
    overflow-wrap: anywhere;
}

.planner-balance-status {
    color: #959baa;
    white-space: nowrap;
}

.planner-balance-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 12px;
    margin: 12px 0 8px;
}

.planner-balance-details dd {
    margin: 0;
    text-align: right;
}

.planner-global-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.planner-global-group-notional,
.planner-global-group-tp {
    position: relative;
}

.planner-global-value {
    min-width: 64px;
    height: 26px;
    padding: 0 10px;
    background: #1e222d;
    border: 1px solid #2a2e39;
    border-radius: 6px;
    color: #fff;
    font-size: 11px;
    line-height: 24px;
    font-family: var(--macos-ui-font);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
    text-align: right;
    box-sizing: border-box;
    cursor: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.planner-global-value:hover {
    background: #2a2e39;
    border-color: #404657;
}

.planner-global-value-notional {
    min-width: 54px;
}

.planner-global-value-tp {
    min-width: 66px;
}

.planner-global-presets-popup {
    position: absolute;
    top: calc(100% - 1px);
    left: 0;
    min-width: 220px;
    max-width: min(520px, calc(100vw - 20px));
    padding: 10px;
    background: #1e222d;
    border: 1px solid #2a2e39;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 140;
}

.planner-global-group-tp:hover .planner-global-presets-popup,
.planner-global-group-notional:hover .planner-global-presets-popup,
.planner-global-group-notional:focus-within .planner-global-presets-popup,
.planner-global-group-tp:focus-within .planner-global-presets-popup,
.planner-global-group-tp.presets-open .planner-global-presets-popup {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.planner-global-popup-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 8px;
    margin-bottom: 8px;
}

.planner-global-presets-row {
    width: auto;
    margin-top: 0;
}

.planner-global-tp-editor {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 240px;
}

.planner-global-tp-field {
    display: grid;
    grid-template-columns: 62px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 8px;
    opacity: 0.48;
    transition: opacity 0.12s ease;
}

.planner-global-tp-field.active {
    opacity: 1;
}

.planner-global-tp-field-label {
    font-size: 10px;
    font-weight: 700;
    color: #9aa3be;
    letter-spacing: 0.24px;
    text-transform: uppercase;
    cursor: pointer;
    user-select: none;
    text-align: left;
}

.planner-global-tp-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: #242424;
    border: 1px solid #4f586e;
    border-radius: 6px;
    color: #d1d4dc;
    font-size: 11px;
    line-height: 1.2;
    padding: 6px 8px;
    text-align: right;
    cursor: text;
}

.planner-global-tp-input::-webkit-outer-spin-button,
.planner-global-tp-input::-webkit-inner-spin-button,
.planner-global-notional-input::-webkit-outer-spin-button,
.planner-global-notional-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.planner-global-tp-input[type="number"],
.planner-global-notional-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.planner-global-tp-input:focus {
    outline: none;
    border-color: #6b8e23;
}

.planner-global-notional-popup {
    min-width: 210px;
    padding: 10px 12px;
}

.planner-global-notional-editor {
    display: grid;
    grid-template-columns: 78px minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
}

.planner-global-notional-label {
    font-size: 11px;
    font-weight: 700;
    color: #787b86;
    letter-spacing: 0.2px;
    text-align: left;
}

.planner-global-notional-input {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    background: #242424;
    border: 1px solid #4f586e;
    border-radius: 6px;
    color: #d1d4dc;
    font-size: 11px;
    line-height: 1.2;
    padding: 6px 8px;
    text-align: right;
    cursor: text;
}

.planner-global-notional-input:focus {
    outline: none;
    border-color: #6b8e23;
}

.view.active {
    display: flex;
}

html[data-initial-route="chart"] #view-watchlist {
    display: none;
}

html[data-initial-route="chart"] #view-chart {
    display: flex;
}

#view-watchlist {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* --- WATCHLIST STYLES --- */
#watchlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px;
    font-size: 24px;
    font-weight: bold;
    border-bottom: 1px solid #2a2e39;
    background: #131722;
}

.watchlist-header-title {
    min-width: 0;
}

.watchlist-filter-tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border: 1px solid #2a2e39;
    border-radius: 9px;
    background: #0f131d;
}

.watchlist-filter-tab {
    min-width: 64px;
    padding: 7px 12px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #8f96a3;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease;
}

.watchlist-filter-tab:hover,
.watchlist-filter-tab:focus {
    outline: none;
    color: #d1d4dc;
}

.watchlist-filter-tab.active {
    background: #17327c;
    color: #f2f5ff;
}

.watchlist-search-wrap {
    position: relative;
    width: min(280px, 45vw);
    min-width: 180px;
}

.watchlist-search {
    width: 100%;
    min-width: 0;
    padding: 9px 36px 9px 12px;
    border: 1px solid #2a2e39;
    border-radius: 8px;
    background: #1e222d;
    color: #d1d4dc;
    font-size: 13px;
    line-height: 1.2;
    box-sizing: border-box;
}

.watchlist-search:focus {
    outline: none;
    border-color: #4f586e;
}

.watchlist-search::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.watchlist-search-clear {
    position: absolute;
    top: 50%;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #8f96a3;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 120ms ease, color 120ms ease;
}

.watchlist-search-wrap.has-value .watchlist-search-clear {
    opacity: 1;
    pointer-events: auto;
}

.watchlist-search-clear:hover {
    color: #d1d4dc;
}

.watchlist-search-clear:focus {
    outline: none;
    color: #d1d4dc;
}

.watchlist-table-header {
    display: flex;
    padding: 10px 20px;
    background: #1e222d;
    border-bottom: 1px solid #2a2e39;
    font-size: 12px;
    color: #787b86;
    font-weight: bold;
}

#watchlist-content {
    flex: 1;
    overflow-y: auto;
}

.market-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.coin-item {
    position: relative;
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #1e222d;
    cursor: pointer;
    transition: background 0.2s;
}

.coin-item:hover {
    background: #2a2e39;
    z-index: 20;
}

.wl-info-popup {
    /* Fixed, mounted on <body>: an absolutely positioned popup inside the row
       was clipped by the scrolling watchlist container on lower rows. */
    position: fixed;
    top: 0;
    left: 0;
    width: 270px;
    padding: 11px 12px;
    border: 1px solid #344055;
    border-radius: 10px;
    background: #111824;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.38);
    color: #d1d4dc;
    font-size: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 70ms ease, transform 70ms ease;
    visibility: hidden;
    z-index: 100;
}

.wl-info-popup.is-open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
}

.wl-info-title {
    margin-bottom: 8px;
    color: #f2f5ff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.wl-info-muted {
    color: #8f96a3;
}

.wl-info-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 3px 0;
    line-height: 1.25;
}

.wl-info-label {
    color: #8f96a3;
    white-space: nowrap;
}

.wl-info-value {
    max-width: 165px;
    color: #d1d4dc;
    font-variant-numeric: tabular-nums;
    overflow: hidden;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wl-col {
    flex: 1;
    display: flex;
    align-items: center;
}

.wl-name {
    flex: 2;
    cursor: pointer;
}

.wl-price {
    flex: 1;
    justify-content: flex-end;
}

.wl-change {
    flex: 1;
    justify-content: flex-end;
}

.wl-vol {
    flex: 1;
    justify-content: flex-end;
}

.wl-mcap {
    flex: 1;
    justify-content: flex-end;
}

.wl-funding {
    flex: 1.15;
    justify-content: flex-end;
}

.wl-price,
.wl-change,
.wl-vol,
.wl-mcap,
.wl-funding {
    font-variant-numeric: tabular-nums;
}

.wl-actions {
    flex: 1;
    justify-content: flex-end;
    gap: 10px;
}

.wl-info-action {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Reserved whether or not this row has an info button, so the chart and
       trade icons line up down the column instead of shifting per row. */
    flex: 0 0 22px;
    width: 22px;
}

.wl-info-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #3a4354;
    border-radius: 50%;
    color: #9aa4b6;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
}

.wl-info-action:hover .wl-info-btn {
    border-color: #5d6f91;
    color: #f2f5ff;
}

.wl-funding-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 2px;
    width: 100%;
}

.wl-funding-top-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

.wl-funding-rate {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.wl-funding-period {
    font-size: 11px;
    color: #787b86;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.wl-funding-countdown {
    font-size: 10px;
    color: #8a90a2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.wl-funding-empty {
    color: #787b86;
}

.coin-symbol {
    font-size: 14px;
    font-weight: 600;
    color: #d1d4dc;
    margin-left: 10px;
}

.coin-icon-slot {
    width: 24px;
    min-width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coin-icon {
    width: 24px;
    height: 24px;
    display: block;
}

.coin-icon-missing {
    visibility: hidden;
}

.coin-name-sub {
    font-size: 12px;
    color: #787b86;
    margin-left: 8px;
}

.coin-price {
    font-size: 14px;
    font-weight: 500;
    color: #d1d4dc;
}

.coin-change {
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    text-align: center;
    min-width: 60px;
}

.watchlist-empty {
    padding: 18px 20px;
    color: #787b86;
    font-size: 13px;
}

.green {
    color: #26a69a;
}

.red {
    color: #ef5350;
}

.bg-green {
    color: #26a69a;
}

.bg-red {
    color: #ef5350;
}

.wl-action-btn {
    background: transparent;
    border: none;
    color: #787b86;
    cursor: pointer;
    font-size: 16px;
}

.wl-action-btn:hover {
    color: #d1d4dc;
}

/* --- CHART HEADER STYLES --- */
#chart-header {
    position: relative;
    height: 50px;
    background-color: #131722;
    border-bottom: 1px solid #2a2e39;
    display: flex;
    align-items: center;
    padding: 0 10px;
    box-sizing: border-box;
    z-index: 10;
}

.back-btn {
    font-size: 24px;
    padding: 0 15px 0 5px;
    cursor: pointer;
    color: #787b86;
}

.planner-account-switcher {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    padding: 3px;
    border: 1px solid #2a2e39;
    background: #1b1f2a;
    flex: 0 0 auto;
    margin-left: auto;
}

.planner-account-switch {
    min-width: 44px;
    height: 24px;
    padding: 0 10px;
    border: none;
    background: #2a2e39;
    color: #d1d4dc;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.planner-account-switch.loaded {
    background: #496200;
    color: #fff;
}

.planner-account-switch.active {
    background: #5f7f00;
    color: #fff;
}

/* --- CHART OVERLAYS & TOOLBAR --- */
.chart-overlay {
    position: absolute;
    pointer-events: none;
    /* Let clicks pass through to canvas */
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.chart-toolbar {
    pointer-events: auto;
    /* Enable clicks on toolbar */
    display: flex;
    align-items: center;
    background: transparent;
    padding: 4px 8px;
    gap: 4px;
    overflow-x: auto;
    /* Allow scrolling if too many items */
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.chart-toolbar::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar Chrome */

.toolbar-item {
    font-size: 13px;
    color: #b2b5be;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}

.toolbar-item:hover {
    background: #2a2e39;
    color: #fff;
}

.toolbar-item.active {
    color: #2962ff;
    font-weight: bold;
}

.symbol-btn {
    font-weight: bold;
    color: #fff;
    margin-right: 4px;
}

.toolbar-sep {
    width: 1px;
    height: 16px;
    background: #2a2e39;
    margin: 0 4px;
}

/* Dropdown */
#interval-dropdown {
    display: none;
    position: fixed;
    background: #1e222d;
    border: 1px solid #2a2e39;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    grid-template-columns: 1fr;
    padding: 4px 0;
}

.dropdown-item {
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: #b2b5be;
    min-width: 80px;
}

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

.dropdown-item .star {
    font-size: 14px;
    color: #434651;
    margin-left: 8px;
}

.dropdown-item .star:hover {
    color: #f0b90b;
}

.dropdown-item .star.pinned {
    color: #f0b90b;
}

.ticker-group {
    display: flex;
    flex-direction: column;
    margin-right: auto;
}

h1 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #d1d4dc;
}

.status {
    font-size: 11px;
    color: #26a69a;
}

.intervals {
    display: flex;
    gap: 2px;
    height: 100%;
    align-items: center;
}

.interval-btn {
    background: transparent;
    border: none;
    color: #b2b5be;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    padding: 0 10px;
    height: 100%;
    border-radius: 0;
    transition: color 0.1s, background 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interval-btn:hover {
    color: #d1d4dc;
    background-color: #2a2e39;
}

.interval-btn.active {
    color: #448aff;
    background-color: transparent;
    /* TradingView style: text/highlight only, or subtle bg */
    font-weight: 600;
}

/* Active state with subtle indicator or just text color? User said 'tiles'. 
   Let's use a subtle background for active to define the 'tile'. */
.interval-btn.active {
    color: #2962ff;
    background-color: transparent;
}

/* To mimic tiles, maybe consistent height/padding */
.intervals {
    display: flex;
    gap: 0;
    /* Tiles usually touch or have small gap */
    height: 100%;
    align-items: center;
}

.fs-btn {
    margin-left: 8px;
    border: 1px solid #2a2e39;
    border-radius: 4px;
    padding: 4px 8px;
    color: #d1d4dc;
    font-size: 11px;
    transition: color 0.2s;
}

.fs-btn:hover {
    background-color: #2a2e39;
}

.obj-btn {
    font-size: 16px;
    padding: 4px 8px;
    cursor: pointer;
    color: #d1d4dc;
    border: none;
    background: transparent;
}

.obj-btn:hover {
    color: #fff;
}

canvas {
    display: block;
    cursor: crosshair;
    flex: 1;
}

/* --- CONTEXT MENU --- */
#context-menu,
#flush-menu {
    display: none;
    position: absolute;
    background-color: #2a2e39;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 8px 0;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    min-width: 200px;
}

/* The divider menu carries one action, so it should not open at dialog width. */
#flush-menu {
    min-width: 150px;
    padding: 4px 0;
}

.menu-section {
    padding: 8px 16px;
    border-bottom: 1px solid #363a45;
    font-size: 12px;
    font-weight: bold;
    color: #787b86;
    text-transform: uppercase;
}

.menu-item {
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    color: #d1d4dc;
    font-size: 14px;
}

.menu-item:hover {
    background-color: #363a45;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 24px;
    height: 24px;
    padding: 0;
    background: none;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 1px solid #434651;
    border-radius: 4px;
}

/* --- OBJECT MANAGER MODAL --- */
#obj-modal {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 6px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    flex-direction: column;
}

#obj-modal-header {
    padding: 15px;
    border-bottom: 1px solid #2a2e39;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
}

#obj-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
}

.obj-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background: #2a2e39;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 13px;
}

.obj-delete {
    color: #ef5350;
    cursor: pointer;
    font-weight: bold;
    padding: 0 5px;
}

/* Object Manager Group Headers */
.obj-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    color: #787b86;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #2a2e39;
    margin-bottom: 4px;
}

.obj-group-count {
    background: #363a45;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
}

/* Object Item Controls */
.obj-item-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.obj-item-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.obj-item-controls .obj-btn {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s;
    padding: 2px 4px;
    font-size: 12px;
}

.obj-item-controls .obj-btn:hover {
    opacity: 1;
}

/* Hidden drawings - dimmed appearance */
.obj-list-item.obj-hidden {
    opacity: 0.5;
}

.obj-list-item.obj-hidden .obj-item-label {
    text-decoration: line-through;
}

/* Locked drawings - subtle indicator */
.obj-list-item.obj-locked {
    border-left: 2px solid #ffa726;
}

.obj-empty {
    text-align: center;
    color: #787b86;
    padding: 20px;
    font-style: italic;
}

#obj-modal-footer {
    padding: 10px;
    border-top: 1px solid #2a2e39;
    text-align: right;
}

.btn-text {
    background: none;
    border: none;
    color: #2962ff;
    cursor: pointer;
    font-size: 13px;
}

.btn-close {
    background: #363a45;
    border: none;
    color: #d1d4dc;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

/* Loading Indicator */
/* Loading Indicator */
.chart-loading-indicator {
    position: absolute;
    transform: translate(-50%, -50%);
    background: rgba(30, 34, 45, 0.8);
    color: #d1d4dc;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    display: none;
    z-index: 50;
    pointer-events: none;
}

/* --- INTERVAL DROPDOWN --- */
.interval-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 100;
    min-width: 120px;
    max-height: 300px;
    overflow-y: auto;
    padding: 4px 0;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #d1d4dc;
    transition: background 0.1s;
}

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

.dropdown-item.active {
    background: rgba(41, 98, 255, 0.1);
    color: #2962ff;
}

.star-btn {
    padding: 0 4px;
    font-size: 14px;
    cursor: pointer;
    color: #787b86;
    transition: color 0.1s;
}

.star-btn:hover {
    color: #d1d4dc;
}

.star-filled {
    color: #f0b90b;
    /* Binance Yellow / Gold */
}

.star-filled:hover {
    color: #fcd535;
}

/* --- SETTINGS MODAL --- */
.draggable-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 6px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid #2a2e39;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    cursor: move;
    /* Indicate draggable */
}

.modal-content {
    padding: 15px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}

button {
    -webkit-appearance: none;
    appearance: none;
}

/* --- NEW UI ELEMENTS --- */

.icon-btn {
    background: transparent;
    border: none;
    color: #787b86;
    cursor: pointer;
    font-size: 16px;
    padding: 6px 8px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
    color: #d1d4dc;
    background-color: #2a2e39;
}

.menu-separator {
    height: 1px;
    background-color: #363a45;
    margin: 4px 0;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: #1e222d;
    border: 1px solid #363a45;
    border-radius: 6px;
    width: 300px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
}

.modal-header-simple {
    padding: 15px;
    border-bottom: 1px solid #2a2e39;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    color: #d1d4dc;
}

.close-btn {
    cursor: pointer;
    color: #787b86;
    font-size: 14px;
}

.close-btn:hover {
    color: #d1d4dc;
}

#symbol-search-input {
    background: #131722;
    border: none;
    border-bottom: 1px solid #2a2e39;
    padding: 15px;
    color: #d1d4dc;
    font-size: 14px;
    outline: none;
}

.symbol-list {
    overflow-y: auto;
    flex: 1;
    padding: 5px 0;
}

.symbol-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    color: #d1d4dc;
}

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


/* Chart Overlays */
#chart-panels {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.chart-base-panel {
    position: absolute;
    box-sizing: border-box;
    border: 1px solid #2a2e39;
    background: #131722;
    pointer-events: none;
    overflow: hidden;
    isolation: isolate;
}

.chart-base-panel.active {
    z-index: 2;
    border-color: transparent;
}

.chart-base-panel.active::after {
    content: '';
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border: 2px solid #2962ff;
    pointer-events: none;
}

.chart-base-panel-canvas {
    position: absolute;
    left: 0;
    top: 36px;
    display: block;
    width: 100%;
    height: calc(100% - 36px);
    pointer-events: none;
}

#chart-overlays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.chart-header-overlay {
    justify-content: flex-start;
}

.chart-overlay {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    box-sizing: border-box;
    pointer-events: none;
}

.overlay-symbol {
    font-weight: bold;
    color: #d1d4dc;
    font-size: 14px;
    background: rgba(19, 23, 34, 0.7);
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: auto;
    cursor: pointer;
}

.overlay-intervals {
    display: flex;
    gap: 4px;
    pointer-events: auto;
}

.overlay-intervals button {
    background: rgba(19, 23, 34, 0.7);
    border: none;
    color: #787b86;
    cursor: pointer;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
}

.overlay-intervals button:hover {
    color: #d1d4dc;
    background: rgba(42, 46, 57, 0.8);
}

.overlay-intervals button.active {
    color: #2962ff;
    font-weight: bold;
}

/* --- PLANNER V3 --- */

/* Sidebar Container */
#planner-sidebar {
    position: relative;
    /* Context for selection rect */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Header/Footer fixed, content scrolls */
    min-width: var(--planner-sidebar-min-width, 150px);
    max-width: var(--planner-sidebar-max-width, 800px);
}

#planner-resizer {
    touch-action: none;
}

/* Automation Toolbar */
.planner-toolbar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #1e222d;
    border-bottom: 1px solid #2a2e39;
    gap: 8px;
}

.planner-tool-btn {
    background: transparent;
    border: 1px solid #2a2e39;
    border-radius: 4px;
    color: #787b86;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    transition: all 0.2s;
}

.planner-tool-btn:hover {
    background: #2a2e39;
    color: #d1d4dc;
}

/* Selection Rectangle */
.selection-rect {
    position: absolute;
    background: rgba(41, 98, 255, 0.1);
    border: 1px solid rgba(41, 98, 255, 0.5);
    pointer-events: none;
    /* Let clicks pass */
    z-index: 1000;
    display: none;
}

/* Compact Rows */
.planner-row {
    height: 32px;
    /* Force height */
    display: flex;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid #2a2e39;
    font-size: 11px;
    cursor: default;
    user-select: none;
}

.planner-row.selected {
    background: #2a2e39;
}

/* Compact Checkbox */
.planner-row input[type="checkbox"] {
    margin-right: 8px;
}

/* Compact Info */
.planner-row-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.planner-row-side {
    font-weight: bold;
    width: 45px;
}

.planner-row-price {
    font-family: var(--macos-ui-font);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
    color: #d1d4dc;
}

.planner-row-close {
    opacity: 0;
    background: transparent;
    border: none;
    color: #787b86;
    cursor: pointer;
    padding: 2px 6px;
}

.planner-row-close-hidden {
    opacity: 0 !important;
    visibility: hidden;
    pointer-events: none;
}

/* --- VERTICAL TOOLBAR --- */
#planner-tools button {
    background: transparent;
    border: none;
    color: #787b86;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

#planner-tools button:hover {
    color: #d1d4dc;
    background: #2a2e39;
}

#planner-tools button.active {
    color: #2962ff;
    background: rgba(41, 98, 255, 0.1);
}

.planner-tools-section {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* --- PLANNER SIDEBAR NEW CLASSES --- */
.planner-header {
    padding: 9px 14px;
    border-bottom: 1px solid #2a2e39;
    cursor: pointer;
    position: sticky;
    top: var(--planner-pane-header-sticky-offset, 0px);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 10px;
}

.planner-header.active {
    background: #313131;
}

.planner-header.inactive {
    background: #313131;
}

.planner-header-title {
    font-size: 14px;
    color: #d1d4dc;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.planner-header-closed {
    font-size: 11px;
    color: #aaa;
}

.planner-header-side-long {
    border-left: 2px solid rgba(38, 166, 154, 0.7);
}

.planner-header-side-short {
    border-left: 2px solid rgba(217, 83, 79, 0.75);
}

.planner-side-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex: 0 0 auto;
}

.planner-side-chip-long {
    background: #26a69a;
}

.planner-side-chip-short {
    background: #d9534f;
}

.planner-label {
    font-size: 11px;
    color: #787b86;
}

.planner-value {
    font-size: 11px;
    color: #d1d4dc;
    font-family: var(--macos-ui-font);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

.planner-time {
    font-size: 11px;
    color: #787b86;
    justify-self: end;
    text-align: right;
    white-space: nowrap;
}

.planner-row-size {
    font-family: var(--macos-ui-font);
    font-size: 11px;
    color: #d1d4dc;
    justify-self: start;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

.planner-offset {
    color: #787b86;
    font-size: 11px;
    justify-self: end;
}

.planner-row-tp-price,
.planner-row-tp-percent {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 0 4px;
    font-family: var(--macos-ui-font);
    font-size: 11px;
    color: #d1d4dc;
    justify-self: end;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

.planner-row-tp-trigger {
    cursor: pointer;
}

.planner-row-tp-hidden {
    visibility: hidden;
}

.planner-row-tp-price-tone-orange-positive {
    color: #b3cc7f;
}

.planner-row-tp-percent-tone-orange-positive {
    color: #70a800;
}

.planner-row-tp-price-tone-orange-negative {
    color: #de9b9b;
}

.planner-row-tp-percent-tone-orange-negative {
    color: #e45454;
}

.planner-row-tp-price-tone-pending,
.planner-row-tp-percent-tone-pending {
    color: #a3ad8e;
}

.planner-content {
    background: #131722;
    border-bottom: 1px solid #2a2e39;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.planner-anchor-row {
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #2a2e39;
}

.planner-footer {
    padding: 10px;
    background: #1e222d;
    border-top: 1px solid #2a2e39;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.planner-btn {
    background: #2a2e39;
    border: none;
    color: #fff;
    padding: 4px;
    cursor: pointer;
    font-size: 11px;
    border-radius: 3px;
}

.planner-btn.danger {
    background: #ef5350;
}

.planner-btn.icon {
    background: transparent;
    border: none;
    color: #787b86;
    cursor: pointer;
}

.planner-open-btn {
    background: transparent;
    border: 1px solid #787b86;
    border-radius: 3px;
    color: #787b86;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 11px;
    margin-left: 8px;
}

#planner-sidebar .planner-input {
    width: 60px;
    flex: 0 0 auto;
    background: #131722;
    border: 1px solid #2a2e39;
    color: #fff;
    padding: 4px;
    font-size: 11px;
}

#planner-sidebar .planner-input.planner-input-tp {
    width: 64px;
    text-align: right;
}

.planner-empty {
    padding: 20px;
    text-align: center;
    color: #555;
    font-size: 12px;
    font-style: italic;
}

#planner-sidebar-list,
.planner-scrollable,
.planner-account-pane {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#planner-sidebar-list::-webkit-scrollbar,
.planner-scrollable::-webkit-scrollbar,
.planner-account-pane::-webkit-scrollbar {
    display: none;
}

.planner-account-pane {
    --planner-pane-header-sticky-offset: 0px;
    position: relative;
    display: flex;
    flex-direction: column;
    width: var(--planner-pane-width, 250px);
    min-width: var(--planner-pane-width, 250px);
    max-width: var(--planner-pane-width, 250px);
    flex: 0 0 var(--planner-pane-width, 250px);
    border-right: 1px solid #2a2e39;
    align-self: stretch;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.planner-account-pane-dragging {
    opacity: 0.72;
}

.planner-account-pane-drop-before,
.planner-account-pane-drop-after,
.planner-account-pane-drop-origin {
    isolation: isolate;
}

.planner-account-pane-drop-before::after,
.planner-account-pane-drop-after::after,
.planner-account-pane-drop-origin::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 220;
    background: rgba(112, 168, 0, 0.1);
    box-shadow: inset 0 0 0 1px rgba(112, 168, 0, 0.85);
}

.planner-account-pane-drop-origin::after {
    background: rgba(112, 168, 0, 0.07);
    box-shadow: inset 0 0 0 1px rgba(112, 168, 0, 0.55);
}

.planner-account-pane-drag-preview {
    position: fixed;
    margin: 0;
    pointer-events: none;
    z-index: 260;
    opacity: 0.96;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.42);
    border: 1px solid rgba(112, 168, 0, 0.55);
    background: #171b25;
    transform: scale(1.01);
}

.planner-account-pane-drag-preview .planner-account-pane-resizer {
    display: none;
}

.planner-account-pane-header {
    position: sticky;
    top: 0;
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #2a2e39;
    background: #171b25;
    color: #aeb6c4;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    cursor: pointer;
}

.planner-account-pane-header.draggable {
    cursor: grab;
}

.planner-account-pane-header-dragging {
    cursor: grabbing;
}

.planner-account-pane-header-label {
    min-width: 0;
}

.planner-account-pane-header.active {
    background: #1e2510;
}

.planner-account-pane-header.active .planner-account-pane-header-label {
    color: #70a800;
}

.planner-account-pane-header-close {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: transparent;
    color: inherit;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.planner-account-pane-header-close:hover {
    background: rgba(174, 182, 196, 0.12);
}

.planner-account-pane-body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.planner-account-pane-resizer {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 8px;
    z-index: 140;
    cursor: col-resize;
    touch-action: none;
}

.planner-account-pane-resizer::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: transparent;
    transition: background 0.15s ease;
}

.planner-account-pane-resizer:hover::after {
    background: rgba(174, 182, 196, 0.45);
}

.planner-account-pane-resizer-left {
    left: 0;
}

/* Planner row grid layout */
.planner-row-grid {
    display: grid;
    grid-template-columns: 52px 72px 52px 72px 58px minmax(0, 1fr) 52px 26px;
    gap: 5px;
    align-items: center;
    border-bottom: 1px solid #1e222d;
}

.planner-row-spacer {
    min-width: 0;
    width: 100%;
    height: 1px;
}

/* Header info section */
.planner-header-info {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.planner-header-stats {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
}

.planner-header-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
}

.planner-header-stat-label {
    font-size: 11px;
    font-weight: 700;
    color: #787b86;
    letter-spacing: 0.3px;
}

.planner-header-stat-value {
    font-size: 11px;
    font-weight: 700;
    color: #d1d4dc;
    font-family: var(--macos-ui-font);
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
}

.planner-header-stat-profit-positive {
    color: #26a69a;
}

.planner-header-stat-profit-negative {
    color: #d9534f;
}

.planner-header-stat-profit-neutral {
    color: #787b86;
}

/* Position size that disagrees with the exchange. The number still reads as a
   number -- it is the plan's own figure -- but it stops looking authoritative. */
.planner-header-stat-size-warn {
    color: #e8b339;
}

.planner-header-stat-size-alert {
    color: #ef5350;
    /* An alert means the exchange holds exposure the plan does not know about,
       or a materially different size. That earns more than a colour. */
    animation: cvt-drift-pulse 1.6s ease-in-out infinite;
}

@keyframes cvt-drift-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
    .planner-header-stat-size-alert {
        animation: none;
        text-decoration: underline wavy currentColor;
    }
}

.planner-header-title-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.planner-header-counters {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    flex: 0 0 auto;
}

.planner-header-counter {
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.planner-header-counter:disabled {
    cursor: default;
}

.planner-header-counter-green {
    background: #2e7d32;
}

.planner-header-counter-red {
    background: #d9534f;
}

.planner-header-counter-orange {
    background: #f39c12;
}

.planner-header-counter-purple {
    background: #9b59b6;
}

.planner-header-counter-pink {
    background: rgb(255, 133, 173);
}

/* Footer row layouts */
.planner-footer-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.planner-footer-row.no-margin {
    margin-bottom: 0;
}

.planner-footer-row.centered {
    align-items: center;
}

.planner-footer-row-tp {
    flex-wrap: nowrap;
}

.planner-tp-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.planner-tp-save-btn {
    width: 22px;
    height: 22px;
    border: 1px solid #3a3f4e;
    border-radius: 4px;
    background: #2a2e39;
    color: #d1d4dc;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.35;
    transition: opacity 0.15s ease, border-color 0.15s ease;
}

.planner-tp-save-btn svg {
    fill: currentColor;
}

.planner-tp-save-btn.enabled {
    border-color: #5d6478;
}

.planner-tp-save-btn:disabled {
    cursor: default;
}

.planner-tp-presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    width: 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #2a2e39;
}

.planner-tp-presets-section {
    width: 100%;
}

.planner-tp-presets-section + .planner-tp-presets-section {
    margin-top: 4px;
}

.planner-tp-presets-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #8f97ad;
    letter-spacing: 0.24px;
    text-transform: uppercase;
    margin-top: 8px;
}

.planner-tp-preset-item {
    position: relative;
    cursor: grab;
}

.planner-tp-preset-item.dragging {
    opacity: 0.45;
}

.planner-tp-preset-item.drag-over .planner-tp-preset-btn {
    box-shadow: inset 0 0 0 1px #9aa3be;
}

.planner-tp-preset-btn {
    border: none;
    border-radius: 12px;
    background: #2f3443;
    color: #d1d4dc;
    font-size: 11px;
    line-height: 1;
    height: 24px;
    padding: 0 12px;
    cursor: pointer;
}

.planner-tp-preset-remove {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 15px;
    height: 15px;
    border: none;
    border-radius: 50%;
    background: #ef5350;
    color: #fff;
    font-size: 11px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
}

.planner-tp-preset-item:hover .planner-tp-preset-remove {
    opacity: 1;
    pointer-events: auto;
}

.planner-footer-buttons {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.planner-btn.flex-1 {
    flex: 1;
}

.planner-row-price.end {
    justify-self: end;
}

.planner-row-empty {
    font-size: 11px;
    color: #787b86;
    padding: 8px 12px;
    border-bottom: 1px solid #1e222d;
    font-style: italic;
}

.planner-row-wrapper {
    display: block;
}

.planner-status-btn {
    width: 22px;
    height: 18px;
    border: none;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    background: #2a2e39;
    justify-self: end;
}

.planner-status-btn.status-green {
    background: #2e7d32;
}

.planner-status-btn.status-red {
    background: #d9534f;
}

.planner-status-btn.status-pink {
    background: rgb(255, 133, 173);
}

.planner-status-btn.status-orange {
    background: #f39c12;
}

.planner-status-btn.status-purple {
    background: #8e44ad;
}

.planner-row-action {
    border: none;
    border-radius: 3px;
    background: #2a2e39;
    color: #d1d4dc;
    font-size: 11px;
    height: 18px;
    padding: 0 6px;
    cursor: pointer;
}

.planner-tp-editor {
    display: grid;
    grid-template-columns: 84px 125px auto;
    gap: 8px 10px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px 12px;
    border-bottom: 1px solid #1e222d;
    background: #1f1f1f;
}

.planner-tp-editor-label {
    font-size: 11px;
    color: #d1d4dc;
    text-align: right;
}

.planner-tp-editor-preview {
    font-size: 11px;
    font-weight: 700;
    color: #d1d4dc;
    justify-self: start;
    white-space: nowrap;
}

.planner-tp-editor-spacer {
    width: 104px;
    min-height: 1px;
}

.planner-tp-editor-submit-row {
    grid-column: 2 / 3;
    display: flex;
    justify-content: flex-start;
    padding-top: 4px;
}

.planner-tp-editor-submit {
    width: 125px;
    min-width: 125px;
    max-width: 125px;
    height: 25px;
    padding: 0 6px;
    box-sizing: border-box;
}

.planner-tp-editor-apply-all {
    white-space: nowrap;
    min-width: 104px;
    height: 25px;
    padding: 0 10px;
    box-sizing: border-box;
}

.planner-tp-editor > .planner-tp-input {
    width: 125px;
    min-width: 125px;
    max-width: 125px;
    justify-self: start;
    box-sizing: border-box;
    background: #242424;
    border: 1px solid #6b8e23;
    color: #d1d4dc;
    font-size: 11px;
    padding: 4px 6px;
    text-align: right;
}

.planner-tp-input::-webkit-outer-spin-button,
.planner-tp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.planner-tp-input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.status-hidden {
    visibility: hidden;
}

.history-pane-title {
    padding: 12px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #d1d4dc;
    border-bottom: 1px solid #2a2e39;
    letter-spacing: 0.4px;
}

.history-pane-empty {
    padding: 14px;
    font-size: 12px;
    color: #787b86;
    font-style: italic;
}

.history-row {
    padding: 10px 12px;
    border-bottom: 1px solid #1e222d;
}

.history-row-top {
    font-size: 12px;
    color: #d1d4dc;
    font-weight: 600;
}

.history-row-meta {
    margin-top: 4px;
    font-size: 11px;
    color: #787b86;
}

@media (max-width: 900px) {
    #planner-resizer {
        width: 14px !important;
        margin-left: -6px !important;
        margin-right: -8px !important;
    }

    #planner-sidebar {
        min-width: 0 !important;
    }
}

/* --- DRAWING TOOLBAR (HTML-based floating toolbar for drawings) --- */
.drawing-toolbar {
    position: fixed;
    display: flex;
    align-items: center;
    gap: 2px;
    background: rgba(30, 34, 45, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(54, 58, 69, 0.8);
    border-radius: 8px;
    padding: 6px 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    pointer-events: auto;
}

.drawing-toolbar .toolbar-section {
    display: flex;
    align-items: center;
    gap: 4px;
}

.drawing-toolbar .toolbar-section.colors {
    gap: 6px;
}

.drawing-toolbar .toolbar-section.thickness {
    gap: 2px;
}

.drawing-toolbar .toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(84, 88, 99, 0.5);
    margin: 0 6px;
}

.drawing-toolbar .toolbar-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    padding: 0;
}

.drawing-toolbar .toolbar-color:hover {
    transform: scale(1.15);
}

.drawing-toolbar .toolbar-color.active {
    border-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 2px rgba(41, 98, 255, 0.4);
}

.drawing-toolbar .toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #787b86;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}

.drawing-toolbar .toolbar-btn:hover {
    color: #d1d4dc;
    background: rgba(42, 46, 57, 0.8);
}

.drawing-toolbar .toolbar-btn.active {
    color: #2962ff;
    background: rgba(41, 98, 255, 0.15);
}

.drawing-toolbar .toolbar-btn.delete {
    color: #787b86;
}

.drawing-toolbar .toolbar-btn.delete:hover {
    color: #f23645;
    background: rgba(242, 54, 69, 0.15);
}

.drawing-toolbar .toolbar-btn svg {
    width: 16px;
    height: 16px;
}

.drawing-toolbar .toolbar-value {
    font-size: 11px;
    color: #d1d4dc;
    min-width: 28px;
    text-align: center;
    font-weight: 500;
}

.drawing-toolbar .toolbar-drag-handle {
    display: flex;
    align-items: center;
    padding: 0 6px 0 2px;
    color: #555;
    cursor: grab;
    transition: color 0.15s;
}

.drawing-toolbar .toolbar-drag-handle:hover {
    color: #888;
}

.drawing-toolbar.dragging .toolbar-drag-handle {
    cursor: grabbing;
    color: #2962ff;
}

.drawing-toolbar .toolbar-content {
    display: flex;
    align-items: center;
    gap: 2px;
}
