.react-grid-layout {
  position: relative;
  transition: height 200ms ease;
}
.react-grid-item {
  transition: all 200ms ease;
  transition-property: left, top, width, height;
}
.react-grid-item img {
  pointer-events: none;
  user-select: none;
}
.react-grid-item.cssTransforms {
  transition-property: transform, width, height;
}
.react-grid-item.resizing {
  transition: none;
  z-index: 1;
  will-change: width, height;
}

.react-grid-item.react-draggable-dragging {
  transition: none;
  z-index: 3;
  will-change: transform;
}

.react-grid-item.dropping {
  visibility: hidden;
}

.react-grid-item.react-grid-placeholder {
  background: red;
  opacity: 0.2;
  transition-duration: 100ms;
  z-index: 2;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -o-user-select: none;
  user-select: none;
}

.react-grid-item.react-grid-placeholder.placeholder-resizing {
  transition: none;
}

.react-grid-item > .react-resizable-handle {
  position: absolute;
  width: 20px;
  height: 20px;
}

.react-grid-item > .react-resizable-handle::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 5px;
  height: 5px;
  border-right: 2px solid rgba(0, 0, 0, 0.4);
  border-bottom: 2px solid rgba(0, 0, 0, 0.4);
}

.react-resizable-hide > .react-resizable-handle {
  display: none;
}

