.error-message {
  color: #ff4d4f;
  margin-top: 3px;
  font-size: 12px;
}

.highlighted {
  background-color: var(--bg-button);
}

.input {
  padding: 4px;
  border-radius: 4px;
  background-color: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  width: 50%;
}

.trade-panel-bar {
  display: flex;
  align-items: center;
  gap: 3px;
  user-select: none;
  -webkit-user-select: none;
}

.trade-panel-bar input,
.trade-panel-bar textarea {
  user-select: text;
  -webkit-user-select: text;
}

.chart-button-container {
  display: flex;
  gap: 4px;
}

/* Seconds menu styling */
.seconds-button-container {
  position: relative;
  display: inline-block;
}

.seconds-menu {
  position: absolute;
  user-select: none;
  bottom: 100%;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  background-color: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px;
  z-index: 10;
  margin-bottom: 2px;
  box-shadow: 0 2px 8px var(--shadow);
  user-select: none;
}

.seconds-menu .chart-button {
  width: 100%;
  text-align: center;
  margin: 1px 0;
  border: none;
  border-radius: 2px;
}

.seconds-menu .chart-button:hover {
  background-color: rgba(180, 180, 249, 0.1);
  border-color: rgba(180, 180, 249, 0.25);
}

.seconds-menu .chart-button.selected {
  background-color: rgba(180, 180, 249, 0.15);
  border-color: rgba(180, 180, 249, 0.3);
}

.chart-button-container {
  display: flex;
  gap: 4px;
}

.chart-button {
  display: inline-block;
  cursor: pointer;
  background-color: var(--bg-deep);
  border: 1px solid rgba(180, 180, 249, 0.15);
  border-radius: 4px;
  color: var(--text);
  line-height: 26px;
  font-family: var(--app-body-font);
  font-weight: 500;
  font-size: 0.9em;
  padding: 0 4px;
  transition: all 0.2s ease;
  user-select: none;
}

.chart-button.selected {
  background-color: rgba(180, 180, 249, 0.15);
  border-color: rgba(180, 180, 249, 0.3);
  color: var(--text);
  font-weight: 500;
}

.chart-button:hover {
  background-color: rgba(180, 180, 249, 0.1);
  border-color: rgba(180, 180, 249, 0.25);
  color: var(--text);
}

.chart-button-icon {
  height: 1em;
  width: 1em;
  vertical-align: middle;
  display: inline-block;
}

.star-button {
  background: none;
  border: none;
  padding: 0;
  margin: 0 0 0 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.star-button img {
  width: 14px;
  height: 14px;
}

.star-button:hover {
  transform: scale(1.1);
}

.star-button:active {
  transform: scale(0.95);
}

.symbol-search-wrapper {
  /* Symbols are <=10 chars incl. prefixes (xyz:, O:) - no need to hog the
     bar; freed width keeps trade buttons + quote readout on one row */
  flex: 0 1 130px;
  min-width: 90px;
  max-width: 150px;
  margin: 0 8px;
}

.chart-indicators-container {
  position: relative;
  display: inline-block;
  user-select: none;
}

/* ── Chart toolbar popups (drawing tools, indicators, settings) -- same look as
   the chart right-click menu, whose flyouts render these rows too ── */
.chart-popup {
  z-index: 10000;
  min-width: 170px;
  padding: 6px;
  font-family: var(--app-font), sans-serif;
  font-size: 11px;
  background: var(--bg-alt);
  border-radius: 4px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px var(--shadow, rgba(0, 0, 0, 0.5));
  user-select: none;
  color: var(--text);
}

.chart-popup-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 24px;
  padding: 0 5px;
  box-sizing: border-box;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--app-font), sans-serif;
  font-size: 10px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition:
    background 0.1s,
    color 0.1s;
}

.chart-popup-row:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.chart-popup-row.active {
  color: var(--tc-45b5ff);
}

.chart-popup-row.disabled {
  cursor: default;
  color: var(--text-muted);
}

.chart-popup-row.disabled:hover {
  background: transparent;
}

.chart-popup-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.85;
}

