:root {
  --bg: #0a0a0a;
  --card: rgba(17, 17, 17, 0.95);
  --ink: #e0e0e0;
  --muted: #888;
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  --chart-ui-control-bg: rgba(255, 255, 255, 0.06);
  --chart-ui-control-hover-bg: rgba(255, 255, 255, 0.12);
  --chart-ui-control-active-border: rgba(74, 222, 128, 0.62);
  --chart-ui-progress-bg: rgba(18, 18, 18, 0.88);
  --chart-ui-progress-border: rgba(255, 255, 255, 0.13);
  --chart-ui-progress-track: rgba(255, 255, 255, 0.12);
  --chart-ui-progress-fill: linear-gradient(90deg, #8b8b8b, #f0f0f0);
  --chart-ui-progress-duration: 180ms;
  --chart-ui-help-bg: rgba(10, 10, 10, 0.82);
  --chart-ui-help-border: rgba(255, 255, 255, 0.16);
  --chart-ui-help-color: rgba(255, 255, 255, 0.78);
  --chart-ui-help-duration: 2000ms;
  --ui-font-micro: 10px;
  --ui-font-compact: 11px;
  --ui-font-body: 12px;
  --ui-radius-control: 8px;
  --ui-radius-panel: 12px;
  --ui-radius-pill: 999px;
  --ui-radius-round: 50%;
  --ui-radius-tooltip: 4px;
  --chart-plot-bg: #111111;
  --chart-grid-color: rgba(255, 255, 255, 0.06);
  --chart-axis-color: #666;
  --chart-font-color: #ccc;
  --chart-font-family: "Apple SD Gothic Neo", Pretendard, sans-serif;
  --chart-hover-bg: rgba(34, 34, 34, 0.45);
  --chart-hover-border: rgba(140, 140, 140, 0.35);
  --chart-hover-color: #eee;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

.app-shell { width: min(1120px, calc(100vw - 24px)); margin: 0 auto; padding: 20px 0 72px; }
.hero { padding: 18px 20px 6px; }
.hero h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 58px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: rgba(255, 255, 255, 0.09);
  position: relative;
  display: inline-block;
  --title-load: 100%;
}

.hero h1::after {
  content: attr(data-title);
  position: absolute;
  inset: 0;
  color: #fff;
  white-space: nowrap;
  pointer-events: none;
  clip-path: inset(0 calc(100% - var(--title-load)) 0 0);
  transition: filter 0.32s ease;
}

.hero h1.is-loading::after {
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.22));
}

.hero-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.stock-add-panel-inline {
  margin-top: 0;
  width: min(288px, 41vw);
  flex: 0 0 auto;
}

.stock-add-panel-inline .stock-search-wrap {
  min-height: 36px;
}

.top-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.top-control-toggle {
  min-height: 36px;
  padding: 7px 10px;
}

.refresh-btn,
.icon-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--ui-radius-round);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.refresh-btn:hover,
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.refresh-btn.spinning { animation: spin 0.7s linear infinite; color: var(--accent); border-color: rgba(74, 222, 128, 0.3); }

.icon-btn {
  font-size: 17px;
}

.icon-btn.is-configured { color: var(--accent); border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.1); }

@keyframes spin { to { transform: rotate(360deg); } }

.chart-toggle {
  border: 1px solid var(--border);
  background: var(--chart-ui-control-bg);
  color: var(--muted);
  font-size: var(--ui-font-body);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease;
}

.chart-toggle:hover:where(:not(:disabled)) {
  background: var(--chart-ui-control-hover-bg);
  color: var(--ink);
}

.chart-toggle.is-active {
  border-color: var(--chart-ui-control-active-border);
  background: transparent;
  color: var(--accent);
  box-shadow: none;
}

.chart-toggle:disabled {
  opacity: 0.34;
  cursor: not-allowed;
  filter: grayscale(0.9);
  background: rgba(255, 255, 255, 0.025);
  border-color: var(--border);
  color: #707070;
}

.hover-toggle-btn {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--ui-radius-pill);
  font-weight: 600;
}

.insider-trade-toggle-btn[aria-busy="true"] { opacity: 0.72; }

.reset-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--ui-radius-pill);
}

.main-chart-wrap {
  --chart-control-left: 35px;
  --chart-control-right: 34px;
  --chart-history-inset: 44px;
  position: relative;
}

.main-chart-wrap.handles-hidden {
  --chart-control-left: 14px;
  --chart-control-right: 12px;
  --chart-history-inset: 20px;
}

#y-handles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

.y-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--ui-radius-round);
  cursor: ns-resize;
  pointer-events: auto;
  touch-action: none;
  transition: transform 100ms ease, box-shadow 100ms ease, border-color 100ms ease;
  z-index: 101;
}

.y-handle-left { left: 14px; }

.y-handle.y-handle-eps {
  border-width: 2px;
  background: transparent;
  box-shadow: inset 0 0 0 1px rgba(8, 8, 8, 0.82);
}

.y-handle:hover {
  transform: scale(1.4);
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

.y-handle.dragging {
  transform: scale(1.5);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.4);
}

.main-chart-wrap.tools-hidden #coMovementToggle,
.main-chart-wrap.tools-hidden #insiderTradeToggle,
.main-chart-wrap.tools-hidden #disclosureToggle,
.main-chart-wrap.tools-hidden #epsToggle,
.main-chart-wrap.tools-hidden #recessionToggle,
.main-chart-wrap.tools-hidden #aiForecastToggle,
.main-chart-wrap.tools-hidden .chart-refresh-tools,
.main-chart-wrap.tools-hidden .chart-progress,
.main-chart-wrap.tools-hidden #y-handles {
  display: none !important;
}

.chart-refresh-tools {
  position: absolute;
  z-index: 120;
  top: 14px;
  right: var(--chart-control-right);
  width: 28px;
  height: 184px;
  transition: right 0.15s ease;
}

