/* TradingView-inspired dark theme */
:root {
  --bg-base: #131722;
  --bg-panel: #1e222d;
  --bg-hover: #2a2e39;
  --bg-active: #363a45;
  --border: #2a2e39;
  --text: #d1d4dc;
  --text-muted: #787b86;
  --text-dim: #5d606b;
  --accent: #2962ff;
  --accent-hover: #1e53e5;
  --green: #26a69a;
  --green-bg: rgba(38, 166, 154, 0.15);
  --red: #ef5350;
  --red-bg: rgba(239, 83, 80, 0.15);
  --header-h: 48px;
  --header-divider-w: 2px;
  --footer-h: 28px;
  --watchlist-w: 300px;
  --ai-assistant-h: 220px;
  --ai-assistant-header-h: 36px;
  --font: "Segoe UI", "Hiragino Sans", "Meiryo", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", "Meiryo UI", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-base);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

.app {
  display: grid;
  grid-template-rows: var(--header-h) 1fr var(--footer-h);
  height: 100vh;
  height: 100dvh;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.header__logo {
  color: var(--accent);
  font-size: 18px;
}

.header__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.header__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.header__controls::-webkit-scrollbar {
  display: none;
}

.header__divider {
  flex: 0 0 var(--header-divider-w);
  width: var(--header-divider-w);
  min-width: var(--header-divider-w);
  max-width: var(--header-divider-w);
  height: 28px;
  align-self: center;
  background: var(--accent);
  border: none;
  padding: 0;
  margin: 0;
}

.header__tools,
.header__zoom,
.header__icons {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.header .tool-btn {
  width: 28px;
  height: 28px;
  font-size: 13px;
}

.header-icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.header-icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.timeframes {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

.reorder-list--horizontal {
  flex-direction: row;
  align-items: center;
}

.reorder-list--vertical {
  flex-direction: column;
  align-items: center;
}

.reorder-item {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.reorder-item.is-press-pending {
  background: var(--bg-hover) !important;
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
}

.reorder-item.is-dragging {
  opacity: 0.65;
  cursor: grabbing;
  z-index: 2;
}

.reorder-list.is-reordering {
  cursor: grabbing;
}

body.is-reorder-active {
  cursor: grabbing;
  user-select: none;
}

.tf-item {
  gap: 0;
}

.tool-item {
  gap: 0;
}

.tool-btn.reorder-item,
.tf-btn.reorder-item {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tf-btn {
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}

.tf-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.tf-btn.is-active {
  background: var(--accent);
  color: #fff;
}

/* ── Main layout ── */
.main {
  display: grid;
  grid-template-columns: 1fr var(--watchlist-w);
  grid-template-rows: 1fr;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.main:has(.side-panel.is-collapsed) {
  grid-template-columns: 1fr 20px;
}

.tool-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.tool-btn.is-active {
  background: var(--bg-active);
  color: var(--accent);
}

/* ── Chart ── */
.chart-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chart-legend {
  position: absolute;
  top: 8px;
  left: 12px;
  z-index: 2;
  font-size: 12px;
  color: var(--text-muted);
  pointer-events: none;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.chart-legend__symbol-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.chart-legend__symbol-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.chart-legend__symbol {
  font-size: 13px;
  color: var(--text);
  font-weight: 400;
}

.chart-legend__tf {
  font-size: 12px;
  color: #fff;
  font-weight: 400;
}

.chart-legend__meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 11px;
  color: #fff;
  font-weight: 400;
}

.chart-legend__meta-item span {
  font-family: var(--mono);
  font-weight: 400;
  color: #fff;
}

.object-style-panel {
  position: absolute;
  top: 8px;
  left: 220px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  max-width: calc(100% - 24px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(30, 34, 45, 0.95);
  pointer-events: auto;
  overflow: hidden;
}

.object-style-panel.is-dragging {
  opacity: 0.92;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.object-style-panel__header {
  display: flex;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.object-style-panel.is-dragging .object-style-panel__header {
  cursor: grabbing;
}

.object-style-panel__body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
}

.object-style-panel__label {
  font-size: 11px;
  color: var(--text-dim);
}

.object-style-panel__colors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.object-style-panel__swatch {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.object-style-panel__swatch.is-selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px var(--accent);
}

.object-style-panel__swatch-inner {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

.object-style-panel__width {
  min-width: 64px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

.chart-plot {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 200px;
}

.chart-area__stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.ai-assistant__resize {
  flex: 0 0 5px;
  cursor: row-resize;
  background: transparent;
  touch-action: none;
  position: relative;
}

.ai-assistant__resize::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 2px;
  height: 1px;
  background: var(--border);
}

.ai-assistant__resize:hover::before,
body.is-ai-resizing .ai-assistant__resize::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--accent);
  opacity: 0.25;
}

.ai-assistant__resize:has(+ .ai-assistant.is-collapsed) {
  display: none;
}

.ai-assistant {
  flex: 0 0 var(--ai-assistant-h);
  min-height: var(--ai-assistant-header-h);
  max-height: 55vh;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  min-width: 0;
}

.ai-assistant.is-collapsed {
  flex-basis: var(--ai-assistant-header-h);
}

.ai-assistant__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--ai-assistant-header-h);
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-assistant__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ai-assistant__toggle {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 10px;
  line-height: 1;
}

.ai-assistant__toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.ai-assistant__icon {
  color: var(--accent);
  font-size: 12px;
}

.ai-assistant__title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.ai-assistant__status {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-active);
  color: var(--text-muted);
  white-space: nowrap;
}

.ai-assistant__status.is-ok {
  color: var(--green);
  background: var(--green-bg);
}

.ai-assistant__status.is-warn {
  color: #f0ad4e;
  background: rgba(240, 173, 78, 0.12);
}

.ai-assistant__billing-link {
  font-size: 10px;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.ai-assistant__billing-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ai-assistant__clear {
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  padding: 4px 8px;
  cursor: pointer;
}

.ai-assistant__clear:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.ai-assistant__body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.ai-assistant.is-collapsed .ai-assistant__body {
  display: none;
}

.ai-assistant__prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 0;
  flex-shrink: 0;
}

.ai-assistant__prompt {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-base);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.ai-assistant__prompt.reorder-item {
  touch-action: none;
  user-select: none;
}

.ai-assistant__prompt:hover {
  background: var(--bg-hover);
  color: var(--text);
  border-color: var(--accent);
}

.ai-assistant__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-assistant__message {
  display: flex;
  max-width: 92%;
}

.ai-assistant__message--user {
  align-self: flex-end;
}

.ai-assistant__message--assistant,
.ai-assistant__message--system {
  align-self: flex-start;
}

.ai-assistant__bubble {
  padding: 8px 10px;
  border-radius: 10px;
  line-height: 1.45;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.ai-assistant__message--user .ai-assistant__bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.ai-assistant__message--assistant .ai-assistant__bubble {
  background: var(--bg-hover);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.ai-assistant__message--system .ai-assistant__bubble {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--border);
}

.ai-assistant__message.is-pending .ai-assistant__bubble {
  opacity: 0.7;
}

.ai-assistant__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.ai-assistant__input {
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
}

.ai-assistant__input:focus {
  outline: none;
  border-color: var(--accent);
}

.ai-assistant__input:disabled {
  opacity: 0.6;
}

.ai-assistant__send {
  min-width: 56px;
  height: 38px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.ai-assistant__send:hover:not(:disabled) {
  background: var(--accent-hover);
}

.ai-assistant__send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body.is-ai-resizing {
  cursor: row-resize;
  user-select: none;
}

.chart-container {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.drawing-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.drawing-overlay.is-active {
  pointer-events: auto;
  cursor: crosshair;
}

.draw-shape {
  fill: rgba(41, 98, 255, 0.08);
  stroke: #2962ff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.draw-shape.is-draft {
  stroke-dasharray: 6 4;
  stroke: #8b98a5;
  fill: rgba(139, 152, 165, 0.06);
}

.draw-shape.is-selected {
  stroke: #2962ff;
  stroke-width: 2.5;
  fill: rgba(41, 98, 255, 0.14);
}

.draw-highlight {
  fill: none;
  stroke: #2962ff;
  stroke-width: 4;
  stroke-opacity: 0.35;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.draw-highlight-glow {
  fill: none;
  stroke: #2962ff;
  stroke-width: 8;
  stroke-opacity: 0.18;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.draw-handle {
  fill: #131722;
  stroke: #2962ff;
  stroke-width: 1.5;
  pointer-events: none;
}

.draw-handle.is-draft {
  stroke: #8b98a5;
}

.draw-label {
  fill: #8b98a5;
  font-size: 11px;
  font-family: "Cascadia Code", Consolas, monospace;
  text-anchor: end;
}

.draw-trend {
  fill: none;
  stroke: #2962ff;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.draw-trend.is-draft {
  stroke: #8b98a5;
  stroke-dasharray: 6 4;
}

.draw-trend.is-selected {
  stroke-width: 2.5;
}

.draw-trend.is-reference {
  stroke-opacity: 0.45;
}

.draw-fib-trend {
  fill: none;
  stroke: #8b98a5;
  stroke-width: 1;
  stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.draw-fib-line {
  fill: none;
  stroke: #2962ff;
  stroke-width: 1;
  stroke-opacity: 0.85;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.draw-fib-line.is-draft {
  stroke: #8b98a5;
  stroke-dasharray: 6 4;
  stroke-opacity: 1;
}

.draw-fib-line.is-selected {
  stroke-width: 1.5;
  stroke-opacity: 1;
}

.draw-fib-label {
  fill: #8b98a5;
  font-size: 10px;
  font-family: "Segoe UI", "Meiryo", sans-serif;
  pointer-events: none;
}

.draw-line-number {
  fill: #d1d4dc;
  font-size: 10px;
  font-weight: 600;
  font-family: "Cascadia Code", Consolas, monospace;
  pointer-events: none;
}

.draw-line-number.is-selected {
  fill: #fff;
}

.draw-line-number__bg {
  pointer-events: none;
}

.object-item__number {
  flex-shrink: 0;
  min-width: 1.6em;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.3;
  text-align: center;
}

.draw-vline {
  fill: none;
  stroke: #2962ff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.draw-vline.is-draft {
  stroke-dasharray: 6 4;
  stroke: #8b98a5;
}

.draw-vline.is-selected {
  stroke-width: 2.5;
}

.draw-shape.is-reference,
.draw-vline.is-reference,
.draw-fib-trend.is-reference,
.draw-fib-line.is-reference {
  stroke-opacity: 0.55;
}

.chart-container.is-dragging-objects {
  cursor: grabbing;
}

.chart-container.is-adjusting-angle {
  cursor: crosshair;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(19, 23, 34, 0.7);
  color: var(--text-muted);
  z-index: 3;
}

.chart-loading[hidden] {
  display: none !important;
}

/* ── Object panel ── */
.object-panel {
  position: absolute;
  top: 72px;
  left: auto;
  right: 8px;
  z-index: 4;
  width: 168px;
  max-height: min(280px, calc(100% - 48px));
  display: flex;
  flex-direction: column;
  background: rgba(30, 34, 45, 0.94);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  pointer-events: auto;
}

.object-panel.is-dragging {
  opacity: 0.92;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.object-panel.is-collapsed {
  max-height: none;
}

.object-panel.is-collapsed .object-panel__header {
  border-bottom: none;
}

.object-panel__title-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.object-panel__toggle {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.object-panel__toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.object-panel__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.object-panel.is-collapsed .object-panel__body {
  display: none;
}

.object-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.object-panel.is-dragging .object-panel__header {
  cursor: grabbing;
}

.object-panel__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.object-panel__count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  min-width: 1.2em;
  text-align: right;
}

.object-list {
  list-style: none;
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.object-list.is-empty {
  display: none;
}

.object-panel__empty {
  display: none;
  margin: 0;
  padding: 12px 10px;
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-dim);
  text-align: center;
}

.object-panel:has(.object-list.is-empty) .object-panel__empty {
  display: block;
}

.object-item {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 4px;
  width: 100%;
  cursor: pointer;
}

.object-item.is-selected {
  background: rgba(41, 98, 255, 0.12);
}

.object-item__body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  border-radius: 3px;
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.object-item__body:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.object-item.is-selected .object-item__body {
  color: var(--accent);
}

.object-item__icon {
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  font-size: 12px;
}

.object-item__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.object-item__alert {
  flex-shrink: 0;
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0.9;
}

.object-item--reference .object-item__body {
  color: var(--text-dim);
}

.object-item--reference.is-selected .object-item__body {
  color: var(--accent);
  background: rgba(41, 98, 255, 0.12);
}

.object-item--reference .object-item__body:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.object-item--reference.is-selected .object-item__body:hover {
  color: var(--accent);
}

/* ── App modals (shortcut / indicator) ── */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.app-modal[hidden] {
  display: none !important;
}

.app-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.app-modal__panel {
  position: relative;
  width: min(360px, 100%);
  max-height: min(80vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

#indicator-modal .app-modal__panel {
  width: min(440px, 100%);
  max-height: min(85vh, 640px);
}

#help-modal .app-modal__panel {
  width: min(480px, 100%);
  max-height: min(85vh, 680px);
}

.app-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.app-modal__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.app-modal__close {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.app-modal__close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.app-modal__hint {
  margin: 0;
  padding: 10px 14px 0;
  font-size: 11px;
  color: var(--text-dim);
}

.shortcut-modal__list {
  padding: 10px 14px 14px;
  overflow-y: auto;
}

.help-modal__list {
  padding: 10px 14px 14px;
  overflow-y: auto;
}

.help-modal__section {
  margin-bottom: 16px;
}

.help-modal__section:last-child {
  margin-bottom: 0;
}

.help-modal__section-title {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.help-modal__items {
  margin: 0;
}

.help-modal__item {
  margin-bottom: 10px;
}

.help-modal__item:last-child {
  margin-bottom: 0;
}

.help-modal__item-label {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.help-modal__item-text {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.indicator-picker__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 10px 14px 14px;
  overflow-y: auto;
}

.indicator-picker__section-title {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.indicator-picker__catalog,
.indicator-picker__active {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.indicator-picker__card,
.indicator-picker__instance {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  padding: 10px;
}

.indicator-picker__card-title,
.indicator-picker__instance-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.indicator-picker__instance-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.indicator-picker__swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.indicator-picker__instance-label {
  flex: 1;
  min-width: 0;
}

.indicator-picker__params {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.indicator-picker__param {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.indicator-picker__param-input {
  width: 64px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.indicator-picker__param-input:focus {
  outline: none;
  border-color: var(--accent);
}

.indicator-picker__card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.indicator-picker__add-btn {
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(41, 98, 255, 0.12);
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.indicator-picker__add-btn:hover {
  background: rgba(41, 98, 255, 0.22);
}

.indicator-picker__remove-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.indicator-picker__remove-btn:hover {
  background: var(--bg-hover);
  color: var(--red);
}

.indicator-picker__empty {
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
}

.indicator-picker__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 14px 14px;
  overflow-y: auto;
}

.indicator-picker__item {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.indicator-picker__item:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
}

.indicator-picker__item.is-active {
  border-color: var(--accent);
  background: rgba(41, 98, 255, 0.12);
  color: var(--accent);
}

.shortcut-modal__category {
  margin: 12px 0 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.shortcut-modal__category:first-child {
  margin-top: 0;
}

.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
}

.shortcut-row__label {
  font-size: 12px;
  color: var(--text);
}

.shortcut-row__key {
  min-width: 88px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  text-align: center;
}

.shortcut-row__key:hover {
  border-color: var(--accent);
  color: var(--text);
}

.shortcut-row__key.is-recording {
  border-color: var(--accent);
  color: var(--accent);
  animation: shortcut-pulse 1s infinite;
}

@keyframes shortcut-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}

.shortcut-modal__reset {
  margin-top: 12px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text-muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.shortcut-modal__reset:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* ── Side panel ── */
.side-panel {
  position: relative;
  display: flex;
  min-height: 0;
  background: var(--bg-base);
  border-left: 1px solid var(--border);
  transition: width 0.2s ease;
}

.side-panel.is-collapsed {
  width: 20px;
}

.side-panel__edge-btn {
  position: absolute;
  left: 0;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-panel);
  color: var(--accent);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.side-panel__edge-btn:hover {
  background: var(--bg-hover);
}

.side-panel__inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
}

.side-panel.is-collapsed .side-panel__inner {
  display: none;
}

/* 右パネル並べ替え（reorder-list--vertical は使わず幅を維持） */
.side-panel__sections.reorder-list {
  align-items: stretch;
}

.panel-section--reorderable.reorder-item {
  width: 100%;
  align-self: stretch;
  touch-action: auto;
}

.panel-section--reorderable.reorder-item.is-press-pending {
  background: transparent !important;
  outline: none;
}

.panel-section--reorderable.reorder-item.is-press-pending .panel-section__handle {
  background: var(--bg-hover);
  outline: 1px dashed var(--accent);
  outline-offset: -1px;
  border-radius: 3px;
}

.panel-section--reorderable.reorder-item.is-dragging {
  opacity: 0.85;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.panel-section__handle {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: -2px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  padding: 0 2px;
  line-height: 1;
}

.panel-section--reorderable.is-dragging .panel-section__handle {
  cursor: grabbing;
}

.panel-section--reorderable .panel-section__header {
  touch-action: auto;
}

.panel-section--reorderable .panel-section__body {
  touch-action: auto;
  user-select: auto;
  -webkit-user-select: auto;
}

.panel-section {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  overflow: hidden;
}

.panel-section__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid transparent;
  background: rgba(0, 0, 0, 0.12);
}

.panel-section.is-open .panel-section__header {
  border-bottom-color: var(--border);
}

.panel-section__toggle {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text-muted);
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.panel-section__toggle:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.panel-section__title {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.panel-section__meta {
  font-size: 10px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.panel-section__status {
  font-size: 10px;
  flex-shrink: 0;
}

.panel-section__status.is-warn {
  color: #f7931a;
}

.panel-section__status.is-ok {
  color: var(--green);
}

.panel-section__body {
  display: none;
}

.panel-section.is-open .panel-section__body {
  display: block;
}

.panel-section__body--padded {
  padding: 10px;
}

.panel-section[data-section="pairs"] .panel-section__body {
  display: none;
  max-height: 280px;
  overflow: hidden;
}

.panel-section[data-section="pairs"].is-open .panel-section__body {
  display: flex;
  flex-direction: column;
}

.panel-section__search {
  width: calc(100% - 16px);
  margin: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
  flex-shrink: 0;
}

.panel-section__search:focus {
  border-color: var(--accent);
}

.panel-section__search::placeholder {
  color: var(--text-dim);
}

.watchlist-tabs {
  display: flex;
  gap: 4px;
  padding: 0 8px 8px;
  flex-shrink: 0;
}

.watchlist-tab {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.watchlist-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.watchlist-tab.is-active {
  border-color: var(--accent);
  background: rgba(41, 98, 255, 0.12);
  color: var(--text);
}

.pair-list {
  list-style: none;
  margin: 0;
  padding: 0 6px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.pair-item {
  display: grid;
  grid-template-columns: 16px 22px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 7px 8px;
  margin-bottom: 4px;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--bg-base);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.pair-item:hover {
  background: var(--bg-hover);
}

.pair-item.is-active {
  border-color: var(--green);
  background: rgba(38, 166, 154, 0.08);
}

.pair-item__num {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}

.pair-item__handle {
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: -2px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.pair-item__name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-item__spread {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
  white-space: nowrap;
}

.pair-item__spread.is-down {
  color: #ef5350;
}

.pair-list--stock .pair-item {
  grid-template-columns: 8px 22px 1fr auto;
}

.pair-list--stock .pair-item__handle {
  cursor: default;
  visibility: hidden;
}

.pair-list--stock .pair-item__spread {
  font-size: 10px;
  max-width: 108px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.setup-steps {
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-muted);
}

.setup-steps a {
  color: var(--accent);
}

.setup-steps li + li {
  margin-top: 6px;
}

.setup-code {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-muted);
  white-space: pre-wrap;
  overflow-x: auto;
}

.setup-note {
  margin: 0 0 6px;
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.45;
}

.setup-note code,
.setup-steps code {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
}

.tv-setup__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
}

.tv-setup__label {
  color: var(--text-muted);
  font-size: 11px;
}

.tv-setup__json {
  margin-top: 12px;
}

.tv-setup__steps-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

.tv-setup__info {
  margin-top: 12px;
}

.setup-lead {
  margin: 0 0 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

.setup-bullets {
  margin: 0 0 12px;
  padding-left: 18px;
  font-size: 11px;
  line-height: 1.55;
  color: var(--text-muted);
}

.setup-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.55;
}

.setup-btn--active {
  cursor: pointer;
  opacity: 1;
}

.setup-btn--active:hover {
  filter: brightness(1.08);
}

.setup-btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  opacity: 1;
}

.setup-btn--secondary:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.setup-btn--secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.setup-btn--secondary:disabled:hover {
  color: var(--text-muted);
  border-color: var(--border);
}

.line-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.line-form__field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.line-form__field label {
  font-size: 10px;
  color: var(--text-dim);
}

.line-form__optional {
  font-weight: 400;
  color: var(--text-dim);
}

.line-form__field input {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  font-size: 11px;
}

.line-form__field input:focus {
  outline: none;
  border-color: var(--accent);
}

.line-status-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.line-status-grid__label {
  font-size: 10px;
  color: var(--text-dim);
}

.line-status-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
  font-size: 10px;
  color: var(--text-muted);
}

.line-status-value {
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 10px;
  word-break: break-all;
  text-align: right;
  flex: 1;
  min-width: 0;
}

.line-status-ok {
  color: var(--green);
  font-weight: 600;
}

.line-status-warn {
  color: var(--orange);
  font-weight: 600;
}

.line-env-path,
.line-webhook,
.line-discovered {
  margin-bottom: 10px;
}

.line-env-path__label,
.line-webhook__label,
.line-discovered__label {
  display: block;
  margin-bottom: 4px;
  font-size: 10px;
  color: var(--text-dim);
}

.line-env-path__value,
.line-webhook__value {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-all;
}

.line-copy-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.line-copy-row code {
  flex: 1;
  min-width: 0;
}

.line-copy-btn,
.line-use-btn {
  flex-shrink: 0;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font: inherit;
  font-size: 10px;
  cursor: pointer;
}

.line-copy-btn:hover,
.line-use-btn:hover {
  color: var(--text);
  border-color: var(--text-dim);
}

.line-discovered__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.line-discovered__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
}

.line-discovered__item code {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-all;
}

.line-discovered__type {
  font-size: 10px;
  color: var(--text-dim);
}

.line-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.line-message {
  margin: 8px 0 0;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.45;
}

.line-message--ok {
  color: var(--green);
}

.line-error {
  margin: 8px 0 0;
  font-size: 10px;
  color: #ef5350;
  line-height: 1.45;
}

.alert-history {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alert-history__item {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
}

.alert-history__item.is-fired {
  border-color: rgba(38, 166, 154, 0.35);
}

.alert-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.alert-history__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.alert-history__delete {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.alert-history__delete:hover {
  background: var(--bg-hover);
  color: var(--red);
}

.alert-history__empty {
  margin: 0;
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 8px 0;
  list-style: none;
}

.alert-history__symbol {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.alert-history__badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-hover);
  color: var(--text-dim);
}

.alert-history__item.is-fired .alert-history__badge {
  background: rgba(38, 166, 154, 0.15);
  color: var(--green);
}

.alert-history__message {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.alert-history__time {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.alert-rules__actions {
  margin-bottom: 10px;
}

.alert-rules__actions .setup-btn {
  width: 100%;
}

.alert-rules__group {
  margin-bottom: 10px;
}

.alert-rules__group-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.alert-rules__group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-rules__item-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
}

.alert-rules__active {
  margin-top: 12px;
}

.alert-rules__active-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.alert-rules__active-title,
.alert-rules__history-title {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.alert-rules__history-title {
  margin-top: 14px;
  margin-bottom: 8px;
}

.alert-rules__active-count {
  font-size: 10px;
  color: var(--text-dim);
}

.alert-rules__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-rules__item {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-base);
}

.alert-rules__item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}

.alert-rules__item-symbol {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
}

.alert-rules__item-message {
  font-size: 11px;
  color: var(--text-muted);
}

.alert-rules__delete {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.alert-rules__delete:hover {
  background: var(--bg-hover);
  color: var(--red);
}

.alert-rules__empty {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  padding: 6px 0;
}

.alert-history {
  margin-top: 0;
}

/* ── Footer ── */
.footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 12px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}

.footer__status {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-dot--live {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

.footer__clock {
  font-family: var(--mono);
}

.footer__hint {
  margin-left: auto;
}

/* ── MTF Screener ── */
.mtf-screener__label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.mtf-screener__scope-tabs {
  padding: 0 0 8px;
  margin-bottom: 2px;
}

.mtf-screener__select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  margin-bottom: 6px;
}

.mtf-screener__preset-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 6px;
}

.mtf-screener__select--preset {
  flex: 1;
  margin-bottom: 0;
}

.mtf-screener__preset-manage {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: -2px 0 8px;
}

.mtf-screener__preset-manage .mtf-screener__link-btn {
  margin-bottom: 0;
}

.mtf-screener__icon-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.mtf-screener__icon-btn:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.mtf-screener__icon-btn--danger:hover {
  border-color: rgba(239, 83, 80, 0.5);
  color: #ef5350;
}

.mtf-screener__editor {
  margin-bottom: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.15);
}

.mtf-screener__editor-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.mtf-screener__input {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-base);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.mtf-screener__input:focus {
  outline: none;
  border-color: var(--accent);
}

.mtf-screener__conditions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}

.mtf-screener__condition-row {
  display: grid;
  grid-template-columns: 1fr 1fr 28px;
  gap: 4px;
  align-items: center;
}

.mtf-screener__select--cond-tf,
.mtf-screener__select--cond-dir {
  margin-bottom: 0;
  min-width: 0;
}

.mtf-screener__link-btn {
  padding: 0;
  margin: 0 0 8px;
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.mtf-screener__link-btn:hover {
  text-decoration: underline;
}

.mtf-screener__editor-preview {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.mtf-screener__editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.mtf-screener__preset-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.mtf-screener__actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.mtf-screener__filter {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
}

.mtf-screener__status {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.mtf-screener__results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 320px;
  overflow-y: auto;
}

.mtf-screener__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.mtf-screener__row:hover {
  border-color: var(--accent);
}

.mtf-screener__row.is-matched {
  border-color: rgba(38, 166, 154, 0.45);
  background: rgba(38, 166, 154, 0.08);
}

.mtf-screener__row.is-error {
  border-color: rgba(239, 83, 80, 0.35);
  background: rgba(239, 83, 80, 0.06);
  cursor: default;
}

.mtf-screener__row.is-error .mtf-screener__trends {
  color: #ef5350;
  font-family: inherit;
  font-size: 10px;
  white-space: normal;
}

.mtf-screener__symbol {
  font-weight: 600;
}

.mtf-screener__trends {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.mtf-screener__empty {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
  }

  .side-panel {
    display: none;
  }
}

@media (max-width: 600px) {
  .header__brand .header__title {
    display: none;
  }

  .timeframes .tf-btn.reorder-item:not(.is-active) {
    display: none;
  }

  .object-panel {
    width: 140px;
    top: 68px;
  }
}