.react-grid-item > .react-resizable-handle.react-resizable-handle-sw {
  bottom: 0;
  left: 0;
  cursor: sw-resize;
  transform: rotate(90deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-se {
  bottom: 0;
  right: 0;
  cursor: se-resize;
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-nw {
  top: 0;
  left: 0;
  cursor: nw-resize;
  transform: rotate(180deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-ne {
  top: 0;
  right: 0;
  cursor: ne-resize;
  transform: rotate(270deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-w,
.react-grid-item > .react-resizable-handle.react-resizable-handle-e {
  top: 50%;
  margin-top: -10px;
  cursor: ew-resize;
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-w {
  left: 0;
  transform: rotate(135deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-e {
  right: 0;
  transform: rotate(315deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-n,
.react-grid-item > .react-resizable-handle.react-resizable-handle-s {
  left: 50%;
  margin-left: -10px;
  cursor: ns-resize;
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-n {
  top: 0;
  transform: rotate(225deg);
}
.react-grid-item > .react-resizable-handle.react-resizable-handle-s {
  bottom: 0;
  transform: rotate(45deg);
}
.react-resizable {
  position: relative;
}
.react-resizable-handle {
  position: absolute;
  width: 20px;
  height: 20px;
  background-repeat: no-repeat;
  background-origin: content-box;
  box-sizing: border-box;
  background-image: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA2IDYiIHN0eWxlPSJiYWNrZ3JvdW5kLWNvbG9yOiNmZmZmZmYwMCIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSI2cHgiIGhlaWdodD0iNnB4Ij48ZyBvcGFjaXR5PSIwLjMwMiI+PHBhdGggZD0iTSA2IDYgTCAwIDYgTCAwIDQuMiBMIDQgNC4yIEwgNC4yIDQuMiBMIDQuMiAwIEwgNiAwIEwgNiA2IEwgNiA2IFoiIGZpbGw9IiMwMDAwMDAiLz48L2c+PC9zdmc+');
  background-position: bottom right;
  padding: 0 3px 3px 0;
}
.react-resizable-handle-sw {
  bottom: 0;
  left: 0;
  cursor: sw-resize;
  transform: rotate(90deg);
}
.react-resizable-handle-se {
  bottom: 0;
  right: 0;
  cursor: se-resize;
}
.react-resizable-handle-nw {
  top: 0;
  left: 0;
  cursor: nw-resize;
  transform: rotate(180deg);
}
.react-resizable-handle-ne {
  top: 0;
  right: 0;
  cursor: ne-resize;
  transform: rotate(270deg);
}
.react-resizable-handle-w,
.react-resizable-handle-e {
  top: 50%;
  margin-top: -10px;
  cursor: ew-resize;
}
.react-resizable-handle-w {
  left: 0;
  transform: rotate(135deg);
}
.react-resizable-handle-e {
  right: 0;
  transform: rotate(315deg);
}
.react-resizable-handle-n,
.react-resizable-handle-s {
  left: 50%;
  margin-left: -10px;
  cursor: ns-resize;
}
.react-resizable-handle-n {
  top: 0;
  transform: rotate(225deg);
}
.react-resizable-handle-s {
  bottom: 0;
  transform: rotate(45deg);
}.flow-container {
  padding: 5px;
  height: calc(100% - 30px);
  overflow-y: auto;
  border-radius: 5px;
  white-space: pre-wrap;
}

.flow-item {
  padding: 5px 0;
  margin-bottom: 3px;
  border-radius: 3px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.1s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flow-item:hover {
  background-color: var(--bg-hover) !important;
  color: var(--text);
}

.flow-item-left {
  display: flex;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 50px;
  cursor: pointer;
}

.flow-item-left-color {
  width: 5px;
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
}

.flow-item-content {
  padding-left: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.flow-item-time,
.flow-item-stock-price,
.flow-item-strike,
.flow-item-expiration,
.flow-item-stock {
  flex: 0.75;
}

.flow-item-stock {
  font-weight: bold;
}

.flow-item-tag {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.flow-item-tag span {
  margin-right: 8px;
  font-weight: bold;
  font-size: 12px;
  font-family: "Fira Code", monospace;
  display: inline-block;
  text-align: right;
}

.flow-item-tag span:last-child {
  margin-left: 8px;
  width: 40px;
  padding: 3px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: bold;
  text-align: center;
}
/* Watchlist Panel Styles */
.watchlist-panel {
  padding: 4px 6px 6px 6px;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  font-family: 'Quantico', monospace;
  user-select: none;
}

.watchlist-panel * {
  font-family: inherit;
}

/* Title Bar */
.watchlist-title-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
  min-width: 0;
  flex-wrap: wrap;
}

.watchlist-dropdown-container {
  position: relative;
}

.watchlist-dropdown-button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.watchlist-dropdown-button:hover {
  background-color: var(--bg-alt);
}

/* Scanner Dropdown Styles */
.scanner-dropdown-container {
  position: relative;
}

/* Consolidated Button Styles */
.watchlist-button {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 2px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.watchlist-button:hover {
  background: var(--bg-hover);
}

/* Special button variants */
.watchlist-button--sort {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  min-width: 32px;
  transition: all 0.2s ease;
}

.watchlist-button--sort:hover {
  color: var(--text);
}

.watchlist-button--sort.active {
  background: #4a5568;
  color: var(--text);
  border-color: #718096;
}

.watchlist-button--action {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 1px 2px;
  font-size: 10px;
  transition:
    color 0.2s,
    transform 0.2s;
  border-radius: 1px;
}

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

.watchlist-button--edit:hover {
  color: var(--profit);
}

.watchlist-button--delete:hover {
  color: #ff5c5c;
}

.watchlist-button--remove {
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: 14px;
  padding: 0 2px;
  width: 20px;
  text-align: center;
  transition:
    color 0.2s,
    transform 0.2s;
}

.watchlist-button--remove:hover {
  color: #ff5c5c;
  transform: scale(1.1);
}

.scanner-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 4px;
  z-index: 1000;
  min-width: 120px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.scanner-dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  padding: 4px 8px;
  text-align: left;
  cursor: pointer;
  font-size: 12px;
  border-radius: 2px;
  transition: background-color 0.2s ease;
}

.scanner-dropdown-item:hover {
  background-color: var(--bg-hover);
}

.watchlist-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-alt);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 4px;
  z-index: 1000;
  min-width: 180px;
  max-width: 250px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.watchlist-dropdown-header {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.watchlist-search-input {
  flex: 1;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 12px;
  min-width: 0;
}

.watchlist-search-input:focus {
  outline: none;
  border-color: var(--text);
}

.watchlist-items-container {
  max-height: 60vh;
  overflow-y: auto;
}

.watchlist-no-results {
  padding: 8px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

.watchlist-item {
  padding: 2px 3px;
  cursor: pointer;
  background: transparent;
  border-radius: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.2s ease;
  font-size: 12px;
  margin-bottom: 1px;
}

.watchlist-item:hover,
.watchlist-item.active {
  background-color: var(--bg-hover);
}

.watchlist-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.watchlist-basket-change {
  font-size: 10px;
  font-weight: 400;
  padding: 1px 4px;
  border-radius: 2px;
  flex-shrink: 0;
  min-width: 40px;
  text-align: right;
}

.watchlist-name-text {
  font-weight: 400;
}

.watchlist-matching-symbols {
  color: #6c6c6c;
  font-size: 10px;
  font-weight: 400;
  margin-left: 2px;
  opacity: 0.9;
}

.watchlist-basket-change.positive {
  color: var(--profit);
  background-color: rgba(0, 255, 136, 0.1);
}

.watchlist-basket-change.negative {
  color: #ff5c5c;
  background-color: rgba(255, 92, 92, 0.1);
}

.watchlist-basket-change.neutral {
  color: var(--text-muted);
  background-color: rgba(136, 136, 136, 0.1);
}

.watchlist-item-actions {
  display: flex;
  gap: 1px;
  margin-left: 4px;
  flex-shrink: 0;
}

.watchlist-name-input {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 2px 4px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 500;
  width: 100px;
  min-width: 0;
}

/* Watchlist Table */
.watchlist-table-container {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
}

.watchlist-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.watchlist-table th,
.watchlist-table td {
  padding: 4px 8px;
  text-align: left;
  font-weight: 500;
  font-size: 13px;
  box-sizing: border-box;
}

.watchlist-table th {
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

/* Sort Icon Styles */
.sort-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  position: relative;
}

.sort-neutral::before,
.sort-neutral::after {
  content: '';
  position: absolute;
  left: 50%;
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
}

.sort-neutral::before {
  top: 1px;
  border-bottom: 3px solid var(--text);
}

.sort-neutral::after {
  bottom: 1px;
  border-top: 3px solid var(--text);
}

.sort-asc::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid var(--text);
}

.sort-desc::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 6px solid var(--text);
}

.watchlist-table th.sortable {
  min-width: 80px;
}

.watchlist-table tbody tr {
  border-bottom: 1px solid var(--bg-alt);
  transition: background-color 0.2s ease;
}

.watchlist-table tbody tr:hover {
  background-color: var(--bg-alt);
}

.watchlist-row-selected {
  background-color: #2d3748 !important;
  /* border-left: 3px solid #4a9eff !important; */
  /* box-shadow: inset 0 0 0 1px #4a9eff !important; */
  position: relative;
}

.watchlist-row-selected:hover {
  background-color: #2d3748 !important;
}

.watchlist-symbol-cell {
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease;
  text-align: left;
}

.watchlist-symbol-cell:hover {
  color: var(--text-dim);
}

.watchlist-price-cell,
.watchlist-volume-cell,
.watchlist-volumenotional-cell,
.watchlist-change-cell {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.watchlist-change-positive {
  color: var(--profit);
}

.watchlist-change-negative {
  color: #ff5c5c;
}

.watchlist-change-neutral {
  color: var(--text);
}

/* Add specific width for the remove button column */
.watchlist-table th:last-child,
.watchlist-table td:last-child {
  width: 24px;
  min-width: 24px;
  max-width: 24px;
  padding: 4px 2px;
  text-align: center;
}

.watchlist-edit-input {
  width: 80px;
  font-weight: 600;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  padding: 2px 4px;
  border-radius: 2px;
}

/* ── View toggle (List / Scanner) ── */
.watchlist-view-toggle {
  display: flex;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.watchlist-view-tab {
  background: var(--bg-alt);
  color: var(--text-muted);
  border: none;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.watchlist-view-tab.active {
  background: var(--accent);
  color: #fff;
}

/* ── Scanner view ── */
.scanner-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.scanner-mode-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.scanner-mode-tab {
  background: var(--bg-alt);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.scanner-mode-tab:hover {
  background: var(--bg-hover);
}

.scanner-mode-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Scanner movers table ── */
.scanner-movers-table {
  width: 100%;
  /* separate, not collapse: collapsed borders break sticky thead painting
     in Chromium (rows draw over the stuck header) */
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.scanner-movers-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 2px 6px;
  position: sticky;
  top: 0;
  z-index: 2;
  /* --bg does not exist in the theme palette (bg-base/bg-alt/bg-deep do) --
     it resolved transparent and rows showed through the stuck header */
  background: var(--bg-deep);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}

.scanner-movers-table th.num,
.scanner-movers-table td.num {
  text-align: right;
}

.scanner-movers-table td {
  padding: 2px 6px;
  border-bottom: 1px solid var(--bg-alt);
}

.scanner-movers-table tbody tr {
  cursor: pointer;
}

.scanner-movers-table tbody tr:hover {
  background: var(--bg-hover);
}

.scanner-movers-table tbody tr.selected {
  background: var(--bg-alt);
}

.scanner-movers-symbol {
  font-weight: 700;
  color: var(--text);
}

.scanner-view-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.scanner-toolbar-label {
  font-size: 11px;
  color: var(--text-muted);
}

.scanner-min-filter {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.scanner-min-input {
  width: 44px;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 1px 4px;
  font-size: 11px;
}

.scanner-loading {
  color: var(--text-muted);
  font-size: 11px;
}

.scanner-picker {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--bg-alt);
  margin-bottom: 6px;
  padding: 2px 0;
}

.scanner-picker-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
}

.scanner-picker-item:hover {
  background: var(--bg-hover);
}

.scanner-picker-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-picker-count {
  color: var(--text-muted);
  font-size: 11px;
}

.scanner-picker-empty,
.scanner-section-empty {
  color: var(--text-muted);
  font-size: 12px;
  padding: 6px 8px;
}

.scanner-sections {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.scanner-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 8px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.scanner-section {
  margin-bottom: 10px;
}

.scanner-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0 4px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.scanner-section-name {
  flex: 1;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scanner-section-change {
  font-size: 11px;
  font-weight: 600;
}

.scanner-section-hits {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.scanner-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.scanner-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px 2px 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color 0.1s ease,
    background 0.1s ease;
}

.scanner-chip:hover {
  filter: brightness(1.12);
}

/* Direction-tinted chips: the whole pill leans green (uptrend) or red
   (downtrend) so the two views read at a glance and never look alike. */
.scanner-chip-strong {
  border-color: color-mix(in srgb, var(--profit) 45%, transparent);
  background: color-mix(in srgb, var(--profit) 12%, var(--bg-alt));
}

.scanner-chip-weak {
  border-color: color-mix(in srgb, var(--loss) 45%, transparent);
  background: color-mix(in srgb, var(--loss) 12%, var(--bg-alt));
}

.scanner-chip.selected {
  border-color: var(--text);
}

/* The count sits in a small solid badge in the direction's color. */
.scanner-chip-hits {
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
  padding: 2px 5px;
  border-radius: 3px;
  color: #fff;
}

.scanner-chip-strong .scanner-chip-hits {
  background: var(--profit);
  /* --profit is a bright green; white washes out on it, so use dark text
     (kept in-hue rather than flat black). --loss is darker, so weak keeps #fff. */
  color: color-mix(in srgb, var(--profit) 24%, #000);
}

.scanner-chip-weak .scanner-chip-hits {
  background: var(--loss);
}

.watchlist-add-row {
  color: var(--text-muted);
}

/* Empty State Styles */
.watchlist-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--text-muted);
}

.watchlist-empty-message {
  text-align: center;
  max-width: 300px;
}

.watchlist-empty-message h3 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.watchlist-empty-message p {
  margin: 0 0 16px 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-muted);
}

/* Ticker Description Tooltip */
.ticker-description-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 11px;
  line-height: 1.4;
  max-width: 300px;
  min-width: 200px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-family: 'Inter', sans-serif;
  font-weight: 400;
  white-space: normal;
  word-wrap: break-word;
  margin-top: 4px;
  opacity: 0;
  animation: fadeInTooltip 0.2s ease-in-out forwards;
}

.ticker-description-tooltip::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 8px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-bottom: 5px solid var(--bg-alt);
}

@keyframes fadeInTooltip {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Watchlist Settings Modal Styles */
.calendar-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  font-family: 'Quantico', monospace;
  user-select: none;
  -webkit-user-select: none;
}

/* Top bar */
.calendar-panel .cal-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.calendar-panel .cal-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-panel .cal-nav-btn {
  padding: 2px 6px;
  font-size: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Quantico', monospace;
}

.calendar-panel .cal-nav-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.calendar-panel .cal-month-label {
  font-size: 12px;
  font-weight: bold;
  color: var(--text);
  min-width: 120px;
  text-align: center;
}

.calendar-panel .cal-today-btn {
  padding: 2px 8px;
  font-size: 10px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Quantico', monospace;
  margin-left: 4px;
}

.calendar-panel .cal-today-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.calendar-panel .cal-search {
  flex: 0 0 auto;
}

.calendar-panel .cal-search-input {
  width: 110px;
  padding: 2px 6px;
  font-size: 10px;
  font-family: 'Quantico', monospace;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  color: var(--text);
  outline: none;
}

.calendar-panel .cal-search-input:focus {
  border-color: rgba(255, 255, 255, 0.2);
}

.calendar-panel .cal-search-input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.calendar-panel .cal-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.calendar-panel .cal-select {
  padding: 2px 4px;
  font-size: 10px;
  font-family: 'Quantico', monospace;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.calendar-panel .cal-select option {
  background: var(--bg-input);
  color: var(--text);
}

.calendar-panel .cal-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  white-space: nowrap;
}

.calendar-panel .cal-filter-checkbox input {
  margin: 0;
  cursor: pointer;
}

.calendar-panel .cal-zoom {
  display: flex;
  gap: 2px;
}

.calendar-panel .cal-zoom-btn {
  padding: 1px 5px;
  font-size: 9px;
  font-family: 'Quantico', monospace;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.15s;
}

.calendar-panel .cal-zoom-btn:hover {
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
}

.calendar-panel .cal-zoom-btn--active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.calendar-panel .cal-count {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  margin-left: auto;
  padding-right: 4px;
  white-space: nowrap;
}

/* Event type filter chips */
.calendar-panel .cal-type-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 22px;
}

.calendar-panel .cal-type-chip {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  font-size: 9px;
  font-family: 'Quantico', monospace;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.calendar-panel .cal-type-chip:hover {
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.15);
}

.calendar-panel .cal-type-chip--active {
  background: rgba(255, 255, 255, 0.05);
}

.calendar-panel .cal-type-chip--excluded {
  background: rgba(255, 92, 92, 0.06);
  opacity: 0.7;
}

.calendar-panel .cal-type-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-panel .cal-type-clear {
  padding: 1px 6px;
  font-size: 9px;
  font-family: 'Quantico', monospace;
  background: rgba(255, 92, 92, 0.08);
  border: 1px solid rgba(255, 92, 92, 0.15);
  border-radius: 10px;
  color: #ff5c5c;
  cursor: pointer;
  transition: all 0.15s;
}

.calendar-panel .cal-type-clear:hover {
  background: rgba(255, 92, 92, 0.15);
}

/* Body: grid + sidebar */
.calendar-panel .cal-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.calendar-panel .cal-grid-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Day of week header */
.calendar-panel .cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex-shrink: 0;
}

.calendar-panel .cal-dow {
  padding: 3px 4px;
  font-size: 9px;
  text-align: center;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* Calendar grid */
.calendar-panel .cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  flex: 1;
  overflow: hidden;
}

.calendar-panel .cal-cell {
  border-right: 1px solid rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  padding: 1px 3px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: background 0.1s;
  min-height: 0;
}

/* pnl.css styles the same .cal-* class names (its grid is 7 days + a
   weekly P&L column = 8 columns) and stylesheet load order is
   bundler-dependent -- EVERY selector in this file is scoped under
   .calendar-panel so the events calendar always wins its own cascade. */
.calendar-panel .cal-grid-container .cal-cell {
  align-items: stretch;
}

.calendar-panel .cal-cell:hover {
  background: rgba(255, 255, 255, 0.02);
}

.calendar-panel .cal-cell--dim {
  opacity: 0.3;
}

.calendar-panel .cal-cell--today {
  background: rgba(0, 255, 136, 0.04);
}

.calendar-panel .cal-cell--today .cal-cell-day {
  color: var(--profit);
  font-weight: bold;
}

.calendar-panel .cal-cell--selected {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.1);
}

.calendar-panel .cal-cell-day {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.1;
  flex-shrink: 0;
}

.calendar-panel .cal-cell-events {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.calendar-panel .cal-cell-event {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

.calendar-panel .cal-event-logo {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  flex-shrink: 0;
  object-fit: contain;
}

.calendar-panel .cal-event-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-panel .cal-event-ticker {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: bold;
}

.calendar-panel .cal-cell-more {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.3);
  text-align: center;
  flex-shrink: 0;
  height: 13px;
  line-height: 13px;
}

.calendar-panel .cal-cell-count {
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.2);
}

/* Sidebar */
.calendar-panel .cal-sidebar {
  width: 260px;
  flex-shrink: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-panel .cal-sidebar-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.calendar-panel .cal-sidebar-date {
  font-size: 11px;
  color: var(--text);
  font-weight: bold;
}

.calendar-panel .cal-sidebar-count {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.3);
  margin-left: auto;
}

.calendar-panel .cal-sidebar-close {
  padding: 0 4px;
  font-size: 12px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: color 0.15s;
}

.calendar-panel .cal-sidebar-close:hover {
  color: var(--text);
}

.calendar-panel .cal-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 2px 0;
}

.calendar-panel .cal-sidebar-item {
  padding: 3px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.1s;
}

.calendar-panel .cal-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.calendar-panel .cal-sidebar-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.calendar-panel .cal-sidebar-company {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 24px;
}

.calendar-panel .cal-sidebar-name {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 24px;
}

.calendar-panel .cal-sidebar-logo {
  width: 18px;
  height: 18px;
  border-radius: 2px;
  flex-shrink: 0;
  object-fit: contain;
}

.calendar-panel .cal-sidebar-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.calendar-panel .cal-sidebar-ticker {
  font-size: 12px;
  font-weight: bold;
  color: var(--text);
  min-width: 40px;
}

.calendar-panel .cal-sidebar-type {
  font-size: 9px;
}

.calendar-panel .cal-sidebar-status {
  font-size: 8px;
  padding: 0 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.4);
}

.calendar-panel .cal-sidebar-status--confirmed {
  background: rgba(0, 255, 136, 0.1);
  color: rgba(0, 255, 136, 0.7);
}

.calendar-panel .cal-sidebar-mcap {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  margin-left: auto;
  white-space: nowrap;
}

/* Loading / Error */
.calendar-panel .cal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}

.calendar-panel .cal-error {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #ff5c5c;
  font-size: 12px;
}

/* View toggle button */
.calendar-panel .cal-view-toggle {
  padding: 2px 8px;
  font-size: 10px;
  font-family: 'Quantico', monospace;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.calendar-panel .cal-view-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.calendar-panel .cal-view-toggle--active {
  color: #ffb347;
  border-color: rgba(255, 179, 71, 0.3);
  background: rgba(255, 179, 71, 0.08);
}

.calendar-panel .cal-view-toggle--active:hover {
  background: rgba(255, 179, 71, 0.12);
}

/* Weekly Earnings Grid */
.calendar-panel .cal-week-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  flex: 1;
  overflow: hidden;
  height: 100%;
}

.calendar-panel .cal-week-col {
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.calendar-panel .cal-week-col:last-child {
  border-right: none;
}

.calendar-panel .cal-week-day-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.calendar-panel .cal-week-day-header--today {
  background: rgba(0, 255, 136, 0.04);
}

.calendar-panel .cal-week-day-name {
  font-size: 10px;
  font-weight: bold;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.calendar-panel .cal-week-day-header--today .cal-week-day-name {
  color: var(--profit);
}

.calendar-panel .cal-week-day-date {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.35);
}

.calendar-panel .cal-week-day-header--today .cal-week-day-date {
  color: rgba(0, 255, 136, 0.5);
}

.calendar-panel .cal-week-half {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.calendar-panel .cal-week-half + .cal-week-half {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.calendar-panel .cal-week-half-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 2px 2px;
}

.calendar-panel .cal-week-section {
  padding: 3px 4px 2px;
  font-size: 8px;
  font-weight: bold;
  color: rgba(100, 200, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(100, 200, 255, 0.08);
  flex-shrink: 0;
}

.calendar-panel .cal-week-section--after {
  color: rgba(255, 179, 71, 0.6);
  border-bottom-color: rgba(255, 179, 71, 0.08);
}

.calendar-panel .cal-week-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  transition: background 0.1s;
}

.calendar-panel .cal-week-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Unverified rows: unknown report time, tentative date, or a date the
   backend corrected after its sources disagreed (tooltip carries why) */
.calendar-panel .cal-week-item--uncertain {
  border-left: 2px solid rgba(230, 180, 60, 0.55);
  background: rgba(230, 180, 60, 0.05);
}

.calendar-panel .cal-week-item--uncertain:hover {
  background: rgba(230, 180, 60, 0.1);
}

.calendar-panel .cal-week-logo {
  width: 16px;
  height: 16px;
  border-radius: 2px;
  flex-shrink: 0;
  object-fit: contain;
}

.calendar-panel .cal-week-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.2);
}

.calendar-panel .cal-week-ticker {
  font-size: 11px;
  font-weight: bold;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-panel .cal-week-mcap {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.35);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

.calendar-panel .cal-week-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.15);
}

/* -- Fable pass: motion, depth, econ/dividend lanes -------------------- */

.calendar-panel .cal-body {
  animation: cal-fade-in 0.25s ease both;
}

@keyframes cal-fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.calendar-panel .cal-cell {
  transition:
    background 0.12s ease,
    box-shadow 0.12s ease;
}

.calendar-panel .cal-cell:hover {
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}

.calendar-panel .cal-cell--today {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--profit, #00ff88) 35%, transparent);
}

.calendar-panel .cal-cell--selected {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent, #4d8dff) 55%, transparent);
}

.calendar-panel .cal-cell-count {
  top: 2px;
  right: 3px;
  padding: 0 4px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.4);
  line-height: 13px;
}

.calendar-panel .cal-cell-event {
  border-radius: 3px;
  padding: 0 2px;
  transition: background 0.1s ease;
}

.calendar-panel .cal-cell-event:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Economic events: ticker-less macro rows, impact-colored dot, softer text */
.calendar-panel .cal-cell-event--econ .cal-event-ticker {
  font-weight: normal;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.65);
  font-style: italic;
}

.calendar-panel .cal-type-chip {
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.15s ease;
}

.calendar-panel .cal-type-chip:hover {
  transform: translateY(-1px);
}

.calendar-panel .cal-nav-btn:hover,
.calendar-panel .cal-today-btn:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.calendar-panel .cal-search-input {
  border-radius: 4px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.calendar-panel .cal-search-input:focus {
  border-color: color-mix(in srgb, var(--accent, #4d8dff) 55%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent, #4d8dff) 12%, transparent);
}

.calendar-panel .cal-sidebar {
  animation: cal-slide-in 0.18s ease both;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent);
}

@keyframes cal-slide-in {
  from {
    opacity: 0;
    transform: translateX(10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.calendar-panel .cal-sidebar-item {
  transition: background 0.1s ease;
  border-radius: 4px;
}

.calendar-panel .cal-sidebar-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* Econ estimate/actual + dividend pay-date detail rows */
.calendar-panel .cal-sidebar-detail {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  padding: 1px 0 2px 14px;
}

.calendar-panel .cal-sidebar-detail--actual {
  color: var(--profit, #00ff88);
}

.calendar-panel .cal-sidebar-detail--impact {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 176, 32, 0.8);
}

.calendar-panel .cal-sidebar-list::-webkit-scrollbar,
.calendar-panel .cal-week-half-list::-webkit-scrollbar {
  width: 6px;
}

.calendar-panel .cal-sidebar-list::-webkit-scrollbar-thumb,
.calendar-panel .cal-week-half-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 3px;
}

.calendar-panel .cal-week-item {
  border-radius: 3px;
  transition: background 0.1s ease;
}

.calendar-panel .cal-week-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

@media (prefers-reduced-motion: reduce) {
  .calendar-panel * {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* Preset quick-filters + impact levels */
.calendar-panel .cal-preset {
  padding: 1px 9px;
  font-size: 9px;
  font-family: 'Quantico', monospace;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.calendar-panel .cal-preset:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
}

.calendar-panel .cal-preset--active {
  color: var(--accent, #4d8dff);
  border-color: color-mix(in srgb, var(--accent, #4d8dff) 55%, transparent);
  background: color-mix(in srgb, var(--accent, #4d8dff) 10%, transparent);
}

.calendar-panel .cal-preset-sep {
  width: 1px;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 2px;
}

.calendar-panel .cal-sidebar-detail--impact-high {
  color: #ff5c5c;
}

/* Day cells scroll in place -- wheel works, no visible scrollbar chrome */
.calendar-panel .cal-cell-events {
  overflow-y: auto;
  scrollbar-width: none;
}

.calendar-panel .cal-cell-events::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.calendar-panel .cal-sidebar-econ-name {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.calendar-panel .cal-sidebar-detail {
  padding-left: 24px;
}

.calendar-panel .cal-sidebar-detail--econ {
  padding-left: 13px;
}

.calendar-panel .cal-sidebar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.calendar-panel .cal-sidebar-link {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 10px;
  line-height: 1;
  padding: 1px 4px;
  cursor: pointer;
  transition:
    color 0.12s ease,
    border-color 0.12s ease;
}

.calendar-panel .cal-sidebar-link:hover {
  color: var(--accent, #4d8dff);
  border-color: color-mix(in srgb, var(--accent, #4d8dff) 55%, transparent);
}

.calendar-panel .cal-sidebar-div-amt {
  color: var(--profit, #00ff88);
}
.chart-grid-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--panel-bg, #191919);
  user-select: none;
  -webkit-user-select: none;
}

/* Inputs inside the grid still need to be selectable/typeable. */
.chart-grid-panel input,
.chart-grid-panel textarea {
  user-select: text;
  -webkit-user-select: text;
}

.chart-grid-panel.is-fullscreen {
  background: var(--panel-bg, #191919);
}

/* Fullscreen mode: hide per-cell chrome so it's just the charts. */
.chart-grid-panel.is-fullscreen .chart-grid-cell-header {
  display: none;
}

.chart-grid-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.chart-grid-fs-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #aaa);
  width: 22px;
  height: 22px;
  font-size: 14px;
  line-height: 1;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}
.chart-grid-fs-button:hover {
  color: var(--text, #fff);
  border-color: rgba(255, 255, 255, 0.2);
}

.chart-grid-cells {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 2px;
  padding: 2px;
}

.chart-grid-cell {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border: 1px solid transparent;
  background: var(--panel-bg, #191919);
  overflow: hidden;
  position: relative;
}

.chart-grid-cell.focused {
  border-color: #c4b5fd;
}

.chart-grid-cell-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
}

.chart-grid-cell-header .chart-grid-symbol-search {
  flex: 1;
  min-width: 0;
}

.chart-grid-cell-interval {
  font-size: 11px;
  color: var(--text-muted, #aaa);
  font-family: monospace;
  padding: 0 6px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  user-select: none;
}

.chart-grid-cell-chart {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}

.chart-grid-cell-chart-inner {
  position: absolute;
  inset: 0;
}

.chart-grid-cell-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted, #777);
  font-size: 13px;
  gap: 6px;
  text-align: center;
  padding: 16px;
}

.chart-grid-cell-empty-hint {
  font-size: 11px;
  opacity: 0.6;
}

/* Layout picker */
.chart-grid-layout-picker {
  position: relative;
}

.chart-grid-layout-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted, #aaa);
  width: 26px;
  height: 22px;
  border-radius: 3px;
  cursor: pointer;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chart-grid-layout-button:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.chart-grid-layout-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  background: #1b1b1b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  min-width: 280px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.chart-grid-layout-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted, #aaa);
  font-size: 10px;
  padding: 6px;
  cursor: pointer;
  border-radius: 3px;
}
.chart-grid-layout-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #fff);
}
.chart-grid-layout-option.selected {
  border-color: #c4b5fd;
  color: var(--text, #fff);
}

.chart-grid-preset-glyph {
  display: grid;
  gap: 2px;
  width: 28px;
  height: 20px;
}
.chart-grid-preset-glyph-cell {
  background: currentColor;
  opacity: 0.6;
  border-radius: 1px;
}
.symbol-search-container {
  position: relative;
  width: 100%;
  height: 100%;
}

.symbol-search-input {
  padding: 6px 8px;
  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: 100%;
  height: 100%;
  transition: border-color 0.2s ease;
}

.symbol-search-input:focus {
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.symbol-search-input::placeholder {
  color: var(--text-muted);
}

.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 400px;
  max-height: 400px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  user-select: none;
}

.suggestions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: 'Quantico', monospace;
}

.suggestions-table th,
.suggestions-table td {
  padding: 2px 6px;
  text-align: left;
  border-bottom: 1px solid var(--bg-alt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.suggestions-table th {
  background: var(--bg-alt);
  color: var(--text);
  position: sticky;
  top: 0;
  font-weight: 600;
  font-size: 10px;
  font-family: 'Quantico', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  height: 22px;
  cursor: pointer;
}

.suggestions-table tr {
  height: 28px;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.suggestions-table tr:hover,
.suggestions-table tr.highlighted {
  background: var(--bg-alt);
}

.suggestions-table td:first-child {
  font-weight: 600;
  color: var(--text);
  font-family: 'Quantico', monospace;
  font-size: 12px;
}

.suggestions-table td:nth-child(2) {
  max-width: 140px;
  font-size: 11px;
  font-family: 'Quantico', monospace;
}

.suggestions-table td:nth-child(3) {
  text-align: right;
  font-family: 'Quantico', monospace;
  color: #bdbdbd;
  font-weight: 700;
  font-size: 12px;
}

.no-suggestions {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-family: 'Quantico', monospace;
  padding: 8px;
}

/* Scrollbar */
.suggestions-dropdown::-webkit-scrollbar {
  width: 8px;
}

.suggestions-dropdown::-webkit-scrollbar-track {
  background: var(--bg-base);
}

.suggestions-dropdown::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}

.suggestions-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Sort indicators */
.suggestions-table th::after {
  content: '';
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0.3;
}

.suggestions-table th:hover::after {
  opacity: 0.6;
}

/* Loading state */
.suggestions-dropdown.loading {
  opacity: 0.7;
}

.suggestions-dropdown.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border: 2px solid #333;
  border-top: 2px solid #4a9eff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Responsive */
@media (max-width: 768px) {
  .suggestions-dropdown {
    width: 100vw;
    left: 0;
    right: 0;
  }
}

@media (max-width: 900px) {
  .suggestions-dropdown {
    width: 98vw;
  }
}
.fundamentals-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  font-family: 'Quantico', monospace;
  user-select: none;
  -webkit-user-select: none;
}

/* Top bar */
.fund-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.fund-tabs {
  display: flex;
  gap: 2px;
}

.fund-tab {
  padding: 3px 10px;
  font-size: 11px;
  font-family: 'Quantico', monospace;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s;
}

.fund-tab:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.04);
}

.fund-tab--active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

.fund-search-wrapper {
  flex: 1;
  max-width: 220px;
}

.fund-back-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-family: 'Quantico', monospace;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.15s;
}

.fund-back-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.fund-zoom {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.fund-zoom-btn {
  padding: 1px 5px;
  font-size: 9px;
  font-family: 'Quantico', monospace;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  color: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.15s;
}

.fund-zoom-btn:hover {
  color: rgba(255, 255, 255, 0.6);
  border-color: rgba(255, 255, 255, 0.12);
}

.fund-zoom-btn--active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Screener */
.fund-screener {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.fund-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.fund-filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.fund-filter-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
}

.fund-filter-input {
  width: 50px;
  padding: 2px 4px;
  font-size: 10px;
  font-family: 'Quantico', monospace;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  color: var(--text);
  outline: none;
}

.fund-filter-input:focus {
  border-color: rgba(255, 255, 255, 0.2);
}

.fund-filter-checkbox {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  white-space: nowrap;
}

.fund-filter-checkbox input {
  margin: 0;
  cursor: pointer;
}

.fund-table-wrapper {
  flex: 1;
  overflow: auto;
}

.fund-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.fund-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-input);
  padding: 4px 6px;
  text-align: right;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.45);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 10px;
}

.fund-table th:first-child {
  text-align: left;
}

.fund-table th:hover {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: dotted underline rgba(255, 255, 255, 0.3);
}

.fund-table th.fund-sort-active {
  color: var(--text);
}

.fund-sort-arrow {
  font-size: 9px;
  margin-left: 2px;
}

.fund-table td {
  padding: 3px 6px;
  text-align: right;
  color: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

.fund-table td:first-child {
  text-align: left;
  color: var(--text);
  font-weight: bold;
}

.fund-table tr {
  cursor: pointer;
  transition: background 0.1s;
}

.fund-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.fund-metric-strong {
  color: var(--profit) !important;
}

.fund-metric-positive {
  color: #88cc88 !important;
}

.fund-metric-negative {
  color: #ff5c5c !important;
}

.fund-metric-warn {
  color: #ffc832 !important;
}

.fund-score-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: bold;
}

.fund-score-high {
  background: rgba(0, 255, 136, 0.15);
  color: var(--profit);
}

.fund-score-mid {
  background: rgba(255, 200, 50, 0.15);
  color: #ffc832;
}

.fund-score-low {
  background: rgba(255, 92, 92, 0.1);
  color: rgba(255, 255, 255, 0.4);
}

/* Stock detail */
.fund-detail {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  padding: 0 6px 12px;
}

.fund-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
}

.fund-detail-symbol {
  font-size: 18px;
  font-weight: bold;
  color: var(--text);
}

.fund-detail-name {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
}

.fund-detail-badges {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.fund-badge {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
}

.fund-badge--good {
  background: rgba(0, 255, 136, 0.1);
  color: var(--profit);
}

.fund-badge--bad {
  background: rgba(255, 92, 92, 0.1);
  color: #ff5c5c;
}

.fund-badge--warn {
  background: rgba(255, 200, 50, 0.1);
  color: #ffc832;
}

.fund-chart-section {
  height: 280px;
  margin: 6px 0;
  flex-shrink: 0;
}

.fund-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
  padding: 4px 0;
}

.fund-card {
  background: var(--bg-alt);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  padding: 8px 10px;
}

.fund-card-title {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.fund-card-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.fund-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.fund-card-row-label {
  color: rgba(255, 255, 255, 0.45);
}

.fund-card-row-value {
  color: rgba(255, 255, 255, 0.8);
  font-family: 'Quantico', monospace;
}

.fund-quarters-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  margin-top: 6px;
}

.fund-quarters-table th {
  padding: 2px 4px;
  text-align: right;
  font-weight: normal;
  color: rgba(255, 255, 255, 0.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.fund-quarters-table th:first-child {
  text-align: left;
}

.fund-quarters-table td {
  padding: 2px 4px;
  text-align: right;
  color: rgba(255, 255, 255, 0.6);
}

.fund-quarters-table td:first-child {
  text-align: left;
  color: rgba(255, 255, 255, 0.4);
}

.fund-yoy-row td {
  font-size: 9px !important;
  color: rgba(255, 255, 255, 0.35) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03) !important;
}

.fund-yoy-row td:first-child {
  color: rgba(255, 255, 255, 0.25) !important;
  padding-left: 8px;
}

.fund-yoy-row td.fund-metric-strong {
  color: var(--profit) !important;
}

.fund-yoy-row td.fund-metric-positive {
  color: #88cc88 !important;
}

.fund-yoy-row td.fund-metric-negative {
  color: #ff5c5c !important;
}

.fund-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
}

.fund-error {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #ff5c5c;
  font-size: 12px;
}

.fund-count {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  margin-left: auto;
  padding-right: 4px;
}

/* AI Analysis section */
.fund-ai-section {
  margin-top: 6px;
}

.fund-ai-content {
  margin-top: 4px;
}

.fund-ai-result {
  font-size: 11px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  padding: 4px 0;
}

.fund-ai-result h1,
.fund-ai-result h2,
.fund-ai-result h3 {
  color: rgba(255, 255, 255, 0.9);
  margin: 8px 0 4px;
  font-family: 'Quantico', monospace;
}

.fund-ai-result h1 { font-size: 13px; }
.fund-ai-result h2 { font-size: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); padding-bottom: 2px; }
.fund-ai-result h3 { font-size: 11px; }

.fund-ai-result p {
  margin: 3px 0;
}

.fund-ai-result ul {
  margin: 3px 0;
  padding-left: 14px;
}

.fund-ai-result li {
  margin: 1px 0;
}

.fund-ai-result strong {
  color: rgba(255, 255, 255, 0.95);
}

.fund-ai-result code {
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 10px;
}

.fund-ai-result pre {
  background: rgba(255, 255, 255, 0.04);
  padding: 6px;
  border-radius: 3px;
  overflow-x: auto;
  font-size: 10px;
}

/* Strengths / Concerns side-by-side */
.fund-ai-verdicts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}

.fund-ai-verdict {
  padding: 6px 8px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.fund-ai-verdict--good {
  background: rgba(0, 255, 136, 0.03);
  border-color: rgba(0, 255, 136, 0.08);
}

.fund-ai-verdict--bad {
  background: rgba(255, 92, 92, 0.03);
  border-color: rgba(255, 92, 92, 0.08);
}

.fund-ai-verdict-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.4);
}

.fund-ai-verdict--good .fund-ai-verdict-title {
  color: var(--profit);
}

.fund-ai-verdict--bad .fund-ai-verdict-title {
  color: #ff5c5c;
}

/* Inline insight under tables */
.fund-ai-inline {
  margin-top: 6px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 0 0 3px 3px;
}


/* --- FMP expansion sections --- */
.fund-eps-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Quantico, monospace;
  font-size: 12px;
}
.fund-eps-table th {
  text-align: right;
  color: var(--text-muted);
  font-weight: 600;
  padding: 3px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.fund-eps-table th:first-child,
.fund-eps-table td:first-child {
  text-align: left;
}
.fund-eps-table td {
  text-align: right;
  padding: 3px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.fund-eps-est-row td {
  color: var(--text-muted);
  font-style: italic;
  background: rgba(255, 255, 255, 0.02);
}
.fund-seg-period {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 400;
}
.fund-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.fund-seg-rows {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.fund-seg-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.fund-seg-name {
  flex: 0 0 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.fund-seg-bar-track {
  flex: 1 1 auto;
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  overflow: hidden;
}
.fund-seg-bar {
  display: block;
  height: 100%;
  background: #4f8cc9;
  border-radius: 2px;
}
.fund-seg-value {
  flex: 0 0 58px;
  text-align: right;
  font-family: Quantico, monospace;
}
.fund-seg-share {
  flex: 0 0 34px;
  text-align: right;
  color: var(--text-muted);
  font-family: Quantico, monospace;
}
.fund-seg-yoy {
  flex: 0 0 44px;
  text-align: right;
  font-family: Quantico, monospace;
}
.fund-ratings-strip {
  display: flex;
  gap: 2px;
  margin: 6px 0 2px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}
.fund-ratings-strip > span {
  padding: 2px 4px;
  border-radius: 2px;
  overflow: hidden;
}
.fund-ratings-buy {
  background: rgba(76, 175, 80, 0.25);
  color: #7fd18a;
}
.fund-ratings-hold {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}
.fund-ratings-sell {
  background: rgba(239, 83, 80, 0.25);
  color: #ef8a88;
}
.fund-grades-list {
  margin-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
}
.fund-grades-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
}
.fund-grades-date {
  flex: 0 0 38px;
  color: var(--text-muted);
  font-family: Quantico, monospace;
}
.fund-grades-firm {
  flex: 0 0 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fund-peers-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.fund-peer-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  color: var(--text);
  font-family: Quantico, monospace;
  font-size: 11px;
  padding: 2px 8px;
  cursor: pointer;
}
.fund-peer-chip:hover {
  background: rgba(255, 255, 255, 0.12);
}

.fund-peer-mcap {
  margin-left: 6px;
  color: var(--text-muted);
  font-size: 10px;
}

.fund-ai-charts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}
.fund-ai-chart {
  flex: 1 1 280px;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 6px 8px;
}
.fund-ai-chart-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.fund-ai-result img {
  max-width: 100%;
  border-radius: 4px;
}
/* ── Journal Panel ─────────────────────────────────────────────── */
.journal-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-base);
  color: var(--text);
  font-family: inherit;
  overflow: hidden;
}

.journal-btn {
  background: var(--bg-button);
  color: var(--text);
  border: none;
  border-radius: 3px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background 0.15s;
  white-space: nowrap;
}
.journal-btn:hover { background: var(--bg-button-hover); }
.journal-btn.primary { background: var(--bg-alt); color: var(--profit); }
.journal-btn.primary:hover { background: var(--bg-hover); }
.journal-btn.danger { color: var(--loss); }
.journal-btn.danger:hover { background: var(--bg-hover); }

/* ── Master-Detail layout ──────────────────────────────────────── */
.journal-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ── List (left pane) ──────────────────────────────────────────── */
.journal-list-pane {
  width: 240px;
  min-width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Draggable divider ───────────────────────────────────────── */
.journal-divider {
  width: 4px;
  flex-shrink: 0;
  cursor: col-resize;
  background: var(--border);
  transition: background 0.15s;
}
.journal-divider:hover { background: var(--border-light); }

.journal-filter-bar {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}

.journal-search-row {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.journal-time-filter-row {
  display: flex;
  gap: 3px;
}

.journal-time-filter-btn {
  flex: 1;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 0;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.journal-time-filter-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.journal-time-filter-btn.active {
  background: var(--bg-alt);
  border-color: var(--border-light);
  color: var(--text);
}

/* ── Smart Search ─────────────────────────────────────────────── */
.journal-smart-search {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}
.journal-smart-search:focus-within { border-color: var(--border-light); }

.journal-search-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px 5px 0;
}

.journal-search-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--bg-hover);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 1px 5px;
  font-size: 9px;
  color: var(--text-dim);
  white-space: nowrap;
}

.chip-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  margin-left: 1px;
}
.chip-remove:hover { color: var(--loss); }

.journal-search-input {
  background: none;
  border: none;
  color: var(--text);
  font-size: 11px;
  padding: 4px 7px;
  flex: 1;
  min-width: 0;
  outline: none;
}
.journal-search-input::placeholder { color: var(--text-muted); }

.journal-search-dropdown {
  position: absolute;
  top: 100%;
  left: -1px;
  right: -1px;
  z-index: 100;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 3px 3px;
  max-height: 180px;
  overflow-y: auto;
}
.journal-search-dropdown::-webkit-scrollbar { width: 3px; }
.journal-search-dropdown::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.journal-search-suggestion {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.08s;
}
.journal-search-suggestion:hover,
.journal-search-suggestion.highlighted {
  background: var(--bg-hover);
}

.suggestion-prefix {
  color: var(--text-dim);
  font-weight: 600;
}

.suggestion-value {
  color: var(--text);
}

.journal-new-btn {
  width: 28px;
  min-width: 28px;
  padding: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  border-radius: 3px;
  flex-shrink: 0;
}

.journal-list-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}
.journal-list-scroll::-webkit-scrollbar { width: 4px; }
.journal-list-scroll::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.journal-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Entry Card ────────────────────────────────────────────────── */
.journal-card {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.journal-card:hover { background: var(--bg-hover); }
.journal-card.selected { background: var(--bg-hover); border-left: 2px solid var(--border-light); }
.journal-card.multi-selected { background: var(--bg-hover); border-left: 2px solid var(--accent); }

.journal-card-top {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
  flex-wrap: wrap;
}

.journal-card-symbol {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.journal-card-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.journal-card-badge.buy { background: var(--bg-alt); color: var(--profit); }
.journal-card-badge.sell { background: var(--bg-alt); color: var(--loss); }
.journal-card-badge.open { background: var(--bg-alt); color: var(--accent); }

.journal-card-bottom {
  display: flex;
  align-items: center;
  gap: 5px;
}

.journal-card-pnl {
  font-size: 11px;
  font-weight: 600;
  flex: 1;
}
.journal-card-pnl.positive { color: var(--profit); }
.journal-card-pnl.negative { color: var(--loss); }
.journal-card-pnl.neutral { color: var(--text-dim); }

.journal-card-stars {
  font-size: 9px;
  color: #f5a623;
  letter-spacing: -1px;
}

.journal-card-time {
  font-size: 10px;
  color: var(--text-muted);
}

.journal-card-icons {
  display: flex;
  gap: 3px;
  font-size: 10px;
}

.journal-card-badge-news {
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  background: var(--bg-alt);
  color: var(--profit);
  letter-spacing: 0.5px;
}

/* ── Detail pane (right) ───────────────────────────────────────── */
.journal-detail-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.journal-detail-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}
.journal-detail-scroll::-webkit-scrollbar { width: 4px; }
.journal-detail-scroll::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.journal-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 12px;
}

.journal-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}

.journal-detail-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.journal-detail-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-detail-title-input {
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 3px 0;
  flex: 1;
  min-width: 0;
  outline: none;
  cursor: text;
  transition: border-bottom-color 0.15s;
}
.journal-detail-title-input:hover { border-bottom-color: var(--border-light); }
.journal-detail-title-input:focus { border-bottom-color: var(--text-muted); }

.journal-detail-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  margin-top: 4px;
  max-height: 52px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.journal-detail-tags-row::-webkit-scrollbar { width: 3px; }
.journal-detail-tags-row::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.journal-detail-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.journal-status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.journal-status-badge.open { background: var(--bg-alt); color: var(--accent); }
.journal-status-badge.closed { background: var(--bg-alt); color: var(--profit); }

.journal-section {
  margin-bottom: 14px;
  flex-shrink: 0;
}

.journal-section.journal-section-grow {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.journal-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ── Chart collapse toggle ───────────────────────────────────── */
.journal-chart-toggle {
  cursor: pointer;
  transition: color 0.1s;
}
.journal-chart-toggle:hover { color: var(--text-dim); }

/* ── Trade info table ──────────────────────────────────────────── */
.journal-trade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 6px;
}

.journal-trade-cell {
  background: var(--bg-alt);
  border-radius: 3px;
  padding: 5px 7px;
}

.journal-trade-cell-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.journal-trade-cell-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.journal-trade-cell-value.positive { color: var(--profit); }
.journal-trade-cell-value.negative { color: var(--loss); }

/* ── Chart ─────────────────────────────────────────────────────── */
.journal-chart-wrapper {
  height: 450px;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
}

/* ── News section ──────────────────────────────────────────────── */
.journal-news-box {
  background: var(--bg-alt);
  border-radius: 4px;
  padding: 8px 10px;
  border-left: 2px solid var(--border);
}

.journal-news-headline {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.4;
}

.journal-news-analysis {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}

.journal-news-analysis p {
  margin: 2px 0;
}

.journal-news-meta {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

/* ── Notes ─────────────────────────────────────────────────────── */
.journal-notes-display {
  background: var(--bg-alt);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  min-height: 40px;
  white-space: pre-wrap;
}

.journal-notes-empty {
  color: var(--text-muted);
  font-style: italic;
}

/* ── Tags ──────────────────────────────────────────────────────── */
.journal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.journal-tag {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 2px 7px;
  font-size: 10px;
  color: var(--text-dim);
  cursor: default;
}

.journal-tag-add {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 2px;
  padding: 2px 7px;
  font-size: 10px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.journal-tag-add:hover { border-color: var(--border-light); color: var(--text-dim); }

.journal-tag-input {
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 2px;
  padding: 2px 7px;
  font-size: 10px;
  color: var(--text);
  outline: none;
  width: 80px;
}

/* ── Stars ─────────────────────────────────────────────────────── */
.journal-stars {
  display: flex;
  gap: 4px;
}

.journal-star {
  font-size: 14px;
  cursor: pointer;
  color: var(--border);
  transition: color 0.1s;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}
.journal-star.filled { color: #f5a623; }
.journal-star:hover { color: #f5a623; }

/* ── Overflow Menu (⋯) ───────────────────────────────────────── */
.journal-overflow-menu {
  position: relative;
  display: inline-block;
}

.journal-overflow-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: all 0.1s;
}
.journal-overflow-btn:hover { color: var(--text-dim); border-color: var(--border); }

.journal-overflow-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-top: 2px;
  min-width: 120px;
  overflow: hidden;
}

.journal-overflow-item {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.journal-overflow-item:hover { background: var(--bg-hover); color: var(--text); }
.journal-overflow-item.danger { color: var(--loss); }
.journal-overflow-item.danger:hover { background: var(--bg-hover); }
.journal-overflow-label {
  padding: 4px 10px 2px;
  font-size: 9px;
  font-weight: 700;
  color: var(--border-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.journal-overflow-separator {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* ── Manual Trade Form ───────────────────────────────────────── */
.journal-manual-trade-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--bg-alt);
  border-radius: 3px;
}

.journal-manual-trade-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.journal-manual-trade-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 50px;
  font-weight: 600;
}

.journal-manual-trade-input,
.journal-manual-trade-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 11px;
  padding: 4px 7px;
  flex: 1;
  min-width: 0;
  outline: none;
}
.journal-manual-trade-input:focus,
.journal-manual-trade-select:focus { border-color: var(--border-light); }

.journal-manual-trade-select {
  cursor: pointer;
}

/* ── Editor ────────────────────────────────────────────────────── */
.journal-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.journal-editor-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.journal-editor-scroll::-webkit-scrollbar { width: 4px; }
.journal-editor-scroll::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.journal-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.journal-editor-title-input {
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  padding: 3px 0;
  width: 100%;
  outline: none;
}
.journal-editor-title-input:focus { border-bottom-color: var(--border-light); }

.journal-field-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.journal-textarea {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 8px 10px;
  resize: vertical;
  outline: none;
  line-height: 1.6;
  min-height: 80px;
  width: 100%;
  box-sizing: border-box;
}
.journal-textarea:focus { border-color: var(--border-light); }

.journal-editor-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Orders expand ─────────────────────────────────────────────── */
.journal-orders-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.journal-orders-toggle:hover { color: var(--text-dim); }

.journal-orders-list {
  background: var(--bg-alt);
  border-radius: 3px;
  margin-top: 5px;
  overflow: hidden;
}

.journal-order-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.journal-order-row:last-child { border-bottom: none; }
.journal-order-row.buy { color: var(--profit); }
.journal-order-row.sell { color: var(--loss); }

/* ── Tag Autocomplete ─────────────────────────────────────────── */
.journal-tag-autocomplete {
  position: relative;
  display: inline-block;
}

.journal-tag-dropdown {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  min-width: 120px;
  max-height: 160px;
  overflow-y: auto;
}

.journal-tag-dropdown-item {
  padding: 4px 8px;
  font-size: 10px;
  color: var(--text-dim);
  cursor: pointer;
}
.journal-tag-dropdown-item:hover,
.journal-tag-dropdown-item.highlighted {
  background: var(--bg-hover);
  color: var(--text);
}

/* ── TipTap Editor ────────────────────────────────────────────── */
.journal-tiptap-wrapper {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 120px;
}
.journal-tiptap-wrapper:focus-within { border-color: var(--border-light); }

.journal-tiptap-toolbar {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.journal-tiptap-toolbar button {
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.1s;
}
.journal-tiptap-toolbar button:hover { color: var(--text-dim); border-color: var(--border); }
.journal-tiptap-toolbar button.is-active { color: var(--text); background: var(--bg-hover); border-color: var(--border-light); }

.journal-tiptap-content {
  padding: 8px 10px;
  min-height: 80px;
  flex: 1;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text);
  line-height: 1.6;
}
.journal-tiptap-content::-webkit-scrollbar { width: 4px; }
.journal-tiptap-content::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.journal-tiptap-content .ProseMirror { outline: none; }
.journal-tiptap-content .ProseMirror p { margin: 0 0 4px; }
.journal-tiptap-content .ProseMirror ul,
.journal-tiptap-content .ProseMirror ol { margin: 4px 0; padding-left: 20px; }
.journal-tiptap-content .ProseMirror li { margin-bottom: 2px; }
.journal-tiptap-content .ProseMirror code { background: var(--bg-input); padding: 1px 4px; border-radius: 2px; font-size: 11px; }
.journal-tiptap-content .ProseMirror pre { background: var(--bg-hover); padding: 8px 10px; border-radius: 3px; overflow-x: auto; }
.journal-tiptap-content .ProseMirror pre code { background: none; padding: 0; }
.journal-tiptap-content .ProseMirror mark { background: #4a3a00; color: #ffd700; border-radius: 1px; }
.journal-tiptap-content .ProseMirror hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

/* TipTap placeholder (via Placeholder extension) */
.journal-tiptap-content .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  float: left;
  height: 0;
  pointer-events: none;
}

/* ── Resizable inline images in TipTap ────────────────────────── */
.journal-img-node {
  display: block;
  margin: 6px 0;
}

.journal-img-resizable {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
  border: 2px solid transparent;
  border-radius: 4px;
  transition: border-color 0.1s;
}
.journal-img-resizable.hovered { border-color: var(--border); }
.journal-img-resizable.resizing { border-color: var(--accent); }

.journal-img-resizable img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
  pointer-events: none;
}

/* ── Image controls (move up/down/delete) ────────────────────── */
.journal-img-controls {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 2px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
}
.journal-img-resizable.hovered .journal-img-controls { opacity: 1; }

.journal-img-move-btn {
  width: 20px;
  height: 20px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 9px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  transition: background 0.1s, color 0.1s;
}
.journal-img-move-btn:hover { background: rgba(0, 0, 0, 0.9); color: var(--text); border-color: var(--text-muted); }
.journal-img-delete-btn:hover { color: var(--loss); border-color: rgba(255, 92, 92, 0.3); }

.journal-img-resize-handle {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 12px;
  height: 12px;
  background: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 2px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.journal-img-resizable.hovered .journal-img-resize-handle { opacity: 1; }
.journal-img-resize-handle:hover { background: var(--accent); }

/* ── Notes HTML display ───────────────────────────────────────── */
.journal-notes-html ul,
.journal-notes-html ol { margin: 4px 0; padding-left: 20px; }
.journal-notes-html li { margin-bottom: 2px; }
.journal-notes-html code { background: var(--bg-input); padding: 1px 4px; border-radius: 2px; font-size: 11px; }
.journal-notes-html pre { background: var(--bg-hover); padding: 8px 10px; border-radius: 3px; overflow-x: auto; }
.journal-notes-html pre code { background: none; padding: 0; }
.journal-notes-html mark { background: #4a3a00; color: #ffd700; border-radius: 1px; }
.journal-notes-html hr { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.journal-notes-html p { margin: 0 0 4px; }

/* ── Group Card ───────────────────────────────────────────────── */
.journal-group-card {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
  border-left: 2px solid var(--border);
}
.journal-group-card:hover { background: var(--bg-hover); }
.journal-group-card.selected { background: var(--bg-hover); border-left-color: var(--accent); }

.journal-group-card-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.journal-group-card-meta {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}

.journal-group-card-top {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
}

.journal-group-card-pnl {
  font-weight: 600;
}
.journal-group-card-pnl.positive { color: var(--profit); }
.journal-group-card-pnl.negative { color: var(--loss); }

.journal-group-card-date {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 10px;
}

/* ── Header dropdown ──────────────────────────────────────────── */
.journal-new-dropdown {
  position: relative;
  display: inline-block;
}

.journal-new-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-top: 2px;
  min-width: 120px;
  overflow: hidden;
}

.journal-new-dropdown-item {
  padding: 6px 10px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.journal-new-dropdown-item:hover { background: var(--bg-hover); color: var(--text); }

/* ── Group detail ─────────────────────────────────────────────── */
.journal-group-entries-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.journal-group-entry-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  background: var(--bg-alt);
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  transition: background 0.1s;
}
.journal-group-entry-row:hover { background: var(--bg-hover); }

.journal-group-entry-symbol {
  font-weight: 700;
  color: var(--text);
  min-width: 70px;
}

.journal-group-entry-pnl {
  margin-left: auto;
  font-weight: 600;
}
.journal-group-entry-pnl.positive { color: var(--profit); }
.journal-group-entry-pnl.negative { color: var(--loss); }

.journal-group-remove-entry {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0 2px;
}
.journal-group-remove-entry:hover { color: var(--loss); }

/* ── Group editor entry selector ──────────────────────────────── */
.journal-entry-selector {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px;
}
.journal-entry-selector::-webkit-scrollbar { width: 4px; }
.journal-entry-selector::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.journal-entry-selector-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 2px;
}
.journal-entry-selector-item:hover { background: var(--bg-hover); }

.journal-entry-selector-item input[type="checkbox"] {
  accent-color: var(--profit);
}

/* ── Multi-select action bar ─────────────────────────────────── */
.journal-multiselect-bar {
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  flex-shrink: 0;
}

/* ── Non-selectable UI chrome ────────────────────────────────── */
.journal-section-label,
.journal-detail-meta,
.journal-status-badge,
.journal-card,
.journal-btn,
.journal-field-label,
.journal-trade-cell-label,
.journal-group-card,
.journal-orders-toggle,
.journal-star,
.journal-card-badge,
.journal-overflow-btn,
.journal-search-chip {
  user-select: none;
}

/* ── News Journal annotation textareas ─────────────────────── */
.nj-annotation-textarea {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 8px;
  resize: vertical;
  outline: none;
  line-height: 1.5;
  width: 100%;
  box-sizing: border-box;
}
.nj-annotation-textarea:focus { border-color: var(--border-light); }
.nj-annotation-textarea::placeholder { color: var(--text-muted); }

/* ── Confirm modal (replaces native window.confirm) ──────────── */
.journal-confirm-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.journal-confirm-modal {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px;
  min-width: 240px;
  max-width: 320px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}
.journal-confirm-msg { font-size: 12px; color: var(--text); margin-bottom: 14px; line-height: 1.4; }
.journal-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Entry card context menu (right-click) ─────────────────── */
.journal-context-menu {
  position: fixed;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  padding: 4px 0;
  z-index: 10000;
  min-width: 160px;
  display: flex;
  flex-direction: column;
}
.journal-context-stars-row { display: flex; align-items: center; gap: 2px; padding: 4px 8px 6px; }
.journal-context-star {
  background: none;
  border: none;
  color: var(--border-light);
  cursor: pointer;
  font-size: 15px;
  padding: 2px 3px;
  line-height: 1;
}
.journal-context-star:hover { color: #ffd700; }
.journal-context-star.filled { color: #ffd700; }
.journal-context-star-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  margin-left: 4px;
}
.journal-context-star-clear:hover { color: var(--loss); }
/* Locate Panel Styles - Matching position panel patterns */
.locate-panel-main {
  background-color: var(--bg-base);
  color: var(--text);
  padding: 0;
  font-family: 'Quantico', sans-serif;
  height: 100%;
  user-select: none;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* Input row */
.locate-inquiry-section {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.locate-input-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.locate-input-group {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.locate-input-group label {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.locate-input {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 3px 6px;
  font-size: 11px;
  font-family: 'Quantico', monospace;
  width: 80px;
  outline: none;
}

.locate-input:focus {
  border-color: var(--accent);
}

.locate-input::placeholder {
  color: var(--text-muted);
}

.locate-select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 3px 6px;
  font-size: 11px;
  font-family: 'Quantico', monospace;
  width: 70px;
  outline: none;
  cursor: pointer;
}

.locate-select:focus {
  border-color: var(--accent);
}

.locate-button-group {
  display: flex;
}

.locate-button {
  background: var(--bg-button);
  color: var(--text);
  border: 1px solid #1e1e1e;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Quantico', monospace;
}

.locate-button:hover:not(:disabled) {
  background: var(--scrollbar);
}

.locate-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.locate-button--inquire {
  background: var(--accent);
  border-color: var(--accent);
}

.locate-button--inquire:hover:not(:disabled) {
  background: #0070cc;
  border-color: #0070cc;
}

/* Table */
.locate-unified-section {
  flex: 1;
  overflow: auto;
}

.locate-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

/* Column widths */
.locate-table th:nth-child(1),
.locate-table td:nth-child(1) { width: 14%; } /* Symbol */
.locate-table th:nth-child(2),
.locate-table td:nth-child(2) { width: 10%; } /* Qty */
.locate-table th:nth-child(3),
.locate-table td:nth-child(3) { width: 10%; } /* Located */
.locate-table th:nth-child(4),
.locate-table td:nth-child(4) { width: 14%; } /* Cost */
.locate-table th:nth-child(5),
.locate-table td:nth-child(5) { width: 10%; } /* MPID */
.locate-table th:nth-child(6),
.locate-table td:nth-child(6) { width: 26%; } /* Status - needs room for Accept/Decline */
.locate-table th:nth-child(7),
.locate-table td:nth-child(7) { width: 16%; } /* Time */

.locate-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-base);
  padding: 4px 6px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  letter-spacing: 0.2px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.locate-table td {
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-family: 'Quantico', monospace;
  white-space: nowrap;
}

.locate-table-row:hover {
  background-color: var(--bg-alt);
  transition: background-color 0.1s;
}

.locate-symbol-cell {
  font-weight: 600;
  color: var(--text) !important;
}

.locate-empty {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  padding: 8px;
}

/* Status column */
.locate-actions {
  display: flex;
  gap: 3px;
  align-items: center;
  white-space: nowrap;
}

.locate-action-button {
  background: var(--scrollbar);
  color: var(--text);
  border: 1px solid #666;
  padding: 1px 6px;
  font-size: 10px;
  cursor: pointer;
}

.locate-action-button:hover:not(:disabled) {
  background: var(--border-light);
}

.locate-action-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.locate-action-button--accept {
  background: rgba(34, 197, 94, 0.2);
  border-color: #22c55e;
  color: #4ade80;
}

.locate-action-button--accept:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.35);
}

.locate-action-button--reject {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  color: #f87171;
}

.locate-action-button--reject:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.35);
}

.locate-status-text {
  font-size: 10px;
  font-weight: 600;
}

.locate-status-text--pending {
  color: #fbbf24;
}

.locate-status-text--submitted {
  color: #60a5fa;
}

.locate-status-text--accepted {
  color: #4ade80;
}

.locate-status-text--available {
  color: #10b981;
}

/* Footer */
.locate-footer {
  padding: 3px 6px;
  background: var(--bg-alt);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.locate-status-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.locate-connection-status {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
}

.locate-connection-status--connected {
  color: var(--profit);
}

.locate-connection-status--disconnected {
  color: #f87171;
}

.locate-messages {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.locate-refresh-button {
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 1px 8px;
  font-size: 10px;
  cursor: pointer;
  font-family: 'Quantico', monospace;
}

.locate-refresh-button:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-dim);
}

.locate-refresh-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.locate-inquiry-result {
  color: #4ade80;
  font-size: 10px;
  font-family: 'Quantico', monospace;
}
body {
  margin: 0;
  font-family: 'Inter', monospace;
}

.logs-container {
  gap: 4px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-base);
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  overflow: auto;
}

.logs-log {
  padding: 8px;
  max-width: 100%;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

.logs-log::after {
  content: '';
  display: block;
  height: 16px;
  flex-shrink: 0;
}

.logs-log > .out {
  color: var(--text-dim);
}

.logs-log > .error {
  color: #f44336;
}

.log-entry {
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  min-height: 1.2em;
  width: 100%;
}

.log-timestamp {
  color: #279e06;
  white-space: nowrap;
  font-family: 'Fira Code', monospace;
  flex-shrink: 0;
  margin-right: 8px;
}

.logs-log-message {
  color: var(--text-dim);
  word-wrap: break-word;
  white-space: pre-wrap;
  flex: 1;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.log-entry.error .logs-log-message {
  color: #f44336;
}

.log-entry.error .log-timestamp {
  color: #ff6b6b;
}

.logs-log::-webkit-scrollbar {
  width: 8px;
  background: var(--bg-base);
}

.logs-log::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 8px;
}

.logs-log::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

.scroll-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(25, 25, 25, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 0;
  display: flex;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 10;
  pointer-events: all;
}

.scroll-to-bottom-btn {
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 2px;
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: 'Fira Code', monospace;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.scroll-to-bottom-btn:hover {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
}

.scroll-to-bottom-btn:active {
  color: var(--text-dim);
}
.options-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: contain;
  padding: 4px;
  gap: 4px;
  font-family: 'Quantico', sans-serif;
  user-select: none;
}

.options-header {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  flex-shrink: 0;
}

/* Trade Panel */
.options-trade-panel-wrapper {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0;
  flex-shrink: 0;
}

.options-trade-panel {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  flex: 0 0 auto;
  min-width: 210px;
  max-width: 350px;
  width: 210px;
  display: flex;
  flex-direction: column;
}

.options-trade-panel-chart {
  flex: 1 1 200px;
  min-width: 150px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  min-height: 300px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.options-trade-panel-chart > * {
  flex: 1;
  min-height: 0;
}

.options-trade-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.options-trade-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.options-trade-panel-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.options-trade-panel-close:hover {
  color: var(--text);
}

.options-trade-panel-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.options-trade-panel-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.options-trade-panel-contract {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  font-family: 'Fira Code', monospace;
}

.options-trade-panel-prices {
  display: flex;
  flex-direction: column;
  font-size: 10px;
}

.options-trade-panel-price-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.options-trade-panel-price-label {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
}

.options-trade-panel-price-value {
  color: var(--text);
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  font-size: 11px;
}

.options-trade-panel-price-value.clickable {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  transition: all 0.2s;
}

.options-trade-panel-price-value.clickable:hover {
  background: rgba(100, 100, 255, 0.2);
  color: var(--accent);
}

.options-trade-panel-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.options-trade-panel-control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.options-trade-panel-label {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
}

.options-trade-panel-select,
.options-trade-panel-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  outline: none;
  transition: all 0.2s;
}

.options-trade-panel-select {
  cursor: pointer;
}

.options-trade-panel-select option {
  background: var(--bg-input);
  color: var(--text);
}

.options-trade-panel-select:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.options-trade-panel-select:focus,
.options-trade-panel-input:focus {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.options-trade-panel-input::placeholder {
  color: var(--text-muted);
}

.options-trade-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.options-trade-panel-buy,
.options-trade-panel-sell {
  flex: 1;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: 'Quantico', sans-serif;
}

.options-trade-panel-buy {
  background: rgba(100, 200, 100, 0.2);
  color: var(--profit);
  border: 1px solid rgba(100, 200, 100, 0.4);
}

.options-trade-panel-buy:hover {
  background: rgba(100, 200, 100, 0.3);
  border-color: rgba(100, 200, 100, 0.6);
}

.options-trade-panel-sell {
  background: rgba(200, 100, 100, 0.2);
  color: var(--loss);
  border: 1px solid rgba(200, 100, 100, 0.4);
}

.options-trade-panel-sell:hover {
  background: rgba(200, 100, 100, 0.3);
  border-color: rgba(200, 100, 100, 0.6);
}

/* Expiration Tabs */
.expiration-tabs-container {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.expiration-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) var(--bg-base);
  padding-bottom: 8px;
}

.expiration-tabs::-webkit-scrollbar {
  height: 8px;
}

.expiration-tabs::-webkit-scrollbar-track {
  background: var(--bg-alt);
  border-radius: 4px;
}

.expiration-tabs::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}

.expiration-tabs::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

.expiration-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 90px;
  user-select: none;
}

.expiration-tab:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.expiration-tab.active {
  background: rgba(100, 100, 255, 0.2);
  border-color: var(--accent);
}

.expiration-date {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.3px;
}

.expiration-days {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Controls Bar */
.options-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.options-controls-left {
  display: flex;
  gap: 8px;
  align-items: center;
}

.options-dropdown {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  outline: none;
}

.options-dropdown:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.options-dropdown:focus {
  border-color: var(--accent);
}

/* Options Table */
.options-table-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
}

.options-table-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 4px 4px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  gap: 4px;
  /* sticky ONLY — a trailing `position: relative` used to override this,
     so the header never actually stuck */
  position: sticky;
  top: 0;
  z-index: 101;
  flex-shrink: 0;
}

.atm-iv-left {
  position: absolute;
  left: 8px;
  top: 4px;
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
}

.atm-iv-right {
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 500;
}

.calls-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.puts-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.5px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.strikes-control-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 102;
}

/* Table Subheader */
.options-table-subheader {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(40px, 1fr);
  gap: 2px;
  padding: 2px 4px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
  position: sticky;
  top: 32px;
  z-index: 100;
  text-align: center;
  flex-shrink: 0;
}

/* Table Body — no own scrollbar: the table CONTAINER is the single scroller,
   which is what lets the sticky header/subheader actually stick */
.options-table-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.options-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(40px, 1fr);
  gap: 2px;
  padding: 2px 4px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  font-size: 10px;
  text-align: center;
  align-items: center;
  min-height: 22px;
}

.options-row:hover {
  background: var(--bg-hover);
}

.options-row.selected {
  background: rgba(100, 100, 255, 0.15);
  /* inset shadow, not border — a border added 2px to the row and shifted
     the whole table on every selection */
  box-shadow: inset 0 0 0 1px rgba(100, 100, 255, 0.3);
}

/* ATM row: the spot sits between this strike and its neighbor */
.options-row.atm-row {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent);
}

.options-row.atm-row .strike-price {
  color: var(--accent);
  font-weight: 700;
}

/* Strikes inside the ATM straddle's expected move — the tradeable range */
.options-row.em-range .strike-price {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 2px;
}

.chg-pos {
  color: var(--profit);
}

.chg-neg {
  color: var(--loss);
}

.strike-price {
  text-align: center;
  font-weight: 600;
  color: var(--text);
  background: rgba(100, 100, 255, 0.15);
  padding: 3px 0;
  border-radius: 2px;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Column Styles - Call Columns */
.col-call-volume,
.col-call-bidSize,
.col-call-askSize,
.col-call-impliedVol,
.col-call-delta,
.col-call-theta {
  color: var(--text-dim);
  font-size: 10px;
}

.col-call-bid {
  color: rgba(150, 180, 220, 0.9);
  font-weight: 500;
  font-size: 10px;
}

.col-call-bid.clickable:hover {
  background: rgba(150, 180, 220, 0.15);
  border-radius: 2px;
}

.col-call-ask {
  color: rgba(220, 180, 130, 0.9);
  font-weight: 500;
  font-size: 10px;
}

.col-call-ask.clickable:hover {
  background: rgba(220, 180, 130, 0.15);
  border-radius: 2px;
}

/* Column Styles - Put Columns */
.col-put-volume,
.col-put-bidSize,
.col-put-askSize,
.col-put-impliedVol,
.col-put-delta,
.col-put-theta {
  color: var(--text-dim);
  font-size: 10px;
}

.col-put-bid {
  color: rgba(150, 180, 220, 0.9);
  font-weight: 500;
  font-size: 10px;
}

.col-put-bid.clickable:hover {
  background: rgba(150, 180, 220, 0.15);
  border-radius: 2px;
}

.col-put-ask {
  color: rgba(220, 180, 130, 0.9);
  font-weight: 500;
  font-size: 10px;
}

.col-put-ask.clickable:hover {
  background: rgba(220, 180, 130, 0.15);
  border-radius: 2px;
}

/* No bid/ask styling (when value is -1) */
.col-call-bid.no-bid-ask,
.col-call-ask.no-bid-ask,
.col-put-bid.no-bid-ask,
.col-put-ask.no-bid-ask {
  color: var(--loss) !important;
  font-weight: 600;
}

/* ITM (In The Money) shading */
[class^='col-call-'].itm,
[class*=' col-call-'].itm {
  background: rgba(100, 200, 100, 0.08);
  padding: 3px 0;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

[class^='col-put-'].itm,
[class*=' col-put-'].itm {
  background: rgba(100, 200, 100, 0.08);
  padding: 3px 0;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
  .options-table-subheader,
  .options-row {
    font-size: 9px;
  }

  .strike-price {
    font-size: 10px;
  }
}

/* Scrollbar styling for table body */
.options-table-body::-webkit-scrollbar {
  width: 8px;
}

.options-table-body::-webkit-scrollbar-track {
  background: var(--bg-base);
}

.options-table-body::-webkit-scrollbar-thumb {
  background: var(--scrollbar);
  border-radius: 4px;
}

.options-table-body::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* Quantity Preset Buttons */
.quantity-preset-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.quantity-preset-button {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  background-color: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  line-height: 22px;
  font-family: 'Inter';
  font-weight: 500;
  font-size: 10px;
  padding: 0 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.quantity-preset-button:hover {
  border-color: var(--border-light);
  color: var(--text);
}

.quantity-preset-button:active {
  background-color: var(--bg-hover);
  border-color: var(--border-light);
}

/* Strikes Dropdown */
.strikes-control-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.strikes-control-wrapper:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.strikes-input {
  width: 30px;
  height: 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 11px;
  outline: none;
  text-align: center;
  padding: 0;
  margin: 0;
  line-height: 16px;
  box-sizing: border-box;
}

.strikes-value-display {
  font-size: 11px;
  color: var(--text);
  padding: 0;
  margin: 0;
  cursor: text;
  min-width: 30px;
  width: 30px;
  height: 16px;
  text-align: center;
  display: inline-block;
  line-height: 16px;
  box-sizing: border-box;
}

.strikes-dropdown-button {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0 2px;
  display: flex;
  align-items: center;
  font-size: 9px;
  height: 16px;
  line-height: 16px;
}

.strikes-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding-top: 4px;
  padding-bottom: 4px;
  padding-left: 4px;
  padding-right: 4px;
  z-index: 1000;
  min-width: 60px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.strikes-dropdown-item {
  padding-left: 8px;
  padding-right: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  border-radius: 2px;
  transition: background-color 0.2s;
}

.strikes-dropdown-item:first-child {
  padding-top: 0;
}

.strikes-dropdown-item:not(:last-child) {
  padding-bottom: 2px;
}

.strikes-dropdown-item:last-child {
  padding-bottom: 0;
}

.strikes-dropdown-item.selected {
  background-color: rgba(100, 100, 255, 0.3);
}

.strikes-dropdown-item:not(.selected):hover {
  background-color: var(--bg-hover);
}

/* Spread Mode Toggle */
.spread-mode-toggle {
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'Quantico', sans-serif;
  letter-spacing: 0.5px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.spread-mode-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
  color: var(--text);
}

.spread-mode-toggle.active {
  background: rgba(180, 130, 255, 0.2);
  border-color: rgba(180, 130, 255, 0.5);
  color: rgb(180, 130, 255);
}

/* Spread Leg Row Indicators */
.options-row.spread-leg-1 {
  background: rgba(100, 180, 255, 0.1);
  border-left: 2px solid rgba(100, 180, 255, 0.6);
}

.options-row.spread-leg-2 {
  background: rgba(255, 170, 100, 0.1);
  border-left: 2px solid rgba(255, 170, 100, 0.6);
}

/* Spread Trade Panel */
.spread-trade-panel {
  background: var(--bg-alt);
  border: 1px solid rgba(180, 130, 255, 0.3);
  border-radius: 4px;
  padding: 6px;
  margin: 4px 0;
  flex-shrink: 0;
}

.spread-trade-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
}

.spread-trade-panel-title {
  font-size: 11px;
  font-weight: 600;
  color: rgb(180, 130, 255);
}

/* Spread Legs Display */
.spread-legs-display {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}

.spread-leg {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
}

.spread-leg-1-display {
  background: rgba(100, 180, 255, 0.1);
  border: 1px solid rgba(100, 180, 255, 0.3);
}

.spread-leg-2-display {
  background: rgba(255, 170, 100, 0.1);
  border: 1px solid rgba(255, 170, 100, 0.3);
}

.spread-leg-label {
  font-weight: 700;
  font-size: 9px;
  color: var(--text-muted);
  min-width: 16px;
}

.spread-leg-side {
  font-weight: 600;
  font-size: 10px;
  min-width: 28px;
}

.spread-leg-side[data-side='BUY'] {
  color: var(--profit);
}

.spread-leg-side[data-side='SELL'] {
  color: var(--loss);
}

.spread-leg-details {
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.spread-leg-price {
  font-family: 'Fira Code', monospace;
  font-weight: 600;
  color: var(--text);
  font-size: 10px;
}

.spread-leg-remove {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.spread-leg-remove:hover {
  color: var(--loss);
}

/* Spread Trade Controls */
.spread-trade-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
  max-width: 320px;
}

.spread-inputs-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
}

.spread-input-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 80px;
  flex-shrink: 0;
}

.spread-input-label {
  font-size: 8px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.spread-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}

.spread-input:focus {
  border-color: var(--accent);
  background: var(--bg-hover);
}

.spread-size-display {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  white-space: nowrap;
  align-self: flex-end;
  padding-bottom: 4px;
}

/* Spread net-price range (Low / Mid / High) */
.spread-price-range {
  display: flex;
  gap: 4px;
  max-width: 320px;
}

.spread-price-range-chip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  background-color: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 4px;
}

.spread-price-range-chip:hover {
  border-color: var(--border-light);
  background-color: var(--bg-hover);
}

.spread-price-range-chip.is-mid {
  border-color: var(--accent);
}

.spread-price-range-label {
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.spread-price-range-value {
  font-size: 11px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  color: var(--text);
}

/* Spread Preset Buttons (override base) */
.spread-trade-controls .quantity-preset-buttons {
  max-width: 320px;
}

/* Spread Body - two column layout */
.spread-body {
  display: flex;
  gap: 8px;
}

.spread-controls-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  max-width: 320px;
}

/* Spread Payoff Chart */
.spread-payoff-chart {
  flex: 1;
  min-width: 150px;
  min-height: 120px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-base);
  position: relative;
  display: flex;
  flex-direction: column;
}

.spread-payoff-chart canvas {
  flex: 1;
  min-height: 0;
}

.spread-payoff-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding: 6px 8px 2px;
}

.spread-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.spread-metric-label {
  font-size: 9px;
  color: var(--text-dim);
  font-weight: 500;
}

.spread-metric-value {
  font-size: 11px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
  color: var(--text);
}

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

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

/* Spread Actions */
.spread-actions {
  display: flex;
  gap: 6px;
}

/* Expected move (ATM straddle) badge next to the spot price */
.expected-move-badge {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(245, 178, 107, 0.12);
  color: #f5b26b;
  font-weight: 600;
  cursor: default;
}
.pnl-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 0;
  font-family: 'Quantico', sans-serif;
  background-color: var(--bg-base);
  color: var(--text);
  overflow: hidden;
  user-select: none;
}

