/* Compact Balance Display */
.balance-display-compact {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-app-region: no-drag;
  pointer-events: auto;
  margin-right: 16px;
  font-family: 'Quantico', monospace;
}

.total-balance {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 11px;
  white-space: nowrap;
  -webkit-app-region: no-drag;
  pointer-events: auto;
  height: 24px;
  box-sizing: border-box;
}

.total-balance:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.total-label {
  color: rgba(174, 206, 255, 0.8);
  font-weight: 500;
  font-size: 11px;
}

.total-cash {
  font-weight: 600;
  font-size: 11px;
  color: var(--text);
}

.total-buying-power {
  display: flex;
  align-items: center;
  gap: 4px;
}

.total-buying-power-label {
  color: rgba(174, 206, 255, 0.8);
  font-size: 11px;
}

.buying-power-value {
  font-weight: 600;
  font-size: 11px;
  color: var(--text);
}

.total-pnl {
  display: flex;
  align-items: center;
  gap: 4px;
}

.total-pnl-label {
  color: rgba(174, 206, 255, 0.8);
  font-size: 11px;
}

.pnl-value {
  font-weight: 600;
  font-size: 11px;
}

.pnl-value.profit {
  color: var(--profit);
}

.pnl-value.loss {
  color: var(--loss);
}

.expand-arrow {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.6);
  transition: transform 0.2s ease;
  margin-left: 4px;
}

.expand-arrow.expanded {
  transform: rotate(180deg);
}

/* Account Breakdown */
.account-breakdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 8px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  width: 100%;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
  box-sizing: border-box;
}

.account-breakdown::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 6px solid var(--bg-base);
}

.account-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  gap: 12px;
}

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

.account-id {
  font-weight: 600;
  color: var(--text-dim);
  min-width: 40px;
  font-size: 11px;
}

.account-cash {
  font-weight: 600;
  color: var(--text);
  min-width: 60px;
  text-align: right;
  font-size: 11px;
}

.account-buying-power {
  font-weight: 600;
  color: var(--text);
  min-width: 60px;
  text-align: right;
  font-size: 11px;
}

.account-pnl {
  font-weight: 600;
  min-width: 60px;
  text-align: right;
  font-size: 11px;
}

.account-pnl.profit {
  color: var(--profit);
}

.account-pnl.loss {
  color: var(--loss);
}

/* Session Indicator */
.session-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  transition: all 0.2s ease;
  height: 24px;
  box-sizing: border-box;
  margin-right: 8px;
  min-width: 100px;
}

.session-indicator.news-alert {
  animation: newsFlash 4s ease-in-out infinite;
}

.session-indicator:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
  /* transform: translateY(-1px); */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.session-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  font-family: 'Quantico', monospace;
  letter-spacing: 0.3px;
  line-height: 1;
}

.session-timer {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  font-family: 'Quantico', monospace;
  letter-spacing: 0.3px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  min-width: 60px;
  text-align: right;
}

@keyframes newsFlash {
  0%,
  100% {
    background-color: rgba(255, 255, 255, 0.03);
    transform: scale(1);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
  }
  20%,
  40%,
  60%,
  80% {
    background-color: rgba(255, 255, 255, 0.15);
    transform: scale(1);
  }
}

/* Connection Indicators */
.connection-indicators {
  display: flex;
  align-items: center;
  /* margin-right: 2px; */
  gap: 4px;
}

.status-indicator-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  transition: all 0.2s ease;
  height: 24px;
  box-sizing: border-box;
}

.status-indicator-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  font-family: 'Quantico', monospace;
  letter-spacing: 0.3px;
}
/* Alert "+" button — matches price label height, TradingView style */
.alert-plus-button {
  position: absolute;
  width: 17px;
  height: 17px;
  border-radius: 3px;
  background: rgba(60, 60, 60, 0.95);
  color: #aaa;
  font-size: 14px;
  font-weight: 300;
  display: none;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  pointer-events: auto;
  line-height: 17px;
  z-index: 10000;
  border: 1px solid rgba(100, 100, 100, 0.5);
  padding: 0;
  box-sizing: border-box;
}

.alert-plus-button:hover {
  background: rgba(80, 80, 80, 1);
  color: #ddd;
  border-color: rgba(140, 140, 140, 0.6);
}

/* Alert Edit Modal — unified with chart-position-menu */
.alert-edit-modal {
  position: absolute;
  z-index: 10001;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  width: 210px;
  box-shadow: 0 4px 12px var(--shadow, rgba(0, 0, 0, 0.5));
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  color: var(--text);
  user-select: none;
  pointer-events: auto;
}

.alert-edit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}

.alert-edit-header:active {
  cursor: grabbing;
}

.alert-edit-symbol {
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
  margin-right: 4px;
}

.alert-edit-label {
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.alert-edit-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-family: 'Quantico', sans-serif;
  line-height: 1;
}

.alert-edit-close:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.alert-edit-field {
  margin-bottom: 5px;
}

