:root {
  --bg: #f5f7fb;
  --ink: #12213a;
  --sub: #50617f;
  --panel: #ffffffd0;
  --line: #d9e0ec;
  --accent: #008d7a;
  --rise: #dd2e44;
  --fall: #1f5ad2;
  --warn: #f1a208;
  --dashboard-sidebar-fr: 0.77fr;
  --dashboard-main-fr: 2.23fr;
  --left-panel-fr: 1.2fr;
  --right-panel-fr: 1.8fr;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans KR", "Space Grotesk", sans-serif;
  color: var(--ink);
  background: linear-gradient(155deg, #eef5ff 0%, #f7faf2 45%, #fff8ef 100%);
  overflow-x: hidden;
}

.bg-blur {
  position: fixed;
  border-radius: 50%;
  filter: blur(45px);
  z-index: -1;
}
.bg-blur.one { width: 280px; height: 280px; background: #86b7ff66; top: -90px; left: -70px; }
.bg-blur.two { width: 320px; height: 320px; background: #57c4ad55; bottom: -120px; right: -80px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: #ffffffcc;
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left { min-width: 0; flex: 1 1 auto; }
.topbar-actions { align-self: flex-end; margin-left: 12px; }
.topbar h1 { margin: 0; font-size: 1.4rem; font-family: "Space Grotesk", sans-serif; }
.topbar p { margin: 4px 0 0; color: var(--sub); font-size: 0.9rem; }
.top-menu { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.meta-wrap { margin-top: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-clock { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: #fff; box-shadow: inset 0 1px 0 #fff; }
.meta-clock-ring { width: 14px; height: 14px; border-radius: 50%; background: conic-gradient(#1f5ad2 0deg, #d9e0ec 0deg); box-shadow: 0 0 0 2px #edf2fb; }
.meta-clock-text { display: inline-flex; align-items: baseline; gap: 8px; }
#serverClockTime { font-family: "Space Grotesk", sans-serif; font-weight: 700; color: #1f355f; letter-spacing: 0.4px; }
#serverClockSub { color: var(--sub); font-size: 0.78rem; }
.meta-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meta-chip { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; background: #fff; color: #334763; font-size: 0.8rem; line-height: 1; }
.meta-chip b { color: #5f7391; font-weight: 700; }
.meta-chip.up { background: #e9fff6; border-color: #9cd8bd; color: #0b6a45; }
.meta-chip.down { background: #fff0f0; border-color: #f0b6bc; color: #9b1f2f; }


.yahoo-strip {
  margin-top: 8px;
  background: linear-gradient(180deg, #0f1726 0%, #121a2c 100%);
  border: 1px solid #243149;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  gap: 12px;
  overflow-x: auto;
  color: #d4def0;
}
.yahoo-strip-item { min-width: 152px; border-right: 1px solid #243149; padding-right: 12px; }
.yahoo-strip-lead {
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid #243149;
  padding-right: 12px;
  color: #dce8ff;
  font-weight: 800;
  letter-spacing: 0.2px;
}
.yahoo-strip-item:last-child { border-right: 0; }
.yahoo-strip-name { font-size: 0.78rem; color: #9fb2d0; font-weight: 700; white-space: nowrap; }
.yahoo-strip-name a { color: inherit; text-decoration: none; }
.yahoo-strip-name a:hover { text-decoration: underline; }
.yahoo-strip-price { font-family: "Space Grotesk", sans-serif; font-size: 1.03rem; font-weight: 700; color: #f3f8ff; }
.yahoo-strip-main { display: flex; align-items: center; gap: 8px; }
.yahoo-strip-spark { width: 84px; height: 20px; opacity: 0.95; }
.spark-svg { width: 100%; height: 100%; overflow: visible; }
.spark-svg polyline { fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.spark-rise { stroke: #35d98f; }
.spark-fall { stroke: #ff5f6d; }
.spark-ref { stroke: #4a5872; stroke-width: 0.9; stroke-dasharray: 1.2 2.4; opacity: 0.7; }

.yahoo-strip-chg { font-size: 0.92rem; font-weight: 700; }
.yahoo-strip .rise { color: #3ecf8e; }
.yahoo-strip .fall { color: #ff6b6b; }
.yahoo-strip-empty { color: #8aa0c1; font-size: 0.85rem; }
.yahoo-strip-secondary { margin-top: 6px; }

.menu-link { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d3dbe8; border-radius: 999px; padding: 4px 10px; background: #f4f7fc; color: #2c4f88; font-weight: 700; cursor: pointer; line-height: 1.15; white-space: nowrap; box-shadow: inset 0 1px 0 #ffffff; }
.menu-link:hover { background: #eaf1ff; border-color: #b8c7e0; color: #1f5ad2; text-decoration: none; }
.menu-link:focus-visible { outline: 2px solid #8ab6ff; outline-offset: 1px; }
.menu-link:disabled { background: #eef2f7; color: #8a97ab; border-color: #d6dde8; cursor: not-allowed; box-shadow: none; opacity: 0.8; }
.top-actions { display: grid; grid-template-columns: repeat(2, minmax(96px, 1fr)); gap: 8px; min-width: 220px; }
.top-actions .btn { width: 100%; }

.grid {
  padding: 16px;
  display: grid;
  grid-template-columns: var(--left-panel-fr) var(--right-panel-fr);
  gap: 12px;
  grid-template-areas:
    "watch charts"
    "market charts"
    "leaders logs";
}
.grid > * { min-width: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 8px 28px #1b376205;

  min-width: 0;
}
.watch { grid-area: watch; }
.watch .table-wrap {
  max-height: none;
  overflow: visible;
}
.charts { grid-area: charts; min-width: 0; overflow: hidden; align-self: start; }
.grid > .market { grid-area: market; }
.leaders { grid-area: leaders; }
.holdings { grid-area: holdings; }
.logs { grid-area: logs; }
.panel { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; background: #fff; }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.card-head.compact { margin-bottom: 8px; }
.card h2 { margin: 0; font-size: 1.02rem; }
h3 { margin: 6px 0; }
.clickable-index { cursor: pointer; }
.clickable-index:hover { text-decoration: underline; }

.row { display: flex; gap: 8px; align-items: center; }
.form-row { margin-bottom: 8px; }
.alert-form { flex-wrap: wrap; }

.chart-head-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.chart-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sub);
  font-size: 0.84rem;
}
.chart-date-input {
  min-width: 148px;
}
.chart-date-reset {
  white-space: nowrap;
}
.chart-ticker-select {
  min-width: 240px;
}

input, select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  font-size: 0.9rem;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus {
  border-color: #84b5ff;
  outline: none;
  box-shadow: 0 0 0 2px #84b5ff33;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: #f2f6ff; }
.btn.accent {
  background: var(--accent);
  color: #fff;
  border-color: #007566;
}

.table-wrap { max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
th, td { padding: 7px 8px; border-bottom: 1px solid #edf1f8; text-align: right; }
th:first-child, td:first-child { text-align: left; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: #f2f6ff; }
tr:nth-child(even) { background: #fbfdff; }
.watch-row { cursor: pointer; }
.watch-row:hover { background: #eef5ff; }
.watch-origin { display: inline-block; margin-right: 6px; }
.lag-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #d3dbe8;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.76rem;
  line-height: 1;
  color: #4b5f7d;
  background: #f4f7fc;
  white-space: nowrap;
}
.lag-badge.up { background: #e9fff6; border-color: #9cd8bd; color: #0b6a45; }
.lag-badge.down { background: #fff0f0; border-color: #f0b6bc; color: #9b1f2f; }

.rise { color: var(--rise); font-weight: 700; }
.fall { color: var(--fall); font-weight: 700; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(360px, 1fr);
  gap: 8px;

  min-width: 0;
}
.chart { width: 100%; min-width: 0; height: 100%; border: 1px solid var(--line); border-radius: 10px; }

.market-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.breadth-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  background: #fff;
}
.breadth-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.bar { height: 8px; border-radius: 20px; background: #e8eef7; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #f47070, #5078db); }

.turnover-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.turnover-grid ul { margin: 0; padding-left: 16px; }
.turnover-grid li { margin-bottom: 4px; }

.leaders-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 4px;
}

.leaders-dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.leaders-box {
  border: 1px solid #edf1f8;
  border-radius: 8px;
  padding: 4px;
}
.leaders-title {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 2px 4px 6px;
}
.leaders-scroll {
  max-height: 165px;
  overflow: auto;
}
.leaders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.leaders-table th,
.leaders-table td {
  padding: 6px 7px;
  border-bottom: 1px solid #edf1f8;
  text-align: right;
}
.leaders-table th:first-child,
.leaders-table td:first-child {
  text-align: left;
}
.leaders-empty {
  color: var(--sub);
  font-size: 0.85rem;
  padding: 8px;
}


.pill-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pill-list li {
  background: #eff4ff;
  border: 1px solid #d4e2ff;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.82rem;
}
.pill-list button { margin-left: 6px; border: 0; background: transparent; color: #8a1538; cursor: pointer; }

.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.config-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--sub);
}
.config-grid label.check-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--ink);
}
.config-grid label.check-label input {
  width: 16px;
  height: 16px;
}
.settings-group {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(117, 135, 165, 0.16);
}
.settings-group h3 {
  margin: 0 0 4px;
  font-size: 0.96rem;
}
.settings-help {
  margin: 0 0 10px;
  color: var(--sub);
  font-size: 0.8rem;
  line-height: 1.45;
}
.settings-note {
  color: #6d7f98;
  font-size: 0.72rem;
  line-height: 1.4;
}

.action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-box {
  margin-top: 10px;
  min-height: 140px;
  max-height: 240px;
  overflow: auto;
  background: #f7f9fd;
  color: #324662;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-family: "Space Grotesk", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
}

.source-switch-box {
  margin: 0 0 8px;
  min-height: 86px;
  max-height: 120px;
  overflow: auto;
  background: #fffaf0;
  color: #7b5b12;
  border: 1px solid #ead9b2;
  border-radius: 10px;
  padding: 10px;
  font-family: "Space Grotesk", monospace;
  font-size: 0.78rem;
}
#logBox {
  margin: 0;
  min-height: 180px;
  max-height: 220px;
  overflow: auto;
  background: #0f1728;
  color: #9ce0c6;
  border-radius: 10px;
  padding: 10px;
  font-family: "Space Grotesk", monospace;
  font-size: 0.8rem;
}

.toast {
  position: fixed;
  right: 14px;
  bottom: 14px;
  background: #1f2a44;
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  min-width: 260px;
  box-shadow: 0 8px 20px #0003;
}
.hidden { display: none; }

@media (max-width: 1180px) {
  .grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "watch"
      "charts"
      "market"
      "leaders"
      "logs";
  }
  .grid > * { min-width: 0; }
  .topbar { padding: 12px; align-items: flex-start; }
  .top-actions { width: 100%; min-width: 0; }
  .topbar-actions { align-self: stretch; margin-left: 0; margin-top: 8px; }
  .meta-wrap { gap: 6px; }
  .meta-chip { font-size: 0.76rem; }
  .yahoo-strip { padding: 7px 8px; gap: 10px; }
  .yahoo-strip-item { min-width: 132px; }
  .yahoo-strip-spark { width: 72px; height: 18px; }
  .chart-head-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .chart-control-group {
    width: 100%;
  }
  .chart-date-input,
  .chart-ticker-select {
    width: 100%;
    min-width: 0;
  }
  .charts-grid {
    grid-template-rows: auto minmax(360px, auto);
    min-width: 0;
  }
}

.modal.hidden { display: none; }
.modal {
  position: fixed;
  inset: 0;
  background: #0b132780;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}
.modal-card {
  width: min(980px, 95vw);
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.popup-chart { height: min(62vh, 520px); min-height: 320px; }



















.us-market-modal-card { width: min(860px, 95vw); }
.us-market-modal-card:has(.world-index-chart-panel) { width: min(1180px, 96vw); }
.us-market-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--sub);
  font-size: 0.85rem;
}
.us-market-meta-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.market-index-link {
  color: #1f5ad2;
  text-decoration: none;
  font-weight: 700;
}
.market-index-link:hover { text-decoration: underline; }
.us-market-wrap { max-height: 360px; }
#usMarketTable th, #usMarketTable td { text-align: right; }
#usMarketTable th:first-child, #usMarketTable td:first-child { text-align: left; }
.world-index-chart-panel {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(121, 139, 168, 0.22);
}
.world-index-chart {
  height: min(38vh, 360px);
  min-height: 260px;
}

#asiaMarketTable th, #asiaMarketTable td { text-align: right; }
#asiaMarketTable th:first-child, #asiaMarketTable td:first-child { text-align: left; }
#asiaMarketTable th:nth-child(2), #asiaMarketTable td:nth-child(2) { text-align: left; }

.indicator-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.indicator-tab { border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 600; }
.indicator-tab.active { background: #eaf2ff; border-color: #9db9ec; color: #1f4ea8; }
#indicatorTable th, #indicatorTable td { text-align: right; }
#indicatorTable th:first-child, #indicatorTable td:first-child { text-align: left; }
.ksvkospi-modal-card { width: min(1280px, 96vw); }
.external-chart-frame {
  width: 100%;
  height: min(72vh, 680px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
#popularTable th, #popularTable td { text-align: right; vertical-align: middle; }
#popularTable th:first-child, #popularTable td:first-child { text-align: left; }
#popularTable th:nth-child(2), #popularTable td:nth-child(2) { text-align: center; }
.popular-graph { width: 88px; height: 26px; object-fit: contain; opacity: 0.95; }

.investor-flow-chart { height: min(62vh, 520px); min-height: 360px; }
.market-money-modal-card { width: min(1160px, 96vw); }
.market-money-chart {
  height: min(42vh, 380px);
  min-height: 300px;
  margin-bottom: 18px;
}
.market-money-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  margin: 8px 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7fc;
}
.market-money-tab {
  border: 0;
  border-radius: 6px;
  padding: 5px 10px;
  background: transparent;
  color: #50627f;
  font-weight: 700;
  cursor: pointer;
}
.market-money-tab.active {
  background: #ffffff;
  color: #1f5ad2;
  box-shadow: 0 1px 2px rgba(20, 36, 64, 0.12);
}
.market-money-notes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
  clear: both;
}
.market-money-note {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fbff;
  color: #50627f;
  font-size: 0.86rem;
  line-height: 1.45;
}
.market-money-note strong {
  display: block;
  color: #1d3358;
  margin-bottom: 2px;
}
.mini-btn {
  padding: 3px 7px;
  font-size: 0.74rem;
  white-space: nowrap;
}
.side-card-regime {
  display: grid;
  gap: 8px;
}
.market-regime-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 0;
}
.market-regime-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}
.market-regime-card:hover {
  border-color: #9db9ec;
  background: #f8fbff;
}
.market-regime-icon,
.market-regime-hero-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  background: #eef2f7;
  color: #56647b;
  flex: 0 0 auto;
}
.market-regime-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.market-regime-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.92rem;
}
.market-regime-main span {
  color: var(--sub);
  font-size: 0.78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.market-regime-main span:empty {
  display: none;
}
.market-regime-score {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
  font-size: 1rem;
}
.market-regime-card.positive,
.market-regime-icon.positive,
.market-regime-day.positive,
.market-regime-hero.positive,
.market-regime-group-score.positive,
.market-regime-feature.positive { border-color: #9bd7bc; background: #effbf5; color: #0b6a45; }
.market-regime-card.mild-positive,
.market-regime-icon.mild-positive,
.market-regime-day.mild-positive,
.market-regime-hero.mild-positive,
.market-regime-group-score.mild-positive,
.market-regime-feature.mild-positive { border-color: #b9d9ff; background: #f1f7ff; color: #1f5ad2; }
.market-regime-card.neutral,
.market-regime-icon.neutral,
.market-regime-day.neutral,
.market-regime-hero.neutral,
.market-regime-group-score.neutral,
.market-regime-feature.neutral { border-color: #d8e0ed; background: #f8fafc; color: #40516b; }
.market-regime-card.warning,
.market-regime-icon.warning,
.market-regime-day.warning,
.market-regime-hero.warning,
.market-regime-group-score.warning,
.market-regime-feature.warning { border-color: #f3cc77; background: #fff8e8; color: #8a5a00; }
.market-regime-card.negative,
.market-regime-icon.negative,
.market-regime-day.negative,
.market-regime-hero.negative,
.market-regime-group-score.negative,
.market-regime-feature.negative { border-color: #f2a7af; background: #fff1f3; color: #9b1f2f; }
.market-regime-mini-days,
.market-regime-day-strip {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  padding-bottom: 2px;
}
.market-regime-mini-days {
  gap: 3px;
  overflow-x: visible;
  flex-wrap: nowrap;
  padding-bottom: 0;
}
.market-regime-day {
  min-width: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 6px;
  display: inline-grid;
  justify-items: center;
  gap: 2px;
  cursor: pointer;
  font-weight: 800;
}
.market-regime-day.compact {
  min-width: 18px;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  font-size: 0.6rem;
  line-height: 1;
}
.market-regime-day small {
  font-size: 0.68rem;
  color: #66768f;
  font-weight: 700;
}
.market-regime-day.selected {
  outline: 1px solid #1f5ad2;
  outline-offset: 1px;
}
.market-regime-mini-chart {
  height: 42px;
  margin-top: -1px;
  overflow: hidden;
  border: 1px solid rgba(182, 197, 220, 0.62);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.market-regime-mini-chart:empty {
  display: none;
}
.market-regime-mini-chart svg {
  display: block;
  width: 100%;
  height: 100%;
}
.market-regime-mini-axis {
  stroke: rgba(117, 135, 165, 0.18);
  stroke-width: 1;
}
.market-regime-mini-baseline {
  stroke: rgba(117, 135, 165, 0.16);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.market-regime-mini-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.market-regime-mini-line.activity.positive { stroke: #0f8a5f; }
.market-regime-mini-line.activity.mild-positive { stroke: #1f5ad2; }
.market-regime-mini-line.activity.neutral { stroke: #62718a; }
.market-regime-mini-line.activity.warning { stroke: #ad6d00; }
.market-regime-mini-line.activity.negative { stroke: #c93649; }
.market-regime-modal-card {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: auto;
}
.market-regime-modal-head {
  gap: 8px;
  align-items: flex-start;
}
.modal-subline {
  margin: 4px 0 0;
  color: var(--sub);
  font-size: 0.82rem;
}
.market-regime-summary {
  display: grid;
  gap: 10px;
}
.market-regime-hero {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.market-regime-hero-icon {
  width: 48px;
  height: 48px;
  font-size: 1.05rem;
  background: rgba(255, 255, 255, 0.7);
}
.market-regime-hero-date {
  display: block;
  color: var(--sub);
  font-size: 0.78rem;
  margin-bottom: 2px;
}
.market-regime-hero strong {
  display: block;
  font-size: 1.25rem;
  line-height: 1.2;
}
.market-regime-hero p {
  margin: 4px 0 0;
  color: #44546d;
  line-height: 1.45;
}
.market-regime-hero p.market-regime-score-note {
  color: #23334d;
  font-size: 0.82rem;
  font-weight: 700;
}
.market-regime-confidence {
  min-width: 70px;
  text-align: right;
  color: #5f6f86;
  font-size: 0.78rem;
}
.market-regime-confidence b {
  display: block;
  color: var(--ink);
  font-size: 1.08rem;
}
.market-regime-score-guide {
  border: 1px solid rgba(121, 139, 168, 0.28);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f8fbff;
  color: #53647c;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: 0.8rem;
  line-height: 1.35;
}
.market-regime-score-guide span {
  min-width: 0;
}
.market-regime-score-guide b {
  color: #10213a;
}
.market-regime-group-scores {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.market-regime-group-score {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: grid;
  gap: 4px;
  align-content: start;
}
.market-regime-group-score .market-regime-group-name {
  font-size: 0.78rem;
  color: #56657a;
}
.market-regime-group-score strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}
.market-regime-group-indicators {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}
.market-regime-group-indicators em {
  border: 1px solid rgba(121, 139, 168, 0.28);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.62);
  color: #46566f;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
  line-height: 1.25;
}
.market-regime-group-score small,
.market-regime-feature-values small {
  color: #63728a;
  font-size: 0.72rem;
  font-weight: 700;
}
.market-regime-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
}
.market-regime-section-head span {
  color: var(--sub);
  font-size: 0.8rem;
}
.market-regime-detail {
  margin-top: 12px;
}
.market-regime-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(121, 139, 168, 0.22);
}
.market-regime-detail-head div {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.market-regime-detail-head span {
  color: var(--sub);
  font-size: 0.84rem;
}
.market-regime-detail-head b {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.1rem;
}
.market-regime-feature-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.market-regime-feature-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}
.market-regime-feature-group h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}
.market-regime-feature-list {
  display: grid;
  gap: 6px;
}
.market-regime-feature {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.market-regime-feature strong {
  display: block;
  color: var(--ink);
  font-size: 0.84rem;
}
.market-regime-feature span {
  display: block;
  color: #63728a;
  font-size: 0.76rem;
  line-height: 1.35;
}
.market-regime-feature-values {
  min-width: 76px;
  text-align: right;
}
.market-regime-feature-values b {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  color: inherit;
}
.market-regime-feature-values small {
  display: block;
  margin-top: 1px;
  white-space: nowrap;
}
.market-regime-data-status {
  margin-top: 12px;
  color: var(--sub);
  font-size: 0.8rem;
}
.market-regime-data-status summary {
  cursor: pointer;
  font-weight: 700;
  color: #314664;
}
.market-regime-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.market-regime-status-grid span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  background: #f8fbff;
}
.market-regime-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--sub);
  background: #f8fbff;
}
@media (max-width: 760px) {
  .market-money-notes { grid-template-columns: 1fr; }
  .market-regime-hero {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .market-regime-confidence {
    grid-column: 1 / -1;
    text-align: left;
  }
  .market-regime-group-scores,
  .market-regime-feature-groups {
    grid-template-columns: 1fr;
  }
  .market-regime-feature {
    grid-template-columns: 1fr;
  }
  .market-regime-feature-values {
    text-align: left;
  }
}

body.popup-mode .bg-blur,
body.popup-mode .topbar,
body.popup-mode .dashboard-shell { display: none !important; }
body.popup-mode .modal {
  position: static;
  inset: auto;
  background: transparent;
  padding: 12px;
  display: none;
}
body.popup-mode .modal:not(.hidden) { display: flex; }
body.popup-mode .modal-card {
  width: min(1160px, 96vw);
  max-height: calc(100vh - 24px);
}

.order-modal-card { width: min(560px, 96vw); }
.order-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.order-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--sub);
}
.order-form label:nth-child(1),
.order-form label:nth-child(6) {
  grid-column: 1 / -1;
}
.order-actions { justify-content: flex-end; }
.order-result {
  margin: 0;
  min-height: 118px;
  max-height: 260px;
  overflow: auto;
  background: #0f1728;
  color: #c8f0dd;
  border-radius: 10px;
  padding: 10px;
  font-family: "Space Grotesk", monospace;
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .order-form {
    grid-template-columns: 1fr;
  }
}
.order-pending-wrap {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}
.order-pending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  color: #1f355f;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.order-pending-table-wrap { max-height: 220px; }
#orderPendingTable th, #orderPendingTable td { text-align: right; }
#orderPendingTable th:nth-child(1), #orderPendingTable td:nth-child(1),
#orderPendingTable th:nth-child(2), #orderPendingTable td:nth-child(2),
#orderPendingTable th:nth-child(3), #orderPendingTable td:nth-child(3) { text-align: left; }


.trend-modal-card { width: min(1180px, 96vw); }
.trend-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 10px;
}
.trend-side, .trend-main {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}
.trend-side h3 { margin: 4px 0 8px; }
.trend-theme-list-wrap { max-height: 310px; }
#trendThemeTable tr { cursor: pointer; }
#trendThemeTable tr.selected { background: #eaf2ff; }
#trendThemeTable tr:hover { background: #f5f9ff; }
.trend-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.trend-editor {
  border: 1px dashed #cfdaf0;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
  margin-bottom: 8px;
}
.trend-editor-row { margin-bottom: 8px; }
.trend-editor-row label {
  display: block;
  margin-bottom: 4px;
  color: var(--sub);
  font-size: 0.84rem;
}
#trendTickersInput {
  width: 100%;
  resize: vertical;
  min-height: 96px;
}
.trend-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.trend-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.trend-chart-title {
  font-weight: 700;
  color: #1f355f;
  font-size: 0.9rem;
}
.trend-title-theme {
  color: #2f6fd6;
}
.trend-chart { height: min(54vh, 520px); min-height: 340px; }

@media (max-width: 980px) {
  .trend-layout { grid-template-columns: 1fr; }
}
.trend-log-head {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.trend-log-box {
  margin: 0;
  min-height: 110px;
  max-height: 170px;
  overflow: auto;
  border: 1px solid #dfe7f4;
  border-radius: 10px;
  background: #0f1728;
  color: #bfe7ff;
  padding: 8px;
  font-family: "Space Grotesk", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
}
#trendThemeTable th:nth-child(1), #trendThemeTable td:nth-child(1) { text-align: center; width: 52px; }
#trendThemeTable input[type="checkbox"] { transform: scale(1.08); }
.screener-modal-card { width: min(1240px, 96vw); }
.screener-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 10px;
}
.screener-side, .screener-main {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}
.screener-side h3 { margin: 4px 0 8px; }
.screener-list-wrap { max-height: 320px; }
#screenerListTable tr { cursor: pointer; }
#screenerListTable tr.selected { background: #eaf2ff; }
#screenerListTable tr:hover { background: #f5f9ff; }
#screenerListTable th:nth-child(4),
#screenerListTable td:nth-child(4) { text-align: center; width: 64px; }
.screener-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.screener-editor {
  border: 1px dashed #cfdaf0;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
  margin-bottom: 8px;
}
.screener-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.screener-inline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
}
.screener-active-row {
  display: flex;
  align-items: flex-end;
}
#screenerRulesInput {
  width: 100%;
  resize: vertical;
  min-height: 180px;
  font-family: "Space Grotesk", monospace;
  font-size: 0.82rem;
}
.screener-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.screener-summary {
  border: 1px solid #dbe4f5;
  border-radius: 10px;
  background: #f8fbff;
  color: #264266;
  padding: 10px 12px;
  line-height: 1.55;
  width: 100%;
}
.screener-result-wrap { max-height: 340px; }
#screenerResultTable th:nth-child(3),
#screenerResultTable td:nth-child(3),
#screenerResultTable th:nth-child(4),
#screenerResultTable td:nth-child(4),
#screenerResultTable th:nth-child(5),
#screenerResultTable td:nth-child(5) { text-align: right; }
.screener-hit-box {
  min-height: 130px;
  max-height: 190px;
}
@media (max-width: 980px) {
  .screener-layout { grid-template-columns: 1fr; }
  .screener-editor-grid { grid-template-columns: 1fr; }
}
.data-modal-card { width: min(1180px, 96vw); }
.data-layout {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 10px;
}
.data-side, .data-main {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}
.data-side h3 { margin: 4px 0 8px; }
.data-index-list-wrap { max-height: 360px; }
#dataIndexTable tr { cursor: pointer; }
#dataIndexTable tr.selected { background: #eaf2ff; }
#dataIndexTable tr:hover { background: #f5f9ff; }
#dataIndexTable th:nth-child(1), #dataIndexTable td:nth-child(1) { text-align: center; width: 52px; }
#dataIndexTable input[type="checkbox"] { transform: scale(1.08); }
.data-chart { height: min(54vh, 520px); min-height: 340px; }

@media (max-width: 980px) {
  .data-layout { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
  .calendar-layout { grid-template-columns: 1fr; }
  .calendar-event-buckets { grid-template-columns: 1fr; }
}


.market-status-modal-card { width: min(1120px, 96vw); }
.market-status-meta { margin-bottom: 8px; }
.market-status-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 8px;
}
.market-status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe4f5;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f8fbff;
  color: #1f355f;
  font-size: 0.82rem;
}
.market-status-tag.rise { color: #d63b3b; border-color: #f2c6c6; background: #fff3f3; }
.market-status-tag.fall { color: #1f64d3; border-color: #c5d8fb; background: #f2f7ff; }
.market-status-empty { color: #7b8798; font-size: 0.85rem; }
.market-status-chart { height: min(52vh, 520px); min-height: 320px; }
.market-status-summary {
  margin-top: 8px;
  display: flex;
  gap: 18px;
  align-items: center;
  font-weight: 700;
}
.market-status-summary .rise { color: #d63b3b; }
.market-status-summary .steady { color: #8c95a3; }
.market-status-summary .fall { color: #1f64d3; }
.calendar-modal-card { width: min(1160px, 96vw); }
.calendar-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.calendar-month-label {
  min-width: 92px;
  text-align: center;
  color: #1f355f;
  letter-spacing: 0.02em;
}
.calendar-summary {
  border: 1px solid #d9e4f5;
  border-radius: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f6f9ff 0%, #f7fcfa 100%);
  color: #1f355f;
  line-height: 1.6;
  margin-bottom: 10px;
}
.calendar-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.calendar-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}
.calendar-panel-wide {
  grid-column: 1 / -1;
}
.calendar-panel h3 {
  margin: 0 0 8px;
  color: #1f355f;
  font-size: 0.94rem;
}
.calendar-panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.calendar-panel-sub {
  color: #6b7d98;
  font-size: 0.82rem;
  line-height: 1.45;
}
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(112px, 1fr));
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.calendar-weekday {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid #dbe4f5;
  border-radius: 10px;
  background: #f3f7fd;
  color: #577096;
  font-size: 0.82rem;
  font-weight: 700;
}
.calendar-day-cell {
  min-height: 128px;
  border: 1px solid #dfe7f4;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.calendar-day-cell.outside {
  background: #f7f9fc;
}
.calendar-day-cell.today {
  border-color: #76a3eb;
  box-shadow: inset 0 0 0 1px rgba(86, 137, 221, 0.2);
}
.calendar-day-cell.has-items {
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
}
.calendar-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.calendar-day-number {
  color: #20385f;
  font-size: 1rem;
  font-weight: 700;
}
.calendar-day-cell.outside .calendar-day-number {
  color: #97a6bb;
}
.calendar-day-cell.today .calendar-day-number {
  color: #2054a8;
}
.calendar-day-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eaf2ff;
  color: #1f5cb6;
  font-size: 0.76rem;
  font-weight: 700;
}
.calendar-day-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
}
.calendar-day-item {
  border: 1px solid #e4edf9;
  border-radius: 10px;
  background: #fff;
  padding: 6px 7px;
}
.calendar-day-cell.outside .calendar-day-item {
  background: #fcfdff;
}
.calendar-day-item-main {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.calendar-day-item-priority {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 6px;
  background: #fff3e9;
  color: #a35a14;
  font-size: 0.72rem;
  font-weight: 700;
  flex: 0 0 auto;
}
.calendar-day-item-title {
  color: #1f355f;
  font-size: 0.8rem;
  font-weight: 700;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 auto;
}
.calendar-day-item-sub {
  margin-top: 3px;
  color: #60728d;
  font-size: 0.74rem;
  line-height: 1.4;
  word-break: break-word;
}
.calendar-day-more {
  color: #657894;
  font-size: 0.76rem;
  font-weight: 700;
}
.calendar-month-placeholder {
  grid-column: 1 / -1;
}
.calendar-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.calendar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #dbe4f5;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f8fbff;
  color: #1f355f;
  font-size: 0.82rem;
  font-weight: 700;
}
.calendar-badge.priority {
  background: #fff3f3;
  border-color: #f2c6c6;
  color: #b02d3b;
}
.calendar-badge.status {
  background: #eef8ff;
  border-color: #c7dcfb;
  color: #2256af;
}
.calendar-rule-list,
.calendar-card-list,
.calendar-sync-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.calendar-rule {
  border: 1px solid #dfe7f4;
  border-radius: 10px;
  background: #f8fbff;
  padding: 9px 10px;
}
.calendar-rule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: #1f355f;
  font-weight: 700;
}
.calendar-rule-desc {
  color: #50617f;
  font-size: 0.84rem;
  line-height: 1.5;
}
.calendar-event-buckets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}
.calendar-event-bucket {
  border: 1px solid #dfe7f4;
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
}
.calendar-event-bucket-label {
  color: #50617f;
  font-size: 0.8rem;
  margin-bottom: 4px;
}
.calendar-event-bucket-value {
  color: #1f355f;
  font-size: 1.12rem;
  font-weight: 700;
}
.calendar-card {
  border: 1px solid #dfe7f4;
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
}
.calendar-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.calendar-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.calendar-type-badge,
.calendar-target-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-weight: 700;
}
.calendar-type-badge {
  background: #ecf4ff;
  color: #2054a8;
}
.calendar-target-badge {
  background: #fff3e9;
  color: #a35a14;
}
.calendar-card-time {
  color: #50617f;
  font-size: 0.82rem;
  white-space: nowrap;
}
.calendar-card-title {
  color: #1f355f;
  font-size: 0.94rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.calendar-card-meta {
  color: #50617f;
  font-size: 0.82rem;
  line-height: 1.5;
}
.calendar-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.calendar-stat {
  border: 1px solid #dfe7f4;
  border-radius: 8px;
  background: #fff;
  padding: 4px 7px;
  font-size: 0.78rem;
  color: #34506f;
}
.calendar-sync-item {
  border: 1px solid #dfe7f4;
  border-radius: 10px;
  background: #fbfdff;
  padding: 9px 10px;
}
.calendar-sync-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  color: #1f355f;
  font-weight: 700;
}
.calendar-sync-body {
  color: #50617f;
  font-size: 0.82rem;
  line-height: 1.55;
}
.calendar-empty {
  border: 1px dashed #cfdaf0;
  border-radius: 10px;
  background: #fbfdff;
  color: #6e7f99;
  padding: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
}
@media (max-width: 860px) {
  .calendar-head-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  .calendar-event-buckets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .calendar-month-grid {
    grid-template-columns: repeat(7, minmax(96px, 1fr));
  }
  .calendar-day-cell {
    min-height: 112px;
    padding: 8px;
  }
}
.investor-modal-card { width: min(1120px, 96vw); }
.daily-compare-modal-card { width: min(1240px, 96vw); }
.daily-compare-controls {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) repeat(4, minmax(140px, 1fr)) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}
.daily-compare-controls label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 0.86rem;
  color: #2c3f63;
  font-weight: 700;
}
.daily-compare-controls label.muted {
  opacity: 0.58;
}
.daily-compare-controls select,
.daily-compare-controls input {
  width: 100%;
}
.daily-compare-head {
  margin-top: 2px;
}
.daily-compare-chart {
  height: min(62vh, 560px);
  min-height: 360px;
}
.investor-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.investor-controls input {
  width: 100%;
  min-width: 220px;
}
.series-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 8px;
  padding: 6px 8px;
  border: 1px solid #dfe7f4;
  border-radius: 8px;
  background: #f8fbff;
}
.series-checks .series-check-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  color: #1f355f;
}
@media (max-width: 860px) {
  .investor-controls {
    grid-template-columns: 1fr;
  }
  .daily-compare-controls {
    grid-template-columns: 1fr;
  }
}


.investor-debug-head {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.investor-debug-box {
  margin: 0;
  min-height: 96px;
  max-height: 170px;
  overflow: auto;
  border: 1px solid #dfe7f4;
  border-radius: 10px;
  background: #0f1728;
  color: #bfe7ff;
  padding: 8px;
  font-family: "Space Grotesk", monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
}


.data-stock-title { margin-top: 10px; }
.data-stock-input-row { margin: 0 0 8px; }
.data-stock-input-row input { width: 100%; }
.data-stock-list-wrap { max-height: 280px; }
#dataStockTable tr { cursor: pointer; }
#dataStockTable tr.selected { background: #eaf2ff; }
#dataStockTable tr:hover { background: #f5f9ff; }
#dataStockTable th:nth-child(1), #dataStockTable td:nth-child(1) { text-align: center; width: 52px; }
#dataStockTable th:nth-child(3), #dataStockTable td:nth-child(3) { text-align: right; width: 92px; }
#dataStockTable input[type="checkbox"] { transform: scale(1.08); }
.data-stock-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.company-financials-modal-card { width: min(1220px, 96vw); }
.company-financials-chart {
  height: min(54vh, 520px);
  min-height: 340px;
}
.company-per-modal-card { width: min(1160px, 96vw); }
.company-per-chart {
  height: min(56vh, 520px);
  min-height: 340px;
  margin-top: 10px;
}
.company-per-missing-list {
  margin-top: 10px;
  color: #61738f;
  font-size: 0.86rem;
  line-height: 1.5;
}
.company-per-missing-list strong {
  color: #1f355f;
  margin-right: 6px;
}
.company-per-mode-btn.active {
  background: #eaf2ff;
  border-color: #9db9ec;
  color: #1f5ad2;
}
.company-per-value-wrap {
  max-height: 190px;
  margin-top: 10px;
}
#companyPerValueTable tr[data-company-per-value-row] {
  cursor: pointer;
}
#companyPerValueTable .rise { color: #1f64d3; font-weight: 700; }
#companyPerValueTable .fall { color: #d92d20; font-weight: 700; }
.company-per-row-hidden {
  color: #91a0b4;
  text-decoration: line-through;
  opacity: 0.72;
}
.company-financials-actions {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
#companyFinancialsStockTable tr { cursor: pointer; }
#companyFinancialsStockTable tr.selected { background: #eaf2ff; }
#companyFinancialsStockTable tr:hover { background: #f5f9ff; }
#companyFinancialsStockTable th:nth-child(1),
#companyFinancialsStockTable td:nth-child(1) { text-align: center; width: 52px; }
#companyFinancialsStockTable th:nth-child(3),
#companyFinancialsStockTable td:nth-child(3) { text-align: right; width: 92px; }
#companyFinancialsStockTable input[type="checkbox"] { transform: scale(1.08); }
.company-financials-metric-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  color: #1f355f;
  font-weight: 700;
  cursor: pointer;
}
.company-financials-metric-btn.active {
  background: #eaf2ff;
  border-color: #9db9ec;
  color: #1f5ad2;
}
.investor-data-layout {
  grid-template-columns: 1fr 2fr;
}
.investor-flow-chart {
  height: min(54vh, 520px);
  min-height: 340px;
}
#investorStockTable tr { cursor: pointer; }
#investorStockTable tr.selected { background: #eaf2ff; }
#investorStockTable tr:hover { background: #f5f9ff; }
#investorStockTable th:nth-child(1), #investorStockTable td:nth-child(1) { text-align: center; width: 52px; }
#investorStockTable th:nth-child(3), #investorStockTable td:nth-child(3) { text-align: right; width: 92px; }
#investorStockTable input[type="checkbox"] { transform: scale(1.08); }
.data-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}










#watchTable th, #watchTable td { padding: 2px 6px; }
#watchTable tbody tr { line-height: 1.15; }
#watchTable .watch-origin { white-space: nowrap; font-size: 0.78rem; }
.watch-del-btn { padding: 2px 6px; min-width: 24px; font-size: 0.76rem; font-weight: 700; }

/* Dashboard refresh: premium workspace shell, hero, and sync rail */
:root {
  --bg: #edf2fa;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: #ffffff;
  --ink: #10203c;
  --sub: #5f708c;
  --line: rgba(121, 139, 168, 0.22);
  --line-strong: rgba(53, 70, 98, 0.12);
  --accent: #0f9f8e;
  --accent-strong: #0b786c;
  --accent-soft: rgba(15, 159, 142, 0.12);
  --rise: #d63d52;
  --fall: #245ed6;
  --warn: #f4a623;
  --shadow-lg: 0 26px 80px rgba(15, 23, 42, 0.12);
  --shadow-md: 0 14px 36px rgba(15, 23, 42, 0.08);
  --dashboard-sidebar-fr: 0.6fr;
  --dashboard-main-fr: 2.4fr;
  --left-panel-fr: 1.1fr;
  --right-panel-fr: 1.9fr;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(105, 157, 255, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(15, 159, 142, 0.16), transparent 32%),
    linear-gradient(160deg, #eff4fb 0%, #f6f9fd 40%, #f8fbf6 100%);
}

.bg-blur {
  filter: blur(54px);
  opacity: 0.9;
}
.bg-blur.one { width: 360px; height: 360px; background: #7cb4ff52; }
.bg-blur.two { width: 420px; height: 420px; background: #43c7a558; }

.topbar {
  gap: 20px;
  padding: 18px 28px;
  background: rgba(244, 248, 253, 0.82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(121, 139, 168, 0.18);
}
.topbar-left {
  min-width: 0;
  flex: 1 1 auto;
}
.topbar-kicker,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #2e7d8f;
}
.topbar-brand h1 {
  margin: 0;
  font-size: 1.58rem;
  letter-spacing: -0.03em;
}
.topbar-brand p {
  margin: 6px 0 0;
  max-width: 700px;
  color: var(--sub);
  font-size: 0.92rem;
}
.top-actions {
  grid-template-columns: repeat(2, minmax(128px, 1fr));
  gap: 10px;
  min-width: 308px;
}

.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(300px, var(--dashboard-sidebar-fr)) minmax(0, var(--dashboard-main-fr));
  gap: 12px;
  padding: 12px;
  align-items: start;
}
.dashboard-sidebar {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 94px;
  width: 100%;
}
.dashboard-sidebar > * {
  width: 100%;
}
.dashboard-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.side-card,
.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.72)),
    rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
}
.side-card {
  min-width: 0;
  padding: 14px;
}
.card {
  border-radius: 22px;
  padding: 16px;
}
.dashboard-hero {
  padding: 16px;
  box-shadow: var(--shadow-lg);
}
.dashboard-hero-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.95fr);
  gap: 18px;
  align-items: start;
}
.hero-copy h2 {
  margin: 0;
  font-size: clamp(1.35rem, 1.8vw, 2rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}
.dashboard-summary {
  margin: 12px 0 0;
  color: var(--sub);
  font-size: 0.95rem;
  line-height: 1.62;
  max-width: 720px;
}
.card-sub {
  margin: 6px 0 0;
  color: var(--sub);
  font-size: 0.84rem;
  line-height: 1.45;
}
.overview-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.overview-card {
  position: relative;
  overflow: hidden;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(129, 147, 175, 0.18);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.96), rgba(255, 255, 255, 0.82));
}
.overview-card::after {
  content: "";
  position: absolute;
  inset: auto -18px -28px auto;
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: rgba(14, 159, 142, 0.08);
}
.overview-card-label {
  display: block;
  color: #6c7c94;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.overview-card-value {
  display: block;
  margin-top: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.08;
}
.overview-card-note {
  display: block;
  margin-top: 6px;
  color: var(--sub);
  font-size: 0.83rem;
}
.overview-card.rise .overview-card-value { color: var(--rise); }
.overview-card.fall .overview-card-value { color: var(--fall); }
.overview-card.warning .overview-card-value { color: #a76a00; }

.hero-meta {
  margin-top: 0;
  padding: 14px;
  border: 1px solid rgba(126, 143, 169, 0.18);
  border-radius: 18px;
  background: rgba(247, 250, 255, 0.7);
}
.hero-strips {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}
.meta-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.meta-clock {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(126, 143, 169, 0.18);
  background: rgba(255, 255, 255, 0.9);
}
.meta-clock-ring {
  width: 15px;
  height: 15px;
  box-shadow: 0 0 0 3px #eef3fb;
}
#serverClockTime {
  color: #1a315c;
  letter-spacing: 0.04em;
}
.meta-chip {
  padding: 6px 11px;
  border-color: rgba(126, 143, 169, 0.18);
  background: rgba(255, 255, 255, 0.92);
}

.yahoo-strip {
  border-radius: 18px;
  padding: 10px 12px;
  border-color: rgba(109, 130, 169, 0.22);
}
.yahoo-strip-item {
  min-width: 156px;
  border-right-color: rgba(109, 130, 169, 0.18);
}
.yahoo-strip-lead {
  min-width: 128px;
  border-right-color: rgba(109, 130, 169, 0.18);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.top-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dashboard-menu .menu-link { width: 100%; min-height: 42px; }
.menu-link {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border-color: rgba(117, 135, 165, 0.18);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.96), rgba(238, 244, 252, 0.78));
  color: #24456d;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.menu-link:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(235, 244, 255, 0.98), rgba(229, 239, 252, 0.84));
  border-color: rgba(61, 115, 209, 0.26);
  color: #1c56c8;
}

.sync-status-rail {
  display: grid;
  gap: 12px;
  width: 100%;
}
.sync-status-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(126, 143, 169, 0.18);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.92), rgba(255, 255, 255, 0.78));
}
.sync-status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(28, 76, 168, 0.08);
  color: #255ed6;
}
.sync-status-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sync-status-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}
.sync-status-title {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.18;
  letter-spacing: -0.01em;
  flex: 1 1 auto;
  min-width: 0;
}
.sync-status-line {
  margin: 0;
  color: var(--sub);
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: keep-all;
}
.sync-status-line-muted {
  color: #5c6f8f;
  overflow-wrap: anywhere;
}
.sync-status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  min-width: 58px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(126, 143, 169, 0.16);
  background: rgba(255, 255, 255, 0.9);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}
.sync-status-card.tone-active .sync-status-icon,
.sync-status-card.tone-active .sync-status-pill {
  color: #0a7567;
  background: rgba(15, 159, 142, 0.12);
  border-color: rgba(15, 159, 142, 0.22);
}
.sync-status-card.tone-ok .sync-status-icon,
.sync-status-card.tone-ok .sync-status-pill {
  color: #0f6f50;
  background: rgba(33, 192, 108, 0.1);
  border-color: rgba(33, 192, 108, 0.18);
}
.sync-status-card.tone-warning .sync-status-icon,
.sync-status-card.tone-warning .sync-status-pill {
  color: #ad6d00;
  background: rgba(244, 166, 35, 0.12);
  border-color: rgba(244, 166, 35, 0.22);
}
.sync-status-card.tone-muted .sync-status-icon,
.sync-status-card.tone-muted .sync-status-pill {
  color: #68798e;
  background: rgba(107, 124, 149, 0.1);
  border-color: rgba(107, 124, 149, 0.18);
}
.dashboard-sidebar .sync-status-rail {
  gap: 8px;
}
.dashboard-sidebar .sync-status-card {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
}
.dashboard-sidebar .sync-status-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}
.dashboard-sidebar .sync-status-main {
  gap: 2px;
}
.dashboard-sidebar .sync-status-title {
  font-size: 0.88rem;
}
.dashboard-sidebar .sync-status-line {
  font-size: 0.76rem;
  line-height: 1.28;
}
.dashboard-sidebar .sync-status-pill {
  min-width: 52px;
  padding: 4px 9px;
  font-size: 0.62rem;
}
.ui-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.ui-icon.spin { animation: dashboard-spin 1s linear infinite; }
.ui-icon.pulse { animation: dashboard-pulse 1.4s ease-in-out infinite; }

@keyframes dashboard-spin {
  to { transform: rotate(360deg); }
}
@keyframes dashboard-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.08); opacity: 0.72; }
}

.grid {
  gap: 12px;
}
.card-head {
  gap: 10px;
  margin-bottom: 10px;
}
.card-head.compact { margin-bottom: 8px; }
.card-head-stack { align-items: flex-start; }
.card-head-split { justify-content: space-between; }

.btn {
  gap: 8px;
  padding: 9px 13px;
  border-radius: 12px;
  border-color: rgba(117, 135, 165, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 246, 252, 0.84));
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
.btn:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.98), rgba(232, 240, 252, 0.84));
  border-color: rgba(61, 115, 209, 0.24);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}
.btn.accent {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-color: rgba(11, 120, 108, 0.8);
}
.btn.is-active {
  border-color: rgba(15, 159, 142, 0.32);
  background: linear-gradient(180deg, rgba(15, 159, 142, 0.14), rgba(15, 159, 142, 0.08));
  color: #08665a;
}
.btn.is-busy {
  border-color: rgba(36, 94, 214, 0.3);
  color: #255ed6;
}

input,
select,
textarea {
  border-color: rgba(117, 135, 165, 0.22);
  border-radius: 12px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.92);
}
input:focus,
select:focus,
textarea:focus {
  border-color: rgba(66, 125, 227, 0.44);
  box-shadow: 0 0 0 3px rgba(66, 125, 227, 0.12);
}

.table-wrap {
  max-height: 280px;
  border: 1px solid rgba(117, 135, 165, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
}
th,
td {
  padding: 9px 10px;
  border-bottom-color: rgba(131, 147, 173, 0.12);
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(245, 249, 255, 0.94);
  color: #4f617a;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
tr:nth-child(even) { background: rgba(248, 251, 255, 0.64); }
.watch-row:hover { background: rgba(226, 238, 255, 0.78); }
.watch-origin { color: #61738f; }
.lag-badge {
  padding: 4px 8px;
  border-color: rgba(117, 135, 165, 0.18);
  background: rgba(243, 247, 252, 0.92);
  display: none;
}

.chart-head-controls {
  justify-content: flex-end;
  gap: 8px;
}
.charts-grid {
  gap: 12px;
}
.chart-stage {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(117, 135, 165, 0.16);
  background: linear-gradient(180deg, rgba(247, 250, 255, 0.88), rgba(255, 255, 255, 0.78));
}
.chart-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chart-stage-title-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.chart-stage-title-line h3 {
  margin: 0;
}
.chart-stage-context {
  color: #61738f;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.2;
}
.chart-meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.chart-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 14px;
  border: 1px solid rgba(117, 135, 165, 0.16);
  background: rgba(255, 255, 255, 0.82);
  text-align: left;
  white-space: nowrap;
}
.chart-metric-label {
  display: inline;
  color: #68798e;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.chart-metric-value {
  display: inline;
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.05;
}
.chart-metric-note {
  display: inline;
  margin-top: 0;
  color: var(--sub);
  font-size: 0.78rem;
}
.chart-metric.rise .chart-metric-value { color: var(--rise); }
.chart-metric.fall .chart-metric-value { color: var(--fall); }
.chart-metric.warning .chart-metric-value { color: #ab6f03; }
.chart-metric.neutral .chart-metric-value { color: #1c3560; }
.chart {
  border: 1px solid rgba(117, 135, 165, 0.16);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 250, 255, 0.88));
}
.dashboard-chart {
  min-height: 270px;
}

.market-row,
.turnover-grid,
.leaders-dual {
  gap: 12px;
}
.breadth-card,
.leaders-box,
.turnover-grid li {
  border-radius: 16px;
  border: 1px solid rgba(117, 135, 165, 0.16);
  background: rgba(255, 255, 255, 0.82);
}
.breadth-card { padding: 14px; }
.bar {
  height: 10px;
  background: rgba(222, 231, 244, 0.84);
}
.leaders-panel {
  border-radius: 18px;
  border-color: rgba(117, 135, 165, 0.16);
  background: rgba(255, 255, 255, 0.82);
  padding: 8px;
}
.turnover-grid ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.turnover-grid li { padding: 10px 12px; }

.source-switch-box {
  margin: 0 0 10px;
  min-height: 90px;
  max-height: 140px;
  background: linear-gradient(180deg, rgba(255, 251, 238, 0.98), rgba(255, 247, 223, 0.86));
  border-radius: 16px;
  padding: 12px;
}
#logBox {
  min-height: 220px;
  max-height: 260px;
  border-radius: 18px;
  padding: 12px;
  border: 1px solid rgba(85, 116, 171, 0.18);
}
.toast {
  right: 18px;
  bottom: 18px;
  min-width: 280px;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

@media (max-width: 1360px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }
  .dashboard-sidebar {
    position: static;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1180px) {
  .topbar {
    padding: 14px 16px;
    align-items: flex-start;
    flex-direction: column;
  }
  .top-actions {
    width: 100%;
    min-width: 0;
  }
  .dashboard-shell {
  padding: 10px 12px;
  }
  .dashboard-sidebar {
    grid-template-columns: 1fr;
  }
  .dashboard-hero-main {
    grid-template-columns: 1fr;
  }
  .chart-head-controls {
    width: 100%;
    justify-content: flex-start;
  }
  .chart-control-group {
    width: 100%;
  }
  .chart-date-input,
  .chart-ticker-select {
    width: 100%;
    min-width: 0;
  }
  .chart-stage-head {
    flex-direction: column;
  }
  .chart-meta-badges {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .top-actions,
  .top-menu,
  .turnover-grid,
  .market-row,
  .leaders-dual,
  .overview-stats {
    grid-template-columns: 1fr;
  }
  .dashboard-shell {
    padding: 12px;
  }
  .card,
  .side-card {
    padding: 14px;
    border-radius: 18px;
  }
  .sync-status-card {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 13px 14px;
  }
  .sync-status-pill {
    min-width: 56px;
  }
}

/* Layout adjustments requested after dashboard refresh */
.header-menu {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.header-menu .menu-link {
  flex: 0 0 auto;
  width: auto;
  min-height: 38px;
  min-width: max-content;
  padding: 8px 12px;
  white-space: nowrap;
}
.dashboard-sidebar .market-row {
  grid-template-columns: 1fr;
}
.dashboard-sidebar .turnover-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}
.dashboard-sidebar .turnover-grid ul {
  margin-top: 6px;
}
.side-card-head {
  margin-bottom: 6px;
}
.side-card-head h2 {
  line-height: 1.34;
  letter-spacing: -0.02em;
}
.side-card-market .card-sub {
  max-width: 24ch;
}
.dashboard-sidebar .breadth-card {
  padding: 12px 13px;
}
.dashboard-sidebar .breadth-head {
  align-items: baseline;
  gap: 10px;
}
.dashboard-sidebar .breadth-head strong {
  font-size: 0.95rem;
}
.dashboard-sidebar .breadth-head span {
  font-size: 0.92rem;
  font-weight: 700;
  color: #314b70;
}
.dashboard-sidebar .turnover-grid h3 {
  margin: 12px 0 8px;
  font-size: 1rem;
}
.dashboard-sidebar .turnover-grid li {
  margin-bottom: 8px;
  padding: 12px 13px;
}
.grid {
  grid-template-areas:
    "watch charts"
    "logs logs";
}

@media (max-width: 1180px) {
  .grid {
    grid-template-areas:
      "watch"
      "charts"
      "logs";
  }
}

@media (max-width: 760px) {
  .header-menu {
    margin-top: 8px;
  }
  .top-menu {
    grid-template-columns: unset;
  }
}

/* 2026-04-17 compact desktop pass */
.topbar {
  gap: 8px;
  padding: 10px 18px 7px;
  align-items: stretch;
}
.topbar-kicker,
.section-kicker {
  margin-bottom: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
}
.topbar-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.topbar-brand h1 {
  font-size: 1.38rem;
}
.topbar p {
  margin-top: 4px;
  font-size: 0.84rem;
}
.topbar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-width: 0;
}
.header-menu {
  flex: 1 1 auto;
  gap: 6px;
  margin-top: 0;
  padding-bottom: 0;
}
.header-menu .menu-link {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
}
.top-actions {
  grid-template-columns: repeat(2, minmax(112px, 1fr));
  gap: 8px;
  min-width: 256px;
}
.topbar-inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  grid-template-columns: none;
  gap: 8px;
  min-width: auto;
  margin-left: 0;
  flex: 0 0 auto;
}
.topbar-inline-actions .btn {
  width: auto;
  min-width: 96px;
  white-space: nowrap;
}
.top-actions .btn {
  padding: 7px 10px;
}
.dashboard-shell {
  display: grid;
  grid-template-columns: minmax(300px, var(--dashboard-sidebar-fr)) minmax(0, var(--dashboard-main-fr));
  gap: 8px;
  padding: 4px 10px 10px;
  align-items: start;
}
.dashboard-sidebar {
  display: grid;
  gap: 8px;
  position: sticky;
  top: 76px;
  align-items: start;
}
.dashboard-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dashboard-sidebar > *,
.dashboard-main > * {
  min-width: 0;
  width: 100%;
}
.side-card,
.card,
.dashboard-hero {
  border-radius: 14px;
  padding: 12px;
}
.side-card-status,
.side-card-market,
.watch,
.charts,
.logs,
.dashboard-hero {
  margin: 0;
}
.hero-meta {
  padding: 10px 12px;
  border-radius: 14px;
}
.hero-strips {
  margin-top: 6px;
  gap: 6px;
}
.meta-wrap {
  gap: 6px;
}
.meta-clock {
  padding: 6px 10px;
}
.meta-chip {
  padding: 4px 8px;
  font-size: 0.76rem;
}
.yahoo-strip {
  margin-top: 6px;
  border-radius: 14px;
  padding: 6px 8px;
  gap: 8px;
}
.yahoo-strip-item {
  min-width: 128px;
  padding-right: 8px;
}
.yahoo-strip-lead {
  min-width: 92px;
  padding-right: 8px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}
.yahoo-strip-name {
  font-size: 0.69rem;
}
.yahoo-strip-price {
  font-size: 0.92rem;
}
.yahoo-strip-main {
  gap: 6px;
}
.yahoo-strip-spark {
  width: 68px;
  height: 16px;
}
.yahoo-strip-chg {
  font-size: 0.78rem;
}
.yahoo-strip-secondary {
  margin-top: 4px;
}
.market-combined-strip {
  gap: 6px;
}
.market-combined-strip .yahoo-strip-item {
  min-width: 124px;
  padding-right: 6px;
}
.market-combined-strip .yahoo-strip-price {
  font-size: 0.88rem;
}
.market-combined-strip .yahoo-strip-spark {
  width: 58px;
  height: 14px;
}
.market-combined-strip .yahoo-strip-chg {
  font-size: 0.74rem;
}
.sync-status-rail {
  gap: 8px;
}
.sync-status-card {
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
}
.sync-status-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
}
.sync-status-title {
  font-size: 0.88rem;
}
.sync-status-line {
  font-size: 0.76rem;
  line-height: 1.3;
}
.sync-status-pill {
  min-width: 52px;
  padding: 4px 9px;
  font-size: 0.62rem;
}
.grid {
  gap: 8px;
}
.card-head {
  margin-bottom: 8px;
}
.card-head.compact {
  margin-bottom: 6px;
}
.card h2 {
  font-size: 0.96rem;
}
.chart-head-controls {
  gap: 6px;
}
.chart-control-group {
  gap: 6px;
  font-size: 0.76rem;
}
.chart-date-input {
  min-width: 132px;
}
.chart-ticker-select {
  min-width: 200px;
}
.charts-grid {
  gap: 10px;
}
.chart-stage {
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
}
.chart-meta-badges {
  gap: 6px;
}
.chart-metric {
  gap: 6px;
  min-width: 0;
  padding: 6px 9px;
  border-radius: 12px;
}
.chart-metric-label {
  font-size: 0.66rem;
}
.chart-metric-value {
  margin-top: 0;
  font-size: 0.92rem;
}
.chart-metric-note {
  margin-top: 0;
  font-size: 0.72rem;
}
.dashboard-chart {
  min-height: 240px;
}
.table-wrap {
  max-height: 320px;
  border-radius: 12px;
}
table {
  font-size: 0.8rem;
}
th,
td {
  padding: 5px 6px;
}
#watchTable th,
#watchTable td {
  padding: 3px 5px;
}
#watchTable tbody tr {
  line-height: 1.05;
}
#watchTable .watch-origin {
  font-size: 0.74rem;
}
.watch-del-btn {
  min-width: 22px;
  padding: 1px 5px;
  border-radius: 8px;
  font-size: 0.72rem;
}
.market-row,
.turnover-grid,
.leaders-dual {
  gap: 8px;
}
.breadth-card,
.dashboard-sidebar .breadth-card {
  padding: 10px 11px;
}
.bar {
  height: 8px;
}
.turnover-grid ul,
.dashboard-sidebar .turnover-grid ul {
  margin-top: 6px;
  gap: 6px;
}
.turnover-grid li,
.dashboard-sidebar .turnover-grid li {
  margin-bottom: 0;
  padding: 7px 9px;
  border-radius: 12px;
  font-size: 0.79rem;
}
.source-switch-box {
  margin: 0 0 8px;
  min-height: 70px;
  max-height: 110px;
  padding: 10px;
  font-size: 0.74rem;
}
#logBox {
  min-height: 180px;
  max-height: 220px;
  overflow: auto;
  padding: 10px;
  font-size: 0.74rem;
}
.btn {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
}
input,
select,
textarea {
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 0.84rem;
}
.panel {
  padding: 8px;
}
.config-grid {
  gap: 7px;
}
.config-grid label {
  gap: 3px;
  font-size: 0.74rem;
}
.settings-group {
  margin-top: 10px;
  padding-top: 10px;
}
.settings-help {
  margin-bottom: 8px;
  font-size: 0.76rem;
}
.settings-note {
  font-size: 0.68rem;
}
.status-box {
  min-height: 120px;
  padding: 8px;
  font-size: 0.76rem;
}

@media (max-width: 1380px) {
  .topbar-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-inline-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .dashboard-shell {
    grid-template-columns: 1fr;
  }
}

/* Header menu: keep the desktop menu to two compact rows, about 12 items per row. */
.header-menu {
  display: grid;
  grid-template-columns: repeat(12, minmax(64px, max-content));
  grid-auto-rows: minmax(30px, auto);
  grid-auto-flow: row;
  align-items: center;
  justify-content: start;
  overflow-x: visible;
  row-gap: 5px;
  column-gap: 6px;
}
.header-menu .menu-link {
  width: 100%;
  min-width: 0;
}
.trend-realtime-chart {
  height: min(58vh, 560px);
  min-height: 360px;
}
@media (max-width: 1320px) {
  .header-menu {
    grid-template-columns: repeat(8, minmax(64px, max-content));
  }
}
@media (max-width: 760px) {
  .header-menu {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