.chart-recession-btn {
  position: absolute;
  z-index: 120;
  top: 116px;
  left: var(--chart-control-left);
  min-width: 48px;
  padding: 5px 11px;
  background: rgba(18, 18, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-refresh-btn {
  position: static;
  width: 28px;
  height: 28px;
  border-color: rgba(255, 255, 255, 0.32);
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.62);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chart-refresh-btn:hover {
  border-color: rgba(74, 222, 128, 0.7);
  background: transparent;
  color: var(--accent);
}

.chart-range-controls {
  position: absolute;
  top: 64px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chart-cursor-mode-btn {
  position: absolute;
  top: 32px;
  right: 0;
  color: rgba(255, 255, 255, 0.68);
}

.cursor-line-glyph {
  position: relative;
  display: block;
  width: 15px;
  height: 15px;
  margin: auto;
}

.cursor-line-glyph::before,
.cursor-line-glyph::after {
  content: "";
  position: absolute;
  display: none;
  border-radius: var(--ui-radius-pill);
  background: currentColor;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.18);
}

[data-chart-cursor-mode="vertical"] .cursor-line-glyph::before,
[data-chart-cursor-mode="cross"] .cursor-line-glyph::before {
  display: block;
  top: 0;
  bottom: 0;
  left: 7px;
  width: 1px;
}

[data-chart-cursor-mode="horizontal"] .cursor-line-glyph::after,
[data-chart-cursor-mode="cross"] .cursor-line-glyph::after {
  display: block;
  top: 7px;
  left: 0;
  right: 0;
  height: 1px;
}

.chart-range-btn {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: var(--ui-radius-round);
  background: transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.62);
  color: var(--muted);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.chart-range-label {
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
}

.chart-range-unit {
  margin-left: 1px;
  font-size: var(--ui-font-micro);
}

.chart-latest-btn {
  font-size: 0;
}

.chart-latest-symbol {
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid currentColor;
  transform: translateX(1px);
}

.chart-range-btn:hover:not(:disabled) {
  border-color: rgba(74, 222, 128, 0.7);
  background: transparent;
  color: var(--accent);
}

.chart-range-btn:disabled {
  opacity: 0.58;
  border-color: rgba(255, 255, 255, 0.24);
  color: rgba(255, 255, 255, 0.42);
  cursor: default;
}

.chart-help-message {
  border: 1px solid var(--chart-ui-help-border);
  border-radius: var(--ui-radius-pill);
  background: var(--chart-ui-help-bg);
  color: var(--chart-ui-help-color);
  font-size: var(--ui-font-compact);
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ui-fade-message {
  opacity: 1;
  transition: opacity var(--chart-ui-help-duration) ease;
}

.ui-fade-message.is-fading { opacity: 0; }

.runtime-refresh-status {
  position: absolute;
  z-index: 120;
  top: 2px;
  right: calc(100% + 8px);
  max-width: min(260px, calc(100vw - 120px));
  padding: 4px 8px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runtime-refresh-status.is-loading { color: #93c5fd; border-color: rgba(147, 197, 253, 0.32); }
.runtime-refresh-status.is-error { color: #fca5a5; border-color: rgba(252, 165, 165, 0.32); }
.runtime-refresh-status[hidden] { display: none; }

.co-movement-panel {
  position: absolute;
  z-index: 119;
  top: auto;
  bottom: 38px;
  left: 50%;
  width: max-content;
  max-width: calc(100% - 176px);
  padding: 0;
  border: 0;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 26px;
  overflow-x: auto;
  background: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: var(--muted);
  font-size: var(--ui-font-compact);
  line-height: 1.2;
  white-space: nowrap;
  scrollbar-width: none;
  text-align: center;
  text-shadow: none;
}

.co-movement-panel::-webkit-scrollbar { display: none; }
.co-movement-panel[hidden] { display: none; }
.co-movement-title { flex: 0 0 auto; color: var(--ink); font-weight: 700; }
.co-movement-metric { flex: 0 0 auto; }
.co-movement-metric b { color: #f8d477; font-weight: 700; }

/* Main chart controls share one visual shell; only their vertical slots differ. */
.chart-ai-btn,
.chart-side-btn {
  position: absolute;
  z-index: 120;
  left: var(--chart-control-left);
  min-width: 48px;
  padding: 5px 11px;
  background: rgba(18, 18, 18, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-progress {
  position: absolute;
  z-index: 121;
  left: calc(var(--chart-control-left) + 59px);
  width: min(190px, calc(100% - var(--chart-control-left) - 78px));
  padding: 5px 8px 6px;
  border: 1px solid var(--chart-ui-progress-border);
  border-radius: var(--ui-radius-control);
  background: var(--chart-ui-progress-bg);
  color: rgba(255, 255, 255, 0.76);
  font-size: var(--ui-font-micro);
  line-height: 1;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chart-ai-btn { top: 184px; }

.ai-forecast-progress { top: 185px; }
.eps-progress { top: 151px; }
.signal-progress { top: 117px; }

.ui-progress-track {
  display: block;
  overflow: hidden;
  border-radius: var(--ui-radius-pill);
  background: var(--chart-ui-progress-track);
}

.ui-progress-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--chart-ui-progress-fill);
  transition: width var(--chart-ui-progress-duration) ease-out;
}

.chart-progress-track {
  height: 3px;
  margin-top: 5px;
}

.ui-modal {
  position: fixed;
  inset: 0;
  z-index: var(--ui-modal-z-index, 2000);
  display: flex;
  align-items: var(--ui-modal-align, center);
  justify-content: var(--ui-modal-justify, center);
  padding: var(--ui-modal-padding, 0);
}

.ui-modal[hidden] {
  display: none !important;
}

.ui-modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--ui-modal-backdrop, rgba(0, 0, 0, 0.62));
  backdrop-filter: var(--ui-modal-backdrop-filter, none);
}

.ui-dialog-panel {
  position: relative;
  width: var(--ui-dialog-width, min(560px, calc(100vw - 16px)));
  max-height: var(--ui-dialog-max-height, 84vh);
  overflow: auto;
  margin: var(--ui-dialog-margin, 0);
  padding: var(--ui-dialog-padding, 14px);
  border: var(--ui-dialog-border, 1px solid var(--border));
  border-radius: var(--ui-dialog-radius, 20px);
  background: var(--ui-dialog-background, #131313);
  box-shadow: var(--ui-dialog-shadow, var(--shadow));
  color: var(--ui-dialog-color, var(--ink));
}

.ui-scroll-affordance::before,
.ui-scroll-affordance::after {
  content: "";
  position: absolute;
  left: var(--ui-scroll-cue-left, 50%);
  z-index: 3;
  width: 8px;
  height: 8px;
  border-right: 2px solid rgba(255, 255, 255, 0.62);
  border-bottom: 2px solid rgba(255, 255, 255, 0.62);
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.ui-scroll-affordance::before {
  top: var(--ui-scroll-cue-top, 8px);
  transform: translateX(-50%) rotate(225deg);
}

.ui-scroll-affordance::after {
  bottom: var(--ui-scroll-cue-bottom, 8px);
  transform: translateX(-50%) rotate(45deg);
}

.ui-scroll-affordance.can-scroll-up::before,
.ui-scroll-affordance.can-scroll-down::after { opacity: 0.72; }

.ui-circle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ui-circle-button-size, 30px);
  height: var(--ui-circle-button-size, 30px);
  flex: 0 0 var(--ui-circle-button-size, 30px);
  padding: 0;
  border: var(--ui-circle-button-border, 1px solid var(--border));
  border-radius: var(--ui-radius-round);
  background: var(--ui-circle-button-background, rgba(255, 255, 255, 0.06));
  color: var(--ui-circle-button-color, var(--ink));
  line-height: 1;
  cursor: pointer;
}

.ui-circle-button:hover:not(:disabled) {
  background: var(--ui-circle-button-hover-background, rgba(255, 255, 255, 0.12));
}

.ui-circle-button:disabled,
.ui-compact-control:disabled {
  opacity: 0.32;
  cursor: default;
}

.ui-compact-control {
  min-height: 29px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--ui-radius-pill);
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  cursor: pointer;
}

.ui-compact-control[aria-pressed="true"] {
  border-color: rgba(46, 218, 127, 0.62);
  background: rgba(24, 128, 72, 0.16);
  color: #45de85;
}

.api-settings-modal {
  --ui-modal-z-index: 2000;
  --ui-modal-align: flex-end;
  --ui-modal-backdrop-filter: blur(2px);
}

.api-settings-backdrop {
  --ui-modal-backdrop: rgba(0, 0, 0, 0.62);
}

.api-settings-panel {
  --ui-dialog-width: min(560px, calc(100vw - 16px));
  --ui-dialog-max-height: 84vh;
  --ui-dialog-radius: 20px 20px 14px 14px;
  --ui-dialog-margin: 8px;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.api-settings-panel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.settings-confirm-modal {
  --ui-modal-z-index: 2200;
  --ui-modal-align: center;
  --ui-modal-padding: 16px;
}

.settings-confirm-backdrop {
  --ui-modal-backdrop: rgba(0, 0, 0, 0.72);
  --ui-modal-backdrop-filter: blur(2px);
}

.settings-confirm-panel {
  --ui-dialog-width: min(330px, calc(100vw - 32px));
  --ui-dialog-max-height: none;
  --ui-dialog-padding: 18px;
  --ui-dialog-radius: 16px;
  overflow: hidden;
  text-align: center;
}

.settings-confirm-panel > strong {
  color: #fff;
  font-size: 15px;
}

.settings-confirm-panel > p {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.settings-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.settings-confirm-actions .api-action-btn {
  min-width: 74px;
}

.settings-confirm-actions .is-destructive {
  border-color: rgba(239, 120, 120, 0.38);
  background: rgba(160, 58, 58, 0.12);
  color: #efb0b0;
}

.api-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.api-settings-header h2 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}

.api-settings-version {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.api-close-btn {
  --ui-circle-button-size: 30px;
}

.api-settings-help,
.api-settings-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.api-field {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.api-field span {
  font-size: 11px;
  color: #b5b5b5;
  letter-spacing: 0.02em;
}

.api-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 13px;
  padding: 10px 12px;
}

.api-field input:focus {
  outline: none;
  border-color: rgba(74, 222, 128, 0.35);
}

.api-local-server-field {
  margin-top: 12px;
}

.api-local-server-field label,
.api-local-server-field small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.api-local-server-row {
  display: flex;
  gap: 7px;
  margin: 6px 0 5px;
}

.api-local-server-row input {
  min-width: 0;
  flex: 1;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 8px 9px;
  font: inherit;
  font-size: 12px;
}

.api-check-field {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.api-check-field input {
  margin-top: 2px;
  accent-color: var(--accent);
}

.api-settings-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.settings-control-group {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--ui-radius-panel);
  background: rgba(255, 255, 255, 0.025);
}

.cursor-line-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
}

.cursor-line-setting + .cursor-line-setting {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.cursor-line-setting-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.cursor-line-mode-options {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cursor-line-mode-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.52);
  cursor: pointer;
}

.cursor-line-mode-btn:hover,
.cursor-line-mode-btn.is-active,
.cursor-line-mode-btn[aria-pressed="true"] {
  border-color: rgba(74, 222, 128, 0.52);
  background: rgba(74, 222, 128, 0.08);
  color: var(--accent);
}

.settings-number-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-stepper-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.72);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.settings-stepper-btn:hover:where(:not(:disabled)) {
  border-color: rgba(74, 222, 128, 0.52);
  color: var(--accent);
}

.settings-stepper-btn:disabled { opacity: 0.25; cursor: default; }

.settings-stepper-value {
  min-width: 18px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.credit-offset-value { min-width: 24px; }

.stock-research-universe-value { min-width: 34px; }

.release-notes-open-btn { margin-right: 0; }
.api-period-open-btn { margin-right: auto; }
.cache-summary-open-btn { font-variant-numeric: tabular-nums; }

.api-settings-view-btn[aria-pressed="true"] {
  border-color: rgba(74, 222, 128, 0.42);
  background: var(--accent-soft);
  color: var(--accent);
}

.performance-diagnostics {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--ui-radius-panel);
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.07), rgba(34, 211, 238, 0.025)),
    rgba(255, 255, 255, 0.025);
}

.performance-diagnostics[hidden] { display: none !important; }

.api-period-panel {
  padding: 0;
  border: 0;
  background: transparent;
}

.api-period-panel .api-period-rows {
  margin-top: 0;
  background:
    linear-gradient(135deg, rgba(74, 222, 128, 0.07), rgba(34, 211, 238, 0.025)),
    rgba(255, 255, 255, 0.025);
}

.release-notes-header { gap: 12px; }

.release-notes-heading {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}

.release-notes-heading > strong {
  color: var(--accent);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

#releaseNotesSize,
#releaseNotesDate {
  color: rgba(166, 177, 173, 0.72);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.app-cache-header > strong {
  color: var(--accent);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.app-cache-delete-btn {
  min-height: 30px;
  padding: 5px 10px;
  border-color: rgba(248, 113, 113, 0.3);
  color: #f3b0b0;
  font-size: 11px;
}

.app-cache-delete-btn:not(:disabled):hover {
  border-color: rgba(248, 113, 113, 0.58);
  background: rgba(248, 113, 113, 0.09);
  color: #ffd0d0;
}

.app-cache-delete-btn:disabled { opacity: 0.32; }

.app-cache-rows {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
}

.app-cache-rows[hidden],
.app-cache-row[hidden] { display: none; }

.app-cache-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 45px;
}

.app-cache-row:not([hidden]) ~ .app-cache-row:not([hidden]) {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.app-cache-empty {
  margin: 12px 0 2px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.app-cache-kind {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 8px 10px;
  white-space: nowrap;
}

.app-cache-kind strong {
  flex: 0 0 auto;
  color: #e2e7e5;
  font-size: 11px;
  font-weight: 700;
}

.app-cache-kind small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-cache-size {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 72px;
  padding: 8px 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  color: #f1f5f3;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.release-notes-navigation {
  display: flex;
  align-items: center;
  gap: 7px;
}

.release-notes-navigation .api-action-btn {
  min-width: 32px;
  min-height: 30px;
  padding: 4px 9px;
  font-size: 15px;
  line-height: 1;
}

.release-notes-navigation .api-action-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

#releaseNotesPosition {
  min-width: 34px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.release-notes-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(5, minmax(18px, auto));
  gap: 8px;
  margin: 11px 0 1px;
  min-height: 122px;
  padding: 0;
  list-style: none;
  color: #d9dfdd;
  font-size: 12px;
  line-height: 1.45;
}

.release-notes-list.is-two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 18px;
}

.release-notes-list.is-two-column li {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.release-notes-list li {
  position: relative;
  padding-left: 14px;
}

.release-notes-list li::before {
  position: absolute;
  left: 1px;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.72);
  content: "";
}

.auxiliary-separator-layer {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.auxiliary-section-separator {
  position: absolute;
  right: 0;
  left: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.03);
  transform: translateY(-0.5px);
}

.auxiliary-panel-title,
.auxiliary-representative-toggle,
.auxiliary-chart-label {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  margin: 0;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: var(--ui-radius-pill);
  background: var(--chart-ui-control-bg);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  color: rgba(255, 255, 255, 0.72);
  font-family: "Apple SD Gothic Neo", Pretendard, sans-serif;
  font-size: var(--ui-font-compact);
  line-height: 14px;
  white-space: nowrap;
  cursor: pointer;
}

.auxiliary-panel-title {
  font-weight: 400;
  pointer-events: auto;
}

.auxiliary-panel-title::before,
.auxiliary-representative-toggle::before,
.auxiliary-chart-label::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--auxiliary-series-color, #ffffff);
  content: "";
}

.auxiliary-panel-heading {
  position: absolute;
  z-index: 5;
  left: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 14px;
  pointer-events: auto;
}

.auxiliary-representative-toggles {
  position: absolute;
  z-index: 6;
  top: 7px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2.5vw, 22px);
  max-width: calc(100% - 20px);
  transform: translateX(-50%);
  white-space: nowrap;
  pointer-events: auto;
}

.auxiliary-representative-toggle {
  transition: background-color 150ms ease, border-color 150ms ease,
    color 150ms ease, opacity 150ms ease;
}

.auxiliary-panel-title:hover,
.auxiliary-chart-label:hover,
.auxiliary-representative-toggle:hover:where(:not(:disabled)) {
  border-color: rgba(255, 255, 255, 0.28);
  background: var(--chart-ui-control-hover-bg);
  color: var(--ink);
}

.auxiliary-representative-toggle[aria-pressed="false"] {
  opacity: 0.34;
}

.auxiliary-representative-toggle:disabled {
  opacity: 0.2;
  cursor: default;
}

.auxiliary-series-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  margin: 0;
  padding: 0 5px;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font: inherit;
  font-size: 10px;
  line-height: 14px;
  cursor: pointer;
  pointer-events: auto;
}

.auxiliary-series-toggle::before {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--auxiliary-series-color, #ffffff);
  content: "";
}

.auxiliary-series-toggle[aria-pressed="false"] {
  opacity: 0.34;
}

.auxiliary-series-toggle:disabled {
  opacity: 0.2;
  cursor: default;
}

.auxiliary-macd-heading {
  width: calc(100% - 4px);
  min-height: 28px;
}

.auxiliary-macd-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.auxiliary-chart-label {
  appearance: none;
  cursor: pointer;
  pointer-events: auto;
}

.auxiliary-macd-target {
  cursor: pointer;
  pointer-events: auto;
}

@media (max-width: 600px) {
  .auxiliary-macd-controls .auxiliary-series-toggle {
    padding-right: 2px;
    padding-left: 2px;
    font-size: 9px;
  }

  .auxiliary-macd-target {
    font-size: 9px;
  }
}

.api-period-rows {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
}

.api-period-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(145px, 0.85fr);
  align-items: center;
  min-height: 38px;
  color: #c9d3d0;
  font-size: 11px;
  line-height: 1.35;
}