.alert-edit-field label {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.alert-edit-input {
  width: 100%;
  padding: 4px 6px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  font-family: 'Quantico', sans-serif;
  outline: none;
  box-sizing: border-box;
  user-select: text;
}

.alert-edit-input:focus {
  border-color: var(--border-light);
}

.alert-edit-select {
  width: 100%;
  padding: 4px 6px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  font-family: 'Quantico', sans-serif;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 18px;
}

.alert-edit-select:focus {
  border-color: var(--border-light);
}

.alert-edit-select option {
  background: var(--bg-alt);
  color: var(--text);
}

.alert-edit-actions {
  display: flex;
  gap: 3px;
  margin-top: 6px;
}

.alert-edit-save {
  flex: 1;
  padding: 4px 0;
  background: var(--bg-button);
  color: var(--text);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Quantico', sans-serif;
  font-size: 10px;
  font-weight: 600;
  transition: background 0.1s;
}

.alert-edit-save:hover {
  background: var(--bg-button-hover);
}

.alert-edit-delete {
  padding: 4px 8px;
  background: rgba(255, 72, 0, 0.1);
  color: var(--loss, #ff4800);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Quantico', sans-serif;
  font-size: 10px;
  transition: background 0.1s;
}

.alert-edit-delete:hover {
  background: rgba(255, 72, 0, 0.2);
}

/* Alert Panel buttons (PositionPanel > Alerts tab) */
.alert-panel-btn {
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-family: 'Quantico', sans-serif;
  transition: background 0.15s;
}

.alert-panel-btn-add {
  background: rgba(150, 150, 150, 0.15);
  color: var(--text, #ddd);
  border: 1px solid rgba(150, 150, 150, 0.3);
}

.alert-panel-btn-add:hover {
  background: rgba(150, 150, 150, 0.25);
}

.alert-panel-btn-delete {
  background: rgba(255, 72, 0, 0.1);
  color: #ff4800;
  border: 1px solid rgba(255, 72, 0, 0.25);
  padding: 2px 6px;
  font-size: 10px;
}

.alert-panel-btn-delete:hover {
  background: rgba(255, 72, 0, 0.2);
}

.alert-panel-btn-clear {
  background: none;
  color: var(--text-muted, #888);
  border: 1px solid var(--border, #333);
  font-size: 10px;
  padding: 2px 6px;
}

.alert-panel-btn-clear:hover {
  color: var(--text, #ddd);
  border-color: #555;
}

/* Drawing Style Settings — unified with chart-position-menu & alert-edit */
.drawing-style-modal {
  position: absolute;
  z-index: 10001;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  min-width: 210px;
  box-shadow: 0 4px 12px var(--shadow, rgba(0, 0, 0, 0.5));
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  color: var(--text);
  user-select: none;
  pointer-events: auto;
}

.drawing-style-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
}

.drawing-style-header:active {
  cursor: grabbing;
}

.drawing-style-title {
  font-weight: 700;
  font-size: 11px;
  color: var(--text);
}

.drawing-style-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  padding: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-family: 'Quantico', sans-serif;
  line-height: 1;
}

.drawing-style-close:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.drawing-style-field {
  margin-bottom: 5px;
}

.drawing-style-field label {
  display: block;
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.drawing-style-swatches {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.drawing-style-swatch {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border-light);
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
}

.drawing-style-swatch.active {
  border: 2px solid #fff;
}

.drawing-style-swatch:hover {
  border-color: var(--text-dim);
}

.drawing-style-range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.drawing-style-range-row input[type='range'] {
  flex: 1;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

.drawing-style-range-row input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-dim);
  cursor: pointer;
}

.drawing-style-range-val {
  font-size: 10px;
  color: var(--text-dim);
  min-width: 28px;
  text-align: right;
}

.drawing-style-select {
  width: 100%;
  padding: 4px 6px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  font-family: 'Quantico', sans-serif;
  outline: none;
  cursor: pointer;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 18px;
}

.drawing-style-select:focus {
  border-color: var(--border-light);
}

.drawing-style-select option {
  background: var(--bg-alt);
  color: var(--text);
}

/* Tabs (Style / Text / Coords) */
.drawing-style-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.drawing-style-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  padding: 3px 8px 5px;
  cursor: pointer;
}

.drawing-style-tab:hover {
  color: var(--text);
}

.drawing-style-tab.active {
  color: var(--text);
  border-bottom-color: var(--accent, #b4b4f9);
}

/* Button rows (thickness / line style / bold-italic) */
.drawing-style-btnrow {
  display: flex;
  gap: 4px;
  align-items: center;
}

.drawing-style-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 6px;
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
}

.drawing-style-btn:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.drawing-style-btn.active {
  color: var(--text);
  background: var(--bg-hover);
  border-color: var(--accent, #b4b4f9);
}

.drawing-style-btn-square {
  flex: 0 0 26px;
}

/* Custom color "+" swatch */
.drawing-style-swatch-custom {
  background: linear-gradient(135deg, #f23645 0%, #ffeb3b 35%, #4caf50 65%, #2962ff 100%);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Inline expanding color picker */
.drawing-style-picker {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawing-style-picker .react-colorful {
  width: 100%;
  height: 140px;
}

/* Text inputs / textarea */
.drawing-style-textinput {
  width: 100%;
  padding: 4px 6px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  font-family: 'Quantico', sans-serif;
  outline: none;
  box-sizing: border-box;
}

.drawing-style-textinput:focus {
  border-color: var(--border-light);
}

.drawing-style-textarea {
  width: 100%;
  padding: 4px 6px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  font-family: 'Quantico', sans-serif;
  outline: none;
  box-sizing: border-box;
  resize: vertical;
  user-select: text;
  -webkit-user-select: text;
}

.drawing-style-textarea:focus {
  border-color: var(--border-light);
}

.drawing-style-check {
  display: flex !important;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-transform: none !important;
}

.drawing-style-check input[type='checkbox'] {
  accent-color: var(--accent, #b4b4f9);
  cursor: pointer;
}