.chart-popup-hint {
  margin-left: auto;
  padding-left: 12px;
  color: var(--text-muted);
  font-size: 9px;
}

.chart-popup-check {
  margin-left: auto;
  display: flex;
  color: var(--tc-45b5ff);
}

.chart-popup-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 5px 2px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.chart-popup-label:first-child {
  padding-top: 2px;
}

.chart-popup-sep {
  border-top: 1px solid var(--border);
  margin: 5px 0;
}

/* Small borderless action (drawing alert / hide / delete, Clear all) */
.chart-popup-action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 9px;
  cursor: pointer;
}

.chart-popup-action:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* Indicators: overlays | panes side by side */
.chart-popup-cols {
  display: grid;
  grid-template-columns: minmax(165px, 1fr) minmax(150px, 1fr);
  gap: 0 6px;
}

.chart-popup-col {
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

/* Chart type picker: 2 x 3, fits the popup's width */
.chart-popup-typegrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
  padding: 2px 5px 4px;
}
.chart-popup-type {
  height: 22px;
  padding: 0 4px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 10px;
  white-space: nowrap;
  cursor: pointer;
}
.chart-popup-type:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.chart-popup-type.active {
  border-color: #45b5ff;
  color: var(--tc-45b5ff);
}

/* Indicator period box + add */
.indicator-input {
  width: 30px;
  height: 18px;
  margin-left: auto;
  padding: 0 3px;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-base);
  color: var(--text);
  font-family: inherit;
  font-size: 10px;
  text-align: center;
  user-select: text;
}

.indicator-input:focus {
  outline: none;
  border-color: #45b5ff;
}

.indicator-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.indicator-plus:hover:not(:disabled) {
  background: var(--bg-base);
  color: var(--text);
}

.indicator-plus:disabled {
  opacity: 0.35;
  cursor: default;
}