.api-period-row + .api-period-row {
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.api-period-name,
.api-period-dates {
  padding: 9px 10px;
}

.api-period-dates {
  align-self: stretch;
  display: flex;
  align-items: center;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
  color: #e2e7e5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.performance-diagnostics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 12px;
}

.performance-diagnostics-summary {
  margin: 10px 0 0;
  color: #c9d3d0;
  font-size: 11px;
  line-height: 1.65;
  white-space: pre-line;
}

.diagnostics-clear-btn {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  text-decoration: underline;
  cursor: pointer;
}

.data-attribution {
  margin: 20px 20px 8px;
  padding: 14px 8px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  text-align: center;
}

.chart-navigation-message {
  position: absolute;
  z-index: 124;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: max-content;
  max-width: calc(100% - 120px);
  padding: 7px 12px;
  text-align: center;
}

.chart-frame.is-viewport-panning {
  cursor: grabbing;
}

#adminAccessStatus.is-active { color: var(--accent); }

.api-access-status { margin-top: 5px; }
.api-access-status[hidden] { display: none; }
.api-local-server-field small.is-error { color: #f87171; }

.data-attribution-title {
  display: block;
  margin-bottom: 9px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.data-source-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.data-source-links a {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  line-height: 1;
  text-decoration: none;
}

.data-source-links a:hover,
.data-source-links a:focus-visible {
  border-color: rgba(255, 255, 255, 0.34);
  color: var(--ink);
}

.data-attribution-note {
  margin: 10px 0 0;
}

.app-company-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(10px, 2.5vw, 21px);
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  white-space: nowrap;
}

.app-company-line-main {
  justify-content: center;
  margin-top: 2px;
}

.app-company-line a {
  color: inherit;
  text-decoration: none;
}

.app-company-line a:hover,
.app-company-line a:focus-visible {
  color: var(--ink);
  text-decoration: underline;
}

.api-action-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
}

.api-action-btn.primary {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(74, 222, 128, 0.35);
}

@media (min-width: 821px) {
  .api-settings-modal { align-items: center; }
  .api-settings-panel {
    margin: 0;
    width: min(560px, calc(100vw - 28px));
    border-radius: 20px;
  }
}

.series-toggle-board {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.series-row {
  display: grid;
  gap: 8px;
}

.series-row.base-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.series-row.base-row:nth-child(2) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.series-toggle-board.macro-controls-hidden .series-row.base-row {
  display: none;
}

.custom-series-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.custom-stock-chip {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}

.series-toggle-btn.custom-stock-toggle-btn {
  padding-right: 38px;
}

.series-toggle-btn {
  --series-color: #888;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.series-toggle-btn::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--series-color);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
  flex: 0 0 8px;
}

.series-toggle-btn[data-series="leading_cycle"] { --series-color: #929292; }
.series-toggle-btn[data-series="t10y1y"] { --series-color: #cf7777; }
.series-toggle-btn[data-series="^KS11"] { --series-color: #ce9668; }
.series-toggle-btn[data-series="^KQ11"] { --series-color: #c9b65e; }
.series-toggle-btn[data-series="us_credit_spread"] { --series-color: #75ad7f; }
.series-toggle-btn[data-series="customer_deposit"] { --series-color: #64ada9; }
.series-toggle-btn[data-series="kospi_credit"] { --series-color: #6f91bd; }
.series-toggle-btn[data-series="kosdaq_credit"] { --series-color: #9680b8; }

.stock-research-btn {
  min-width: 0;
  padding: 8px 7px;
  border: 1px solid rgba(244, 211, 94, 0.3);
  border-radius: 12px;
  background: rgba(244, 211, 94, 0.07);
  color: #eadca5;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.top-control-toggle {
  min-width: 0;
  padding: 8px 7px;
  border-radius: 12px;
  font-weight: 700;
}
.stock-research-btn:hover { background: rgba(244, 211, 94, 0.13); }
.stock-research-btn.is-admin-locked { opacity: 0.3; cursor: not-allowed; }

.chart-co-movement-btn { top: 14px; }
.chart-insider-btn { top: 48px; }
.chart-disclosure-btn { top: 82px; }
.chart-eps-btn { top: 150px; }

.disclosure-progress {
  top: 83px;
}

.disclosure-progress[data-anchor="insider"] {
  top: 49px;
}

.stock-research-modal {
  --ui-modal-z-index: 2100;
  --ui-modal-padding: 14px;
  --ui-modal-backdrop: rgba(0, 0, 0, 0.7);
}

.stock-research-panel {
  --ui-dialog-width: min(660px, calc(100vw - 20px));
  --ui-dialog-max-height: min(88vh, 800px);
  --ui-dialog-padding: 18px;
  --ui-dialog-border: 1px solid rgba(255, 255, 255, 0.16);
  --ui-dialog-radius: 20px;
  --ui-dialog-background: #11120f;
  --ui-dialog-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.stock-research-header,
.stock-research-progress-copy,
.stock-research-item-top {
  display: flex;
  align-items: center;
}

.stock-research-header { min-width: 0; gap: 6px; }
.stock-research-header h2 { flex: 0 0 auto; margin: 0; font-size: 17px; }
.stock-research-filters {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 4px;
  margin-left: 2px;
}
.stock-research-filters button {
  min-width: 42px;
  height: 29px;
  padding: 0 9px;
  font-size: 11px;
  font-weight: 720;
}
.stock-research-filters button:disabled { opacity: 0.42; cursor: wait; }
.stock-research-as-of { margin: 8px 0 0; color: var(--muted); font-size: 11px; }

.stock-research-header-blocked-btn {
  height: 29px;
  flex: 0 0 auto;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  cursor: pointer;
}

.stock-research-blocked-menu {
  position: relative;
  flex: 0 0 auto;
  margin-left: auto;
}

.stock-research-header-blocked-btn[aria-expanded="true"] {
  border-color: rgba(74, 222, 128, 0.5);
  background: rgba(74, 222, 128, 0.1);
  color: var(--accent);
}

.stock-research-header-blocked-btn:disabled {
  opacity: 0.32;
  cursor: default;
}

.stock-research-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 12px;
}

.stock-research-close-btn {
  margin-left: 0;
  --ui-circle-button-border: 1px solid rgba(255, 255, 255, 0.2);
  --ui-circle-button-background: transparent;
  font-size: 24px;
}

.stock-research-run-controls {
  justify-self: end;
  display: flex;
  width: max-content;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.stock-research-refresh-btn,
.stock-research-stop-btn {
  min-height: 36px;
  flex: 0 0 auto;
  padding: 0 11px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}

.stock-research-refresh-btn {
  border: 1px solid rgba(244, 211, 94, 0.4);
  background: rgba(244, 211, 94, 0.1);
  color: #f4d35e;
}
.stock-research-refresh-btn:disabled { opacity: 0.45; cursor: wait; }

.stock-research-stop-btn {
  border: 1px solid rgba(255, 112, 112, 0.38);
  background: rgba(255, 112, 112, 0.08);
  color: #ef9a9a;
}

.stock-research-stop-btn:disabled {
  opacity: 0.24;
  cursor: default;
  pointer-events: none;
}
.stock-research-page-controls {
  --ui-circle-button-size: 34px;
  --ui-circle-button-border: 1px solid rgba(255, 255, 255, 0.2);
  --ui-circle-button-background: rgba(255, 255, 255, 0.04);
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-self: center;
  gap: 9px;
}
.stock-research-page-controls button {
  font-size: 18px;
}
.stock-research-page-position {
  display: inline-flex;
  width: 22px;
  height: 34px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
}
.stock-research-page-controls button:disabled { opacity: 0.25; }
.stock-research-disclaimer { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.stock-research-signal-stepper {
  display: flex;
  min-width: 0;
  height: 36px;
  align-items: center;
  justify-self: start;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #d7d7d1;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.stock-research-signal-stepper button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.stock-research-signal-stepper button:disabled { opacity: 0.25; cursor: default; }
.stock-research-signal-stepper output { min-width: 10px; color: #f4d35e; font-size: 11px; font-weight: 750; text-align: center; }
.stock-research-signal-stepper.is-locked { opacity: 0.48; }

.stock-research-progress { margin-top: 14px; }
.stock-research-progress-copy { justify-content: space-between; gap: 10px; color: #e8d98b; font-size: 11px; }
.stock-research-progress-details {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.stock-research-failed-btn {
  height: 29px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 11px;
  font-weight: 720;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
}
.stock-research-failed-btn:hover,
.stock-research-failed-btn:focus-visible {
  border-color: rgba(244, 211, 94, 0.5);
  background: rgba(244, 211, 94, 0.1);
  color: #fff;
}
.stock-research-failed-btn[aria-pressed="true"] {
  border-color: var(--chart-ui-control-active-border);
  background: var(--accent-soft);
  color: var(--accent);
}
.stock-research-progress-track {
  height: 5px;
  margin-top: 7px;
}

.stock-research-results { position: relative; }
.stock-research-list {
  display: grid;
  height: 354px;
  align-content: start;
  grid-auto-rows: minmax(62px, auto);
  gap: 8px;
  margin-top: 14px;
  overflow-y: auto;
}
.stock-research-item {
  position: relative;
  width: 100%;
  min-height: 62px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}
.stock-research-item-main {
  width: 100%;
  min-height: 62px;
  padding: 6px 126px 6px 12px;
  color: var(--ink);
  text-align: left;
}
.stock-research-item:hover { border-color: rgba(244, 211, 94, 0.35); background: rgba(244, 211, 94, 0.065); }
.stock-research-item.is-added { border-color: rgba(74, 222, 128, 0.22); background: rgba(74, 222, 128, 0.035); }
.stock-research-item-actions {
  position: absolute;
  top: 8px;
  right: 10px;
  display: flex;
  gap: 5px;
}
.stock-research-item-actions button {
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
}
.stock-research-toggle-btn {
  border: 1px solid rgba(115, 190, 145, 0.3);
  background: rgba(65, 135, 92, 0.12);
  color: #a9d4b8;
}
.stock-research-block-btn {
  border: 1px solid rgba(239, 120, 120, 0.3);
  background: rgba(160, 58, 58, 0.1);
  color: #d99898;
}
.stock-research-toggle-btn:hover { background: rgba(65, 155, 98, 0.24); color: #c2e8cf; }
.stock-research-block-btn:hover { background: rgba(190, 68, 68, 0.22); color: #f0b0b0; }
.stock-research-item-top { align-items: flex-start; justify-content: space-between; gap: 10px; }
.stock-research-name-group { display: flex; min-width: 0; align-items: baseline; gap: 7px; }
.stock-research-name { overflow: hidden; font-size: 14px; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.stock-research-category { flex: 0 0 auto; color: #9fa99a; font-size: 10px; font-weight: 600; white-space: nowrap; }
.stock-research-status-group { display: flex; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 2px; line-height: 1.15; }
.stock-research-market-rank { color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.stock-research-status { flex: 0 0 auto; color: #f0cf68; font-size: 11px; font-weight: 700; }
.stock-research-item-reason { display: block; margin-top: 3px; color: #c9c9c2; font-size: 10px; line-height: 1.25; }
.stock-research-empty {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  margin: 0;
  padding: 0 16px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  transform: translateY(-50%);
}

.series-toggle-btn:hover { background: rgba(255, 255, 255, 0.12); }

.series-toggle-btn.is-on {
  border-color: rgba(255, 255, 255, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.series-toggle-btn.is-off {
  opacity: 0.5;
  filter: grayscale(0.25);
}

.series-toggle-btn.is-disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.stock-remove-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.stock-remove-btn::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 999px;
}

.stock-remove-btn:hover {
  background: rgba(248, 113, 113, 0.22);
}

.stock-add-panel {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  position: relative;
  z-index: 30;
}

.stock-add-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.stock-search-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 0 10px;
  position: relative;
  overflow: visible;
}

.stock-search-input {
  width: 100%;
  height: 36px;
  background: transparent;
  color: var(--ink);
  border: 0;
  outline: none;
  font-size: 13px;
  appearance: none;
  -webkit-appearance: none;
}

.stock-search-input::placeholder {
  color: rgba(210, 216, 228, 0.55);
}

.stock-search-input::-webkit-search-cancel-button {
  display: none;
  -webkit-appearance: none;
}

@keyframes stock-search-autofill-detected {
  from { opacity: 0.999; }
  to { opacity: 1; }
}

.stock-search-input:-webkit-autofill,
.stock-search-input:-webkit-autofill:hover,
.stock-search-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px #151515 inset;
  caret-color: var(--ink);
  animation: stock-search-autofill-detected 1ms;
}

.startup-loader {
  margin: 2px 20px 8px;
  display: grid;
  gap: 6px;
}

.startup-loader[hidden] {
  display: none !important;
}

.startup-loader-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
}

.startup-loader-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.65), rgba(74, 222, 128, 0.95));
  transition: width 0.22s ease;
}

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

.stock-suggest-list {
  position: absolute;
  top: calc(100% + 6px);
  left: -1px;
  right: -1px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 15, 20, 0.95);
  overflow: hidden;
  max-height: 144px;
  overflow-y: auto;
  z-index: 40;
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.42);
}

.stock-suggest-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
  font-size: 12px;
  cursor: pointer;
}

.stock-suggest-item:last-child {
  border-bottom: 0;
}

.stock-suggest-item:hover {
  background: rgba(74, 222, 128, 0.10);
}

.stock-suggest-item.is-active {
  background: rgba(74, 222, 128, 0.18);
  outline: 1px solid rgba(74, 222, 128, 0.35);
}

.stock-suggest-name {
  font-weight: 600;
}

.stock-suggest-meta {
  color: var(--muted);
  font-size: 11px;
  margin-left: 6px;
}

.chart-frame {
  position: relative;
  touch-action: pan-y;
  margin-top: 8px;
  min-height: 437px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 0;
  overflow: hidden;
  cursor: default;
}

#chart.chart-frame {
  min-height: 451px;
}

.chart-frame .main-svg,
.chart-frame .main-svg * {
  cursor: default !important;
}

.chart-frame.is-line-hovering,
.chart-frame.is-event-marker-hovering,
.chart-frame.is-ai-report-hovering,
.chart-frame.is-line-hovering .main-svg,
.chart-frame.is-event-marker-hovering .main-svg,
.chart-frame.is-ai-report-hovering .main-svg,
.chart-frame.is-line-hovering .main-svg *,
.chart-frame.is-event-marker-hovering .main-svg *,
.chart-frame.is-ai-report-hovering .main-svg * {
  cursor: pointer !important;
}

#chart .scatterlayer .trace.scatter.is-eps-point-highlighted .points path.point {
  transition: stroke-width 80ms ease;
  stroke-width: 3px !important;
}

.chart-frame.is-line-dragging,
.chart-frame.is-line-dragging .main-svg,
.chart-frame.is-line-dragging .main-svg * {
  cursor: ns-resize !important;
}

.chart-frame.chart-frame-macd .main-svg .legend,
.chart-frame.chart-frame-macd .main-svg .legend * {
  cursor: pointer !important;
}

.synced-cursor-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: translateX(0);
  will-change: transform, opacity;
  z-index: 90;
}

.synced-cursor-horizontal-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: translateY(0);
  will-change: transform, opacity;
  z-index: 90;
}

/* Cursor lines are rendered by the lightweight synchronized overlays above. */
.chart-frame .spikeline {
  display: none !important;
}

.is-viewport-panning .synced-cursor-line,
.is-viewport-panning .synced-cursor-horizontal-line {
  opacity: 0 !important;
}

.chart-frame-adr {
  min-height: 570px;
  max-height: 610px;
}

.chart-frame-macd {
  min-height: 190px;
  max-height: 250px;
}

.chart-frame-macd[hidden] { display: none !important; }

.disclosure-popover {
  position: absolute;
  z-index: 130;
  box-sizing: border-box;
  width: max-content;
  max-width: min(230px, calc(100% - 24px));
  padding: 9px 10px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 14px;
  background: rgba(14, 14, 12, 0.94);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  color: rgba(255, 255, 255, 0.9);
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-user-select: text;
  user-select: text;
}

.disclosure-popover[hidden] { display: none !important; }

.disclosure-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.disclosure-popover-head b {
  display: block;
  font-size: 13px;
}

.disclosure-popover-head span {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 11px;
}

.disclosure-popover-head button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  margin: -5px -6px 0 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.75);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.disclosure-popover ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.disclosure-popover li {
  display: grid;
  gap: 2px;
  padding-top: 5px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  line-height: 1.35;
}

.disclosure-popover li:first-child {
  padding-top: 0;
  border-top: 0;
}

.disclosure-event-caption {
  display: block;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  line-height: 1.25;
}

.disclosure-type {
  width: fit-content;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.13);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 700;
}

.disclosure-popover strong,
.disclosure-title-link {
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.disclosure-title-link {
  display: inline;
  line-height: 1.35;
}

.disclosure-popover p {
  margin: 0;
  color: rgba(255, 255, 255, 0.62);
}

.disclosure-popover a {
  display: block;
  color: #fbbf24;
  text-decoration: none;
  font-weight: 700;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(251, 191, 36, 0.2);
}

.disclosure-popover li[data-event-tone="insider-buy"] strong,
.disclosure-popover li[data-event-tone="insider-buy"] a {
  color: #b91c1c;
}

.disclosure-popover li[data-event-tone="insider-sell"] strong,
.disclosure-popover li[data-event-tone="insider-sell"] a {
  color: #1d4ed8;
}

.data-freshness {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 20px 4px;
}

.freshness-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
}

.freshness-chip strong {
  color: #d4d4d4;
  font-weight: 700;
}

.freshness-chip small {
  color: #93c5fd;
  font-size: 10px;
  font-weight: 700;
}

.freshness-chip.is-cache small { color: #c4b5fd; }

.freshness-chip.is-stale {
  border-color: rgba(250, 204, 21, 0.28);
  background: rgba(250, 204, 21, 0.08);
}

.freshness-chip.is-anomaly {
  border-color: rgba(248, 113, 113, 0.48);
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}

.freshness-chip.is-empty {
  opacity: 0.62;
}

.chart-frame-adr .cartesianlayer .point { display: none !important; }
.legend .legendlines { display: none !important; }
.hoverlayer .legendpoints { display: none !important; }
.no-hover-popup .hoverlayer > g { display: none !important; }
.chart-frame.is-hover-waiting .hoverlayer > g { display: none !important; }
.chart-frame.is-line-dragging .hoverlayer > g { display: none !important; }

/* Plotly renders unified and point tooltips with different SVG elements. */
.chart-frame { --chart-hover-font-size: var(--ui-font-compact); }
#chart { --chart-hover-font-size: var(--ui-font-body); }

.chart-frame .hoverlayer > g.hovertext > path,
.chart-frame .hoverlayer > g.legend > rect.bg {
  fill: var(--chart-hover-bg) !important;
  stroke: var(--chart-hover-border) !important;
  stroke-width: 1px !important;
}

.chart-frame .hoverlayer > g.hovertext text.nums,
.chart-frame .hoverlayer > g.legend text.legendtitletext,
.chart-frame .hoverlayer > g.legend text.legendtext {
  fill: var(--chart-hover-color) !important;
  font-family: var(--chart-font-family) !important;
  font-size: var(--chart-hover-font-size) !important;
  font-weight: 400;
}

.chart-hover-summary {
  position: absolute;
  z-index: 130;
  width: max-content;
  max-width: min(230px, calc(100% - 24px));
  padding: 7px 9px;
  border: 1px solid var(--chart-hover-border);
  border-radius: var(--ui-radius-tooltip);
  background: var(--chart-hover-bg);
  color: var(--chart-hover-color);
  font-family: var(--chart-font-family);
  font-size: var(--ui-font-body);
  font-weight: 400;
  line-height: 1.45;
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.chart-hover-summary[hidden] { display: none !important; }

.chart-hover-summary-lines {
  display: grid;
  gap: 1px;
}

.chart-hover-summary-lines span { white-space: nowrap; }

.chart-hover-summary.stock-research-list-popover {
  width: min(190px, calc(100% - 24px));
  max-width: min(190px, calc(100% - 24px));
  pointer-events: auto;
}

.stock-research-list-popover .chart-hover-summary-lines {
  grid-auto-rows: 30px;
  max-height: 150px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.stock-research-list-popover .chart-hover-summary-lines::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.stock-research-list-popover .chart-hover-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.stock-research-list-popover .chart-hover-summary-title {
  min-width: 0;
  max-width: 8em;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stock-research-list-popover .chart-hover-summary-action {
  min-width: 38px;
  height: 25px;
  padding: 0 8px;
  border: 1px solid rgba(74, 222, 128, 0.34);
  border-radius: var(--ui-radius-pill);
  background: rgba(74, 222, 128, 0.08);
  color: var(--accent);
  font: inherit;
  font-size: var(--ui-font-compact);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}

.stock-research-list-popover .chart-hover-summary-action:disabled {
  opacity: 0.45;
  cursor: wait;
}

.stock-research-list-popover .chart-hover-summary-action.is-destructive {
  border-color: rgba(239, 120, 120, 0.3);
  background: rgba(160, 58, 58, 0.1);
  color: #d99898;
}

.stock-research-list-popover .chart-hover-summary-action.is-destructive:hover,
.stock-research-list-popover .chart-hover-summary-action.is-destructive:focus-visible {
  background: rgba(190, 68, 68, 0.22);
  color: #f0b0b0;
}

.message-area {
  margin-top: 12px;
  max-height: 9.5em;
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: var(--ui-radius-panel);
  background: var(--card);
  overscroll-behavior: contain;
  scrollbar-width: none;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}
.message-area:empty { margin-top: 0; }
.message-area::-webkit-scrollbar { width: 0; height: 0; }
.message { padding: 12px 14px; border-radius: inherit; background: var(--card); border: 1px solid var(--border); color: var(--muted); font-size: 15px; }
.message-log { display: grid; gap: 4px; line-height: 1.4; }
.message-log-line.error { color: #f87171; }
.message.error { background: rgba(187, 67, 40, 0.2); color: #f87171; }

.message-area + .data-freshness {
  padding-top: 6px;
}

@media (max-width: 820px) {
  body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  .series-row.base-row:nth-child(2) { gap: 5px; }
  .stock-research-btn,
  .top-control-toggle { font-size: 11px; }
  .stock-research-panel { max-height: 92svh; padding: 15px; border-radius: 17px; }
  .stock-research-actions { gap: 4px; }
  .stock-research-signal-stepper { gap: 2px; }
  .stock-research-page-controls { gap: 6px; }
  .stock-research-run-controls { gap: 2px; }
  .stock-research-disclaimer { margin-top: 8px; }
  .stock-research-refresh-btn,
  .stock-research-stop-btn {
    width: 42px;
    min-height: 42px;
    padding-inline: 0;
    font-size: 12px;
  }
  .stock-research-list { height: 374px; grid-auto-rows: minmax(66px, auto); }
  .stock-research-item { min-height: 66px; }
  .stock-research-item-main { min-height: 66px; }
  .app-shell { width: min(100vw - 18px, 720px); padding-top: 12px; }
  .hero { padding-top: 14px; }
  .hero h1 { font-size: clamp(30px, 9vw, 44px); }
  .hero-title-row {
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
  }
  .stock-add-panel-inline { width: min(162px, 43vw); }
  .top-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: start;
  }
  .data-attribution { margin-inline: 10px; }
  .data-source-links { gap: 5px; }
  .data-source-links a { min-height: 29px; padding-inline: 8px; }
  .series-toggle-btn {
    font-size: 11px;
    padding: 8px 6px;
    line-height: 1.2;
  }
  .series-row.base-row .series-toggle-btn:first-child { white-space: normal; }
  .custom-stock-chip .series-toggle-btn { padding: 7px 28px 7px 8px; }
  .stock-remove-btn { width: 16px; height: 16px; font-size: 11px; right: 7px; }
  .chart-frame { border-radius: 22px; min-height: 350px; }
  #chart.chart-frame { min-height: 366px; }
  .chart-side-btn,
  .chart-recession-btn,
  .chart-ai-btn {
    min-height: 28px;
    max-width: calc(100% - var(--chart-control-left) - 12px);
    padding: 5px 10px;
    line-height: 16px;
    white-space: nowrap;
    overflow: visible;
  }
  .chart-frame-macd { min-height: 175px; max-height: 225px; }
  .chart-frame-adr { min-height: 535px; max-height: 575px; }
  .api-settings-panel {
    width: calc(100vw - 12px);
    margin: 6px;
    max-height: 82vh;
  }
}

@media (max-width: 480px) {
  .stock-research-header { gap: 3px; }
  .stock-research-header h2 { font-size: 15px; }
  .stock-research-filters { gap: 3px; margin-left: 0; }
  .stock-research-filters button {
    min-width: 34px;
    height: 28px;
    padding: 0 5px;
    font-size: 10px;
  }
  .stock-research-header-blocked-btn {
    height: 28px;
    padding: 0 6px;
    font-size: 10px;
  }
  .stock-research-close-btn {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }
}