.pnl-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-alt);
  border-bottom: 1.5px solid #181818;
  height: 36px;
  min-height: 36px;
}

.pnl-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.pnl-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.timeframe-buttons {
  display: flex;
  gap: 2px;
  background: var(--bg-base);
  border-radius: 2px;
  padding: 2px;
  border: 1px solid var(--border);
}

.timeframe-btn {
  padding: 4px 10px;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 2px;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  height: 24px;
  min-width: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.timeframe-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.timeframe-btn.active {
  background: #45b5ff;
  color: #000;
  font-weight: 600;
}

.setup-button {
  padding: 4px 8px;
  background-color: var(--text-muted);
  color: var(--text);
  border: none;
  border-radius: 2px;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.15s;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-button:hover {
  background-color: var(--text-muted);
}

.clear-button {
  padding: 4px 8px;
  background-color: var(--loss);
  color: var(--text);
  border: none;
  border-radius: 2px;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.15s;
  height: 24px;
}

.clear-button:hover {
  background-color: #ff6020;
}

.broker-select {
  padding: 4px 8px;
  background-color: var(--bg-base);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  cursor: pointer;
  height: 24px;
}

.broker-select:focus {
  outline: none;
  border-color: #45b5ff;
}

.load-button {
  padding: 4px 12px;
  background-color: #45b5ff;
  color: #000;
  border: none;
  border-radius: 2px;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
  height: 24px;
}

.load-button:hover:not(:disabled) {
  background-color: #5ac5ff;
}

.load-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.symbol-filter-input {
  flex: 1;
  max-width: 200px;
  padding: 4px 8px;
  background-color: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: #f0f0f0;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  height: 22px;
}

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

.symbol-filter-input::placeholder {
  color: var(--text-muted);
}

.min-pnl-filter {
  display: flex;
  align-items: center;
  gap: 6px;
}

.min-pnl-filter label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.min-pnl-input {
  width: 80px;
  padding: 4px 8px;
  background-color: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: #f0f0f0;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  height: 22px;
}

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

.pnl-summary {
  display: flex;
  gap: 20px;
  padding: 8px 12px;
  background-color: var(--bg-alt);
  border-bottom: 1px solid #181818;
  height: 48px;
  min-height: 48px;
  align-items: center;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

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

.summary-value {
  font-size: 13px;
  font-weight: 600;
}

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

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

.summary-value.commission {
  color: #fffa9f;
}

.pnl-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.pnl-table-container {
  background-color: var(--bg-base);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  font-size: 11px;
}

.pnl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  table-layout: fixed;
}

.pnl-table thead {
  position: sticky;
  top: 0;
  background-color: var(--bg-base);
  z-index: 1;
}

.pnl-table th {
  padding: 4px 6px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  height: 20px;
}

.pnl-table td {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  height: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.pnl-table tbody tr:hover {
  background-color: var(--bg-alt);
  transition: background-color 0.1s;
}

.symbol-cell {
  font-weight: 600;
  color: var(--text);
  font-size: 12px;
}

.option-details {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: normal;
  margin-left: 4px;
}

.side-badge {
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 9px;
  font-weight: 600;
}

.side-badge.buy,
.side-badge.bot {
  color: var(--profit);
}

.side-badge.sell {
  color: #ff5c5c;
}

.pnl-table .commission {
  color: #fffa9f;
  font-size: 10px;
}

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

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

.pnl-table .pnl.loss {
  color: #ff5c5c;
}

.datetime-cell {
  font-size: 10px;
  color: var(--text-muted);
}

/* Setup screen styles */
.pnl-setup {
  padding: 12px;
  max-width: 700px;
  margin: 0 auto;
  overflow-y: auto;
  height: 100%;
}

.setup-instructions {
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 12px;
}

.setup-instructions h3 {
  margin-top: 0;
  color: #45b5ff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.setup-instructions ol {
  margin-left: 16px;
  line-height: 1.6;
  font-size: 11px;
}

.setup-instructions ul {
  margin: 4px 0 4px 16px;
  font-size: 10px;
  line-height: 1.5;
}

.setup-instructions a {
  color: #45b5ff;
  text-decoration: none;
}

.setup-instructions a:hover {
  text-decoration: underline;
}

.setup-form {
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 12px;
}

.form-group {
  margin-bottom: 10px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.flex-input {
  width: 100%;
  padding: 6px 8px;
  background-color: var(--bg-base);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  height: 28px;
}

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

.save-button {
  width: 100%;
  padding: 8px;
  background-color: #45b5ff;
  color: #000;
  border: none;
  border-radius: 2px;
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
  margin-top: 6px;
  height: 32px;
}

.save-button:hover:not(:disabled) {
  background-color: #5ac5ff;
}

.save-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.setup-form .broker-select {
  width: 100%;
  height: 28px;
}

/* Section Headers */
.pnl-section-header {
  background-color: var(--bg-alt);
  border-bottom: 1px solid #181818;
  padding: 0;
}

.section-toggle-btn {
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.1s;
}

.section-toggle-btn:hover {
  background-color: var(--bg-hover);
}

.section-toggle-btn span:first-child {
  font-size: 9px;
  color: var(--text-muted);
}

/* Metrics Section */
.pnl-metrics {
  background-color: var(--bg-base);
  border-bottom: 1px solid #181818;
  padding: 12px;
}

.metrics-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.metrics-row:last-child {
  margin-bottom: 0;
}

.metric-card {
  flex: 1;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-card.long-card {
  flex: 1;
}

.metric-card.short-card {
  flex: 1;
}

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

.metric-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.metric-subtext {
  font-size: 9px;
  color: var(--text-muted);
}

/* Symbol Performance */
.symbol-performance {
  display: flex;
  gap: 12px;
}

.performance-section {
  flex: 1;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
}

.performance-section h3 {
  margin: 0 0 6px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.2px;
}

.performance-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
}

.performance-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  background-color: var(--bg-base);
  border-radius: 2px;
}

.perf-symbol {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  min-width: 60px;
}

.perf-trades {
  font-size: 9px;
  color: var(--text-muted);
  flex: 1;
}

.perf-pnl {
  font-size: 11px;
  font-weight: 600;
  text-align: right;
}

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

.perf-pnl.loss {
  color: #ff5c5c;
}

/* P&L Chart Section */
.pnl-chart-section {
  background-color: var(--bg-base);
  border-bottom: 1px solid #181818;
  padding: 12px;
}

.pnl-chart-container {
  width: 100%;
  height: 300px;
  background-color: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 4px;
}

/* Calendar */
.pnl-calendar {
  background-color: var(--bg-base);
  border-bottom: 1px solid #181818;
  padding: 12px;
}

.cal-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.cal-nav-btn {
  width: 24px;
  height: 24px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-size: 14px;
  font-family: 'Quantico', sans-serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.cal-nav-btn:hover {
  background: var(--bg-hover);
}

.cal-month-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  min-width: 130px;
}

.cal-today-btn {
  padding: 4px 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text);
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  height: 24px;
}

.cal-today-btn:hover {
  background: var(--bg-hover);
}

.cal-monthly-stats {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.cal-stats-label {
  font-size: 11px;
  color: var(--text-muted);
}

.cal-stats-pill {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.cal-stats-pill.profit {
  color: var(--profit);
  background: rgba(0, 200, 100, 0.12);
  border-color: rgba(0, 200, 100, 0.3);
}

.cal-stats-pill.loss {
  color: #ff5c5c;
  background: rgba(255, 80, 80, 0.12);
  border-color: rgba(255, 80, 80, 0.3);
}

.cal-stats-pill.days {
  color: #b08bff;
  background: rgba(140, 100, 240, 0.12);
  border-color: rgba(140, 100, 240, 0.3);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr) 110px;
  /* grid-template-rows is set inline: "24px repeat(weekCount, 70px)" */
  column-gap: 4px;
  row-gap: 4px;
}

.cal-grid .cal-day-label,
.cal-grid .cal-corner {
  /* row 1 — header row */
}

.cal-corner {
  /* empty placeholder so auto-flow advances cleanly into row 2 */
}

.cal-day-label {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-cell {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;
}

.cal-cell-empty {
  background: transparent;
  border-color: transparent;
}

.cal-cell-day {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.cal-cell-pnl {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

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

.cal-cell-pnl.loss {
  color: #ff5c5c;
}

.cal-cell-rate {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cal-cell-profit {
  background: rgba(0, 180, 90, 0.12);
  border-color: rgba(0, 180, 90, 0.35);
}

.cal-cell-loss {
  background: rgba(255, 70, 70, 0.12);
  border-color: rgba(255, 70, 70, 0.35);
}

.cal-cell.is-today {
  outline: 1px solid #45b5ff;
  outline-offset: -2px;
}

.cal-cell-today {
  background: rgba(69, 181, 255, 0.1);
}

.cal-week {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  margin-left: 4px;
}

.cal-week-label {
  font-size: 10px;
  color: var(--text-muted);
}

.cal-week-pnl {
  font-size: 13px;
  font-weight: 700;
}

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

.cal-week-pnl.loss {
  color: #ff5c5c;
}

.cal-week-days {
  font-size: 10px;
  color: #b08bff;
  background: rgba(140, 100, 240, 0.12);
  border: 1px solid rgba(140, 100, 240, 0.3);
  padding: 1px 6px;
  border-radius: 3px;
  align-self: flex-start;
  margin-top: 2px;
}

.cal-cell.is-clickable {
  cursor: pointer;
}

.cal-cell.is-clickable:hover {
  filter: brightness(1.25);
}

.cal-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  font-family: 'Quantico', sans-serif;
  user-select: none;
}

.cal-modal {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: min(720px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.cal-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.cal-modal-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-modal-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.cal-modal-stats {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-modal-stats .profit {
  color: var(--profit);
  font-weight: 700;
}

.cal-modal-stats .loss {
  color: #ff5c5c;
  font-weight: 700;
}

.cal-modal-stat-sep {
  opacity: 0.5;
}

.cal-modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  height: 24px;
}

.cal-modal-close:hover {
  color: var(--text);
}

.cal-modal-body {
  overflow-y: auto;
  padding: 0;
}

.cal-modal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.cal-modal-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-base);
  z-index: 1;
}

.cal-modal-table th {
  padding: 8px;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.3px;
}

.cal-modal-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cal-modal-table tbody tr:hover {
  background: var(--bg-alt);
}

.cal-modal-table .pnl {
  font-weight: 600;
}

.cal-modal-table .pnl.profit {
  color: var(--profit);
}

.cal-modal-table .pnl.loss {
  color: #ff5c5c;
}
.stock-stop-menu-container,
.stock-close-menu-container,
.option-close-menu-container {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  width: 220px;
  background-color: var(--bg-alt);
  border: 1px solid var(--border);
  z-index: 100;
  user-select: none;
  -webkit-user-select: none;
  padding: 4px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-family: 'Quantico', sans-serif;
}

/* Size options styling */
.size-options-sl,
.size-options {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 1px;
}

.size-options-sl span,
.size-options span {
  cursor: pointer;
  padding: 4px 2px;
  background-color: var(--bg-alt);
  flex-grow: 1;
  text-align: center;
  font-size: 0.9em;
  transition: background-color 0.15s ease;
}

.size-options-sl span:hover,
.size-options span:hover {
  background-color: var(--bg-hover);
}

.size-options-sl span:first-child,
.size-options span:first-child {
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;
}

.size-options-sl span:last-child,
.size-options span:last-child {
  border-top-right-radius: 3px;
  border-bottom-right-radius: 3px;
}

/* Selected state with gradients */
.size-options span.selected {
  background: linear-gradient(to right, #2c6b95, #3ea3e6);
  color: var(--text);
}

.size-options-sl span.selected {
  background: linear-gradient(to right, rgb(179, 118, 43), #e59024);
  color: var(--text);
}

/* Add-to-position menu — green accent to distinguish it from Close (blue)
   and Stop (orange). Scoped to .add-menu so the close menus keep their blue. */
.add-menu .size-options span.selected {
  background: linear-gradient(to right, #1f7a4d, #2fbf71);
  color: var(--text);
}

/* The size pills carry the .option class (flex, space-between) which knocks the
   label off-center — re-center it for the add menu's wider pills. */
.add-menu .size-options span {
  justify-content: center;
}

/* Trade options styling */
.trade-options {
  display: flex;
  gap: 8px;
}

.market-option {
  cursor: pointer;
  padding: 6px;
  background-color: var(--bg-alt);
  color: var(--text);
  text-align: center;
  width: 70px;
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.market-option:hover {
  background-color: var(--bg-hover);
}

.limit-section {
  flex-grow: 1;
}

/* Option rows styling */
.option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 4px 6px;
  margin: 2px 0;
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.option:hover {
  background-color: var(--bg-hover);
}

.option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
  color: var(--text-muted);
}

.option.disabled:hover {
  background-color: var(--bg-hover);
}

.sl-entry {
  color: #e59024;
}

.label {
  font-size: 0.9em;
  color: var(--text-dim);
}

/* Input styling */
.custom-limit-input {
  width: 65px;
  padding: 2px 4px;
  background-color: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border-light);
  border-radius: 3px;
  text-align: right;
  font-size: 0.9em;
}

.custom-limit-input:focus {
  outline: none;
  border-color: var(--border-light);
  background-color: var(--bg-hover);
}

.custom-limit-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background-color: var(--bg-base);
  color: var(--text-muted);
}

/* Stop-limit inputs styling */
.stop-limit-inputs {
  display: flex;
  gap: 4px;
}

.stop-limit-inputs .custom-limit-input {
  width: 60px;
}

/* Stop-limit section styling */
.stop-limit-section {
  margin-top: 8px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

/* Button styling */
.trade-button {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 0.9em;
  transition: background-color 0.15s ease;
  font-family: 'Quantico', sans-serif;
  cursor: pointer;
}

.trade-sl-button {
  background-color: rgba(229, 144, 36, 0.15);
  color: #e59024;
  border: 1px solid rgba(229, 144, 36, 0.3);
}

.trade-sl-button:hover {
  background-color: rgba(229, 144, 36, 0.25);
}

.trade-close-button {
  background-color: rgba(62, 163, 230, 0.15);
  color: #3ea3e6;
  border: 1px solid rgba(62, 163, 230, 0.3);
}

.trade-close-button:hover {
  background-color: rgba(62, 163, 230, 0.25);
}

.down-arrow-icon {
  width: 10px;
  height: 10px;
  opacity: 0.8;
}

/* Chart Position Menu — right-click overlay */
.chart-position-menu {
  position: fixed;
  z-index: 10000;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  min-width: 160px;
  box-shadow: 0 4px 12px var(--shadow, rgba(0, 0, 0, 0.5));
  font-family: 'Quantico', sans-serif;
  font-size: 11px;
  color: var(--text);
}

.chart-position-menu button {
  font-family: 'Quantico', sans-serif;
}

/* Size selector row */
.cpm-sizes {
  display: flex;
  gap: 2px;
  margin-bottom: 5px;
}

.cpm-size {
  flex: 1;
  padding: 3px 0;
  background: var(--bg-button);
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  border-radius: 3px;
  transition:
    background 0.1s,
    color 0.1s;
}

.cpm-size:hover {
  background: var(--bg-button-hover);
  color: var(--text);
}

.cpm-size--active {
  background: rgba(62, 163, 230, 0.25);
  color: #6bb8ee;
  font-weight: 700;
}

/* Order buttons row */
.cpm-actions {
  display: flex;
  gap: 3px;
  margin-bottom: 5px;
}

.cpm-btn {
  flex: 1;
  padding: 4px 0;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  transition: opacity 0.1s;
}

.cpm-btn:hover {
  opacity: 0.85;
}

.cpm-btn--mkt {
  background: var(--bg-button);
  color: var(--text);
}

.cpm-btn--lmt {
  background: rgba(62, 163, 230, 0.22);
  color: #5eade8;
}

.cpm-btn--sl {
  background: rgba(229, 144, 36, 0.22);
  color: #e59024;
}

/* Terminal-native stop -- outlined variant of SL so the two read as kin */
.cpm-btn--tsl {
  background: transparent;
  border: 1px solid rgba(229, 144, 36, 0.55);
  color: #e59024;
}

/* P&L line */
.cpm-pnl {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 2px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
  font-size: 10px;
  gap: 8px;
}

.cpm-pnl-qty {
  color: var(--text-muted);
  white-space: nowrap;
}

.cpm-pnl-val {
  font-weight: 600;
  font-size: 10px;
  white-space: nowrap;
}

.cpm-pnl-val--pos {
  color: var(--profit, #00ff88);
}

.cpm-pnl-val--neg {
  color: var(--loss, #ff4800);
}

/* Menu rows (alert, AI, submenu parents, submenu items) */
.cpm-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 5px 5px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  transition:
    background 0.1s,
    color 0.1s;
}

.cpm-row:hover,
.cpm-row--open {
  background: var(--bg-hover);
  color: var(--text);
}

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

.cpm-row--disabled:hover {
  background: transparent;
  color: var(--text-muted);
}

.cpm-row-icon {
  flex-shrink: 0;
  opacity: 0.85;
}

.cpm-row-icon--tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
}

.cpm-row-chevron {
  margin-left: auto;
  opacity: 0.6;
}

.cpm-soon {
  margin-left: auto;
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 8px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

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

/* Submenu flyouts */
.cpm-row-wrap {
  position: relative;
}

.cpm-sub {
  position: absolute;
  top: -7px;
  left: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px;
  min-width: 130px;
  box-shadow: 0 4px 12px var(--shadow, rgba(0, 0, 0, 0.5));
  z-index: 10001;
}

.cpm-sub--left {
  left: auto;
  right: 100%;
}

.cpm-sub--up {
  top: auto;
  bottom: -7px;
}

.cpm-sub-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  min-width: 168px;
}

.cpm-tf {
  padding: 4px 0;
  background: var(--bg-button);
  color: var(--text-dim);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 500;
  text-align: center;
  transition:
    background 0.1s,
    color 0.1s;
}

.cpm-tf:hover {
  background: var(--bg-button-hover);
  color: var(--text);
}

.cpm-tf--active {
  background: rgba(62, 163, 230, 0.25);
  color: #6bb8ee;
  font-weight: 700;
}

/* Spread close section */
.spread-close-section {
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.spread-close-header {
  font-size: 10px;
  font-weight: 600;
  color: rgb(180, 130, 255);
  padding: 4px 6px 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.spread-close-legs {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 6px 4px;
  font-size: 11px;
  color: var(--text-dim);
}

.spread-close-leg {
  display: flex;
  align-items: center;
  gap: 4px;
}

.spread-close-leg-side {
  font-weight: 600;
  font-size: 10px;
  min-width: 28px;
}

.spread-close-actions {
  padding: 0 4px;
}

.spread-close-actions .market-option {
  width: 100%;
  background: rgba(180, 130, 255, 0.12);
  color: rgb(180, 130, 255);
  font-weight: 600;
  font-size: 11px;
}

.spread-close-actions .market-option:hover {
  background: rgba(180, 130, 255, 0.22);
}

/* Bid/Ask info at bottom of close menu */
.close-menu-bidask {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 4px 0 1px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
}

.close-menu-bidask-prices {
  letter-spacing: 0.3px;
}

.close-menu-bidask-x {
  margin: 0 3px;
  opacity: 0.5;
}

.close-menu-bidask-warn {
  font-weight: 600;
  font-size: 10px;
}

.spread-close-divider-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
}

.sl-liq-note {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0 0;
}
.position-panel-main {
  background-color: var(--bg-base);
  color: var(--text);
  padding: 0 0 0 0;
  font-family: 'Quantico', sans-serif;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  border: none;
  height: 100%;
  user-select: none;
  overflow: auto;
  /* z-index: 0; */
}

.tabs {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  background: var(--bg-alt);
  padding: 0 0 0 0;
  margin: 0;
  border-radius: 0;
  width: 100%;
  height: 28px;
  /* border-box so the 1.5px border doesn't push rendered height past 28px —
     the sticky column header below sits at top: 28px and any overhang is a
     see-through seam rows scroll behind */
  box-sizing: border-box;
  flex-shrink: 0;
  border-bottom: 1.5px solid var(--bg-base);
  /* Pinned while the panel content scrolls under it (opaque bg covers rows) */
  position: sticky;
  top: 0;
  z-index: 20;
}

.tab {
  padding: 0 18px;
  height: 28px;
  border: none;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 0;
  font-size: 13px;
  /* font-family: 'Quantico', sans-serif; */
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  margin: 0;
  transition:
    color 0.15s,
    border-bottom 0.15s;
}

.tab.active {
  color: var(--text);
  border-bottom: 2px solid var(--text);
  background: none;
}

.tab:not(.active):hover {
  color: var(--text);
  background: none;
}

.broker-section {
  margin-left: 0;
  margin-top: 0;
}

.position-table {
  width: 100%;
  /* separate, NOT collapse: collapsed-table borders live on the table layer,
     so scrolling rows' borders (the 3px long/short bars) paint straight
     through the sticky header row. Separate keeps borders on the cells,
     which stick along with them. */
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 0;
  table-layout: fixed;
  text-align: left;
}

.position-table th,
.position-table td {
  padding: 4px 6px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.position-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-base);
  height: 20px;
  letter-spacing: 0.2px;
  /* Pinned just below the 28px sticky tab bar; opaque bg covers scrolling rows.
     The shadow paints a 2px opaque band over the tabs/header seam — fractional
     zoom levels can otherwise leave a sub-pixel gap rows show through. */
  position: sticky;
  top: 28px;
  z-index: 10;
  box-shadow: 0 -2px 0 var(--bg-base);
}

.position-table td {
  color: var(--text);
  font-size: 11px;
  height: 20px;
}

.position-table tr {
  min-height: 20px;
}

.position-table tr:hover {
  background-color: var(--bg-alt);
  transition: background-color 0.1s;
}

.privacy-toggle {
  background: none;
  border: none;
  padding: 0 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  height: 28px;
}

.privacy-icon {
  width: 16px;
  height: 16px;
}

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

.position-table td .position-status {
  margin-top: 3px;
  font-size: 0.85em;
}

.position-table td {
  color: var(--text-dim);
  font-size: 0.95em;
}

.equity-row,
.option-row {
  /* cursor: pointer; */
  background-color: var(--bg-alt);
  /* font-weight: 600; */
}

td.combined-size {
  color: var(--text);
  font-size: 1em;
}
.arrow {
  font-size: 11px;
  padding-right: 5px;
}

td.pnl-cell .pnl-percentage {
  color: var(--text-dim);
  font-size: 0.75em;
  margin-top: 5px;
  display: block;
}

.position-status.long {
  color: var(--profit);
}

.position-status.short {
  color: #ff5c5c;
}

.white {
  color: white !important;
}

.sub-info {
  color: var(--text-muted);
  font-size: 0.75em;
}

.broker-badge {
  margin-left: 5px;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  color: var(--text);
}

.broker-badge.clearstreet {
  background-color: #4f00ce; /* Clearstreet purple */
}

.broker-badge.ibkr {
  background-color: #ff0000; /* IBKR red */
}

.pending-orders-table {
  width: 100%;
}

.pending-order-row {
  background: rgba(255, 255, 255, 0.02);
}

.pending-order-row:hover {
  background: rgba(255, 255, 255, 0.05);
}

.order-side {
  font-weight: bold;
}

.order-side.buy {
  color: #90ee90;
}

.order-status {
  color: var(--text-muted);
}

.cancel-button {
  background: rgba(255, 0, 0, 0.1);
  border: 1px solid rgba(255, 0, 0, 0.2);
  color: #ff6b6b;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-button:hover {
  background: rgba(255, 0, 0, 0.2);
  border-color: rgba(255, 0, 0, 0.3);
}

/* History Panel */
.history-list {
  width: 100%;
  overflow: auto;
  height: 90%;
  font-family: 'Quantico', 'Fira Code', 'Consolas', monospace;
}

.history-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px 4px;
  position: relative;
}

.history-wipe-btn {
  background: var(--bg-base);
  color: var(--text-dim);
  border: 1px solid var(--bg-alt);
  font-weight: 500;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
  transition: color 0.15s;
}

.history-wipe-progress {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: rgba(255, 80, 80, 0.35);
  pointer-events: none;
}

.history-filters {
  display: flex;
  gap: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.history-filter-btn {
  background: none;
  color: #666;
  border: none;
  font-weight: 500;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition:
    color 0.15s,
    background 0.15s;
}

.history-filter-btn.active {
  background: var(--bg-alt);
  color: #fff;
  font-weight: 700;
}

.history-total-pnl {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Quantico', 'Fira Code', 'Consolas', monospace;
}

.history-total-pnl.positive {
  color: var(--profit);
}

.history-total-pnl.negative {
  color: #ff5c5c;
}

.history-header {
  display: grid;
  grid-template-columns: 2fr 0.6fr 1.2fr 1.2fr 1fr 0.3fr;
  align-items: center;
  padding: 0 8px;
  height: 22px;
  color: #555;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.history-entry {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.history-row {
  display: grid;
  grid-template-columns: 2fr 0.6fr 1.2fr 1.2fr 1fr 0.3fr;
  align-items: center;
  padding: 4px 8px;
  min-height: 28px;
  cursor: pointer;
  transition: background 0.1s;
  font-size: 12px;
  color: var(--text);
}

.history-row:hover {
  background: var(--bg-alt);
}

.history-row.expanded {
  background: rgba(255, 255, 255, 0.02);
}

.history-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
}

.history-cell.symbol-cell {
  flex-direction: row;
  align-items: center;
  gap: 6px;
}

.history-cell.dim {
  color: var(--text-muted);
}

.history-side-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-side-dot.buy {
  background: var(--profit);
}

.history-side-dot.sell {
  background: #ff5c5c;
}

.history-symbol {
  font-size: 12px;
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-time {
  font-size: 10px;
  color: #555;
}

.history-pnl {
  font-size: 12px;
  font-weight: 600;
}

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

.history-pnl.negative {
  color: #ff5c5c;
}

.history-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: #444;
  padding: 0 2px;
  line-height: 1;
  opacity: 0;
  transition:
    opacity 0.15s,
    color 0.15s;
}

.history-row:hover .history-delete-btn {
  opacity: 0.5;
}

.history-delete-btn:hover {
  opacity: 1 !important;
  color: #ff5c5c !important;
}

/* Expanded fills */
.history-fills {
  padding: 2px 8px 6px 24px;
  background: rgba(0, 0, 0, 0.15);
}

.history-fill-row {
  display: grid;
  grid-template-columns: 40px 40px 70px 1fr;
  gap: 8px;
  align-items: center;
  padding: 2px 0;
  font-size: 11px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

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

.fill-side {
  font-weight: 600;
  font-size: 10px;
}

.fill-side.buy {
  color: var(--profit);
}

.fill-side.sell {
  color: #ff5c5c;
}

.fill-qty {
  color: var(--text-muted);
  font-size: 11px;
}

.fill-price {
  color: var(--text);
  font-size: 11px;
}

.fill-time {
  color: #555;
  font-size: 10px;
}

/* Compact Mode Styles */
.position-table.compact th,
.position-table.compact td {
  padding: 2px 6px;
  height: 24px;
  vertical-align: middle;
}

.position-table.compact .equity-row,
.position-table.compact .option-row {
  min-height: 24px;
}

/* Collapsible folder section header band. Styled as a compact, subtle section
   divider so it doesn't break the table rhythm (esp. in compact mode). */
.position-table .folder-header-row {
  cursor: pointer;
  user-select: none;
}
.position-table .folder-header-row td {
  background: var(--bg-alt);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  height: 18px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.position-table .folder-header-row:hover td {
  background: var(--bg-hover);
}
.position-table.compact .folder-header-row td {
  padding: 1px 8px;
  height: 16px;
}

.position-table.compact .position-status {
  display: inline;
  margin-left: 8px;
  font-size: 10px;
}

.position-table.compact .broker-badge {
  margin-left: 4px;
  padding: 1px 3px;
  font-size: 9px;
  vertical-align: middle;
}

.position-table.compact .sub-info {
  display: inline;
  margin-left: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.position-table.compact .pnl-percentage {
  display: inline;
  margin-left: 6px;
  margin-top: 0;
  font-size: 10px;
}

.position-table.compact .combined-size {
  font-size: 11px;
}

.position-table.compact .pnl-cell {
  font-size: 11px;
}

.position-table.compact .white {
  font-size: 11px;
}

.position-table.compact .button-container {
  gap: 2px;
}

.position-table.compact .trade-button {
  padding: 2px 6px;
  font-size: 10px;
  height: 20px;
  min-width: 28px;
}

.position-table.compact .down-arrow-icon {
  width: 8px;
  height: 8px;
  margin-left: 2px;
}

/* Option symbol styling */
.option-symbol {
  font-weight: normal;
  font-size: 0.85em;
}

/* Compact mode for options */

.position-table.compact td {
  font-size: 10px;
}

.position-table.compact th {
  font-size: 10px;
}

/* Make symbol text more prominent in compact mode */
.position-table.compact td:first-child {
  color: #ffffff !important;
  font-size: 12px !important;
  /* font-weight: 600; */
}

/* Compact mode: Simple left border for long/short with circle indicator for broker.
   On the first CELL, not the row — row borders don't render with
   border-collapse: separate (see .position-table). */
.position-table.compact .equity-row.long > td:first-child,
.position-table.compact .option-row.long > td:first-child {
  border-left: 3px solid var(--profit);
}

.position-table.compact .equity-row.short > td:first-child,
.position-table.compact .option-row.short > td:first-child {
  border-left: 3px solid #ff5c5c;
}

/* Broker circle indicators */
.broker-circle {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  /* margin-left: 0px; */
  margin-right: 4px;
}

.broker-circle.clearstreet {
  background-color: #9966ff; /* Brighter purple */
}

.broker-circle.ibkr {
  background-color: #ff4444; /* Brighter red */
}

/* Hide position status text in compact mode only */
.position-table.compact .position-status {
  display: none;
}

/* Refresh button animation */
@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.refresh-prices-button:hover:not(:disabled) {
  opacity: 0.8;
}

.refresh-prices-button:active:not(:disabled) {
  transform: scale(0.95);
}

.equity-row td:first-child,
.option-row td:first-child {
  position: relative;
}

/* HL Info Tooltip */
.hl-info-icon {
  margin-left: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: help;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.hl-info-icon:hover {
  opacity: 1;
  color: var(--text);
}

.hl-info-tooltip {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: rgba(16, 16, 22, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 8px 10px;
  z-index: 10000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
  min-width: 160px;
  pointer-events: none;
  animation: hlTooltipIn 0.12s ease-out;
}

@keyframes hlTooltipIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hl-info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0;
  font-size: 11px;
}

.hl-info-label {
  color: var(--text-muted);
}

.hl-info-value {
  color: var(--text);
  font-weight: 600;
}

.hl-info-value.positive {
  color: var(--profit);
}

.hl-info-value.negative {
  color: #ff5c5c;
}
/* ── Toolbar ── */
.recap-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.recap-btn {
  padding: 3px 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-button);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.recap-btn:hover {
  background: var(--bg-button-hover);
  color: var(--text-dim);
}

.recap-btn--afk-active {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.4);
  color: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}

.recap-btn--afk-active:hover {
  background: rgba(245, 158, 11, 0.25);
}

.recap-btn--subtle {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

.recap-btn--subtle:hover {
  color: var(--text-muted);
  background: var(--bg-button);
}

.recap-btn--generate {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--accent);
}

.recap-btn--generate:hover {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
}

.recap-btn--generate:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.recap-btn--loading {
  animation: recapPulse 1.5s ease-in-out infinite;
}

.recap-btn--icon {
  border: none;
  background: transparent;
  padding: 3px;
  display: flex;
  align-items: center;
  opacity: 0.4;
  cursor: pointer;
}

.recap-btn--icon:hover {
  opacity: 0.7;
}

/* ── Status ── */
.recap-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.recap-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.recap-item-count {
  background: var(--bg-hover);
  color: var(--text-muted);
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 500;
  margin-left: 2px;
}

/* ── Body ── */
.recap-body {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px 12px;
}

.recap-empty {
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
  margin-top: 40px;
}

/* ── Raw Items ── */
.recap-raw {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.recap-raw-header {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 10px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.recap-raw-list {
  max-height: 250px;
  overflow-y: auto;
}

.recap-raw-item {
  padding: 4px 10px;
  font-size: 11px;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.recap-raw-item--alert {
  background: rgba(248, 113, 113, 0.04);
}

.recap-raw-item--analyzed {
  border-left: 2px solid rgba(99, 102, 241, 0.3);
}

.recap-raw-num {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
  min-width: 18px;
}

.recap-raw-text {
  color: var(--text-muted);
}

.recap-raw-analysis {
  color: var(--accent);
  font-size: 10px;
  margin-top: 2px;
  font-style: italic;
}

.recap-raw-alert {
  color: var(--loss);
  font-size: 10px;
  flex-shrink: 0;
}

/* ── Recap Content ── */
.recap-content {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-dim);
}

.recap-content p {
  margin: 0 0 4px 0;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.recap-content p:last-child {
  margin-bottom: 0;
  border-bottom: none;
  padding-bottom: 0;
}

/* Tier headers */
.recap-content h2 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin: 20px 0 10px 0;
  padding: 0 0 6px 10px;
  border-bottom: none;
}

.recap-content h2:first-child {
  margin-top: 0;
}

.recap-content h2.tier-key {
  color: #fbbf24;
  border-left: 3px solid #fbbf24;
}

.recap-content h2.tier-notable {
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.recap-content h2.tier-brief {
  color: var(--text-muted);
  border-left: 3px solid var(--border);
}

.recap-content h1 {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #fbbf24;
  border-left: 3px solid #fbbf24;
  padding-left: 10px;
  margin: 20px 0 10px 0;
}

.recap-content h1:first-child {
  margin-top: 0;
}

.recap-content h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin: 10px 0 5px 0;
}

/* Lists */
.recap-content ul {
  margin: 4px 0;
  padding-left: 0;
  list-style-type: none;
}

.recap-content li {
  margin: 8px 0;
  padding-left: 14px;
  position: relative;
}

.recap-content li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 7px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

/* Inline styles */
.recap-content strong {
  font-weight: 600;
  color: var(--text);
}

.recap-content em {
  font-style: normal;
  color: inherit;
}

.recap-content a {
  color: var(--accent);
  text-decoration: none;
}

.recap-content a:hover {
  text-decoration: underline;
}

.recap-content code {
  background: var(--bg-hover);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 11px;
}

.recap-content pre {
  background: var(--bg-alt);
  padding: 8px;
  border-radius: 3px;
  overflow-x: auto;
  margin: 8px 0;
}

.recap-content pre code {
  background: none;
  padding: 0;
}

/* Ticker symbols on structured entries — same interaction as .tfa-sym */
.recap-symbols {
  color: var(--accent);
  font-weight: 600;
}

.recap-sym {
  cursor: pointer;
  transition: color 0.12s ease;
}

.recap-sym:hover {
  text-decoration: underline;
}

/* Item references */
.recap-ref {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  transition: color 0.15s;
}

.recap-ref:hover {
  color: var(--text-dim);
}

/* ── Tooltip ── */
.item-tooltip {
  animation: tooltipIn 0.12s ease-out;
}

@keyframes tooltipIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes recapPulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 0.7;
  }
}
.shortcut-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  user-select: none;
}

.shortcut-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px;
  border-bottom: 1px solid var(--border);
  min-height: 22px;
}

.shortcut-title-bar .sc-gear-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  opacity: 0.5;
  transition: opacity 0.15s ease;
}

.shortcut-title-bar .sc-gear-btn:hover {
  opacity: 1;
  background: var(--bg-hover);
}

.shortcut-rows {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px;
}

.shortcut-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

/* Row container */
.sc-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

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

/* Section = label + buttons */
.sc-section {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sc-label {
  font-size: 10px;
  font-weight: bold;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 30px;
  flex-shrink: 0;
  cursor: pointer;
}

.sc-label:hover {
  color: var(--text);
}

/* Stock button grid */
.sc-btn-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
}

.sc-btn-row {
  display: flex;
  gap: 2px;
}

.sc-btn {
  flex: 1;
  cursor: pointer;
  background-color: var(--bg-button);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-weight: bold;
  font-size: 11px;
  height: 24px;
  border-radius: 3px;
  transition: background-color 0.1s ease;
}

.sc-btn:hover {
  background-color: var(--bg-button-hover);
}

.sc-btn:active {
  background-color: var(--text-muted);
}

.sc-buy {
  border-color: var(--profit);
}

.sc-buy:hover {
  background-color: var(--bg-button-hover);
}

.sc-sell {
  border-color: var(--loss);
}

.sc-sell:hover {
  background-color: var(--bg-button-hover);
}

/* Options row - calls and puts side by side */
.sc-options-row {
  display: flex;
  gap: 3px;
  flex: 1;
}

/* Single option button group (info + sizes) */
.sc-opt-group {
  display: flex;
  gap: 2px;
  flex: 1;
}

/* Main option info button */
.sc-opt-info {
  flex: 1 1 0%;
  min-width: 0;
  cursor: pointer;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  background-color: var(--bg-button);
  transition: background-color 0.1s ease;
  gap: 4px;
  overflow: hidden;
}

.sc-opt-info:hover {
  background-color: var(--bg-button-hover);
}

.sc-opt-info:active {
  background-color: var(--bg-button-hover);
}

.sc-opt-info.call {
  border-color: var(--profit);
}

.sc-opt-info.put {
  border-color: var(--loss);
}

.sc-opt-text {
  display: flex;
  flex-direction: column;
  font-size: 9px;
  line-height: 1.2;
  overflow: hidden;
}

.sc-opt-strike {
  color: var(--text-dim);
  font-weight: bold;
  white-space: nowrap;
}

.sc-opt-price {
  color: var(--text-muted);
  white-space: nowrap;
}

.sc-opt-size {
  font-size: 10px;
  font-weight: bold;
  color: var(--text-dim);
  white-space: nowrap;
}

/* Additional size buttons for options */
.sc-opt-size-btn {
  flex: 1 1 0%;
  min-width: 0;
  cursor: pointer;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-button);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: bold;
  transition: background-color 0.1s ease;
}

.sc-opt-size-btn:hover {
  background-color: var(--bg-button-hover);
}

.sc-opt-size-btn:active {
  background-color: var(--bg-button-hover);
}

.sc-opt-size-btn.call {
  border-color: var(--profit);
}

.sc-opt-size-btn.put {
  border-color: var(--loss);
}

/* Illiquidity states - background only, never override call/put border */

/* Waiting state */
.sc-waiting {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 4px;
}

/* Blink animation */
.sc-section.blink {
  animation: sc-blink 0.5s ease-in-out;
}

@keyframes sc-blink {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}
@keyframes yt-live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.botting-panel {
  display: flex;
  flex-direction: column;
  /* Fixed chrome (toolbar + tabs) pinned at the top; each tab renders into
     .botting-body, which is the only scroll region. So tabs read as distinctly
     separated pages instead of one long shared scroll that drags the tab bar
     and other tabs' content past the viewport. */
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text);
  font-size: 11px;
  user-select: none;
}

/* Pin the toolbar + tabs; only the active tab body scrolls. */
.botting-toolbar,
.botting-tabs {
  flex: 0 0 auto;
}
.botting-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Toolbar (no title — panel chrome already shows "Botting") ── */
.botting-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.botting-sound {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
}
.botting-sound select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 4px 0 0 4px;
  font-size: 10px;
  padding: 3px 4px;
  cursor: pointer;
  max-width: 92px;
}
.botting-sound-preview {
  background: var(--bg-button);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 0 4px 4px 0;
  cursor: pointer;
  font-size: 9px;
  padding: 0 6px;
}
.botting-sound-preview:hover {
  color: var(--accent);
}

.botting-arm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  cursor: pointer;
}
.botting-arm-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
}
.botting-arm.on {
  color: var(--profit);
  border-color: color-mix(in srgb, var(--profit) 45%, transparent);
}
.botting-arm.on .botting-arm-dot {
  background: var(--profit);
  box-shadow: 0 0 5px var(--profit);
}
.botting-arm.off {
  color: var(--text-muted);
}
/* Global dry-run ("AFK safe mode") toggle — same shape as .botting-arm but a
   distinct blue "on" state so it never reads as the green Armed switch. */
.botting-dryall {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 9px;
  cursor: pointer;
}
.botting-dryall.on {
  color: #3b82f6;
  border-color: color-mix(in srgb, #3b82f6 50%, transparent);
}
.botting-dryall.on .botting-arm-dot {
  background: #3b82f6;
  box-shadow: 0 0 5px #3b82f6;
}
.botting-dryall.off {
  color: var(--text-muted);
}

.botting-note {
  padding: 4px 8px;
  color: var(--text-muted);
  font-size: 9.5px;
  border-bottom: 1px solid var(--border);
}

/* ── Section header ── */
.botting-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 3px;
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.botting-add {
  background: var(--bg-button);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 9px;
  font-size: 10px;
  cursor: pointer;
}
.botting-add:hover {
  background: var(--bg-button-hover);
}
.botting-add:disabled {
  opacity: 0.5;
  cursor: default;
}

.botting-setups-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px 8px 4px;
}
/* Import status note sits to the left of the buttons. */
.botting-import-msg {
  margin-right: auto;
  font-size: 9.5px;
  color: var(--text-muted);
}
.botting-setups {
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.botting-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* ── Market-cap sizing editor (global table for the `mcap` size token) ── */
.bmcap {
  margin: 6px 8px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-input);
}
.bmcap-head {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bmcap-head:hover {
  color: var(--text);
}
.bmcap-caret {
  color: var(--text-dim);
}
.bmcap-sub {
  margin-left: auto;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-dim);
}
.bmcap-sub code,
.bmcap-hint code,
.bmcap-body code {
  font-family: 'Roboto Mono', monospace;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 0 2px;
  border-radius: 2px;
}
.bmcap-body {
  padding: 4px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--border);
}
.bmcap-hint {
  font-size: 9.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ── Global limits (COOLDOWN & LIMITS) — one stacked row per setting ── */
.blimits {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.blimit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}
.blimit-label {
  flex: 0 0 110px;
  color: var(--text);
}
.blimit-row input {
  width: 56px;
  box-sizing: border-box;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  font-family: inherit;
  text-align: right;
  -moz-appearance: textfield;
  appearance: textfield;
}
.blimit-row input:focus {
  outline: none;
  border-color: var(--accent);
}
.blimit-row input::-webkit-inner-spin-button,
.blimit-row input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.blimit-unit {
  color: var(--text-muted);
  min-width: 14px;
}
.blimit-hint {
  flex: 1;
  min-width: 0;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.3;
}
.bmcap-formula {
  margin: 4px 0;
  padding: 3px 6px;
  font-size: 10px;
  color: var(--text);
  background: var(--bg-button);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
.bmcap-step {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 3px;
}
.bmcap-tiers {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bmcap-tier,
.bmcap-line {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.bmcap-tier input,
.bmcap-line input {
  width: 48px;
  text-align: right;
  background: var(--bg-button);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 3px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.bmcap-mults {
  flex-wrap: wrap;
}
.bmcap-mults label {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.bmcap-mults input {
  width: 40px;
}
.bmcap-x {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
}
.bmcap-x:hover:not(:disabled) {
  color: var(--negative, #e15b64);
}
.bmcap-x:disabled {
  opacity: 0.3;
  cursor: default;
}
.bmcap-add,
.bmcap-reset {
  align-self: flex-start;
  background: var(--bg-button);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
}
.bmcap-add:hover,
.bmcap-reset:hover {
  background: var(--bg-button-hover);
}
.bmcap-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.bmcap-preview-label {
  font-size: 9.5px;
  color: var(--text-dim);
}
.bmcap-chip {
  font-size: 9.5px;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 3px;
  padding: 0 4px;
}

/* ── Setup folders (organizational grouping, mirrors position folders) ── */
.botting-folder-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  user-select: none;
}
.botting-folder-head:hover {
  color: var(--text);
}
.botting-folder-caret {
  flex: 0 0 auto;
  width: 10px;
  text-align: center;
}
.botting-folder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.botting-folder-count {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.botting-folder-empty {
  padding: 6px 10px;
  font-size: 10px;
  font-style: italic;
  color: var(--text-dim);
}

/* Bulk shared-fields editor inside the folder right-click menu. Reuses the
   setup-editor field classes (.botting-field/.botting-row/.bsrc/…) for a
   consistent look; this just sets the section's own rhythm. */
.bfolder-shared {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 4px 9px 3px;
}
.bfolder-hidden {
  font-size: 9.5px;
  font-style: italic;
  color: var(--text-dim);
  padding-top: 1px;
}

/* ── Setup card ── */
.bcard {
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-alt);
  overflow: hidden;
}
.bcard.on {
  border-color: color-mix(in srgb, var(--profit) 40%, var(--border));
}

.bcard-head {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 7px;
}

/* compact switch */
.bswitch {
  flex: 0 0 auto;
  width: 24px;
  height: 13px;
  border-radius: 7px;
  border: none;
  background: var(--bg-button);
  position: relative;
  cursor: pointer;
  transition: background 0.12s ease;
}
.bswitch-knob {
  position: absolute;
  top: 1.5px;
  left: 1.5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  transition:
    transform 0.12s ease,
    background 0.12s ease;
}
.bswitch.on {
  background: color-mix(in srgb, var(--profit) 35%, transparent);
}
.bswitch.on .bswitch-knob {
  transform: translateX(11px);
  background: var(--profit);
}

.bcard-name {
  font-weight: 600;
  cursor: pointer;
}

.bchip {
  flex: 0 0 auto;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid transparent;
  cursor: pointer;
}
.bchip.dry {
  color: var(--text-dim);
  background: var(--bg-input);
  border-color: var(--border);
}
.bchip.live {
  color: var(--loss);
  background: color-mix(in srgb, var(--loss) 14%, transparent);
  border-color: color-mix(in srgb, var(--loss) 45%, transparent);
}

.bcard-fires {
  flex: 0 0 auto;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
}

.bcard-cmd {
  flex: 1;
  min-width: 0;
  font-family: monospace;
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.bicon {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
}
.bicon:hover {
  color: var(--text);
  background: var(--bg-hover);
}
.bicon.danger:hover {
  color: var(--loss);
}

/* ── Editor ── */
.botting-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 8px 9px;
  border-top: 1px solid var(--border);
  background: var(--bg-base);
}

.botting-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.botting-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.botting-field.grow {
  flex: 1;
  min-width: 0;
}
.botting-field.conf {
  flex: 0 0 auto;
  width: 64px;
}
.botting-field.num {
  flex: 1;
  min-width: 0;
}
.botting-field > span {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.botting-field em {
  font-style: normal;
  color: var(--text-dim);
  text-transform: none;
}
.botting-field input,
.botting-field textarea,
.botting-field select {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 11px;
  font-family: inherit;
  resize: vertical;
}
.botting-field input:focus,
.botting-field textarea:focus,
.botting-field select:focus {
  outline: none;
  border-color: var(--accent);
}
.botting-field input.mono {
  font-family: monospace;
}
.botting-field textarea.botting-trigger {
  resize: none;
  line-height: 1.4;
  overflow-y: auto;
}
/* Subtle drag affordance to resize the Trigger box. */
.botting-resize-handle {
  height: 6px;
  cursor: ns-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.4;
  transition: opacity 0.12s ease;
}
.botting-resize-handle::after {
  content: '';
  width: 22px;
  height: 0;
  border-top: 1px solid var(--text-muted);
}
.botting-resize-handle:hover {
  opacity: 0.9;
}
.botting-field.conf input {
  text-align: center;
}
/* Kill the native number spinner. */
.botting-field input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.botting-field input[type='number']::-webkit-inner-spin-button,
.botting-field input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.botting-mode {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  width: fit-content;
}
.botting-mode-btn {
  background: var(--bg-input);
  color: var(--text-muted);
  border: none;
  cursor: pointer;
  font-size: 10px;
  padding: 4px 10px;
}
.botting-mode-btn + .botting-mode-btn {
  border-left: 1px solid var(--border);
}
.botting-mode-btn.active {
  background: var(--bg-hover);
  color: var(--text);
}
.botting-mode-btn.live.active {
  background: color-mix(in srgb, var(--loss) 22%, transparent);
  color: var(--loss);
  font-weight: 700;
}

.botting-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  color: var(--text-dim);
  cursor: pointer;
}
.botting-check input {
  cursor: pointer;
  margin: 0;
}

.botting-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.bsrc {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 2px 8px;
}
.bsrc:hover {
  color: var(--text-dim);
}
.bsrc.on {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
/* Named-filter chips mirror the news feed: left-click = require (green),
   right-click = exclude (red). */
.bsrc.allow {
  background: color-mix(in srgb, var(--profit) 16%, transparent);
  color: var(--profit);
  border-color: color-mix(in srgb, var(--profit) 55%, transparent);
}
.bsrc.deny {
  background: color-mix(in srgb, var(--loss) 16%, transparent);
  color: var(--loss);
  border-color: color-mix(in srgb, var(--loss) 55%, transparent);
}
/* Re-scan-on-summary action chip — distinct from a source toggle: dashed,
   slightly indented, and tinted only when active. */
.bsrc.rerun {
  border-style: dashed;
  margin-left: 2px;
}
.bsrc.rerun.on {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-style: solid;
}

/* ── Tabs ── */
.botting-tabs {
  display: flex;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.botting-tabs button {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 9.5px;
  font-weight: 600;
  padding: 5px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.botting-tabs button:hover {
  color: var(--text-dim);
}
.botting-tabs button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ── Activity log (detail cards) ── */
.botting-logwrap {
  display: flex;
  flex-direction: column;
}
.botting-logbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.botting-clear {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 9px;
  padding: 1px 7px;
}
.botting-clear:hover {
  color: var(--loss);
  border-color: color-mix(in srgb, var(--loss) 45%, transparent);
}
.botting-log {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.blog-card {
  border: 1px solid var(--border);
  border-left: 2px solid var(--text-muted);
  border-radius: 4px;
  background: var(--bg-alt);
  padding: 5px 7px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.blog-card.fired {
  border-left-color: var(--loss);
}
.blog-card.simulated {
  border-left-color: var(--accent);
}
.blog-card.error {
  border-left-color: var(--loss);
}
.blog-card.stale {
  border-left-color: var(--text-dim);
}
.blog-card.skip {
  border-left-color: var(--border);
  opacity: 0.6;
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.blog-badge {
  flex: 0 0 auto;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-muted);
  background: var(--bg-input);
}
.blog-badge.fired {
  color: var(--loss);
  background: color-mix(in srgb, var(--loss) 16%, transparent);
}
.blog-badge.simulated {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}
.blog-badge.error {
  color: var(--loss);
  background: color-mix(in srgb, var(--loss) 12%, transparent);
}
.blog-badge.stale {
  color: var(--text-dim);
  background: var(--bg-input);
}
.blog-badge.cooldown {
  color: #93c5fd;
  background: rgba(100, 116, 139, 0.18);
}

/* ── Global symbol-cooldown control (next to Dynamic Sizing) ── */
.bcooldown {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  margin-bottom: 4px;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-alt);
}
.bcooldown-title {
  font-weight: 700;
  letter-spacing: 0.3px;
  flex: 0 0 auto;
}
.bcooldown-min {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-dim);
  flex: 0 0 auto;
}
.bcooldown-min input {
  width: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 1px 4px;
  font-variant-numeric: tabular-nums;
}
.bcooldown-hint {
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Durable per-symbol cooldown viewer (Log tab) ── */
.botting-fsym {
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-bottom: 6px;
  background: var(--bg-alt);
}
.botting-fsym-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  font-size: 11px;
}
.botting-fsym-title {
  font-weight: 700;
  letter-spacing: 0.3px;
}
.botting-fsym-min {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-dim);
}
.botting-fsym-min input {
  width: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 1px 4px;
  font-variant-numeric: tabular-nums;
}
.botting-fsym-count {
  color: var(--text-muted);
  margin-left: auto;
}
.botting-fsym-list {
  max-height: 160px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.botting-fsym-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  font-size: 10.5px;
  border-bottom: 1px solid var(--border-faint, rgba(255, 255, 255, 0.04));
  opacity: 0.55;
}
.botting-fsym-row.locked {
  opacity: 1;
}
.botting-fsym-sym {
  font-weight: 700;
  min-width: 48px;
  font-variant-numeric: tabular-nums;
}
.botting-fsym-state {
  flex: 0 0 auto;
}
.botting-fsym-when {
  flex: 0 0 auto;
  color: var(--text-dim);
  min-width: 56px;
}
.botting-fsym-setup {
  flex: 0 0 auto;
  color: var(--text-muted);
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.botting-fsym-hl {
  flex: 1;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.botting-fsym-ovr {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
}
.botting-fsym-ovr input {
  width: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 0 3px;
  font-variant-numeric: tabular-nums;
}
.botting-fsym-ovr.set input {
  border-color: #93c5fd;
  color: #93c5fd;
}
.botting-fsym-x {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
}
.botting-fsym-x:hover {
  color: #f87171;
}
/* Manual lock/blacklist add row */
.botting-fsym-add {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}
.botting-fsym-add-sym {
  width: 70px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 2px 5px;
  font-weight: 700;
  text-transform: uppercase;
}
.botting-fsym-add-min {
  width: 48px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  padding: 2px 4px;
  font-variant-numeric: tabular-nums;
}
.botting-fsym-add-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  cursor: pointer;
  padding: 2px 8px;
}
.botting-fsym-add-btn:hover:not(:disabled) {
  border-color: var(--accent, #93c5fd);
}
.botting-fsym-add-btn.danger:hover:not(:disabled) {
  border-color: #f87171;
  color: #f87171;
}
.botting-fsym-add-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
/* Permanent (blacklisted) rows read full-strength + the ∞ override marker */
.botting-fsym-row.perm {
  opacity: 1;
}
.botting-fsym-ovr.perm {
  color: #f87171;
  font-weight: 700;
}
/* Trade-card headline (what the fire triggered on) */
.btrade-hl {
  padding: 1px 8px 3px;
  font-size: 11px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.blog-test {
  flex: 0 0 auto;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 4px;
}
.blog-name {
  font-weight: 600;
  font-size: 10.5px;
}
.blog-grow {
  flex: 1;
}
.blog-conf {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 700;
}
.blog-conf.met {
  color: var(--profit);
}
.blog-conf.miss {
  color: var(--text-muted);
}
.blog-conf-thr {
  font-size: 8.5px;
  font-weight: 500;
  color: var(--text-muted);
}
.blog-times {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.blog-time {
  color: var(--text-muted);
  font-family: monospace;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.blog-time em {
  font-style: normal;
  margin-right: 4px;
  opacity: 0.6;
}
.blog-time:hover {
  color: var(--text-dim);
}

.blog-submeta {
  display: flex;
  gap: 8px;
  color: var(--text-muted);
  font-size: 9px;
}
.blog-submeta span::before {
  content: '';
}
.blog-submeta span + span::before {
  content: '· ';
  margin-right: 6px;
  margin-left: -7px;
}

.blog-news {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.blog-reason {
  color: var(--text);
  font-size: 10px;
  font-style: italic;
  line-height: 1.3;
}
.blog-cmd {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 10px;
}
.blog-cmd code {
  font-family: monospace;
  color: var(--accent);
}
.blog-cmd-res {
  color: var(--text-muted);
}
.blog-err {
  color: var(--loss);
  font-size: 10px;
}

/* ── Tester ── */
.botting-tester {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 8px;
}
.botting-tester select,
.botting-tester textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 11px;
  font-family: inherit;
  resize: none;
}
.botting-test-input {
  overflow-y: auto;
}
.botting-tester select:focus,
.botting-tester textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.botting-test-run {
  display: flex;
  align-items: center;
  gap: 8px;
}
.botting-test-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}
.botting-test-count input {
  width: 46px;
  text-align: center;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 4px;
  font-size: 11px;
}
.botting-test-count input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.botting-test-count input[type='number']::-webkit-inner-spin-button,
.botting-test-count input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.botting-test-note {
  font-size: 10px;
  color: var(--text-dim);
}

.botting-test-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  padding: 5px 8px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.botting-test-summary b {
  font-size: 11px;
}
.botting-test-summary b.all {
  color: var(--profit);
}
.botting-test-summary b.none {
  color: var(--text-muted);
}
.botting-test-summary b.mixed {
  color: var(--accent);
}
.botting-test-errs {
  color: var(--loss);
}

.botting-test-runs {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.btrun {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 7px;
  font-size: 10px;
  border-bottom: 1px solid var(--border);
  border-left: 2px solid transparent;
}
.btrun:last-child {
  border-bottom: none;
}
.btrun.fire {
  border-left-color: var(--profit);
}
.btrun.err {
  border-left-color: var(--loss);
}
.btrun-top {
  display: flex;
  align-items: baseline;
  gap: 7px;
}
.btrun-verdict {
  flex: 0 0 auto;
  width: 30px;
  font-weight: 700;
  font-size: 9px;
}
.btrun.fire .btrun-verdict {
  color: var(--profit);
}
.btrun.no .btrun-verdict {
  color: var(--text-muted);
}
.btrun.err .btrun-verdict {
  color: var(--loss);
}
.btrun.filtered .btrun-verdict {
  color: var(--text-muted);
}
.btrun.filtered .btrun-head {
  color: var(--text-muted);
}
.btrun-head {
  flex: 1;
  min-width: 0;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.btrun-conf {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.btrun-lat {
  flex: 0 0 auto;
  width: 46px;
  text-align: right;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.btrun-reason {
  color: var(--text-muted);
  font-style: italic;
  padding-left: 37px;
  line-height: 1.3;
}
.btrun-resolved {
  font-style: normal;
  font-family: monospace;
  color: var(--accent);
}

/* === Auto position management ============================================ */

.bmanage {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}
.bmanage-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.bmanage-rules {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.bmanage-rule {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bmanage-rule select,
.bmanage-rule input {
  background: var(--bg-input, #111);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
}
.bmanage-num {
  width: 56px;
}

/* Trades tab */
.btrades {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  min-height: 0;
}
.btrades-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
}
.btrade {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
}
.btrade.managing,
.btrade.filling,
.btrade.firing {
  border-left-color: var(--accent);
}
.btrade.exiting {
  border-left-color: #e0a800;
}
.btrade.flat {
  border-left-color: var(--profit);
  opacity: 0.85;
}
.btrade.cancelled,
.btrade.error {
  border-left-color: var(--loss);
  opacity: 0.7;
}
.btrade.dry {
  border-style: dashed;
}
.btrade-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.btrade-state {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.btrade-state.managing {
  color: var(--accent);
}
.btrade-state.exiting {
  color: #e0a800;
}
.btrade-state.flat {
  color: var(--profit);
}
.btrade-state.cancelled,
.btrade-state.error {
  color: var(--loss);
}
.btrade-sym {
  font-weight: 700;
}
.btrade-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}
.btrade-move.up {
  color: var(--profit);
}
.btrade-move.down {
  color: var(--loss);
}
.btrade-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.btrade-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
}
.btrade-btn.exit {
  border-color: #e0a800;
  color: #e0a800;
}
.btrade-btn.flatten {
  border-color: var(--loss);
  color: var(--loss);
  font-weight: 700;
}
.btrade-btn:hover {
  background: var(--bg-hover, rgba(255, 255, 255, 0.06));
}
.btrade-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 3px 12px;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 11px;
}
.btrade-meta b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.btrade-qty {
  color: var(--text-dim);
}
.btrade-reason {
  font-style: italic;
  margin-top: 2px;
}
.btrade-log {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--text-muted);
  max-height: 180px;
  overflow-y: auto;
}
.btrade-logtime {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* Backtest box */
.bbacktest {
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 6px 8px;
}
.bbacktest-error {
  color: var(--loss);
  font-size: 11px;
  margin-top: 4px;
}
.bbacktest-result {
  margin-top: 6px;
  font-size: 12px;
  border-left: 3px solid var(--border);
  padding-left: 8px;
}
.bbacktest-result.up {
  border-left-color: var(--profit);
}
.bbacktest-result.down {
  border-left-color: var(--loss);
}

.bbacktest-chart {
  margin-top: 8px;
  height: 340px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

/* Backtest result chips */
.bbt-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.bbt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.bbt-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.bbt-chip b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.bbt-chip i {
  font-style: normal;
  color: var(--text-dim);
  font-size: 10px;
}
.bbt-chip b.up {
  color: var(--profit);
}
.bbt-chip b.down {
  color: var(--loss);
}
.bbt-chip.dir.long {
  color: var(--profit);
  border-color: rgba(22, 199, 132, 0.35);
  font-weight: 700;
}
.bbt-chip.dir.short {
  color: var(--loss);
  border-color: rgba(234, 57, 67, 0.35);
  font-weight: 700;
}
.bbt-chip.pnl {
  font-weight: 700;
  font-size: 12px;
}
.bbt-chip.pnl.up {
  color: var(--profit);
  border-color: rgba(22, 199, 132, 0.35);
  background: rgba(22, 199, 132, 0.08);
}
.bbt-chip.pnl.down {
  color: var(--loss);
  border-color: rgba(234, 57, 67, 0.35);
  background: rgba(234, 57, 67, 0.08);
}
.bbt-chip.bad {
  color: var(--loss);
  border-color: rgba(234, 57, 67, 0.5);
}
.bbt-reason {
  font-size: 11px;
  font-style: italic;
  color: var(--text-muted);
  padding-left: 2px;
}

/* Backtest chart interval bar — buttons come from ChartInterval (the same
   .chart-button footer the PriceChart uses), so no button styling here. */
.bbt-ivbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}
.bbt-ivloading {
  font-size: 10px;
  color: var(--text-muted);
}

/* Manage profiles */
.bmprofiles {
  margin: 6px 8px 0;
}
.bmprofile {
  border-top: 1px dashed var(--border);
  padding-top: 6px;
  margin-top: 6px;
}
.bmprofile-name {
  background: var(--bg-input, #111);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  width: 160px;
}
.bmprofile-meta {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.bmanage-head select {
  background: var(--bg-input, #111);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
}
.btrades.strip {
  padding: 8px 8px 0;
}

.bbt-nodata {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
  pointer-events: none;
}

/* Trade card: plan line + live adjust */
.btrade-meta b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.btrade-plan {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-size: 10px;
}
.btrade-stop,
.btrade-rule {
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--text-muted);
}
.btrade-stop {
  border-color: rgba(234, 57, 67, 0.4);
  color: var(--loss);
}
.btrade-stop b {
  color: var(--loss);
  font-variant-numeric: tabular-nums;
}
.btrade-stop i {
  font-style: normal;
  color: var(--text-dim);
}
.btrade-stop i.down {
  color: var(--loss);
  font-weight: 700;
}
.btrade-rule {
  color: var(--accent, #4fc3f7);
  border-color: color-mix(in srgb, var(--accent, #4fc3f7) 35%, transparent);
}
.btrade-adjust {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.btrade-fee {
  color: var(--text-muted);
}
.btrade-fee b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.btrade-fee i {
  font-style: normal;
  color: var(--loss);
  font-size: 10px;
}

.btrade-adjust-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.btrade-adjust-hint {
  flex: 1;
  color: var(--text-muted);
  font-size: 10px;
  font-style: italic;
}

/* ── Diagnostics tab: per-day × per-model call counts ── */
.botting-diag {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* Per-model totals over the whole window. */
.bdiag-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
}
.bdiag-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  background: var(--bg-alt);
}
.bdiag-chip.gemini {
  border-color: color-mix(in srgb, var(--loss) 45%, transparent);
}
.bdiag-chip-model {
  color: var(--text-dim);
}
.bdiag-chip-n {
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.bdiag-chip.gemini .bdiag-chip-n {
  color: var(--loss);
}
.bdiag-chip-tag {
  color: var(--loss);
  font-weight: 700;
}
.bdiag-chip-mini {
  padding: 0 4px;
  gap: 0;
}

.bdiag-tablewrap {
  overflow: auto;
  padding: 0 8px;
}
.bdiag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.bdiag-table th,
.bdiag-table td {
  padding: 3px 6px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.bdiag-table th {
  position: sticky;
  top: 0;
  background: var(--bg-base);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.bdiag-table th.gemini,
.bdiag-table td.gemini {
  color: var(--loss);
}
.bdiag-table td.groq {
  color: var(--text);
}
.bdiag-table td.zero {
  color: var(--text-muted);
  opacity: 0.5;
}
.bdiag-table .bdiag-day {
  text-align: left;
  color: var(--text-dim);
}
.bdiag-table .bdiag-rowtot {
  font-weight: 700;
  color: var(--text);
  border-left: 1px solid var(--border);
}
.bdiag-table tr.is-today {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.bdiag-table tr.is-today .bdiag-day {
  color: var(--accent);
  font-weight: 700;
}

.bdiag-note {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px;
  color: var(--text-muted);
  font-size: 9.5px;
  font-style: italic;
}

/* ── Command builder ── */
.cmdb-toggle {
  margin-left: 8px;
  font-size: 9px;
  padding: 1px 7px;
}
.cmdb-toggle.on {
  border-color: var(--accent);
  color: var(--accent);
}
.cmdb {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
  padding: 7px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-base);
}
.cmdb-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.cmdb-cond-label {
  flex: 0 0 auto;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.cmdb-cond {
  flex: 0 0 120px;
  background: var(--bg-input);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 4px;
  font-size: 11px;
  padding: 3px 6px;
}
.cmdb-legs {
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 11px;
  padding: 4px 7px;
}
.cmdb-legs:focus {
  outline: none;
  border-color: var(--accent);
}
.cmdb-actions {
  display: flex;
  gap: 8px;
}

/* ── Tester: setup picker + manual EXECUTE TRADE ── */
.botting-test-top {
  display: flex;
  align-items: stretch;
  gap: 10px;
}
.botting-test-select {
  flex: 0 1 50%;
  min-width: 0;
}
.botting-exec {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.botting-exec-warn {
  color: var(--loss);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.botting-exec-sym {
  width: 80px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 7px;
  font-size: 11px;
  text-transform: uppercase;
}
.botting-exec-btn {
  background: color-mix(in srgb, var(--loss) 18%, transparent);
  color: var(--loss);
  border: 1px solid color-mix(in srgb, var(--loss) 55%, transparent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.botting-exec-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--loss) 30%, transparent);
}
.botting-exec-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.botting-exec-btn.on {
  background: var(--loss);
  color: #fff;
  border-color: var(--loss);
  box-shadow: 0 0 8px color-mix(in srgb, var(--loss) 60%, transparent);
}
.botting-add.live {
  background: color-mix(in srgb, var(--loss) 22%, transparent);
  color: var(--loss);
  border-color: color-mix(in srgb, var(--loss) 55%, transparent);
  font-weight: 700;
}
.botting-exec-msg {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: monospace;
  padding: 2px 0;
}

.botting-logsearch {
  flex: 0 1 240px;
  min-width: 0;
  margin-right: auto;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
}
.botting-logsearch:focus {
  outline: none;
  border-color: var(--accent);
}

/* Naked autonomous fire — a real order placed with NO stop. Impossible to miss. */
.blog-card.unmanaged {
  border: 2px solid var(--loss);
  background: color-mix(in srgb, var(--loss) 16%, var(--bg-alt));
  box-shadow: 0 0 10px color-mix(in srgb, var(--loss) 55%, transparent);
}
.blog-card.unmanaged .blog-action {
  color: #fff;
  background: var(--loss);
  font-weight: 800;
}
/* Prediction Markets panel (Polymarket) */

.prediction-markets-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  font-size: 11px;
}

.pm-header {
  position: relative;
  padding: 6px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pm-search-input {
  width: 100%;
  background: var(--bg-input, #1a1a1a);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  padding: 5px 10px;
  outline: none;
  transition: border-color 0.15s;
}

.pm-search-input:focus {
  border-color: var(--accent, #b4b4f9);
}

.pm-search-spinner {
  position: absolute;
  right: 16px;
  top: 10px;
  color: var(--text-muted);
}

.pm-search-results {
  position: absolute;
  top: 100%;
  left: 6px;
  right: 6px;
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-panel, #141414);
  border: 1px solid var(--border);
  border-radius: 6px;
  z-index: 50;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
}

.pm-search-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

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

.pm-search-row:hover {
  background: var(--bg-hover, #222);
}

.pm-search-text {
  overflow: hidden;
  min-width: 0;
}

.pm-search-event {
  color: var(--text-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-search-question {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-search-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.pm-vol {
  color: var(--text-muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

/* ── YES probability pill ─────────────────────────────────────────────── */

.pm-pill {
  display: inline-block;
  min-width: 40px;
  text-align: center;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(159, 216, 164, 0.12);
  border: 1px solid rgba(159, 216, 164, 0.25);
  color: #9fd8a4;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.pm-pill-sm {
  min-width: 34px;
  padding: 1px 6px;
  font-size: 10px;
}

/* ── Table ────────────────────────────────────────────────────────────── */

.pm-table-wrap {
  flex: 1;
  overflow-y: auto;
}

.pm-empty {
  padding: 32px 12px;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.7;
}

.pm-empty-icon {
  font-size: 22px;
  margin-bottom: 6px;
  opacity: 0.5;
}

.pm-table {
  width: 100%;
  border-collapse: collapse;
}

.pm-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-panel, #141414);
  color: var(--text-muted);
  text-align: right;
  font-weight: 500;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.pm-table th.pm-th-market {
  text-align: left;
}

.pm-table th.pm-th-spark {
  text-align: center;
}

.pm-table td {
  padding: 5px 8px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  vertical-align: middle;
}

.pm-table tbody tr {
  transition: background 0.12s;
}

.pm-table tbody tr:hover {
  background: var(--bg-hover, #1d1d1d);
}

.pm-td-market {
  text-align: left !important;
  max-width: 0;
  width: 44%;
  overflow: hidden;
  cursor: pointer;
}

.pm-event-label {
  color: var(--text-muted);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-question {
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}

.pm-td-market:hover .pm-question {
  color: var(--accent, #b4b4f9);
}

.pm-td-delta {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.pm-up {
  color: #26a69a;
}

.pm-down {
  color: #ef5350;
}

.pm-flat {
  color: var(--text-muted);
}

.pm-td-spark {
  text-align: center !important;
}

.pm-spark {
  display: block;
  margin: 0 auto;
}

.pm-spark-empty {
  color: var(--text-muted);
  opacity: 0.4;
  letter-spacing: 2px;
}

.pm-td-quote,
.pm-td-vol,
.pm-td-ends {
  color: var(--text-dim, #9aa);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
}

.pm-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  padding: 1px 4px;
  opacity: 0;
  transition: opacity 0.12s;
}

.pm-table tbody tr:hover .pm-remove-btn {
  opacity: 1;
}

.pm-remove-btn:hover {
  color: #ef5350;
}

/* ── Tabs + add buttons (Trending default view) ───────────────────────── */

.pm-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 5px;
}

.pm-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  transition:
    color 0.12s,
    background 0.12s;
}

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

.pm-tab.active {
  background: var(--bg-hover, #222);
  border-color: var(--border);
  color: var(--text);
}

.pm-search-wrap {
  position: relative;
}

.pm-add-btn {
  background: rgba(159, 216, 164, 0.12);
  border: 1px solid rgba(159, 216, 164, 0.3);
  border-radius: 4px;
  color: #9fd8a4;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 1px 7px;
}

.pm-add-btn:hover {
  background: rgba(159, 216, 164, 0.25);
}

.pm-added-check {
  color: var(--text-muted);
  font-size: 11px;
}

/* ── Category chips + compact width modes ─────────────────────────────── */

.pm-cats {
  display: flex;
  gap: 2px;
  margin-left: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pm-cats::-webkit-scrollbar {
  display: none;
}

.pm-cat {
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 10px;
  padding: 3px 7px;
  cursor: pointer;
  white-space: nowrap;
}

.pm-cat:hover {
  color: var(--text);
}

.pm-cat.active {
  background: rgba(180, 180, 249, 0.12);
  color: var(--accent, #b4b4f9);
}

/* Long outcome labels (player props, O/U lines) can't blow up the row */
.pm-pill {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Shed low-priority columns as the panel narrows */
.pm-narrow .pm-col-narrow,
.pm-tiny .pm-col-narrow,
.pm-tiny .pm-col-tiny {
  display: none;
}

.pm-tiny .pm-pill {
  max-width: 110px;
}

/* ── In-panel event view ──────────────────────────────────────────────── */

.pm-detail-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pm-back-btn {
  background: var(--bg-hover, #222);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.pm-back-btn:hover {
  border-color: var(--accent, #b4b4f9);
}

.pm-detail-title-wrap {
  min-width: 0;
  flex: 1;
}

.pm-detail-title {
  font-weight: 700;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pm-detail-meta {
  display: flex;
  gap: 10px;
  color: var(--text-muted);
  font-size: 10px;
}

.pm-detail-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.pm-interval-btns {
  display: flex;
  gap: 2px;
}

.pm-chart-wrap {
  padding: 4px 8px 2px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pm-chart {
  width: 100%;
  height: 150px;
  display: block;
}

.pm-chart-empty {
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.pm-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 4px 0 6px;
  font-size: 10px;
  color: var(--text-dim, #9aa);
}

.pm-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.pm-legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pm-td-outcome {
  cursor: default !important;
}

.pm-outcome-inner {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

/* ── Chart hover scrub (crosshair + value stack) ──────────────────────── */

.pm-chart-area {
  position: relative;
  cursor: crosshair;
}

.pm-axis-label {
  position: absolute;
  right: 2px;
  transform: translateY(-50%);
  font-size: 9px;
  color: var(--text-muted);
  pointer-events: none;
  background: rgba(20, 20, 20, 0.6);
  padding: 0 2px;
  border-radius: 2px;
}

.pm-crosshair {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(200, 200, 210, 0.35);
  pointer-events: none;
}

.pm-hover-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(10, 10, 10, 0.9);
  pointer-events: none;
}

.pm-hover-tip {
  position: absolute;
  top: 4px;
  margin: 0 8px;
  padding: 5px 8px;
  background: rgba(16, 16, 18, 0.92);
  border: 1px solid var(--border);
  border-radius: 5px;
  pointer-events: none;
  z-index: 5;
  min-width: 110px;
}

.pm-hover-time {
  color: var(--text-muted);
  font-size: 9.5px;
  margin-bottom: 3px;
}

.pm-hover-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  line-height: 1.5;
}

.pm-hover-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 130px;
}

/* ── Sharp skin: match the terminal's contrast + density ──────────────── */

.prediction-markets-panel {
  font-size: 11px;
}

.pm-table td {
  padding: 4px 7px;
}

.pm-table th {
  color: #8b8f98;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.pm-question {
  color: #e8e9ec;
  font-weight: 500;
}

.pm-event-label {
  font-size: 9px;
  color: #6f747d;
  letter-spacing: 0.4px;
}

.pm-table tbody tr:hover {
  background: #1c1e24;
}

.pm-table tbody tr:hover .pm-question {
  color: #ffffff;
}

/* Pills: tighter, squarer, bolder — color comes inline from probability */
.pm-pill {
  border-radius: 4px;
  padding: 1px 7px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

/* Punchier movement colors (match terminal green/red energy) */
.pm-up {
  color: #16c784;
  font-weight: 700;
}

.pm-down {
  color: #ea3943;
  font-weight: 700;
}

.pm-td-delta {
  font-size: 10.5px;
}

/* Vol 24h reads primary; Total stays secondary */
.pm-td-vol {
  color: #c9ccd3;
}

.pm-td-vol.pm-col-narrow,
.pm-td-quote,
.pm-td-ends {
  color: #7d828b;
}

/* Tabs + chips: accent-filled active states like the interval buttons */
.pm-tab.active {
  background: var(--accent, #b4b4f9);
  border-color: var(--accent, #b4b4f9);
  color: #0d0d0f;
}

.pm-cat.active {
  background: rgba(180, 180, 249, 0.18);
  color: var(--accent, #b4b4f9);
  font-weight: 700;
}

.pm-search-input {
  border-radius: 4px;
  background: #131418;
}

.pm-add-btn {
  border-radius: 3px;
  color: #16c784;
  background: rgba(22, 199, 132, 0.1);
  border-color: rgba(22, 199, 132, 0.35);
}

.pm-add-btn:hover {
  background: rgba(22, 199, 132, 0.25);
}

.pm-detail-title {
  font-size: 12.5px;
  color: #f2f3f5;
}

/* ── Readability pass: undo over-tightening from the sharp skin ───────── */

.pm-table td {
  padding: 5px 8px;
}

.pm-question {
  color: #f0f1f4;
  font-size: 11.5px;
  line-height: 1.4;
}

.pm-event-label {
  font-size: 9.5px;
  color: #999ea8;
  letter-spacing: 0.35px;
  margin-bottom: 1px;
}

.pm-table th {
  color: #9aa0aa;
}

.pm-table tbody tr:hover {
  background: #20232a;
}

/* ── LIVE badge, game-board sections, rules ───────────────────────────── */

.pm-live {
  display: inline-block;
  padding: 0 5px;
  border-radius: 3px;
  background: rgba(234, 57, 67, 0.18);
  border: 1px solid rgba(234, 57, 67, 0.5);
  color: #ea3943;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  vertical-align: middle;
}

.pm-section-row td {
  background: #17181d;
  color: #9aa0aa;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
}

.pm-rules {
  padding: 6px 10px 12px;
}

.pm-rules-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 0;
}

.pm-rules-toggle:hover {
  color: var(--text);
}

.pm-rules-body {
  color: #b9bdc5;
  font-size: 10.5px;
  line-height: 1.55;
  max-width: 720px;
  white-space: pre-wrap;
}

.pm-rules-source a {
  color: var(--accent, #b4b4f9);
  cursor: pointer;
  word-break: break-all;
}

.pm-search-none {
  padding: 10px;
  text-align: center;
  color: var(--text-muted);
}

/* ── No text selection (terminal panel, not a document) ───────────────── */

.prediction-markets-panel {
  user-select: none;
}

.prediction-markets-panel input {
  user-select: text;
}

/* Rules text stays copyable — you WANT to paste resolution terms places */
.pm-rules-body {
  user-select: text;
}

/* Sortable headers */
.pm-th-sort {
  cursor: pointer;
}

.pm-th-sort:hover {
  color: var(--text);
}
@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(./KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(./KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(./KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(./KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(./KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(./KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(./KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(./KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(./KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(./KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(./KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(./KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(./KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(./KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(./KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(./KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(./KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(./KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(./KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(./KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(./KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(./KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(./KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(./KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(./KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(./KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(./KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(./KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(./KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(./KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(./KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(./KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(./KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:"KaTeX_SansSerif";font-style:normal;font-weight:700;src:url(./KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(./KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(./KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:"KaTeX_SansSerif";font-style:italic;font-weight:400;src:url(./KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(./KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(./KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:"KaTeX_SansSerif";font-style:normal;font-weight:400;src:url(./KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(./KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(./KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(./KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(./KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(./KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(./KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(./KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(./KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(./KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(./KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(./KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(./KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(./KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(./KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(./KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(./KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(./KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(./KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(./KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font:normal 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;position:relative;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.18.1"}.katex .katex-mathml{border:0;-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.katex-newline{display:block}.katex .katex-base{position:relative;white-space:nowrap;width:-webkit-min-content;width:-moz-min-content;width:min-content}.katex .katex-base,.katex .katex-strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .katex-vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .katex-thinbox{display:inline-flex;flex-direction:row;max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .katex-hdashline,.katex .katex-hline,.katex .katex-overline .overline-line,.katex .katex-rule,.katex .katex-underline .underline-line,.katex .mfrac .frac-line{min-height:1px}.katex .mspace{display:inline-block}.katex .katex-smash{display:inline;line-height:0}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.katex-inner,.katex .llap>.katex-inner,.katex .rlap>.katex-inner{position:absolute}.katex .clap>.katex-fix,.katex .llap>.katex-fix,.katex .rlap>.katex-fix{display:inline-block}.katex .llap>.katex-inner{right:0}.katex .clap>.katex-inner,.katex .rlap>.katex-inner{left:0}.katex .clap>.katex-inner>span{margin-left:-50%;margin-right:50%}.katex .katex-rule{border:0 solid;display:inline-block;position:relative}.katex .katex-hline,.katex .katex-overline .overline-line,.katex .katex-underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .katex-hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.katex-root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .katex-sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .katex-sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .katex-sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .katex-sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .katex-sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .katex-sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .katex-sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .katex-sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .katex-sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .katex-sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .katex-sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .katex-sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .katex-sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .katex-sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .katex-sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .katex-sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .katex-sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .katex-sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .katex-sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .katex-sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .katex-sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .katex-sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .katex-sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .katex-sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .katex-sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .katex-sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .katex-sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .katex-sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .katex-sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .katex-sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .katex-sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .katex-sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .katex-sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .katex-sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .katex-sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .katex-sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .katex-sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .katex-sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .katex-sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .katex-sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .katex-sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .katex-sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .katex-sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .katex-sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .katex-sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .katex-sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .katex-sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .katex-sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .katex-sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .katex-sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .katex-sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .katex-sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .katex-sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .katex-sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .katex-sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .katex-sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .katex-sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .katex-sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .katex-sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .katex-sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .katex-sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .katex-sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .katex-sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .katex-sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .katex-sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .katex-sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .katex-sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .katex-sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .katex-sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .katex-sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .katex-sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .katex-sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .katex-sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .katex-sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .katex-sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .katex-sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .katex-sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .katex-sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .katex-sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .katex-sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .katex-sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .katex-sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .katex-sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .katex-sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .katex-sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .katex-sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .katex-sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .katex-sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .katex-sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .katex-sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .katex-sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .katex-sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .katex-sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .katex-sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .katex-sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .katex-sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .katex-sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .katex-sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .katex-sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .katex-sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .katex-sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .katex-sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .katex-sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .katex-sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .katex-sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .katex-sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .katex-sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .katex-sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .katex-sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .katex-sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .katex-sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .katex-sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .katex-sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .katex-sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .katex-sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .katex-sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .katex-sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .katex-sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .katex-sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .katex-sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .katex-sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .katex-accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .katex-accent .accent-body{position:relative}.katex .katex-accent .accent-body:not(.accent-full){width:0}.katex .katex-overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex svg{fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .katex-stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .katex-stretchy:after,.katex .katex-stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .katex-sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.katex-tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.katex-tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}
.tfa-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--bg-base);
  color: var(--text);
  font-size: 12px;
}

.tfa-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 4%, transparent),
    transparent
  );
}

.tfa-header-actions {
  display: flex;
  gap: 4px;
}

.tfa-icon-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 10px;
  padding: 3px 8px;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.tfa-icon-btn:hover {
  color: var(--text);
  background: var(--bg-alt);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  transform: translateY(-1px);
}

.tfa-icon-btn:active {
  transform: translateY(0);
}

.tfa-icon-btn--active {
  color: var(--text);
  background: var(--bg-alt);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

/* UI chrome never selects -- a drag across the panel should only grab
   conversation content, not button/tab/label text. */
.tfa-header,
.tfa-tabs,
.tfa-icon-btn,
.tfa-toggle,
.tfa-tab-new,
.tfa-latest,
.tfa-dropdown,
.tfa-empty-hints {
  user-select: none;
}

.tfa-settings {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  animation: tfa-slide-down 0.18s ease both;
}

@keyframes tfa-slide-down {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tfa-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

.tfa-toggle:hover {
  color: var(--text);
}

.tfa-toggle input[type='checkbox'] {
  accent-color: var(--accent);
}

.tfa-custom-prompt {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 11px;
  padding: 5px 6px;
  resize: vertical;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

.tfa-custom-prompt:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

/* Conversation tabs: one strip, scrolls sideways rather than wrapping so the
   feed never loses height as chats accumulate */
.tfa-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  padding: 0 6px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  flex: 0 0 auto;
}

.tfa-tabs::-webkit-scrollbar {
  display: none;
}

.tfa-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 180px;
  padding: 5px 8px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

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

.tfa-tab--active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tfa-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tfa-tab-x {
  opacity: 0;
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
}

.tfa-tab:hover .tfa-tab-x {
  opacity: 0.7;
}

.tfa-tab-x:hover {
  opacity: 1;
  color: var(--negative, #c96a4f);
}

.tfa-tab-input {
  width: 140px;
  padding: 1px 4px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--bg-base);
  color: var(--text);
  font-size: 11px;
  font-family: inherit;
  outline: none;
}

.tfa-tab-new {
  padding: 0 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.tfa-tab-new:hover {
  color: var(--accent);
}

.tfa-feed {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.tfa-messages {
  flex: 1 1 auto;
  /* offsetTop of the anchor question is measured against this box */
  position: relative;
  overflow-y: auto;
  /* wide tables scroll inside their own frame -- the panel itself never
     scrolls sideways (sideways drift read as jitter) */
  overflow-x: hidden;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* NOT scroll-behavior: smooth -- each streamed token writes scrollTop, and
     every write would start a fresh animation the next one interrupts */
}

/* Reserves the room under the newest question that lets it sit at the top
   while its answer streams in; height is set from the panel */
.tfa-spacer {
  flex: 0 0 auto;
  margin-top: -12px;
}

.tfa-latest {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-alt);
  color: var(--text-muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.tfa-latest:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
}

/* Thin terminal scrollbar */
.tfa-messages::-webkit-scrollbar,
.tfa-dropdown::-webkit-scrollbar,
.tfa-ctx-lists::-webkit-scrollbar,
.tfa-step-table-wrap::-webkit-scrollbar,
.tfa-step-pre::-webkit-scrollbar,
.tfa-md-table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.tfa-messages::-webkit-scrollbar-thumb,
.tfa-dropdown::-webkit-scrollbar-thumb,
.tfa-ctx-lists::-webkit-scrollbar-thumb,
.tfa-step-table-wrap::-webkit-scrollbar-thumb,
.tfa-step-pre::-webkit-scrollbar-thumb,
.tfa-md-table-wrap::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--text-muted) 30%, transparent);
  border-radius: 3px;
}

.tfa-messages::-webkit-scrollbar-thumb:hover,
.tfa-dropdown::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--text-muted) 55%, transparent);
}

/* Empty state: quiet hero, gradient wordmark */
.tfa-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 15%;
  font-size: 11px;
  animation: tfa-msg-in 0.35s ease both;
}

.tfa-empty-mark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(
    100deg,
    var(--accent, #4d8dff),
    color-mix(in srgb, var(--accent, #4d8dff) 35%, #b48cff),
    var(--accent, #4d8dff)
  );
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tfa-shimmer 6s linear infinite;
}

.tfa-empty-sub {
  max-width: 320px;
  line-height: 1.5;
}

.tfa-empty-hints {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}

.tfa-empty-hint {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 10px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-alt) 60%, transparent);
}

.tfa-msg {
  max-width: 92%;
  min-width: 0;
  line-height: 1.45;
  /* anchor for the hover actions overlay */
  position: relative;
  animation: tfa-msg-in 0.22s ease both;
}

@keyframes tfa-msg-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tfa-msg--user {
  align-self: flex-end;
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--accent) 14%, var(--bg-alt)),
    color-mix(in srgb, var(--accent) 7%, var(--bg-alt))
  );
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: 10px 10px 3px 10px;
  padding: 6px 11px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.tfa-msg--assistant {
  align-self: flex-start;
  padding: 0 2px;
  max-width: 100%;
}

.tfa-msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.tfa-msg--assistant .tfa-msg-text {
  white-space: normal;
  line-height: 1.55;
}

.tfa-msg--assistant .tfa-msg-text h4 {
  margin: 12px 0 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-left: 8px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, transparent);
}

.tfa-msg--assistant .tfa-msg-text ul {
  margin: 4px 0;
  padding-left: 16px;
}

.tfa-msg--assistant .tfa-msg-text li {
  margin: 2px 0;
}

.tfa-msg--assistant .tfa-msg-text li::marker {
  color: color-mix(in srgb, var(--accent) 65%, var(--text-muted));
}

.tfa-msg--assistant .tfa-msg-text ol {
  margin: 4px 0;
  padding-left: 20px;
}

/* Nested lists sit tighter than the top level */
.tfa-msg--assistant .tfa-msg-text li > ul,
.tfa-msg--assistant .tfa-msg-text li > ol {
  margin: 2px 0;
}

.tfa-msg--assistant .tfa-msg-text p {
  margin: 0 0 8px;
}

.tfa-msg--assistant .tfa-msg-text p:last-child {
  margin-bottom: 0;
}

.tfa-msg--assistant .tfa-msg-text code {
  background: var(--bg-alt);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 11px;
}

.tfa-md-pre {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-alt);
  font-size: 11px;
  overflow-x: auto;
  white-space: pre;
}

.tfa-md-pre code {
  background: none;
  padding: 0;
}

.tfa-msg--assistant .tfa-msg-text a {
  color: var(--accent);
  text-decoration: none;
}

.tfa-msg--assistant .tfa-msg-text a:hover {
  text-decoration: underline;
}

.tfa-msg--assistant .tfa-msg-text blockquote {
  margin: 8px 0;
  padding: 2px 0 2px 10px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  color: var(--text-muted);
}

.tfa-msg--assistant .tfa-msg-text hr {
  margin: 12px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Model-generated images are the answer, not an attachment -- full width */
.tfa-img-gen {
  display: block;
  max-width: 100%;
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.tfa-md-img {
  max-width: 100%;
  border-radius: 4px;
  display: block;
  margin: 4px 0;
}

.tfa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 5px;
}

.tfa-chip {
  background: color-mix(in srgb, var(--accent) 18%, var(--bg-alt));
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10px;
  white-space: nowrap;
}

.tfa-chip--muted {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text-muted);
}

.tfa-steps {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
  max-width: 100%;
}

.tfa-step-note {
  color: var(--text-muted);
  font-size: 11px;
  font-style: italic;
  padding: 2px 0;
}

.tfa-step-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 2px solid color-mix(in srgb, var(--accent) 55%, var(--border));
  border-radius: 5px;
  padding: 3px 8px;
  font-family: monospace;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  min-width: 0;
  animation: tfa-msg-in 0.18s ease both;
  transition:
    color 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

.tfa-step-row:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  border-left-color: var(--accent);
}

/* Running tool call: shimmer sweep across the row */
.tfa-step-row--running {
  background: linear-gradient(
      100deg,
      transparent 30%,
      color-mix(in srgb, var(--accent) 10%, transparent) 50%,
      transparent 70%
    ),
    var(--bg-alt);
  background-size: 250% 100%;
  animation:
    tfa-msg-in 0.18s ease both,
    tfa-shimmer 1.6s linear infinite;
}

.tfa-step-name {
  color: var(--accent);
  flex: 0 0 auto;
}

.tfa-step-args {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
}

.tfa-step-result {
  flex: 0 0 auto;
  white-space: nowrap;
}

.tfa-step-row--error {
  border-left-color: var(--loss);
}

.tfa-step-row--error .tfa-step-result {
  color: var(--loss);
}

.tfa-step-row--running .tfa-step-result {
  animation: tfa-pulse 1.2s ease-in-out infinite;
}

.tfa-step-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  margin-top: 2px;
  animation: tfa-msg-in 0.18s ease both;
}

.tfa-step-table {
  border-collapse: collapse;
  font-family: monospace;
  font-size: 11px;
  width: 100%;
}

.tfa-step-table th {
  position: sticky;
  top: 0;
  background: var(--bg-alt);
  color: var(--text-muted);
  text-align: left;
  padding: 3px 8px;
  border-bottom: 1px solid var(--border);
}

.tfa-step-table td {
  padding: 2px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.tfa-step-sym {
  color: var(--accent);
  font-weight: 600;
}

.tfa-step-pre {
  margin: 2px 0 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg-alt);
  font-family: monospace;
  font-size: 11px;
  color: var(--text);
  max-height: 260px;
  overflow: auto;
  white-space: pre;
  animation: tfa-msg-in 0.18s ease both;
}

/* KaTeX inherits the message color; only scale and overflow need taming
   (1.21em default is oversized next to 12px terminal type) */
.tfa-msg--assistant .tfa-msg-text .katex {
  font-size: 1.05em;
}

.tfa-msg--assistant .tfa-msg-text .katex-display {
  margin: 10px 0;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: left;
}

.tfa-msg--assistant .tfa-msg-text .katex-display > .katex {
  text-align: left;
}

/* Terminal-style tables: hairline row dividers, no cell grid, tabular
   numerics right-aligned, hover row like the terminal's own lists */
.tfa-md-table-wrap {
  margin: 8px 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  width: fit-content;
  max-width: 100%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14);
}

.tfa-md-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
}

.tfa-md-table th {
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: left;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

.tfa-md-table td {
  padding: 4px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background 0.12s ease;
}

.tfa-md-table tbody tr:last-child td {
  border-bottom: none;
}

.tfa-md-table tbody tr:hover td {
  background: var(--bg-alt);
}

.tfa-md-table td.tfa-num {
  text-align: right;
}

.tfa-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 5px;
}

.tfa-sources a {
  color: var(--text-muted);
  font-size: 10px;
  text-decoration: underline;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.tfa-sources a:hover {
  color: var(--text);
}

/* Streaming status: shimmer text sweep + trailing animated dots */
.tfa-status {
  align-self: flex-start;
  font-size: 11px;
  background: linear-gradient(
    100deg,
    var(--text-muted) 35%,
    var(--text) 50%,
    var(--text-muted) 65%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: tfa-shimmer 1.8s linear infinite;
}

@keyframes tfa-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -50% 0;
  }
}

@keyframes tfa-pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.tfa-error {
  color: var(--loss);
  font-size: 11px;
  align-self: flex-start;
  animation: tfa-msg-in 0.2s ease both;
}

.tfa-composer {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid var(--border);
  flex: 0 0 auto;
  /* anchor for the @/ dropdown + the busy sweep line */
  position: relative;
}

/* Busy: a thin animated accent line sweeps along the composer's top edge */
.tfa-composer--busy::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--accent, #4d8dff) 35%,
    color-mix(in srgb, var(--accent, #4d8dff) 40%, #b48cff) 50%,
    var(--accent, #4d8dff) 65%,
    transparent
  );
  background-size: 200% 100%;
  animation: tfa-shimmer 1.4s linear infinite;
  pointer-events: none;
}

.tfa-input {
  flex: 1 1 auto;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  resize: none;
  min-height: 34px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.tfa-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}

.tfa-send {
  align-self: flex-end;
  background: linear-gradient(
    135deg,
    var(--accent, #4d8dff),
    color-mix(in srgb, var(--accent, #4d8dff) 70%, #7f5fff)
  );
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 7px 15px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease;
}

.tfa-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--accent, #4d8dff) 40%, transparent);
}

.tfa-send:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

.tfa-send:disabled {
  opacity: 0.4;
  cursor: default;
}

.tfa-send--stop {
  background: linear-gradient(
    135deg,
    var(--loss, #e05252),
    color-mix(in srgb, var(--loss, #e05252) 75%, #ff8c5f)
  );
  animation: tfa-stop-glow 1.6s ease-in-out infinite;
}

@keyframes tfa-stop-glow {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--loss, #e05252) 35%, transparent);
  }
  50% {
    box-shadow: 0 0 10px 1px color-mix(in srgb, var(--loss, #e05252) 35%, transparent);
  }
}

/* -- A2: ticker chips, composer dropdowns, context menu, message actions -- */

.tfa-sym {
  color: var(--accent, #4d8dff);
  cursor: pointer;
  font-weight: 600;
  transition: color 0.12s ease;
}

.tfa-sym:hover {
  text-decoration: underline;
}

/* Overlaid, faded in -- in-flow display toggling shifted layout and made
   the whole panel feel jittery on hover */
.tfa-msg-actions {
  position: absolute;
  top: -7px;
  right: 0;
  display: flex;
  gap: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 2;
}

.tfa-msg:hover .tfa-msg-actions {
  opacity: 1;
  pointer-events: auto;
}

.tfa-msg-action {
  background: var(--bg-base);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 9px;
  padding: 1px 6px;
  cursor: pointer;
  transition:
    color 0.12s ease,
    background 0.12s ease;
}

.tfa-msg-action:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.tfa-step-addall {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 9px;
  padding: 2px 6px;
  margin: 3px 0;
  cursor: pointer;
  transition:
    color 0.12s ease,
    background 0.12s ease;
}

.tfa-step-addall:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.tfa-dropdown {
  position: absolute;
  bottom: 100%;
  left: 8px;
  right: 8px;
  margin-bottom: 4px;
  max-height: 260px;
  overflow-y: auto;
  background: color-mix(in srgb, var(--bg-base) 88%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.4);
  z-index: 30;
  animation: tfa-drop-in 0.14s ease both;
  transform-origin: bottom center;
}

@keyframes tfa-drop-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.tfa-dropdown-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  white-space: nowrap;
  transition: background 0.1s ease;
}

.tfa-dropdown-item--active {
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-alt));
}

.tfa-dropdown-cat {
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  flex: 0 0 auto;
}

.tfa-dropdown-label {
  font-weight: 600;
  flex: 0 0 auto;
}

.tfa-dropdown-hint {
  color: var(--text-muted);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tfa-ctx-menu {
  position: fixed;
  min-width: 180px;
  max-width: 260px;
  background: color-mix(in srgb, var(--bg-base) 90%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  padding: 4px;
  z-index: 1000;
  animation: tfa-drop-in 0.12s ease both;
}

.tfa-ctx-item {
  display: block;
  width: 100%;
  padding: 4px 8px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 11px;
  text-align: left;
  cursor: pointer;
  border-radius: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s ease;
}

.tfa-ctx-item:hover {
  background: var(--bg-alt);
}

.tfa-ctx-count {
  color: var(--text-muted);
  font-size: 9px;
}

.tfa-ctx-title {
  color: var(--text-muted);
  font-size: 9px;
  text-transform: uppercase;
  padding: 3px 8px;
}

.tfa-ctx-sep {
  border-top: 1px solid var(--border);
  margin: 3px 0;
}

.tfa-ctx-filter {
  width: calc(100% - 8px);
  margin: 2px 4px;
  padding: 3px 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 10px;
  outline: none;
}

.tfa-ctx-lists {
  max-height: 200px;
  overflow-y: auto;
}

.tfa-dropdown-sym {
  color: var(--accent, #4d8dff);
  font-weight: 700;
}

.tfa-dropdown-del {
  color: var(--text-muted);
  font-size: 12px;
  padding: 0 4px;
  flex: 0 0 auto;
  margin-left: auto;
}

.tfa-dropdown-del:hover {
  color: #ff5c5c;
}

.tfa-dropdown-header {
  position: sticky;
  top: 0;
  padding: 4px 8px 2px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
}

/* Pasted image attachments (composer strip + message thumbnails) */
.tfa-img-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.tfa-img-thumb {
  max-height: 72px;
  max-width: 140px;
  border: 1px solid var(--border);
  border-radius: 4px;
  display: block;
  transition: border-color 0.15s ease;
}

.tfa-img-thumb:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}

.tfa-img-pending {
  position: relative;
  display: inline-block;
  animation: tfa-msg-in 0.16s ease both;
}

.tfa-img-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  line-height: 14px;
  padding: 0;
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-base);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.12s ease;
}

.tfa-img-remove:hover {
  color: #ff5c5c;
}

/* AI-returned chart fences (native SVG): card + draw-in animation */
.tfa-chart {
  background: linear-gradient(
    170deg,
    color-mix(in srgb, var(--accent, #4d8dff) 5%, transparent),
    rgba(255, 255, 255, 0.02)
  );
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 8px 0;
  max-width: 400px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.16);
  animation: tfa-msg-in 0.25s ease both;
}

.tfa-chart-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}

/* Bars grow up from the baseline; lines draw left to right */
.tfa-chart svg rect {
  transform-box: fill-box;
  transform-origin: bottom center;
  animation: tfa-bar-grow 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

.tfa-chart svg rect:nth-child(odd) {
  animation-delay: 0.06s;
}

@keyframes tfa-bar-grow {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

.tfa-chart svg polyline {
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  animation: tfa-line-draw 0.9s ease-out forwards;
}

@keyframes tfa-line-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Motion off for users who ask the OS for it */
@media (prefers-reduced-motion: reduce) {
  .tfa-panel *,
  .tfa-panel *::before {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

/* Hold-to-talk voice input status pill */
.tfa-voice {
  position: absolute;
  top: -24px;
  left: 10px;
  font-size: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-base) 85%, transparent);
  backdrop-filter: blur(6px);
  color: var(--text-muted);
  pointer-events: none;
  animation: tfa-msg-in 0.15s ease both;
}

.tfa-voice--rec {
  color: #ff5c5c;
  border-color: color-mix(in srgb, #ff5c5c 45%, var(--border));
  animation:
    tfa-msg-in 0.15s ease both,
    tfa-pulse 1.2s ease-in-out infinite;
}

.tfa-voice--stt {
  color: var(--accent, #4d8dff);
  border-color: color-mix(in srgb, var(--accent, #4d8dff) 45%, var(--border));
}

.tfa-voice--err {
  color: #ffb020;
}

.tfa-voice-device {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 10px;
  padding: 3px 6px;
  max-width: 320px;
}

.tfa-voice-note {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 360px;
  padding-left: 20px;
}
.tape-panel {
  font-size: 11px;
  color: var(--text);
  user-select: none;
}

.tape-symbol-input {
  user-select: text;
}

.tape-header {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 3px 8px;
  user-select: none;
}

.tape-symbol-input {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  padding: 2px 5px;
  width: 70px;
}

.tape-active-symbol {
  font-weight: 600;
  font-size: 12px;
}

.tape-paused {
  color: var(--accent);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.tape-icon-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
  display: grid;
  place-items: center;
}

.tape-icon-button img {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

.tape-icon-button:hover img {
  opacity: 1;
}

.tape-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 8px;
  user-select: none;
}

.tape-cvd {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.tape-ratio-bar {
  width: 64px;
  flex: none;
  height: 6px;
  background: color-mix(in srgb, var(--loss) 45%, transparent);
  border-radius: 3px;
  overflow: hidden;
}

.tape-ratio-buy {
  height: 100%;
  background: color-mix(in srgb, var(--profit) 75%, transparent);
}

.tape-stat {
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tape-character {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  user-select: none;
}

.tape-verdict {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0 6px;
  border-radius: 3px;
  color: var(--text-dim);
  background: var(--bg-alt);
}

.tape-character-bullish .tape-verdict {
  color: var(--profit);
  background: color-mix(in srgb, var(--profit) 15%, transparent);
}

.tape-character-bearish .tape-verdict {
  color: var(--loss);
  background: color-mix(in srgb, var(--loss) 15%, transparent);
}

.tape-check {
  font-size: 9px;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.tape-check.on-bull {
  color: var(--profit);
  font-weight: 700;
}

.tape-check.on-bear {
  color: var(--loss);
  font-weight: 700;
}

.tape-check-note {
  font-size: 9px;
  color: var(--text-muted);
  font-style: italic;
}

.tape-cvd-spark {
  width: 100%;
  height: 34px;
  flex: none;
}

.tape-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 8px;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--loss) 40%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--loss) 8%, transparent);
  color: var(--text-dim);
  font-size: 10px;
}

.tape-banner span {
  flex: 1;
  min-width: 0;
}

.tape-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}

.tape-banner-dismiss:hover {
  color: var(--text);
}

.tape-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 10px;
  user-select: none;
  padding: 0 16px;
  text-align: center;
}

.tape-columns {
  display: flex;
  padding: 1px 8px;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.5px;
  user-select: none;
  border-bottom: 1px solid var(--border);
}

.tape-row {
  display: flex;
  padding: 1px 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
  white-space: nowrap;
}

/* Full-row coloring (DAS-style): the whole row is a side-colored box; tiers
   raise the intensity. Overrides the tier-only backgrounds further down. */
.tape-color-row .tape-row.tape-side-buy {
  background: color-mix(in srgb, var(--profit) 12%, transparent);
}

.tape-color-row .tape-row.tape-side-sell {
  background: color-mix(in srgb, var(--loss) 12%, transparent);
}

.tape-color-row .tape-tier-1.tape-side-buy {
  background: color-mix(in srgb, var(--profit) 26%, transparent);
}

.tape-color-row .tape-tier-1.tape-side-sell {
  background: color-mix(in srgb, var(--loss) 26%, transparent);
}

.tape-color-row .tape-tier-2.tape-side-buy {
  background: color-mix(in srgb, var(--profit) 42%, transparent);
}

.tape-color-row .tape-tier-2.tape-side-sell {
  background: color-mix(in srgb, var(--loss) 42%, transparent);
}

.tape-color-row .tape-side-buy .tape-cell-price,
.tape-color-row .tape-side-buy .tape-cell-size,
.tape-color-row .tape-side-sell .tape-cell-price,
.tape-color-row .tape-side-sell .tape-cell-size {
  color: var(--text);
}

.tape-cell-time {
  width: 60px;
  flex: none;
  color: var(--text-dim);
}

.tape-cell-price {
  width: 62px;
  flex: none;
}

.tape-cell-size {
  width: 56px;
  flex: none;
  text-align: right;
  padding-right: 10px;
}

.tape-cell-venue {
  width: 56px;
  flex: none;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tape-cell-badges {
  flex: 1;
  display: flex;
  gap: 4px;
  align-items: center;
}

.tape-side-buy .tape-cell-price,
.tape-side-buy .tape-cell-size {
  color: var(--profit);
}

.tape-side-sell .tape-cell-price,
.tape-side-sell .tape-cell-size {
  color: var(--loss);
}

.tape-side-mid .tape-cell-price,
.tape-side-mid .tape-cell-size {
  color: var(--text-dim);
}

.tape-tier-1.tape-side-buy {
  background: color-mix(in srgb, var(--profit) 10%, transparent);
}

.tape-tier-1.tape-side-sell {
  background: color-mix(in srgb, var(--loss) 10%, transparent);
}

.tape-tier-2 {
  font-weight: 700;
}

.tape-tier-2.tape-side-buy {
  background: color-mix(in srgb, var(--profit) 22%, transparent);
}

.tape-tier-2.tape-side-sell {
  background: color-mix(in srgb, var(--loss) 22%, transparent);
}

.tape-tier-2.tape-side-mid,
.tape-tier-1.tape-side-mid {
  background: var(--bg-hover);
}

.tape-dark .tape-cell-venue {
  color: var(--accent);
}

.tape-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0 3px;
  border-radius: 2px;
  line-height: 12px;
}

.tape-badge-sweep {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.tape-badge-dark {
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.tape-badge-block {
  color: var(--text);
  background: var(--bg-hover);
}
.dom-panel {
  font-size: 11px;
  color: var(--text);
  user-select: none;
}

.dom-symbol-input {
  user-select: text;
}

.dom-header {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 3px 8px;
  user-select: none;
}

.dom-symbol-input {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 11px;
  padding: 2px 5px;
  width: 70px;
}

.dom-active-symbol {
  font-weight: 600;
  font-size: 12px;
}

.dom-view-toggle {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 6px;
  cursor: pointer;
  font-size: 9px;
  letter-spacing: 0.5px;
}

.dom-view-toggle.active {
  color: var(--text);
  background: var(--bg-hover);
}

.dom-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.dom-stat {
  color: var(--text-dim);
  white-space: nowrap;
}

.dom-absorption {
  font-weight: 700;
}

.dom-columns {
  display: flex;
  padding: 1px 6px;
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.5px;
  user-select: none;
  border-bottom: 1px solid var(--border);
}

.dom-montage {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 1px;
}

.dom-montage-col {
  flex: 1;
  min-width: 0;
  /* keep the two books adjacent and readable in a wide window */
  max-width: 300px;
  display: flex;
  flex-direction: column;
}

.dom-montage-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.dom-montage-row {
  display: flex;
  padding: 1px 6px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Price-level banding: same price = same band, fading away from the touch */
.dom-band-bid-0 {
  background: color-mix(in srgb, var(--profit) 24%, transparent);
}
.dom-band-bid-1 {
  background: color-mix(in srgb, var(--profit) 17%, transparent);
}
.dom-band-bid-2 {
  background: color-mix(in srgb, var(--profit) 11%, transparent);
}
.dom-band-bid-3 {
  background: color-mix(in srgb, var(--profit) 6%, transparent);
}
.dom-band-bid-4 {
  background: transparent;
}
.dom-band-ask-0 {
  background: color-mix(in srgb, var(--loss) 24%, transparent);
}
.dom-band-ask-1 {
  background: color-mix(in srgb, var(--loss) 17%, transparent);
}
.dom-band-ask-2 {
  background: color-mix(in srgb, var(--loss) 11%, transparent);
}
.dom-band-ask-3 {
  background: color-mix(in srgb, var(--loss) 6%, transparent);
}
.dom-band-ask-4 {
  background: transparent;
}

.dom-cell-venue {
  width: 52px;
  flex: none;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dom-cell-price {
  width: 60px;
  flex: none;
}

.dom-cell-size {
  width: 52px;
  flex: none;
  text-align: right;
  padding-right: 8px;
}

.dom-cell-cum {
  width: 48px;
  flex: none;
  text-align: right;
  padding-right: 8px;
  color: var(--text-dim);
}

.dom-cell-vap {
  flex: 1;
  min-width: 20px;
  display: flex;
  align-items: center;
}

.dom-vap-bar {
  height: 5px;
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  border-radius: 2px;
  min-width: 2px;
}

.dom-badges {
  display: flex;
  gap: 3px;
  align-items: center;
  margin-left: 4px;
}

.dom-badge {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 0 3px;
  border-radius: 2px;
  line-height: 12px;
}

.dom-badge-iceberg {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, transparent);
}

.dom-badge-hidden {
  color: var(--text);
  border: 1px dashed color-mix(in srgb, var(--text) 40%, transparent);
}

.dom-badge-pulled {
  color: var(--loss);
  border: 1px solid color-mix(in srgb, var(--loss) 50%, transparent);
}

.dom-ladder {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 2px 0;
}

.dom-ladder-row {
  position: relative;
  display: flex;
  align-items: center;
  padding: 1px 6px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

.dom-ladder-bar {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
}

.dom-ladder-bid .dom-ladder-bar {
  background: color-mix(in srgb, var(--profit) 14%, transparent);
}

.dom-ladder-ask .dom-ladder-bar {
  background: color-mix(in srgb, var(--loss) 14%, transparent);
}

.dom-ladder-bid .dom-cell-price {
  color: var(--profit);
}

.dom-ladder-ask .dom-cell-price {
  color: var(--loss);
}

.dom-spread-row {
  text-align: center;
  color: var(--text-muted);
  font-size: 9px;
  padding: 2px 0;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  user-select: none;
}

.dom-empty {
  padding: 8px;
  color: var(--text-muted);
  text-align: center;
}

.dom-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 8px;
  padding: 3px 6px;
  border: 1px solid color-mix(in srgb, var(--loss) 40%, transparent);
  border-radius: 3px;
  background: color-mix(in srgb, var(--loss) 8%, transparent);
  color: var(--text-dim);
  font-size: 10px;
}

.dom-banner span {
  flex: 1;
  min-width: 0;
}

.dom-banner-dismiss {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}

.dom-banner-dismiss:hover {
  color: var(--text);
}
/* Colored link-group selector (replaces the per-panel star). */

.link-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.12rem;
  background: none;
  border: none;
  padding: 0 0.2rem;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-muted);
}

.link-group-btn:hover {
  color: var(--text);
}

.link-group-dot {
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

/* Unlinked = hollow ring. */
.link-group-dot.unlinked {
  background: transparent;
  border: 1.5px solid var(--text-muted);
}

.link-group-pop {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 7rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 4px 14px var(--shadow, rgba(0, 0, 0, 0.45));
  padding: 0.2rem;
  overflow: hidden;
}

.link-group-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 0.3rem 0.45rem;
  cursor: pointer;
}

.link-group-item:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.link-group-item.active {
  background: var(--bg-hover);
  color: var(--text);
}

.link-group-label {
  flex: 1;
}

/* Star (right of each color) — designates the primary group (Ctrl+S target). */
.link-group-star {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0 0.1rem;
  opacity: 0.5;
}

.link-group-item:hover .link-group-star {
  opacity: 1;
}

.link-group-star.active {
  color: #e5b833;
  opacity: 1;
}