/* Saved indicator sets: a strip above the indicator columns */
.indicator-sets {
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.indicator-sets .indicator-set-name {
  flex: 1;
  width: auto;
  margin-left: 0;
  text-align: left;
  padding: 0 6px;
}
.indicator-set-delete {
  padding: 0 3px;
  border-radius: 3px;
  color: var(--text-muted);
}
.indicator-set-delete:hover {
  background: var(--bg-base);
  color: var(--text);
}

/* ── Option quick-buy shortcuts under the stock buttons (opt-in) ────────
   Compact variant of the feed's OptionBuyButton pair: shorter, tighter
   type, capped width so the size buttons don't become empty planks. */
.trade-panel-opt-shortcuts {
  display: flex;
  /* Mirror the stock buttons' spacing scheme (margin-right 5px on every
     button incl. the last) so pair edges land EXACTLY on the buy/sell
     seam and the 250K right border. gap would drift 2-5px. */
  gap: 0;
  padding: 3px 0 2px;
  align-items: center;
}

.trade-panel-opt-shortcut {
  flex: 1 1 0;
  min-width: 0;
  margin-right: 5px;
}

.trade-panel-opt-shortcut .option-info-btn,
.trade-panel-opt-shortcut .option-size-btn {
  height: 26px !important;
  padding-top: 1px;
  padding-bottom: 1px;
}

.trade-panel-opt-shortcut .option-text {
  gap: 0;
}

.trade-panel-opt-shortcut .option-strike {
  font-size: 10.5px;
  line-height: 1.15;
}

.trade-panel-opt-shortcut .option-price {
  font-size: 9px;
  line-height: 1.1;
}

.trade-panel-opt-shortcut .option-size {
  font-size: 10px;
}

/* Keep the symbol input its natural height when the bar grows a second
   row (option shortcuts) - stretching it to both rows looks goofy */
.trade-panel-bar .symbol-search-wrapper input {
  height: 32px !important;
}

/* Options-chain shortcut under the symbol search (second bar row) */
.trade-panel-chain-btn {
  height: 26px;
  margin: 3px 8px 0;
  background: var(--bg-button);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.trade-panel-chain-btn:hover {
  background: var(--scrollbar);
  border-color: var(--border-light);
}

/* Left column of the trade bar: search on top, chain shortcut below.
   Inside a COLUMN the search wrapper's row flex-basis (130px) would
   become HEIGHT - neutralize it here. */
.trade-panel-left-col {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 146px;
}

.trade-panel-left-col .symbol-search-wrapper {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: none;
}

/* The pair's LAST button carries option-button.css's trailing 5px margin,
   leaving the visible edge 5px shy of the pair box (and the stock button
   seam). The wrapper supplies inter-pair spacing - kill the inner one. */
.trade-panel-opt-shortcut .option-size-btn {
  margin-right: 0;
}

/* ── Chart command search (Ctrl+J) ── */
.chart-cmd {
  position: fixed;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  max-height: 300px;
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.chart-cmd-input {
  flex-shrink: 0;
  height: 28px;
  margin-bottom: 4px;
  padding: 0 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
  color: var(--text);
  font: inherit;
  user-select: text;
}
.chart-cmd-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.chart-cmd-list .chart-popup-row.selected {
  background: var(--bg-hover);
  color: var(--text);
}
.chart-cmd-list .chart-popup-row:hover {
  background: transparent;
}
.chart-cmd-list .chart-popup-row.selected:hover {
  background: var(--bg-hover);
}
.chart-cmd-group {
  flex-shrink: 0;
  width: 108px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-cmd-empty {
  padding: 6px 5px;
  color: var(--text-muted);
}

/* Indicators menu: a shelf of categories, each opening its items to the side */
.indicator-shelf {
  position: relative;
  min-width: 96px;
}
/* a menu holding a shelf is as wide as its category names */
.chart-popup:has(> .indicator-shelf),
.cpm-sub:has(> .indicator-shelf) {
  min-width: 0;
}
.indicator-shelf .chart-popup-row.open {
  background: var(--bg-hover);
  color: var(--text);
}
.indicator-shelf-arrow {
  margin-left: auto;
  color: var(--text-muted);
}
.indicator-shelf-flyout {
  position: absolute;
  width: max-content;
  min-width: 0;
  max-width: 260px;
  margin: 0 6px;
  z-index: 1;
}
.indicator-shelf-flyout .chart-popup-row {
  gap: 14px;
}
.indicator-shelf-flyout .indicator-sets {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.indicator-shelf-flyout .indicator-sets > .chart-popup-label {
  display: none;
}
.indicator-shelf-search {
  display: block;
  width: 100%;
  height: 22px;
  margin: 0 0 4px;
  text-align: left;
  padding: 0 6px;
}
.indicator-shelf-empty {
  padding: 4px 5px;
  color: var(--text-muted);
}
.indicator-shelf.searching {
  min-width: 190px;
}
/* shared by the overlay CLI window and the CLI panel (cli.css only loads in the overlay) */
.cli-row {
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

.cli-row.cli-cmd {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 1px 6px 1px 4px;
  color: var(--text);
}

.cli-res + .cli-cmd {
  margin-top: 4px;
}

.cli-cmd .cli-cmd-text {
  flex: 1;
  min-width: 0;
}

.cli-prompt {
  color: var(--news-marker, khaki);
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}

.cli-time {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 0.82em;
  user-select: none;
}

.cli-row.cli-res {
  margin-left: 8px;
  padding: 1px 6px 1px 9px;
  border-left: 2px solid var(--text-dim);
  color: var(--news-marker, khaki);
}

.cli-cmd + .cli-res {
  margin-top: 2px;
}

.cli-row.cli-res.cli-ok {
  border-left-color: var(--profit);
}

.cli-row.cli-res.cli-err {
  border-left-color: var(--loss);
  color: var(--loss);
}

.cli-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 5px 8px;
  background: transparent;
}

.cli-input-row:focus-within {
  background: var(--bg-hover);
}

.cli-input-row .cli-input,
.cli-input-row .cli-input:focus {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  outline: none;
  color: var(--text) !important;
  background: transparent !important;
  font-size: inherit;
}

.cli-input-row .cli-input::placeholder {
  color: var(--text-dim) !important;
}
