:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #eef2ed;
  --line: #d7ded5;
  --line-strong: #bec9bf;
  --text: #17211b;
  --muted: #68756c;
  --good: #16794c;
  --good-bg: #e2f4ea;
  --watch: #996a0b;
  --watch-bg: #fff1d5;
  --bad: #ad2f32;
  --bad-bg: #fde2e2;
  --accent: #1f6f8b;
  --accent-bg: #ddf0f3;
  --shadow: 0 18px 45px rgba(30, 40, 32, 0.12);
  --dashboard-table-min-width: 2360px;
  --table-header-top: 0px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Noto Sans TC", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 244, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 760;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.1;
}

.brand p,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.genie-research-status {
  position: sticky;
  left: 18px;
  max-width: calc(100vw - 38px);
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
}

.genie-research-heading { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.genie-research-steps { display: grid; grid-template-columns: 1.4fr .7fr 1fr; gap: 10px 20px; margin: 8px 0; }
.genie-research-steps > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.genie-research-steps strong { font-weight: 600; overflow-wrap: anywhere; }
.genie-research-status details { margin-top: 8px; }
.genie-research-status summary { cursor: pointer; color: var(--accent); }
.genie-research-issues { max-height: 220px; overflow-y: auto; margin-top: 8px; }
.genie-research-issues p { margin: 4px 0; line-height: 1.5; }
@media (max-width: 720px) { .genie-research-steps { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .genie-research-status { left: 10px; max-width: calc(100vw - 22px); } }

.actions {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.provider-rate-limit-panel { margin: 10px 18px 12px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.provider-rate-limit-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.provider-rate-limit-heading h2 { font-size: 14px; }
.provider-rate-limit-heading p, .provider-rate-limit-note { font-size: 11px; }
.provider-rate-limit-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 6px; }
.provider-rate-limit-item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 2px 5px; min-width: 0; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; }
.provider-rate-limit-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.provider-rate-limit-item .provider-rate-limit-state { white-space: nowrap; }
.provider-rate-limit-impact { flex-basis: 100%; color: inherit; font-size: 10px; font-weight: 600; white-space: normal; }
.provider-rate-limit-item.is-limited { border-color: #e4a6a6; background: var(--bad-bg); color: var(--bad); }
.provider-rate-limit-item.is-cleared { border-color: #e1ce8c; background: var(--watch-bg); color: var(--watch); }
.provider-rate-limit-item.is-not-observed { background: var(--good-bg); color: var(--good); }
.provider-rate-limit-item.is-unknown, .provider-rate-limit-item.is-unconfigured { color: var(--muted); background: var(--surface-2); }
.provider-rate-limit-note { margin-top: 6px; }

.action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.search span {
  color: var(--muted);
  font-size: 12px;
}

.search input {
  width: min(32vw, 300px);
  min-width: 150px;
  border: 0;
  outline: 0;
  background: transparent;
}

select,
button,
.button-link {
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

select {
  padding: 0 32px 0 10px;
}

button {
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
}

.action-row > button {
  font-size: 13px;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

button:hover,
select:hover,
.button-link:hover,
.search:focus-within {
  border-color: var(--accent);
}

.industry-filter { position: relative; width: 240px; max-width: 100%; }
.industry-filter > summary { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); cursor: pointer; list-style: none; font-size: 13px; }
.industry-filter > summary::-webkit-details-marker { display: none; }
.industry-filter > summary::after { content: "▾"; margin-left: auto; color: var(--muted); }
.industry-filter[open] > summary::after { content: "▴"; }
.industry-filter > summary:hover { border-color: var(--accent); }
#industryFilterLabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.industry-filter-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 25; width: 360px; max-width: calc(100vw - 36px); padding: 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.industry-filter-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; font-size: 13px; }
.industry-filter-toolbar strong { flex: 1; }
.industry-filter-toolbar button { height: 30px; padding: 0 10px; font-size: 12px; }
#industryFilterSearch { width: 100%; height: 34px; margin-bottom: 8px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text); }
.industry-filter-options { max-height: min(320px, 45vh); overflow-y: auto; overscroll-behavior: contain; margin-top: 8px; }
.industry-filter-option { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 6px; border-radius: 5px; cursor: pointer; font-size: 13px; }
.industry-filter-option[hidden] { display: none; }
.industry-filter-option:hover { background: var(--surface-2); }
.industry-filter-option input { flex-shrink: 0; width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.industry-filter-option .industry-option-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.industry-filter-option .industry-option-count { color: var(--muted); font-size: 12px; }
.industry-filter-help { margin-top: 10px; line-height: 1.5; }
#industryFilterEmpty:not([hidden]) { margin-top: 12px; }
.industry-filter :is(summary, button, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 980px) { .industry-filter-panel { left: 0; right: auto; } }
@media (max-width: 640px) { .industry-filter { width: 100%; } }

.toast-host {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 1200;
  max-width: min(520px, calc(100vw - 32px));
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(29, 38, 33, 0.94);
  color: #fff;
  font-size: 12px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  box-shadow: 0 10px 26px rgba(20, 30, 22, 0.18);
}

.toast-host.show {
  opacity: 1;
  transform: translate(-50%, 0);
  transition: none;
}

.export-progress-panel {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
}
.export-progress-panel[hidden] { display: none; }
.export-progress-heading { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.export-progress-track { height: 8px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: var(--line); }
.export-progress-fill { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .18s ease; }
.export-progress-track.is-indeterminate .export-progress-fill {
  width: 100% !important;
  background: repeating-linear-gradient(45deg, var(--accent), var(--accent) 8px, color-mix(in srgb, var(--accent) 58%, white) 8px, color-mix(in srgb, var(--accent) 58%, white) 16px);
  background-size: 32px 32px;
  animation: export-progress-stripes .8s linear infinite;
}
.export-progress-panel.is-error .export-progress-fill { background: #b63d34; }
.export-progress-panel p { margin: 5px 0 0; font-size: 11px; overflow-wrap: anywhere; }
@keyframes export-progress-stripes { to { background-position: 32px 0; } }

.data-update-buttons button[aria-disabled="true"] { opacity: .55; cursor: help; }
.price-batch-receipt { margin-top: 4px; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }

.toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.dashboard-filters {
  position: sticky;
  left: 18px;
  width: calc(100vw - 36px);
  margin: 14px 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.dashboard-filters > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
}

.dashboard-filters > summary::-webkit-details-marker { display: none; }
.dashboard-filters > summary::before { content: "▸"; color: var(--accent); }
.dashboard-filters[open] > summary::before { content: "▾"; }
.dashboard-filters > summary > strong { flex-shrink: 0; }
.dashboard-filter-summary { flex: 1; min-width: 0; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dashboardFilterCount { flex-shrink: 0; }
.dashboard-filter-body { padding: 0 14px 10px; }
.dashboard-filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 16px; }
.dashboard-primary-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.dashboard-filter-fields { display: contents; }
.dashboard-signal-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 10px; }
.dashboard-signal-filter-help { margin-top: 6px; line-height: 1.5; }
.threshold-filter { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.threshold-filter > label { font-size: 12px; font-weight: 650; }
.threshold-filter > label span { margin-left: 5px; color: var(--muted); font-weight: 400; }
.threshold-filter > select { width: 100%; }
.threshold-filter-controls { display: flex; gap: 6px; }
.threshold-filter-controls select { flex: 0 0 103px; width: 103px; padding-right: 22px; font-size: 12px; }
.threshold-filter-controls input { min-width: 0; width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--text); }
.threshold-filter-controls input:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.threshold-filter-controls input[aria-invalid="true"] { border-color: var(--bad); }
.dashboard-more-filters { margin-top: 10px; }
.dashboard-more-filters > summary { width: fit-content; color: var(--accent); font-size: 12px; cursor: pointer; }
.dashboard-more-filters > .dashboard-filter-grid { margin-top: 10px; }
.dashboard-filter-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.dashboard-filter-footer p { line-height: 1.5; }
.dashboard-filter-footer button { flex-shrink: 0; height: 30px; padding: 0 10px; font-size: 12px; }
.dashboard-filters :is(select, input, button, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.performance-tracking-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; }
.performance-tracking-controls label { font-weight: 650; }
.performance-tracking-controls input { width: 220px; max-width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; }
.performance-tracking-controls input#performanceTrackingPurpose { width: 300px; }
.performance-tracking-controls button { height: 34px; background: var(--accent); color: white; }
.performance-tracking-controls button:disabled { opacity: .5; cursor: default; }
.performance-tracking-controls a, .performance-tracking-message a { color: var(--accent); }
.performance-tracking-message { margin-top: 8px; line-height: 1.6; overflow-wrap: anywhere; }
.performance-tracking-message.is-duplicate { color: #80580a; background: var(--watch-bg); border-radius: 5px; padding: 8px 10px; }
.performance-tracking-message.is-error { color: var(--bad); }
.score-snapshot-readiness { width: 100%; margin: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: var(--surface); font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.score-snapshot-readiness.is-warning { border-color: var(--watch-line, #e9c56b); color: var(--text); background: var(--watch-bg); }

@media (max-width: 980px) {
  .dashboard-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 981px) and (max-width: 1100px) {
  .dashboard-primary-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .dashboard-filters { left: 10px; width: calc(100vw - 20px); margin: 10px 10px 0; }
  .dashboard-filters > summary { flex-wrap: wrap; gap: 6px; }
  #dashboardFilterCount { width: 100%; margin-left: 20px; }
  .dashboard-filter-grid { gap: 10px; }
  .dashboard-signal-filters { grid-template-columns: 1fr; }
  .threshold-filter-controls { flex-direction: column; }
  .threshold-filter-controls select { flex-basis: auto; width: 100%; }
  .dashboard-filter-footer { align-items: flex-start; }
}

.layout {
  display: block;
  width: max(100%, calc(var(--dashboard-table-min-width) + 36px));
  max-width: none;
  margin: 0;
  padding: 14px 18px 22px;
}

.table-shell {
  min-width: 0;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.table-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  max-height: none;
  overflow: visible;
}

.dashboard-pagination {
  position: sticky;
  left: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: calc(100vw - 38px);
  padding: 10px 14px;
  font-size: 12px;
}

.dashboard-pagination label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dashboard-pagination button,
.dashboard-pagination select {
  min-height: 30px;
}

.dashboard-pagination-bottom {
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: var(--dashboard-table-min-width);
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  height: 52px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  height: 38px;
  background: var(--surface-2);
  color: #445048;
  font-size: 12px;
  font-weight: 720;
}

.table-wrap th {
  position: sticky;
  top: var(--table-header-top);
  z-index: 2;
}

td {
  font-size: 13px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f8fbfa;
}

tbody tr.selected {
  background: var(--accent-bg);
}

.marker-col,
.marker-cell {
  width: 54px;
  min-width: 54px;
  max-width: 54px;
  text-align: center;
}

.rank-col,
.rank-cell {
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  text-align: right;
}

.rank-cell {
  color: var(--muted);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.marker-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.marker-button.has-marker {
  background: var(--surface-2);
  color: var(--text);
}

.marker-button:hover,
.marker-button:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.marker-menu {
  position: fixed;
  z-index: 50;
  display: grid;
  grid-template-columns: repeat(auto-fill, 32px);
  gap: 6px;
  width: min(384px, calc(100vw - 16px));
  max-height: min(326px, calc(100vh - 16px));
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(20, 30, 22, 0.2);
}

.marker-menu.is-hidden {
  display: none;
}

.marker-menu-option {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.marker-menu-option.empty {
  color: transparent;
}

.marker-menu-option.is-active {
  border-color: var(--accent);
  background: var(--accent-bg);
}

.marker-menu-option:hover,
.marker-menu-option:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-bg);
}

.ticker-col {
  min-width: 150px;
}

.spark-col {
  width: 74px;
  min-width: 74px;
  max-width: 74px;
}

.stock-id {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.stock-logo-link {
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 7px;
  text-decoration: none;
}

.stock-logo-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.stock-logo-link:hover .logo {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-bg);
}

.stock-id > div {
  min-width: 0;
}

.logo {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: contain;
  padding: 3px;
  background: #d9ded8;
}


.logo-big {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  object-fit: contain;
  padding: 3px;
  background: #d9ded8;
}

.logo-placeholder {
  display: inline-grid;
  place-items: center;
  color: #445048;
  font-size: 10px;
  font-weight: 760;
  line-height: 1;
}

.ticker {
  font-weight: 760;
  letter-spacing: 0;
}

.company {
  max-width: 105px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-error,
.status-cell .subline.has-tooltip {
  cursor: help;
}

.company-error {
  color: var(--bad);
}

.stock-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 122px;
  margin-top: 3px;
}

.tag-cell {
  min-width: 82px;
  max-width: 150px;
}

.tag-cell .tag-chip {
  margin: 1px 2px 1px 0;
}

.industry-cell {
  min-width: 92px;
  max-width: 130px;
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
}

.industry-cell > span:first-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
  white-space: nowrap;
}

.tag-chip[role="button"] {
  cursor: pointer;
}

.tag-chip i {
  color: var(--bad);
  font-style: normal;
  font-weight: 800;
}

.fx-chip {
  border-color: #f0b86b;
  background: #fff7ed;
  color: #9a4f13;
}

.fx-conversion-note {
  color: #9a4f13;
  font-weight: 760;
}

.emoji-symbol {
  font-family: "Segoe UI Emoji", "Noto Color Emoji", "Apple Color Emoji", sans-serif;
}

.priority-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #202b22;
  color: #fff;
  font-size: 11px;
  font-weight: 760;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 70px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

.badge.good {
  background: var(--good-bg);
  color: var(--good);
}

.badge.watch {
  background: var(--watch-bg);
  color: var(--watch);
}

.badge.bad {
  background: var(--bad-bg);
  color: var(--bad);
}

.badge.neutral {
  background: var(--surface-2);
  color: var(--muted);
}

.number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.positive {
  color: var(--good);
}

.negative {
  color: var(--bad);
}

.subline {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.status-cell {
  max-width: 126px;
}

.genie-cell { min-width: 175px; cursor: help; }
.security-research-note { display: inline-block; margin: 3px 4px 0 0; padding: 2px 5px; border: 1px solid var(--line); border-radius: 4px; color: #176482; background: #edf6fa; font-weight: 600; }
.security-event-note { display: inline-block; margin-top: 3px; padding: 2px 5px; border: 1px solid #b9c9d2; border-radius: 4px; color: #176482; background: #edf6fa; font-weight: 600; }
.security-event-note.delisted { color: #9f2222; border-color: #e8a3a3; background: #fde8e8; }
.fusion-cell { min-width: 140px; cursor: help; }
.metric-popover:has(.fusion-tooltip) { width: min(760px, calc(100vw - 20px)); }
[data-settings-section="fusion"] > p, [data-settings-section="fusion"] > details { margin-left: 14px; margin-right: 14px; }
.fusion-result { outline-offset: 3px; }
.fusion-settings-fields { border: 0; padding: 0 14px; margin: 0; min-width: 0; }
.fusion-rule-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; }
.fusion-setting-rule { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.fusion-setting-rule input { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; }
.fusion-setting-rule small, .fusion-tooltip small { display: block; color: var(--muted); margin-top: 4px; font-size: 11px; }
.fusion-formula-details { margin-top: 18px; font-size: 13px; line-height: 1.7; }
.fusion-tooltip { max-width: 720px; }
.fusion-tooltip p { line-height: 1.6; overflow-wrap: anywhere; }
.fusion-tooltip .fusion-possible-pass-note { padding: 8px 10px; border-left: 3px solid var(--good); background: var(--good-bg); color: var(--good); }
.fusion-tooltip-table { overflow-x: auto; }
.fusion-tooltip table { min-width: 540px; width: 100%; font-size: 12px; }
.fusion-tooltip th, .fusion-tooltip td { white-space: normal; padding: 8px; }
.fusion-rule-disabled { opacity: .55; }
.fusion-rule-pass td:nth-child(3) { color: #16804a; font-weight: 600; }
.fusion-rule-fail td:nth-child(3) { color: #b33232; font-weight: 600; }
.genie-history-chart { display: block; width: 100%; max-width: 660px; height: auto; margin: 8px 0; }
.genie-history-chart .grid-line { stroke: var(--line); stroke-width: 1; }
.genie-history-chart text { fill: var(--muted); font-size: 11px; }
.genie-history-chart .genie-rating-line { fill: none; stroke: var(--accent); stroke-width: 2; }
.genie-history-chart .genie-rating-point { fill: var(--accent); stroke: var(--surface); stroke-width: 1; }
.genie-history-chart .genie-rating-point.retained { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.genie-history-chart .latest .genie-rating-point { stroke: var(--text); stroke-width: 1.5; }
.genie-history-chart .genie-history-missing { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.genie-history-note { margin: 6px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.genie-history-table { max-height: 250px; overflow: auto; }
.genie-history-table small { display: block; margin-top: 3px; color: var(--muted); }
.genie-settings-panel > p { margin: 12px 14px; line-height: 1.6; overflow-wrap: anywhere; }
.genie-settings-panel .ui-settings-grid { grid-template-columns: repeat(2, minmax(0, 360px)); }
@media (max-width: 700px) {
  .genie-settings-panel .ui-settings-grid { grid-template-columns: minmax(0, 1fr); }
}

.status-cell .subline {
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pe-cell > span:first-child {
  display: inline-block;
}

.pe-signal {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 5px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background: #9ca3af;
  vertical-align: baseline;
}

.pe-signal.max {
  background: #910033;
}

.pe-signal.high {
  background: #ff3015;
}

.pe-signal.mid {
  background: #fde300;
}

.pe-signal.good {
  background: #1efd00;
}

.pe-signal.low {
  background: #0c6800;
}

.fpe-cell > span:first-child {
  display: block;
  font-weight: 720;
}

.peg-line {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

.peg-cell .subline {
  white-space: nowrap;
}

.peer-cell > span:first-child {
  display: block;
  white-space: nowrap;
}

.peer-cell .subline {
  white-space: nowrap;
}

.eps-trend-cell {
  min-width: 96px;
  max-width: 116px;
}

.eps-trend-cell .badge {
  min-width: 0;
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
}

.eps-trend-cell .subline {
  overflow: hidden;
  max-width: 112px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graham-cell > span:first-child {
  display: block;
  font-weight: 720;
}

.graham-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  white-space: nowrap;
}

.valuation-signal {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 999px;
  background: #9ca3af;
}

.valuation-signal.green {
  background: #22c55e;
}

.valuation-signal.yellow {
  background: #facc15;
}

.valuation-signal.red {
  background: #ef4444;
}

.valuation-signal.unknown {
  background: #9ca3af;
}

.metric-popover {
  position: fixed;
  z-index: 80;
  width: min(1120px, calc(100vw - 20px));
  max-height: min(620px, calc(100vh - 20px));
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: left;
}

.metric-popover.is-hidden {
  display: none;
}

.metric-popover.is-pinned {
  border-color: var(--accent);
}

.popover-toolbar {
  position: sticky;
  top: -10px;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin: -10px -10px 10px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(4px);
}

.popover-toolbar button {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 720;
  cursor: pointer;
}

.popover-toolbar button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.popover-section + .popover-section {
  margin-top: 10px;
}

.popover-grid {
  display: grid;
  gap: 10px;
}

.popover-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.popover-column {
  min-width: 0;
}

.popover-grid .popover-section + .popover-section {
  margin-top: 0;
}

.popover-section h4 {
  margin: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
  background: var(--surface-2);
  color: #26322b;
  font-size: 12px;
}

.popover-section table {
  min-width: 0;
  border-collapse: collapse;
}

.popover-section th,
.popover-section td {
  height: auto;
  padding: 7px 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 12px;
  vertical-align: top;
}

.popover-section th {
  position: static;
  width: 54%;
  color: var(--muted);
  font-weight: 650;
}

.popover-section td {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.popover-data {
  min-width: 0;
}

.popover-section table.popover-data th,
.popover-section table.popover-data td {
  display: table-cell;
  width: auto;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.popover-section table.popover-data thead th {
  background: #f7f9f7;
  color: #445048;
  font-weight: 720;
}

.popover-section table.popover-data tbody td {
  color: var(--text);
}

.popover-section table.popover-data a {
  color: var(--accent);
  font-weight: 720;
  text-decoration: none;
}

.popover-grid.three .popover-section th,
.popover-grid.three .popover-section td {
  display: block;
  width: auto;
  text-align: left;
}

.popover-grid.three .popover-section th {
  border-bottom: 0;
}

.popover-grid.three .popover-section td {
  border-top: 0;
  font-weight: 720;
}

.fpe-grid .popover-section + .popover-section {
  margin-top: 10px;
}

.fpe-grid .popover-section h4 {
  min-height: 34px;
  display: flex;
  align-items: center;
}

.popover-pe-layout {
  display: grid;
  grid-template-columns: minmax(390px, 1.2fr) minmax(300px, 0.8fr);
  gap: 10px;
  align-items: start;
}

.pe-table-stack .popover-section + .popover-section {
  margin-top: 10px;
}

.pe-chart-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.pe-chart-card h4 {
  margin: 0;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: #26322b;
  font-size: 12px;
}

.pe-chart {
  display: block;
  width: 100%;
  height: auto;
  padding: 8px;
}

.pe-chart line {
  stroke: #cbd5cd;
  stroke-width: 1;
}

.pe-chart .avg-line {
  stroke: #7c8a80;
  stroke-dasharray: 5 4;
}

.pe-chart .median-line {
  stroke: #1f6f8b;
  stroke-dasharray: 3 4;
}

.pe-chart path {
  fill: none;
  stroke: #1f6f8b;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.pe-chart circle {
  fill: #1f6f8b;
}

.pe-chart text {
  fill: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.pe-chart .chart-end {
  text-anchor: end;
}

.pe-chart .chart-label {
  fill: #445048;
  font-weight: 650;
}

.ntm-pe-z.good {
  color: var(--good);
}

.ntm-pe-z.watch {
  color: var(--watch);
}

.ntm-pe-z.bad {
  color: var(--bad);
}

.ntm-pe-chart-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.ntm-pe-chart-card h4 {
  margin: 0;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: #26322b;
  font-size: 12px;
}

.ntm-pe-chart-card .popover-empty {
  padding: 14px;
}

.ntm-crosshair-readout {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  min-height: 34px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ntm-crosshair-readout b {
  margin-left: 4px;
  color: var(--text);
  font-weight: 740;
}

.ntm-pe-chart {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.ntm-pe-chart .chart-panel {
  fill: #fbfcfb;
  stroke: #d7ded5;
  stroke-width: 1;
}

.ntm-pe-chart .axis,
.ntm-pe-chart .panel-divider {
  stroke: #aeb9b0;
  stroke-width: 1;
}

.ntm-pe-chart .panel-divider {
  stroke: #d7ded5;
}

.ntm-pe-chart path,
.ntm-pe-chart .chart-legend line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ntm-pe-chart .price-line {
  stroke: #315f73;
  stroke-width: 2.1;
}

.ntm-pe-chart .fair-value-line {
  stroke: #d49b13;
  stroke-width: 2.1;
  stroke-dasharray: 7 5;
}

.ntm-pe-chart .ntm-pe-line {
  stroke: #1677c8;
  stroke-width: 2.2;
}

.ntm-pe-chart .latest-price {
  fill: #315f73;
  stroke: #fff;
  stroke-width: 1.5;
}

.ntm-pe-chart .latest-pe {
  fill: #1677c8;
  stroke: #fff;
  stroke-width: 1.5;
}

.ntm-pe-chart .ntm-crosshair-line {
  stroke: #33443a;
  stroke-width: 1.2;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.ntm-pe-chart .ntm-crosshair-point {
  fill: #fff;
  stroke-width: 2;
  pointer-events: none;
}

.ntm-pe-chart .ntm-crosshair-point.price {
  stroke: #315f73;
}

.ntm-pe-chart .ntm-crosshair-point.fair-value {
  stroke: #d49b13;
}

.ntm-pe-chart .ntm-crosshair-point.pe {
  stroke: #1677c8;
}

.ntm-pe-chart .ntm-crosshair-date-bg {
  fill: #33443a;
  pointer-events: none;
}

.ntm-pe-chart .ntm-crosshair-date {
  fill: #fff;
  font-size: 10px;
  font-weight: 720;
  text-anchor: middle;
  pointer-events: none;
}

.ntm-pe-chart .ntm-crosshair-hit-area {
  fill: transparent;
  cursor: ew-resize;
  pointer-events: all;
  touch-action: none;
  outline: none;
}

.ntm-pe-chart.is-crosshair-dragging .ntm-crosshair-line {
  stroke: #17211b;
  stroke-width: 1.6;
}

.ntm-pe-chart .stat-band {
  stroke-width: 1.4;
}

.ntm-pe-chart .stat-band.plus-2 {
  stroke: #a91f2b;
}

.ntm-pe-chart .stat-band.plus-1 {
  stroke: #dc5259;
  stroke-dasharray: 3 4;
}

.ntm-pe-chart .stat-band.mean {
  stroke: #7b8780;
  stroke-dasharray: 7 5;
}

.ntm-pe-chart .stat-band.minus-1 {
  stroke: #39a85c;
  stroke-dasharray: 3 4;
}

.ntm-pe-chart .stat-band.minus-2 {
  stroke: #18733c;
}

.ntm-pe-chart text {
  fill: #5f6c63;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.ntm-pe-chart .panel-title {
  fill: #26322b;
  font-weight: 720;
}

.ntm-pe-chart .axis-label {
  font-size: 10px;
}

.ntm-pe-chart .x-label.middle {
  text-anchor: middle;
}

.ntm-pe-chart .x-label.end,
.ntm-pe-chart .legend-value,
.ntm-pe-chart .summary-value {
  text-anchor: end;
}

.ntm-pe-chart .top-legend text {
  fill: #445048;
  font-size: 11px;
}

.ntm-pe-chart .summary-label,
.ntm-pe-chart .summary-value {
  font-weight: 680;
}

.ntm-pe-chart .ntm-legend-row rect {
  fill: #edf1ee;
}

.ntm-pe-chart .ntm-legend-row.plus-2 rect {
  fill: #a91f2b;
}

.ntm-pe-chart .ntm-legend-row.plus-1 rect {
  fill: #dc5259;
}

.ntm-pe-chart .ntm-legend-row.current rect {
  fill: #1677c8;
}

.ntm-pe-chart .ntm-legend-row.mean rect {
  fill: #d9dedb;
}

.ntm-pe-chart .ntm-legend-row.minus-1 rect {
  fill: #3cb866;
}

.ntm-pe-chart .ntm-legend-row.minus-2 rect {
  fill: #18733c;
}

.ntm-pe-chart .ntm-legend-row:not(.mean) text {
  fill: #fff;
  font-weight: 720;
}

.ntm-pe-chart .ntm-legend-row.mean text {
  fill: #26322b;
  font-weight: 720;
}

.ntm-pe-details {
  margin-top: 10px;
}

.popover-note {
  margin: 6px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.score-history-legend {
  display: flex;
  gap: 12px;
  margin: 4px 2px 6px;
  color: var(--muted);
  font-size: 11px;
}

.score-history-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.score-history-legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.score-history-legend .score,
.score-history-legend .trajectory {
  background: #1f6f8b;
}

.score-history-legend .rank {
  background: #d97706;
}

.score-history-legend .latest {
  background: #7c2d12;
  height: 8px;
  width: 8px;
  border-radius: 50%;
}

.score-history-chart {
  display: block;
  width: 100%;
  max-width: 380px;
  height: auto;
  margin: 0 0 8px;
}

.score-history-chart line {
  stroke: #cbd5cd;
  stroke-width: 1;
}

.score-history-chart .midline {
  stroke-dasharray: 4 4;
}

.score-history-chart .grid-line {
  stroke: #e2e8e2;
  stroke-dasharray: 3 4;
}

.score-history-chart path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.score-history-chart .history-trajectory,
.score-history-chart .score-line {
  stroke: #1f6f8b;
}

.score-history-chart .rank-line {
  stroke: #d97706;
}

.score-history-chart .score-history-point .score-point {
  fill: #1f6f8b;
  stroke: #ffffff;
  stroke-width: 1.4;
}

.score-history-chart .score-history-point .rank-point {
  fill: #d97706;
  stroke: #ffffff;
  stroke-width: 1.4;
}

.score-history-chart .score-history-point.latest circle {
  stroke: #7c2d12;
  stroke-width: 1.7;
}

.score-history-chart text {
  fill: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.score-history-chart .chart-end {
  text-anchor: end;
}

.score-history-chart .chart-label {
  fill: #445048;
  font-weight: 700;
}

.score-history-chart .x-tick {
  text-anchor: middle;
}

.score-history-chart .y-tick {
  text-anchor: end;
}

.score-history-chart .x-axis-label,
.score-history-chart .chart-end {
  text-anchor: end;
}

.score-history-chart .chart-note {
  fill: #61706a;
  font-size: 9.5px;
}

.popover-empty {
  color: var(--muted);
  font-size: 12px;
}

.spark {
  width: 64px;
  height: 28px;
}

.spark-link {
  display: inline-flex;
  width: 100%;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.spark-link:hover .spark {
  opacity: 0.72;
}

.spark-link:focus-visible {
  outline: 2px solid var(--accent, #1f6f8b);
  outline-offset: 1px;
}
.spark-missing { display: inline-block; min-width: 34px; font-size: 10px; text-align: center; }

.range-bar {
  position: relative;
  width: 108px;
  height: 9px;
  border-radius: 999px;
  background: #dfe6dc;
}

.range-bar span {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 17px;
  border-radius: 999px;
  background: var(--accent);
}

.note-cell {
  min-width: 180px;
  max-width: 240px;
  white-space: normal;
}

.note-input {
  box-sizing: border-box;
  width: 100%;
  min-height: 34px;
  max-height: 88px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  line-height: 1.35;
}

.note-input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(26, 115, 232, 0.14);
}

.note-status {
  display: block;
  min-height: 14px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.note-status.saving,
.note-status.pending {
  color: #8a6d1d;
}

.note-status.saved {
  color: #177245;
}

.note-status.error {
  color: #b3261e;
}

.surprise-cell {
  max-width: 180px;
}

.surprise-cell > span:first-child {
  display: block;
  overflow: hidden;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ownership-cell {
  min-width: 118px;
  max-width: 148px;
}

.dcf-cell {
  min-width: 82px;
  max-width: 104px;
}

.ownership-badge {
  min-width: 0;
  height: 22px;
  padding: 0 7px;
  font-size: 11px;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.detail-panel {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  width: auto;
  max-height: min(760px, calc(100vh - 116px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.detail-panel.is-hidden {
  display: none;
}

.detail-page-shell {
  padding: 16px 18px 24px;
}

.detail-page .topbar {
  min-height: 54px;
  gap: 12px;
  padding: 8px 14px;
}

.detail-page .brand {
  min-width: 0;
  gap: 10px;
}

.detail-page .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  font-size: 13px;
}

.detail-page .brand h1 {
  font-size: 18px;
}

.detail-page .brand p {
  line-height: 1.2;
}

.detail-page .topbar .actions {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.detail-page .topbar .button-link {
  height: 32px;
  padding: 0 12px;
}

.detail-page .detail-panel {
  position: static;
  width: auto;
  max-height: none;
  overflow: visible;
}

.detail-empty {
  padding: 22px;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.detail-title {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
}

.detail-title > div {
  min-width: 0;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.detail-title h2 {
  font-size: 17px;
  line-height: 1.1;
}

.detail-tags .tag-chip {
  padding: 0 5px;
  font-size: 10px;
  line-height: 1.3;
}

.detail-title .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
}

.detail-actions .export-button {
  height: 26px;
  padding: 0 8px;
  font-size: 11px;
}

.detail-actions .close-button {
  width: 30px;
  min-width: 30px;
}

.export-button {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.close-button {
  width: 34px;
  padding: 0;
}

.detail-body {
  display: grid;
  gap: 12px;
  padding: 14px 16px 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.panel h3 {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 13px;
}

.panel-head-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.panel-head-actions h3 {
  border-bottom: 0;
}

.panel-head-actions .export-button {
  margin-right: 10px;
}

.stock-introduction-layout {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(190px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.stock-introduction-layout > .panel {
  min-width: 0;
}

.market-summary-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
}

.market-summary-layout > .panel {
  min-width: 0;
}

.stock-introduction-content {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.stock-introduction-summary {
  color: var(--text);
  font-size: 13px;
  line-height: 1.7;
}

.stock-introduction-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stock-introduction-facts div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.stock-introduction-facts span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.stock-introduction-facts strong {
  font-size: 12px;
  line-height: 1.45;
}

.stock-introduction-content ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.stock-introduction-ecosystem {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stock-introduction-ecosystem span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 12px;
}

.stock-introduction-ecosystem b {
  color: var(--text);
}

.stock-introduction-ecosystem a {
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.external-systems-content {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.external-system-link {
  display: grid;
  gap: 4px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  text-decoration: none;
}

.external-system-link:hover {
  border-color: #8fb7c6;
  background: #f4fafb;
}

.external-system-link strong {
  font-size: 13px;
  line-height: 1.35;
}

.external-system-link span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ibd-links {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.ibd-primary-links,
.ibd-tool-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ibd-action-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.ibd-action-link:hover {
  border-color: #8fb7c6;
  background: #f4fafb;
}

.ibd-action-link.is-disabled {
  color: var(--muted);
  cursor: wait;
  opacity: 0.68;
}

.ibd-tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  height: auto;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.ibd-tool-button:hover {
  border-color: #8fb7c6;
  background: #f4fafb;
}

.ibd-leader-signal {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid #9fc7ad;
  border-radius: 8px;
  background: var(--good-bg);
  color: var(--good);
  font-size: 12px;
  font-weight: 800;
}

.ibd-leader-signal span {
  color: #c48a00;
  font-size: 15px;
}

.ibd-ratings {
  display: grid;
  gap: 8px;
}

.ibd-ratings-status {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ibd-ratings-status.error {
  color: var(--bad);
}

.ibd-ratings-status.compact {
  display: block;
  padding: 8px 10px;
}

.ibd-panel-unsupported {
  filter: grayscale(1);
  background: #f2f4f5;
}

.ibd-unsupported-message {
  border-color: #cbd2d8;
  background: #e8ecef;
  color: #58636d;
  font-weight: 700;
}

.ibd-ratings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ibd-rating-row {
  display: grid;
  gap: 5px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fbfcfb;
}

.ibd-rating-row.green {
  border-left-color: var(--good);
}

.ibd-rating-row.strong-green {
  border-left-color: #079455;
  background: #f3fbf6;
}

.ibd-rating-row.yellow {
  border-left-color: var(--watch);
}

.ibd-rating-row.red {
  border-left-color: var(--bad);
}

.ibd-rating-row.strong-red {
  border-left-color: #8f1d1d;
  background: #fff7f7;
}

.ibd-rating-row.gray {
  border-left-color: var(--muted);
}

.ibd-rating-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.ibd-rating-main strong {
  min-width: 0;
  font-size: 12px;
  line-height: 1.25;
}

.ibd-rating-main b {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.ibd-rating-row p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ibd-cache-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ibd-cache-meta strong {
  color: var(--watch);
}

.ibd-history-content {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.ibd-history-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.ibd-history-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ibd-history-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.ibd-history-chart {
  width: 100%;
  min-height: 280px;
}

.ibd-history-chart .grid line {
  stroke: var(--line);
  stroke-width: 1;
}

.ibd-history-chart .grid text,
.ibd-history-chart .axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.ibd-history-chart .axis-label.end {
  text-anchor: end;
}

.ibd-history-chart .series path {
  fill: none;
  stroke-width: 2.4;
}

.ibd-history-table {
  min-width: 760px;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.fact {
  min-height: 64px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact:nth-child(4n) {
  border-right: 0;
}

.fact span {
  color: var(--muted);
  font-size: 11px;
}

.fact strong {
  display: block;
  margin-top: 5px;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.fact strong.detail-value-stack span {
  display: block;
  line-height: 1.25;
}

.detail-popover-content {
  padding: 12px;
}

.detail-popover-content .popover-section + .popover-section {
  margin-top: 12px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.chart-source {
  margin: 4px 12px 0;
  color: var(--muted);
  font-size: 11px;
}

.graham-manual-controls {
  display: grid;
  grid-template-columns: max-content max-content 82px minmax(180px, 320px) 28px 28px max-content max-content;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 0;
  color: var(--text);
  font-size: 12px;
}

.graham-manual-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.graham-manual-controls input[type="number"] {
  width: 82px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
}

.graham-manual-controls input[type="range"] {
  width: 100%;
}

.graham-manual-controls button {
  height: 28px;
  padding: 0 9px;
}

.graham-manual-controls .step-button {
  width: 28px;
  padding: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
}

.thirty-week-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px 0;
  color: var(--muted);
  font-size: 12px;
}

.thirty-week-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-price {
  background: var(--accent);
}

.legend-upgrade {
  background: linear-gradient(90deg, #2f6fb0 0 50%, #df2856 50% 100%);
}

.legend-conserve {
  background: linear-gradient(90deg, #2f6fb0 0 50%, #df2856 50% 100%);
}

.legend-avwap {
  background: linear-gradient(90deg, #a855f7, #2563eb, #f59e0b, #22c55e, #ef4444);
}

.legend-relative-rank {
  background: linear-gradient(90deg, #c2414b, #9ca3af, #1f6f8b);
}

.legend-30w-ma {
  background: linear-gradient(90deg, #00d228 0 33%, #9ca3af 33% 66%, #e62828 66% 100%);
}

.legend-30w-band {
  background: repeating-linear-gradient(90deg, #6b8f71 0 7px, transparent 7px 11px);
  border: 1px solid #d7ded5;
}

.graham-chart {
  position: relative;
  width: 100%;
  height: 350px;
  padding: 8px 10px 18px;
}

.relative-rank-chart {
  position: relative;
  width: 100%;
  height: 302px;
  padding: 8px 10px 18px;
  background: #fff;
}

.pe-river-panel { background: #fff; overflow: hidden; }
.pe-river-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 16px; background: #f5f8fa; border-bottom: 1px solid #dce5ec; }
.panel .pe-river-heading h3 { margin: 0; padding: 0; border: 0; background: transparent; color: #29465c; font-size: 17px; font-weight: 700; }
.pe-river-periods { display: flex; flex-wrap: wrap; flex-shrink: 1; justify-content: flex-end; gap: 7px; }
.pe-river-periods button { padding: 7px 12px; color: #64788c; background: #fff; border: 1px solid #dce5ec; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.pe-river-periods button[aria-pressed="true"] { color: #087e80; border-color: #64bdb6; background: #e6f6f3; }
.pe-river-periods button:focus-visible { outline: 2px solid #168b91; outline-offset: 2px; }
.pe-river-body { padding: 16px; min-width: 0; }
.pe-river-chart { position: relative; width: 100%; height: clamp(300px, 37vw, 480px); background: #fff; }
.pe-river-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 15px 0; color: #617489; font-size: 13px; }
.pe-river-legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pe-river-legend i, .pe-river-tooltip i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.pe-river-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 14px 0; padding: 15px 18px; border: 1px solid #e1e9ef; border-radius: 10px; background: #f5f8fb; }
.pe-river-stats dt { color: #728499; font-size: 12px; font-weight: 600; }
.pe-river-stats dd { margin: 5px 0 0; color: #2d4960; font-size: 23px; line-height: 1.25; font-weight: 750; font-variant-numeric: tabular-nums; }
.pe-river-basis, .pe-river-note, .pe-river-source { margin: 8px 0 0; font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.pe-river-basis { color: #8a6930; }
.pe-river-note { color: #788797; }
.pe-river-source, .pe-river-source a { color: #768a9b; font-size: 11px; }
.pe-river-tooltip { position: absolute; z-index: 3; min-width: 186px; padding: 11px 13px; pointer-events: none; border: 1px solid #d2dde5; border-radius: 9px; background: rgba(255, 255, 255, 0.97); color: #60758b; box-shadow: 0 5px 22px #263f5720; font-size: 12px; }
.pe-river-tooltip strong { display: block; margin-bottom: 6px; color: #29465c; }
.pe-river-tooltip > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; line-height: 1.8; }
.pe-river-tooltip span { display: inline-flex; align-items: center; gap: 6px; }
.pe-river-tooltip b { color: #29465c; font-variant-numeric: tabular-nums; }
.pe-river-error p { margin: 0 0 12px; }
@media (max-width: 560px) {
  .pe-river-heading { flex-wrap: wrap; padding: 12px; }
  .pe-river-periods { gap: 5px; }
  .pe-river-periods button { padding: 6px 9px; }
  .pe-river-body { padding: 10px; }
  .pe-river-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; }
  .pe-river-stats dd { font-size: 21px; }
  .pe-river-legend { gap: 8px 12px; font-size: 12px; }
}

.advanced-chart {
  position: relative;
  width: 100%;
  height: 560px;
  min-height: 420px;
  background: #fff;
}

.advanced-chart iframe {
  display: block;
  width: 100%;
  height: 100%;
}

.avwap-chart {
  position: relative;
  width: 100%;
  height: 422px;
  padding: 8px 10px 18px;
  background: #fff;
}

.thirty-week-chart {
  position: relative;
  width: 100%;
  height: 422px;
  padding: 8px 10px 18px;
  background: #fff;
}

.graham-chart-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.avwap-chart-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.thirty-week-signal-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.graham-eps-label {
  fill: #4d5a52;
  font-size: 9px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.86);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.graham-eps-label.is-estimate {
  fill: #855d21;
  font-style: italic;
}

.avwap-label {
  font-size: 12px;
  font-weight: 740;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.thirty-week-signal-label {
  font-size: var(--thirty-week-signal-font-size, 22px);
  font-weight: 820;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.96);
  stroke-width: 5px;
  stroke-linejoin: round;
}

.mini-table {
  width: 100%;
  min-width: 0;
}

.mini-table th,
.mini-table td {
  height: 34px;
  padding: 6px 9px;
  font-size: 12px;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 12px;
}

.link-row a {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}

.loading-row td {
  height: 160px;
  color: var(--muted);
  text-align: center;
}

.signal-list {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.signal-item {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.signal-item strong {
  display: block;
  margin-bottom: 4px;
}

.signal-item span {
  color: var(--muted);
  font-size: 12px;
}

.signal-item span strong,
.metric-yoy {
  color: var(--text);
  display: inline;
  font-weight: 800;
}

.surprise-scroll {
  overflow-x: auto;
}

.surprise-table {
  min-width: 1180px;
}

.surprise-table td {
  white-space: nowrap;
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11px;
}

.settings-layout {
  display: grid;
  gap: 14px;
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 14px 18px 22px;
}

.settings-tab-layout {
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
}

.settings-sidebar {
  position: sticky;
  top: 90px;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-tab {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.settings-tab:hover,
.settings-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.settings-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.settings-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.settings-panel[hidden] {
  display: none;
}

.fmp-status-summary { padding: 14px 14px 0; }
.fmp-status-banner {
  display: grid;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--muted);
  border-radius: 7px;
  background: var(--surface-muted, #f5f7f5);
}
.fmp-status-banner strong { font-size: 15px; }
.fmp-status-banner small { color: var(--muted); line-height: 1.5; }
.fmp-status-banner.is-limited { border-left-color: #c63c32; background: #fff3f1; }
.fmp-status-banner.is-cleared { border-left-color: #25805b; background: #eff8f2; }
.fmp-status-banner.is-clear { border-left-color: #25805b; }
.fmp-status-banner.is-unconfigured { border-left-color: #a87100; background: #fff8e6; }
.fmp-status-table-wrap { overflow-x: auto; padding: 4px 14px 14px; }
.fmp-status-table { width: 100%; border-collapse: collapse; min-width: 850px; font-size: 13px; }
.fmp-status-table th, .fmp-status-table td { padding: 10px 11px; border: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.5; }
.fmp-status-table thead th { background: var(--accent-bg); color: var(--accent); font-weight: 800; }
.fmp-status-table tbody th { width: 17%; min-width: 145px; background: #f7f9f7; white-space: normal; }
.fmp-status-table tbody td { min-width: 175px; }
.fmp-status-table tbody tr:nth-child(even) td { background: #fbfcfb; }

.settings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-search input {
  width: min(34vw, 340px);
}

.inline-add {
  display: flex;
  gap: 8px;
}

.inline-add input {
  width: min(28vw, 260px);
  min-width: 180px;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  background: var(--surface);
}

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

.watch-summary {
  display: flex;
  align-items: baseline;
  gap: 7px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.watch-summary strong {
  font-size: 28px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 54px;
  padding: 12px 14px;
}

.graham-settings-grid {
  display: grid;
  grid-template-columns: minmax(100px, 140px) repeat(4, minmax(110px, 1fr));
  gap: 1px;
  padding: 12px 14px;
  background: var(--line);
}

.graham-settings-grid > * {
  min-width: 0;
  padding: 9px;
  background: var(--surface);
}

.graham-settings-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.graham-settings-grid input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.ui-settings-grid {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 12px;
  padding: 12px 14px;
}

.ui-settings-grid label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ui-settings-grid input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.ui-settings-grid input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.ui-settings-grid input[type="range"] {
  height: 20px;
}

.range-setting strong {
  color: var(--text);
  font-size: 12px;
}

.ui-settings-grid textarea {
  width: min(820px, 100%);
  min-height: 230px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: 12px/1.55 ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  resize: vertical;
}

.sec-settings-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
#secSettingsNotice[hidden] { display: none; }
#secDatasetsNotice[hidden] { display: none; }
.sec-options-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.sec-options-grid select { width: 100%; min-height: 34px; }
.sec-options-grid label[hidden] { display: none; }
.sec-email-slots { display: grid; gap: 8px; padding: 4px 14px; }
.sec-email-slots[hidden], #secEmailFilePanel[hidden], #secEmailSlotsHelp[hidden] { display: none; }
.sec-email-row { display: grid; grid-template-columns: 100px minmax(160px, 1fr) 110px; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; }
.sec-email-row > input { width: 100%; min-height: 34px; min-width: 0; }
.sec-email-enabled, .sec-email-manual { display: flex; gap: 7px; align-items: center; font-size: 12px; white-space: nowrap; }
.sec-email-row input[type="checkbox"], .sec-email-row input[type="radio"] { width: 16px; height: 16px; }
.sec-slot-disabled { background: var(--surface); color: var(--muted); }
.sec-connection-status, .sec-dataset-status, .sec-ip-details { margin: 12px 14px; font-size: 13px; overflow-wrap: anywhere; }
.sec-status-grid { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 9px 14px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.sec-status-grid dt { color: var(--muted); }
.sec-status-grid dd { margin: 0; min-width: 0; }
.sec-table-scroll { overflow-x: auto; }
.sec-history-table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 12px; }
.sec-history-table th, .sec-history-table td { padding: 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sec-ip-details summary { cursor: pointer; padding: 8px 0; }
.sec-status-error { color: #c33; }
.sec-quarter-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.sec-quarter-cards > div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 5px; }
.sec-quarter-cards span { color: var(--muted); font-size: 12px; }
.sec-quarter-cards strong { font-size: 20px; }
.sec-quarter-result { padding: 10px 12px; border-radius: 6px; background: #edf7ef; }
.needs-data { background: #fff4db; color: #725600; }
.sec-dataset-toolbar, .sec-history-pagination { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 14px; }
.sec-dataset-toolbar label { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.sec-dataset-toolbar select { min-height: 34px; max-width: 100%; }
.sec-quarter-activity { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 14px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.sec-quarter-activity progress { width: min(280px, 100%); }
.sec-file-badge { display: block; width: fit-content; padding: 3px 6px; border-radius: 5px; margin-top: 6px; font-size: 11px; }
.sec-file-badge.is-available { background: #e7f4ec; color: #28623b; }
.sec-quarter-table td { vertical-align: top; }
#secDatasetsPanel .sec-history-table { table-layout: fixed; }
#secDatasetsPanel .sec-history-table th, #secDatasetsPanel .sec-history-table td { white-space: normal; vertical-align: top; min-width: 0; overflow-wrap: anywhere; }
#secDatasetsSaved .sec-history-table th:nth-child(1) { width: 20%; }
#secDatasetsSaved .sec-history-table th:nth-child(2) { width: 28%; }
#secDatasetsSaved .sec-history-table th:nth-child(3) { width: 52%; }
#secDatasetsPanel .sec-history-table details { margin-top: 6px; }
.sec-file-path { overflow-wrap: anywhere; white-space: normal; max-width: 560px; }
.sec-file-path code { white-space: normal; overflow-wrap: anywhere; }
.sec-import-grid { grid-template-columns: minmax(0, 1fr); }
.sec-history-pagination span { flex: 1; min-width: 170px; font-size: 12px; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .sec-email-row { grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }
  .sec-email-row > input { grid-column: 1 / -1; grid-row: 2; }
  .sec-status-grid { grid-template-columns: 1fr; gap: 6px; }
  .sec-status-grid dd { margin-bottom: 8px; }
}

.score-weight-grid {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.score-weight-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 130px 78px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.score-weight-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.score-weight-row strong {
  font-size: 13px;
}

.score-weight-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.score-weight-row input {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.score-weight-row b {
  color: var(--accent);
  font-size: 13px;
  text-align: right;
}

.score-weight-summary {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.score-weight-summary strong {
  color: var(--text);
  font-size: 16px;
}

.settings-subnote {
  display: grid;
  gap: 4px;
  padding: 0 14px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-subnote strong {
  color: var(--text);
  font-size: 13px;
}

#fusionCacheNotice[hidden] { display: none; }

.cache-category-grid {
  display: grid;
  gap: 8px;
  padding: 0 14px 14px;
}

.cache-category-row {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) 74px 130px 44px;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.cache-category-row span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cache-category-row strong {
  color: var(--text);
  font-size: 13px;
}

.cache-category-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.cache-category-row input[type="checkbox"] {
  justify-self: center;
  width: 18px;
  height: 18px;
}

.cache-category-row input[type="number"] {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
}

.cache-category-row b {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.fmp-source-grid { display: grid; gap: 8px; padding: 0 14px 14px; }
.fmp-source-row { display: grid; grid-template-columns: minmax(250px, 1fr) minmax(220px, 320px); gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.fmp-source-row span { display: grid; gap: 3px; min-width: 0; }
.fmp-source-row strong { color: var(--text); font-size: 13px; }
.fmp-source-row em { color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.35; }
.fmp-source-row select { min-width: 0; width: 100%; }
.fmp-source-toggle input[type="checkbox"] { justify-self: start; width: 18px; height: 18px; }

.financial-route-group { display: grid; gap: 10px; min-width: 0; }
.settings-page .topbar .actions { flex: 0 1 auto; flex-direction: row; flex-wrap: wrap; }
.financial-route-group h3 { margin: 8px 0 0; color: var(--text); font-size: 14px; }
.financial-source-row { align-items: start; }
.financial-source-row label, .earnings-provider-description { display: grid; gap: 6px; min-width: 0; }
.financial-score-badge { display: inline-block; width: fit-content; margin-left: 4px; padding: 2px 7px; border: 1px solid; border-radius: 5px; font-size: 11px; line-height: 1.5; vertical-align: middle; white-space: nowrap; }
.financial-score-badge.score { color: #185944; background: #eaf5ee; border-color: #b5d8c5; }
.financial-score-badge.conditional { color: #80530a; background: #fff5de; border-color: #e7cd94; }
.financial-score-badge.display { color: #58656d; background: #f1f4f5; border-color: #cfd8dc; }
.financial-selection-note { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.earnings-provider-row { grid-template-columns: minmax(0, 1fr) minmax(180px, 220px); align-items: start; }
.earnings-provider-controls { display: grid; gap: 10px; }
.earnings-provider-controls label { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.earnings-provider-controls input[type="number"] { width: 78px; }
.earnings-provider-controls input[type="checkbox"] { width: 17px; height: 17px; }
.earnings-provider-description details { font-size: 12px; color: var(--muted); }
.earnings-provider-description details p { margin: 6px 0; line-height: 1.6; }
.financial-score-reference { margin: 0 14px 14px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.financial-score-reference summary { cursor: pointer; color: var(--accent); font-size: 13px; font-weight: 700; }
.financial-reference-scroll { overflow-x: auto; margin-top: 12px; }
.financial-reference-scroll table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 12px; }
.financial-reference-mobile-note { display: none; color: var(--muted); font-size: 12px; }
.financial-reference-scroll th, .financial-reference-scroll td { padding: 10px; border: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.6; }
.financial-reference-scroll th { background: var(--accent-bg); }
.financial-footer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .settings-page .topbar .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .settings-page .topbar .actions > :last-child { grid-column: 1 / -1; }
  .financial-reference-mobile-note { display: block; }
  .financial-source-row, .earnings-provider-row { grid-template-columns: minmax(0, 1fr); }
  .earnings-provider-controls { display: flex; flex-wrap: wrap; gap: 14px; }
}

.settings-footer-actions {
  padding: 0 14px 14px;
}

.sp500-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  width: 100%;
  padding: 14px;
}

.sp500-panel {
  min-width: 0;
  overflow: hidden;
}

#sp500PeRiverHost { min-width: 0; }

.sp500-chart {
  position: relative;
  width: 100%;
  height: 520px;
  border-top: 1px solid var(--line);
}

.sp500-thirty-week-chart {
  position: relative;
  width: 100%;
  height: 440px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.sp500-label-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.sp500-eps-label text {
  fill: #4f5b52;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 3px;
  stroke-linejoin: round;
  font-size: 10px;
  font-weight: 720;
}

.sp500-eps-label.is-estimate text {
  fill: #1f6f8b;
  font-style: italic;
}

.sp500-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 10px 14px;
  color: var(--muted);
  font-size: 12px;
}

.sp500-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-line {
  display: inline-block;
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: var(--muted);
}

.legend-line.price {
  background: #13866f;
}

.legend-line.upgrade {
  background: #1f6f8b;
}

.legend-line.conserve {
  background: #e11d48;
}

.legend-line.estimate {
  background: repeating-linear-gradient(90deg, #1f6f8b 0 5px, transparent 5px 9px);
}

.legend-line.thirty-week-ma {
  background: linear-gradient(90deg, #00d228 0 33%, #9ca3af 33% 66%, #e62828 66% 100%);
}

.legend-line.thirty-week-band {
  background: repeating-linear-gradient(90deg, #6b8f71 0 6px, transparent 6px 10px);
  border: 1px solid #d7ded5;
}

.sp500-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.sp500-facts > div {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  background: var(--surface);
}

.sp500-facts strong {
  color: var(--muted);
  font-size: 12px;
}

.sp500-facts span {
  font-size: 16px;
  font-weight: 760;
}

.sp500-sources {
  padding: 12px 14px 14px;
}

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

.mini-table th,
.mini-table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.mini-table th {
  width: 150px;
  background: var(--surface-2);
  color: var(--muted);
}

.source-warning {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #f4b4b4;
  border-radius: 7px;
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 12px;
}

.earnings-job-progress {
  margin-block: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.growth-anomaly-badge {
  display: inline-flex;
  align-items: center;
  margin-right: 5px;
  padding: 1px 6px;
  border: 1px solid var(--watch-line, #e9c56b);
  border-radius: 999px;
  background: var(--watch-bg);
  color: var(--watch);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.sp500-growth-control {
  flex: 0 0 auto;
  gap: 6px;
}

.sp500-workbook-control {
  flex: 0 0 auto;
  gap: 6px;
}

.sp500-workbook-control select {
  height: 26px;
  padding: 0 22px 0 4px;
  border: 0;
  background-color: transparent;
  outline: 0;
  font-size: 13px;
}

.sp500-actions {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
}

.sp500-actions .toggle,
.sp500-actions .sp500-mode-toggle,
.sp500-actions .button-link,
.sp500-actions > button {
  flex: 0 0 auto;
}

.sp500-mode-toggle {
  flex: 0 0 auto;
  min-width: 116px;
  font-size: 13px;
}

.sp500-mode-toggle.is-active {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent);
}

.sp500-growth-control input {
  width: 78px;
  min-width: 78px;
  text-align: right;
}

.sp500-growth-control button {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-2);
  cursor: pointer;
}

.sp500-range {
  flex: 0 1 180px;
  width: min(18vw, 220px);
  min-width: 120px;
}

.tag-editor-list {
  display: grid;
  gap: 12px;
  padding: 12px 14px 14px;
}

.tag-editor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: visible;
}

.tag-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.tag-editor-head div {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.tag-editor-head span {
  color: var(--muted);
  font-size: 12px;
}

.tag-delete-button {
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 999px;
  color: #9f2d32;
  font-size: 12px;
  font-weight: 820;
  line-height: 1;
}

.tag-editor-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.tag-add-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.tag-add-row input {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
}

.tag-add-row button {
  height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.tag-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf8;
}

.tag-suggestions[hidden] {
  display: none;
}

.tag-suggestions button,
.tag-assigned-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
}

.tag-suggestions button {
  background: #fff;
}

.tag-assigned-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-assigned-chip {
  border-color: #b7d2d7;
  background: var(--accent-bg);
  color: #164f63;
}

.tag-assigned-chip span {
  color: #55757d;
  font-weight: 820;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--accent-bg);
  color: #164f63;
}

.chip span {
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.section-heading h2 {
  font-size: 16px;
}

.ticker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
  padding: 14px;
}

.ticker-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.ticker-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 9px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.ticker-choice:has(input:checked) {
  border-color: #8db7bf;
  background: var(--accent-bg);
}

.ticker-choice input {
  margin-top: 2px;
}

.ticker-choice-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.ticker-choice-main strong {
  font-size: 14px;
}

.ticker-choice-main em {
  padding: 2px 6px;
  border-radius: 999px;
  background: #202b22;
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 720;
}

.ticker-choice-meta {
  grid-column: 2;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state.compact {
  padding: 12px;
  font-size: 12px;
}

@media (max-width: 980px) {
  :root {
    --table-header-top: 0px;
  }

  .topbar {
    position: relative;
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .detail-page .topbar {
    align-items: center;
    flex-direction: row;
    min-height: 52px;
    padding: 8px 10px;
  }

  .detail-page .topbar .actions {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .sp500-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
  }

  .action-row {
    justify-content: flex-start;
  }

  .table-wrap {
    max-height: none;
  }

  .detail-panel {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 80vh;
  }

  .stock-introduction-layout {
    grid-template-columns: 1fr;
  }

  .market-summary-layout {
    grid-template-columns: 1fr;
  }

  .ibd-ratings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .metric-popover {
    width: min(420px, calc(100vw - 20px));
  }

  .popover-pe-layout {
    grid-template-columns: 1fr;
  }

  .popover-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .layout {
    width: max(100%, calc(var(--dashboard-table-min-width) + 20px));
    padding: 10px;
  }

  .search input {
    width: 100%;
  }

  .panel-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fact:nth-child(2n) {
    border-right: 0;
  }

  .settings-layout {
    padding: 10px;
  }

  .settings-tab-layout {
    grid-template-columns: 1fr;
  }

  .settings-sidebar {
    position: static;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px;
  }

  .settings-tab {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .settings-toolbar,
  .inline-add {
    flex-direction: column;
  }

  .settings-search input,
  .inline-add input {
    width: 100%;
  }

  .score-weight-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .cache-category-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fmp-source-row { grid-template-columns: 1fr; gap: 8px; }

  .score-weight-row b {
    text-align: left;
  }

  .cache-category-row input[type="checkbox"] {
    justify-self: start;
  }

  .cache-category-row b {
    text-align: left;
  }
}

.slow-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: slow-spin 0.7s linear infinite;
  vertical-align: middle;
}

/* 小尺寸：放在欄位數值旁與 tooltip 來源明細列中 */
.slow-spinner-sm {
  width: 10px;
  height: 10px;
  border-width: 2px;
}

.pending-badge {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  line-height: 1;
  vertical-align: middle;
}

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

@media (prefers-reduced-motion: reduce) {
  .slow-spinner {
    animation-duration: 1.6s;
  }
}
.dashboard-data-status {
  margin: 0 16px 12px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 12px;
}
.data-update-groups { position: sticky; left: 18px; width: calc(100vw - 36px); max-width: 100%; margin: 14px 18px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.data-update-group { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.data-update-group[data-update-group="api"] { container-type: inline-size; }
.data-update-group h2 { font-size: 15px; margin-bottom: 5px; }
.data-update-groups.compact-update-groups { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.compact-update-groups .data-update-group > h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.compact-update-groups .data-update-group > h2 > .work-light { order: -1; margin: 0; }
.compact-update-groups .data-update-group > h2 > .work-light[data-light="idle"]:not([data-queue]) { display: none; }
.compact-block-counts, .compact-source-counts { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
h2 > .compact-block-counts { flex-basis: 100%; margin-left: 0; font-weight: 400; }
.compact-primary-sources { display: grid; grid-template-columns: 1fr; gap: 7px; }
.compact-source-row.pipeline-card { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; padding: 8px 10px; margin: 0; }
.compact-source-row > strong { display: inline-flex; align-items: center; min-width: 110px; font-size: 12px; }
.compact-source-row > .compact-source-counts { margin-left: auto; white-space: nowrap; }
.work-eta { font-size:11px; color:var(--muted); font-variant-numeric:tabular-nums; white-space:nowrap; }
.website-cooldown-settings { grid-column:1/-1; border:1px solid var(--line); border-radius:8px; padding:12px; }
.website-cooldown-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; }
.website-cooldown-grid label { display:flex; flex-direction:column; gap:6px; font-size:12px; }
.website-cooldown-grid label > span { display:flex; align-items:center; gap:6px; }
.website-cooldown-grid input { min-width:0; width:110px; }
.listing-recheck-sources { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:10px; margin:10px 0; }
.listing-recheck-sources > div { padding:10px; border:1px solid var(--line); border-radius:6px; }
.listing-recheck-sources small { display:block; margin-top:5px; color:var(--muted); }
#delistedStocksPanel > .section-heading, .listing-review-toolbar { display:flex; flex-wrap:wrap; gap:8px; }
.listing-review-toolbar button { max-width:100%; white-space:normal; }
.compact-source-counts > .work-eta, .compact-block-counts > .work-eta { display:block; text-align:right; margin-top:2px; }
.compact-source-row > .work-icon-actions { margin-left: auto; }
.compact-source-current { flex-basis: 100%; color: var(--muted); }
.compact-metric-group { margin-top: 12px; }
.compact-metric-group h3 { font-size: 13px; margin: 0 0 6px; }
.compact-metric-sources { display: grid; gap: 5px; }
.compact-metric-group [data-source-auxiliary] { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.compact-metric-group [data-source-auxiliary] .compact-source-row { margin-top: 5px; }
.compact-research-block > .compact-block-counts { margin: 8px 0; }
.research-rating-counts { margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--line); }
.research-rating-heading { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.research-rating-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0; }
.research-rating-grid > div { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; padding: 7px 9px; border-radius: 6px; background: var(--surface-2); }
.research-rating-grid dt { font-size: 12px; overflow-wrap: anywhere; }
.research-rating-grid dd { margin: 0; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.research-rating-grid [data-tone="good"] { color: var(--good); background: var(--good-bg); }
.research-rating-grid [data-tone="bad"] { color: var(--bad); background: var(--bad-bg); }
.research-rating-grid [data-tone="neutral"] { color: var(--accent); }
.research-rating-grid [data-tone="muted"], .research-rating-note { color: var(--muted); }
.research-rating-note { margin: 7px 0 0; font-size: 11px; }
@media (max-width: 420px) { .research-rating-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.compact-update-groups .data-pipeline-panel { margin: 0; padding: 0; border: 0; }
@media(max-width:1000px) { .data-update-groups.compact-update-groups { grid-template-columns: 1fr; } }
@media(max-width:780px) { .compact-primary-sources { grid-template-columns:1fr; } .compact-source-row > .work-icon-actions { margin-left:0; } h2 > .compact-block-counts { margin-left:0; flex-basis:100%; } }
/* Dashboard control center: work queue, sources, research and SEC sync in one collapsible area. */
.control-center-bar { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-width: 0; }
.control-center-bar h2 { margin: 0; font-size: 15px; }
.control-center-work { font-size: 12px; }
.control-center-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 12px; }
.rate-limit-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; text-decoration: none; color: var(--muted); background: var(--surface-2); }
.rate-limit-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rate-limit-chip[data-state="ok"] { color: var(--good); background: var(--good-bg); }
.rate-limit-chip[data-state="cleared"] { color: var(--watch); background: var(--watch-bg); border-color: #e1ce8c; }
.rate-limit-chip[data-state="limited"], .rate-limit-chip[data-state="error"] { color: var(--bad); background: var(--bad-bg); border-color: #e4a6a6; }
.data-update-groups.is-collapsed > :not(.control-center-bar) { display: none !important; }
.data-update-groups.compact-update-groups { align-items: stretch; }
.data-update-groups > .sec-sync-dashboard { min-width: 0; margin: 0; }
/* Data sources take the full width below the Genie, fusion and SEC cards; DOM order stays data-first. */
.compact-update-groups > [data-update-group="data"] { grid-column: 1 / -1; order: 1; }
.compact-update-groups [data-pipeline-sources] > .compact-primary-sources::before { content: "行情與財報"; font-size: 13px; font-weight: 700; }
@media (min-width: 1200px) {
  .compact-update-groups [data-update-group="data"] [data-pipeline-sources] { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 10px 16px; align-items: start; }
  .compact-update-groups [data-pipeline-sources] > .compact-metric-group { margin-top: 0; }
}
.data-update-description { color: var(--muted); font-size: 12px; line-height: 1.6; margin-bottom: 10px; }
.data-cache-policy { margin: 0 0 10px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font-size: 11px; line-height: 1.6; }
.data-cache-policy > summary { color: var(--accent); cursor: pointer; overflow-wrap: anywhere; }
.data-cache-policy dl { display: grid; gap: 6px; margin: 9px 0; }
.data-cache-policy dl > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, 1fr); gap: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.data-cache-policy dt, .data-cache-policy dd { margin: 0; overflow-wrap: anywhere; }
.data-cache-policy dd { text-align: right; font-variant-numeric: tabular-nums; }
.data-cache-policy small { display: block; color: var(--muted); font-size: 10px; }
.data-cache-policy p { margin: 6px 0 0; color: var(--muted); }
.data-cache-policy .is-disabled, .data-cache-policy .data-cache-policy-error { color: var(--bad); }
.data-cache-policy [hidden] { display: none; }
.data-cache-lifecycle { margin-bottom: 8px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); font-size: 11px; line-height: 1.6; font-variant-numeric: tabular-nums; }
.data-cache-clock-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; }
.data-cache-clock-heading strong { font-size: 11px; }
.data-cache-clock-heading > span { color: var(--muted); }
.data-cache-clock-track { height: 6px; margin: 5px 0 6px; overflow: hidden; border-radius: 999px; background: #dce3de; }
.data-cache-clock-track > span { display: block; height: 100%; width: 0; background: #30a467; }
.data-cache-lifecycle p { margin: 2px 0; overflow-wrap: anywhere; }
.data-cache-lifecycle [data-clock-counts], .data-cache-lifecycle [data-clock-note] { color: var(--muted); font-size: 10px; }
.data-cache-lifecycle [data-clock-breakdown] { color: var(--text); font-weight: 600; }
.data-cache-clock-category [data-cache-source-limited] { color: var(--bad); font-weight: 600; }
.data-cache-lifecycle > details { margin-top: 5px; }
.data-cache-lifecycle summary { width: fit-content; cursor: pointer; color: var(--accent); }
.data-cache-clock-category { padding: 9px 0; border-bottom: 1px solid var(--line); }
[data-clock-state="fresh"][data-clock-urgent="true"] > .data-cache-clock-track > span { background: #cf9427; }
[data-clock-state="due"] > .data-cache-clock-track > span { background: #cf9427; }
[data-clock-state="due"] > .data-cache-clock-heading > span,
[data-clock-state="due"] > [data-clock-expiry] { color: var(--watch); }
[data-clock-state="expired"] > .data-cache-clock-track > span, [data-clock-state="failed"] > .data-cache-clock-track > span { background: #d34d4d; }
[data-clock-state="expired"] > [data-clock-expiry], [data-clock-state="failed"] > [data-clock-expiry] { color: var(--bad); }
[data-clock-state="unknown"] > .data-cache-clock-track, [data-clock-state="disabled"] > .data-cache-clock-track { opacity: .5; }
.data-update-buttons { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 12px; }
.data-update-buttons button { height: auto; min-height: 34px; padding: 7px 10px; font-size: 12px; }
.data-update-buttons button:first-child { border-color: var(--accent); color: var(--accent); }
.data-update-advanced { margin: -3px 0 10px; }
.data-update-advanced > summary { width: fit-content; cursor: pointer; color: var(--muted); font-size: 12px; }
.data-update-advanced[open] > summary { margin-bottom: 8px; }
.dashboard-progress-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 10px 0 0; }
.data-pipeline-panel { min-width: 0; }
.data-pipeline-panel > h3 { margin: 12px 0 4px; font-size: 12px; }
.data-pipeline-panel > .pipeline-explanation { margin: 3px 0 8px; font-size: 11px; line-height: 1.5; }
.pipeline-card { min-width: 0; margin: 6px 0; padding: 9px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface-2); }
.pipeline-card > summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; cursor: pointer; font-size: 11px; }
.pipeline-card > summary > strong { overflow-wrap: anywhere; }
.pipeline-card > summary > span { color: var(--muted); font-variant-numeric: tabular-nums; }
.pipeline-card > summary > .pipeline-score-impact { padding: 2px 6px; border: 1px solid var(--line-strong); border-radius: 4px; font-size: 10px; white-space: nowrap; }
.pipeline-card > summary > .pipeline-score-impact.scoring { color: #176448; background: #e8f5ed; border-color: #afd2bb; }
.pipeline-card > summary > .pipeline-score-impact.display-only { color: var(--muted); background: var(--surface); }
.pipeline-purpose-list { padding-left: 18px; margin: 5px 0 10px; font-size: 11px; line-height: 1.7; overflow-wrap: anywhere; }
.pipeline-purpose-list span { color: var(--muted); }
.pipeline-inactive-sources details { margin: 6px 0; overflow-wrap: anywhere; }
.pipeline-progress-track { height: 5px; margin-top: 7px; overflow: hidden; border-radius: 10px; background: #dce3de; }
.pipeline-progress-track > span { display: block; height: 100%; background: #2c819e; }
.pipeline-card-body { margin-top: 8px; }
.pipeline-metric { display: grid; gap: 3px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.5; }
.pipeline-metric > span, .pipeline-metric > small, .pipeline-dependencies { color: var(--muted); overflow-wrap: anywhere; }
.pipeline-metric .pipeline-progress-track { margin-top: 0; }
.pipeline-subtitle { margin: 10px 0 3px; font-weight: 650; font-size: 11px; }
.pipeline-provider-details { margin: 8px 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; }
.pipeline-provider-details > summary { cursor: pointer; color: var(--muted); }
.pipeline-provider-details > [data-pipeline-vendor] { margin-top: 9px; }
.pipeline-provider-details p { line-height: 1.5; }
.work-controls-ready [data-legacy-work-controls] { display: none !important; }
.dashboard-work-panel, .work-global-toolbars { grid-column: 1 / -1; min-width: 0; border: 1px solid var(--line-strong); border-radius: 7px; padding: 10px; background: var(--surface-2); }
.dashboard-work-panel > summary { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; cursor: pointer; font-size: 12px; }
.dashboard-work-body { margin-top: 10px; }
.dashboard-work-add, .work-global-toolbars, .work-global-toolbars > div, .work-icon-actions, .pipeline-section-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.dashboard-work-add label { display: flex; align-items: center; gap: 6px; }
.dashboard-work-add select { min-width: 145px; }
.work-global-toolbars { justify-content: space-between; font-size: 11px; }
.work-global-toolbars > .muted { margin-left: auto; }
@media (max-width: 780px) { .work-global-toolbars > .muted { flex-basis: 100%; margin-left: 0; } }
.work-icon-actions { display: inline-flex; gap: 3px; flex-shrink: 0; }
button.work-icon-button { display: inline-grid; place-items: center; width: 29px; height: 28px; min-width: 29px; padding: 0; font-size: 15px; line-height: 1; border-radius: 5px; }
.work-group-select { display: inline-flex; align-items: center; gap: 5px; margin-right: 8px; font-size: 11px; font-weight: 400; color: var(--muted); }
.work-group-select input { width: 15px; height: 15px; margin: 0; }
.dashboard-work-overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 8px; margin: 10px 0; }
.dashboard-work-overview > div { display: grid; gap: 5px; font-size: 11px; overflow-wrap: anywhere; }
.dashboard-work-task-list > summary { cursor: pointer; font-size: 11px; }
[data-work-tasks] { max-height: 400px; overflow: auto; }
.dashboard-work-task { display: grid; gap: 4px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 11px; overflow-wrap: anywhere; }
.dashboard-work-task > div { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; }
.dashboard-work-task progress { width: 100%; height: 7px; accent-color: #2c819e; }
.dashboard-work-task small { color: var(--muted); }
.dashboard-work-body > .muted { font-size: 11px; line-height: 1.5; }
.pipeline-dependencies { margin: 4px 0; font-size: 11px; }
.pipeline-more { margin: 8px 0; }
.pipeline-more > summary { cursor: pointer; font-size: 11px; color: var(--accent); }
.coverage-summary { margin: 4px 0 6px; font-size: 11px; font-weight: 650; }
.coverage-row { margin: 0; padding: 7px 2px; border-top: 1px solid var(--line); font-size: 11px; }
.coverage-row > summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; cursor: pointer; list-style: none; }
.coverage-row > summary::-webkit-details-marker { display: none; }
.coverage-row > summary > strong { overflow-wrap: anywhere; }
.coverage-figure { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.coverage-notes { grid-column: 1 / -1; color: var(--muted); }
.coverage-row[data-coverage-status="gap"] .coverage-figure { color: var(--bad); }
.coverage-row[data-coverage-status="stale"] .coverage-figure { color: var(--watch); }
.coverage-row[data-coverage-status="complete"] .coverage-figure { color: var(--good); }
.coverage-bar { grid-column: 1 / -1; display: flex; height: 6px; overflow: hidden; border-radius: 10px; background: var(--line); }
.coverage-bar > [data-coverage="fresh"] { background: var(--good); }
.coverage-bar > [data-coverage="stale"] { background: #d69e2e; }
.coverage-bar > [data-coverage="failed"] { background: var(--bad); }
.coverage-bar > [data-coverage="missing"] { background: #8a948d; }
.coverage-body { margin: 6px 0 2px; color: var(--muted); line-height: 1.5; }
.coverage-body p { margin: 3px 0; overflow-wrap: anywhere; }
.coverage-body b { margin-right: 6px; color: var(--text); font-weight: 650; }
.coverage-problem { margin: 4px 0 6px; }
.coverage-problem > span { display: block; overflow-wrap: anywhere; }
.coverage-problem[data-coverage-state="failed"] > span { color: var(--bad); }
.coverage-problem > p { display: flex; flex-wrap: wrap; gap: 3px 8px; margin: 2px 0 0; }
.coverage-problem a { color: var(--accent); font-variant-numeric: tabular-nums; }
.source-health { margin: 8px 0 4px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 5px; font-size: 11px; }
.source-health > summary { cursor: pointer; color: var(--muted); }
.source-health-row { display: grid; gap: 2px; padding: 6px 0; border-top: 1px solid var(--line); line-height: 1.5; }
.source-health-row > span, .source-health-row > small { color: var(--muted); overflow-wrap: anywhere; }
.source-health-row[data-source-health-status="gap"] > strong { color: var(--bad); }
.source-health-row[data-source-health-status="warn"] > strong { color: var(--watch); }
.dashboard-progress-card { min-width: 0; margin: 0; padding: 8px 10px; }
.dashboard-progress-card > summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(42px, 1fr) minmax(0, 1.5fr); align-items: center; gap: 6px 9px; list-style: none; cursor: pointer; }
.dashboard-progress-card > summary::-webkit-details-marker { display: none; }
.dashboard-progress-card > summary::marker { content: ""; }
.dashboard-progress-card > summary > strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.dashboard-progress-card .dashboard-data-progress { min-width: 42px; height: 6px; }
.dashboard-progress-card .dashboard-data-progress-label { min-width: 0; overflow-wrap: anywhere; font-size: 10px; }
.dashboard-progress-card-body { margin-top: 8px; }
.dashboard-progress-card > p { margin-top: 7px; }
.dashboard-progress-card .price-batch-receipt { margin-top: 4px; font-variant-numeric: tabular-nums; }
.data-update-group .dashboard-data-status { margin: 8px 0 0; }
.data-update-group .genie-research-status, .data-update-group .fusion-research-status { position: static; width: 100%; max-width: none; margin: 8px 0 0; }
.data-update-group .genie-research-status { padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2); }
.data-update-group .genie-research-heading { margin-top: 6px; }
.data-update-group .genie-research-heading > strong { display: none; }
.data-update-group .dashboard-data-progress-heading { gap: 6px 8px; }
.data-update-group .dashboard-data-progress-label { white-space: normal; }
.data-update-group .genie-research-steps { grid-template-columns: 1fr 1fr; gap: 8px; }
.data-update-group .genie-research-steps > div:last-child { grid-column: 1 / -1; }
.data-update-group #forceRefreshProgressDetails, .data-update-group #apiJobProgressDetails { margin-top: 7px; overflow-wrap: anywhere; line-height: 1.6; }
@media (min-width: 1900px) { .data-update-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 780px) { .data-update-groups { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .data-update-groups { left: 10px; width: calc(100vw - 20px); margin: 10px 10px 0; } }
.dashboard-data-status[hidden] { display: none; }
.dashboard-data-status [hidden] { display: none; }
.dashboard-data-progress-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.dashboard-data-progress-heading > strong { font-size: 12px; white-space: nowrap; }
.dashboard-data-progress {
  display: flex;
  flex: 1 1 160px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce3de;
}
.dashboard-data-progress > span { flex: 0 0 auto; height: 100%; width: 0; }
.dashboard-data-progress-success { background: #30a467; }
.dashboard-data-progress-failed { background: #d34d4d; }
.dashboard-data-progress-cancelled { background: #8c9690; }
.dashboard-data-progress-checked { background: #277ca6; }
.financial-statement-progress-bar { background: #e6ecef; }
.dashboard-data-lane-details { display: grid; gap: 4px; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.dashboard-data-lane-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; border-top: 1px solid var(--line); padding-top: 4px; font-variant-numeric: tabular-nums; }
.dashboard-data-lane-row strong { color: var(--text); }
.dashboard-data-progress-label { font-variant-numeric: tabular-nums; white-space: nowrap; }
.dashboard-data-progress-failures { color: var(--bad); font-size: 11px; white-space: nowrap; }
.force-refresh-progress-bar { position: relative; }
.force-refresh-progress-bar.is-indeterminate > span { display: none; }
.force-refresh-progress-bar.is-indeterminate::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 32%;
  border-radius: inherit;
  background: #d39b28;
  content: "";
  animation: force-refresh-progress-sweep 1.25s ease-in-out infinite alternate;
}
.force-refresh-progress #forceRefreshProgressCancelledLabel { color: var(--muted); }
.force-refresh-progress #forceRefreshProgressDetails { margin-top: 4px; line-height: 1.45; }
@keyframes force-refresh-progress-sweep { from { transform: translateX(0); } to { transform: translateX(210%); } }
@media (prefers-reduced-motion: reduce) { .force-refresh-progress-bar.is-indeterminate::after { animation-duration: 3s; } }
.fusion-research-status { position: sticky; left: 16px; max-width: calc(100vw - 72px); box-sizing: border-box; }
.fusion-research-status [data-fusion-progress="passed"] { background: #30a467; }
.fusion-research-status [data-fusion-progress="notPassed"] { background: #bd8736; }
.fusion-research-status [data-fusion-progress="missing"] { background: #7896a5; }
.fusion-research-status [data-fusion-progress="failed"] { background: #d34d4d; }
.fusion-research-status .fusion-research-summary { margin-top: 5px; line-height: 1.5; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .fusion-research-status { left: 10px; max-width: calc(100vw - 44px); margin-left: 10px; margin-right: 10px; } }
.dashboard-data-status-details { margin-top: 4px; color: var(--muted); font-size: 11px; }
.dashboard-data-status-details > summary { width: fit-content; cursor: pointer; }
.dashboard-data-status-detail-body { display: grid; gap: 5px; margin-top: 6px; }
.dashboard-data-status-error { color: var(--bad); overflow-wrap: anywhere; }
.dashboard-data-legend { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.dashboard-data-status p { margin: 0; font-size: 12px; }
.dashboard-data-badge {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.dashboard-data-badge.saved { color: #475569; background: #eef1f4; border-color: #cbd5e1; }
.dashboard-data-badge.waiting { color: #6b5d31; background: #f7f3e8; border-color: #dfd5b7; }
.dashboard-data-badge.updating { color: #825000; background: #fff3cc; border-color: #e8bf5b; }
.dashboard-data-badge.updated { color: #166534; background: #dcf5e3; border-color: #86c99d; }
.dashboard-data-badge.failed { color: #9f2222; background: #fde8e8; border-color: #e8a3a3; }
.dashboard-data-badge.expired { color: #8a341d; background: #fff0e5; border-color: #ecb090; }
.dashboard-data-badge.limited { color: #7e22ce; background: #f3e8ff; border-color: #c084fc; }
.stock-data-badges { display: flex; flex-wrap: wrap; gap: 0 5px; overflow: visible; }
.stock-data-badges:empty { display: none; }
.stock-data-badges .dashboard-data-badge { white-space: normal; }
.dashboard-row-status { position: relative; z-index: 1; width: fit-content; max-width: 100%; cursor: help; overflow-wrap: anywhere; }
.dashboard-row-status:hover, .dashboard-row-status:focus { z-index: 25; }
.dashboard-row-status:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dashboard-row-status-tooltip {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  width: max-content;
  min-width: 220px;
  max-width: min(380px, calc(100vw - 28px));
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px rgb(21 35 28 / 20%);
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
}
.dashboard-row-status-tooltip strong { display: block; margin-bottom: 4px; }
.dashboard-row-status-tooltip > div + div { margin-top: 3px; }
.dashboard-row-status:hover .dashboard-row-status-tooltip,
.dashboard-row-status:focus .dashboard-row-status-tooltip { display: block; }
@media (max-width: 600px) {
  .dashboard-row-status-tooltip {
    position: fixed;
    left: 14px;
    top: auto;
    bottom: 16px;
    width: calc(100vw - 28px);
    min-width: 0;
    max-width: none;
    max-height: 65vh;
    overflow: auto;
  }
}
tr.dashboard-row-saved td:nth-child(3) { box-shadow: inset 3px 0 #94a3b8; }
tr.dashboard-row-waiting td:nth-child(3) { box-shadow: inset 3px 0 #c6b474; }
tr.dashboard-row-updating td:nth-child(3) { box-shadow: inset 3px 0 #e4aa21; }
tr.dashboard-row-updated td:nth-child(3) { box-shadow: inset 3px 0 #30a467; }
tr.dashboard-row-failed td:nth-child(3) { box-shadow: inset 3px 0 #d34d4d; }
/* Dashboard distribution statistics page */
.dashboard-statistics-page { max-width: 1800px; margin: 18px auto 48px; padding: 0 20px; color: var(--text); }
.dashboard-statistics-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.dashboard-statistics-heading h2 { margin: 0; font-size: 1.45rem; }
.dashboard-statistics-heading p { margin: 5px 0 0; }
.dashboard-statistics-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dashboard-statistics-load-state { display: flex; align-items: center; gap: 13px; margin: 16px 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); }
.dashboard-statistics-load-state p { margin: 4px 0 0; color: var(--muted); }
.dashboard-statistics-load-state.is-error { display: block; border-color: #d34d4d; }
.dashboard-statistics-load-state.is-error button { margin-top: 10px; }
.dashboard-statistics-spinner { width: 22px; height: 22px; flex: 0 0 22px; border: 3px solid color-mix(in srgb, var(--line) 70%, transparent); border-top-color: var(--accent); border-radius: 50%; animation: dashboard-statistics-spin .8s linear infinite; }
@keyframes dashboard-statistics-spin { to { transform: rotate(360deg); } }
#dashboardStatisticsScope[hidden], #dashboardStatisticsOverview[hidden], .dashboard-statistics-grid[hidden], .dashboard-statistics-load-state[hidden] { display: none; }
.dashboard-statistics-scope { margin: 8px 0 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--muted); }
.dashboard-statistics-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.dashboard-statistics-kpi { padding: 13px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.dashboard-statistics-kpi span { display: block; color: var(--muted); font-size: .86rem; }
.dashboard-statistics-kpi strong { display: block; margin-top: 5px; font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.dashboard-statistics-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr) minmax(280px, .8fr); align-items: start; gap: 14px; }
.dashboard-statistics-card { min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 2px 10px #172b3b0a; }
.dashboard-statistics-card h3 { margin: 0 0 5px; font-size: 1.14rem; }
.dashboard-statistics-card h4 { margin: 19px 0 8px; font-size: .94rem; }
.dashboard-statistics-card > .muted { margin: 0; line-height: 1.55; font-size: .83rem; }
.dashboard-statistics-distribution { display: grid; gap: 9px; }
.dashboard-statistics-row { min-width: 0; }
.dashboard-statistics-row-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; font-size: .86rem; }
.dashboard-statistics-row-heading > span:first-child { overflow-wrap: anywhere; }
.dashboard-statistics-row-heading strong { white-space: nowrap; font-variant-numeric: tabular-nums; }
.dashboard-statistics-track { height: 7px; overflow: hidden; border-radius: 9px; background: color-mix(in srgb, var(--line) 58%, transparent); }
.dashboard-statistics-track > span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.dashboard-statistics-row[data-stat-tone="good"] .dashboard-statistics-track > span { background: #30a467; }
.dashboard-statistics-row[data-stat-tone="bad"] .dashboard-statistics-track > span { background: #d34d4d; }
.dashboard-statistics-row[data-stat-tone="watch"] .dashboard-statistics-track > span { background: #d39a3b; }
.dashboard-statistics-row[data-stat-tone="muted"] .dashboard-statistics-track > span { background: #8a9ba5; }
.dashboard-statistics-failure-list { display: grid; gap: 8px; }
.dashboard-statistics-failure-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: .72rem; }
.dashboard-statistics-failure-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dashboard-statistics-failure-legend i { width: 9px; height: 9px; border-radius: 2px; }
.dashboard-statistics-failure-legend .is-complete { background: #d34d4d; }
.dashboard-statistics-failure-legend .is-unknown { background: #d39a3b; }
.dashboard-statistics-failure-row { min-width: 0; }
.dashboard-statistics-failure-heading, .dashboard-statistics-failure-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .78rem; font-variant-numeric: tabular-nums; }
.dashboard-statistics-failure-heading strong { font-weight: 600; }
.dashboard-statistics-failure-heading > span, .dashboard-statistics-failure-meta { color: var(--muted); }
.dashboard-statistics-failure-heading > span { white-space: nowrap; }
.dashboard-statistics-failure-track { display: flex; height: 8px; overflow: hidden; margin: 3px 0 2px; border-radius: 8px; background: color-mix(in srgb, var(--line) 58%, transparent); }
.dashboard-statistics-failure-track span { display: block; height: 100%; min-width: 0; transition: width .2s ease; }
.dashboard-statistics-failure-track .is-complete { background: #d34d4d; }
.dashboard-statistics-failure-track .is-unknown { background: #d39a3b; }
.dashboard-statistics-failure-meta { justify-content: flex-start; flex-wrap: wrap; gap: 3px 12px; font-size: .7rem; }
.dashboard-statistics-failure-list > .muted { margin: 3px 0 0; font-size: .72rem; }
.dashboard-statistics-rule-list { display: grid; gap: 11px; }
.dashboard-statistics-rule-name { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; font-size: .82rem; }
.dashboard-statistics-rule-name small { color: var(--muted); text-align: right; }
.dashboard-statistics-rule-stack { display: flex; height: 8px; overflow: hidden; border-radius: 8px; background: color-mix(in srgb, var(--line) 58%, transparent); }
.dashboard-statistics-rule-stack span { min-width: 0; }
.dashboard-statistics-rule-stack .is-pass { background: #30a467; }
.dashboard-statistics-rule-stack .is-fail { background: #d34d4d; }
.dashboard-statistics-rule-stack .is-unknown { background: #8a9ba5; }
.dashboard-statistics-rule-meta { margin-top: 3px; color: var(--muted); font-size: .72rem; line-height: 1.4; }
body.statistics-mode .topbar .actions,
body.statistics-mode #providerRateLimitPanel,
body.statistics-mode .data-update-groups,
body.statistics-mode #dashboardFilters,
body.statistics-mode .layout,
body.statistics-mode #detailPanel { display: none !important; }
body.statistics-mode .dashboard-statistics-page { display: block; }
@media (max-width: 1120px) {
  .dashboard-statistics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-statistics-card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 680px) {
  .dashboard-statistics-page { margin: 12px auto 30px; padding: 0 10px; }
  .dashboard-statistics-heading { align-items: flex-start; flex-direction: column; }
  .dashboard-statistics-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-statistics-grid { grid-template-columns: minmax(0, 1fr); }
  .dashboard-statistics-card:first-child { grid-column: auto; }
  .dashboard-statistics-card { padding: 13px; }
}
:root { --sec-sync-border: #d5dfd8; }
.sec-sync-dashboard { margin: 12px 14px; padding: 12px 16px; border: 1px solid var(--sec-sync-border); border-radius: 9px; background: #f6f9f6; font-size: 12px; }
.sec-sync-dashboard h2 { font-size: 14px; margin: 0; }
.sec-sync-dashboard p { margin: 5px 0; overflow-wrap: anywhere; }
.sec-sync-history { width: 100%; overflow-x: auto; }
.sec-sync-toast { position: fixed; right: 22px; bottom: 24px; z-index: 10000; max-width: min(520px, 85vw); padding: 12px 18px; color: #fff; background: #23785a; box-shadow: 0 3px 16px #0003; border-radius: 8px; font-size: 14px; }
.sec-sync-toast.is-error { background: #a12e30; }
.dashboard-price-schedule-settings { margin: 16px 0 12px; padding: 12px 16px; border: 1px solid var(--sec-sync-border, #d5dfd8); border-radius: 8px; }
.dashboard-price-schedule-settings legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.dashboard-price-time { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin-bottom: 14px; font-size: 13px; }
.dashboard-price-time input { width: 155px; }
.dashboard-price-weekdays { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.dashboard-price-weekdays label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.dashboard-price-weekdays input { margin: 0; }
/* OHLCV provider capabilities */
.ohlcv-provider-card { border: 1px solid #d5dfd5; border-radius: 8px; padding: 14px; margin: 16px 0; }
.ohlcv-provider-card h3 { margin-top: 0; }
.ohlcv-timeframes { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.ohlcv-timeframes label { display: flex; align-items: center; gap: 5px; }
.ohlcv-timeframes input { width: auto; }
.ohlcv-unsupported { color: #87928b; }
#ohlcvSettingsPanel .ui-settings-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); align-items: end; }
#ohlcvSettingsPanel .ui-settings-grid .toggle { display: flex; box-sizing: border-box; }

.investing-access { margin: 6px 0; padding: 8px; border: 1px solid #d6c798; border-radius: 6px; background: #fff9e8; }
.investing-access-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.investing-access small { display: block; line-height: 1.6; }
.investing-verification-dialog { max-width: min(520px, 90vw); border: 1px solid #a6b8ae; border-radius: 10px; padding: 20px; }
.investing-verification-dialog::backdrop { background: #0007; }
.stock-source-wait-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.stock-source-wait [data-stock-wait-status] { font-weight: 600; }
.stock-source-wait [data-stock-wait-message] { color: #9d3929; overflow-wrap: anywhere; }
.stock-source-wait-note { font-size: 0.9em; color: #586d64; max-width: 60em; line-height: 1.6; }

.ohlcv-pool-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 10px; margin-top: 14px; }
.ohlcv-pool-options label { display: grid; grid-template-columns: auto 1fr; gap: 5px 8px; align-items: center; border: 1px solid var(--line); border-radius: 7px; padding: 10px; }
.ohlcv-pool-options input { width: auto; margin: 0; }
.ohlcv-pool-options small { grid-column: 2; color: var(--muted); font-size: 11px; line-height: 1.5; }
.ownership-columns-hidden .ownership-col,
.ownership-columns-hidden .ownership-cell,
.ownership-columns-hidden [data-ownership-filter] { display: none; }
.source-switch-group { display: grid; gap: 8px; margin: 10px 0 14px; }
.source-switch { display: flex; align-items: flex-start; gap: 9px; margin: 8px 0 12px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); cursor: pointer; }
.source-switch-group .source-switch { margin: 0; }
.source-switch input { flex: none; width: auto; margin: 3px 0 0; }
.source-switch > span { display: grid; gap: 3px; min-width: 0; }
.source-switch small { color: var(--muted); font-size: 12px; line-height: 1.5; }

/* Status lights: green pulse while a stock is being fetched or calculated,
   amber while queued, grey while paused. Idle lights stay hidden. */
.work-light { display: none; flex: none; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: middle; position: relative; top: -1px; }
.work-light[data-queue] { display: inline-block; }
.work-light[data-queue="queued"] { background: var(--watch); }
.work-light[data-queue="paused"] { background: var(--muted); }
.work-light[data-light="running"], .work-light[data-queue="running"] { display: inline-block; background: #1fa463; box-shadow: 0 0 0 0 rgba(31, 164, 99, .55); animation: work-light-pulse 1.4s ease-out infinite; }
.data-update-group > h2 > .work-light { width: 10px; height: 10px; margin: 0 0 0 8px; }
@keyframes work-light-pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 164, 99, .55); } 70% { box-shadow: 0 0 0 6px rgba(31, 164, 99, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 164, 99, 0); } }
@media (prefers-reduced-motion: reduce) { .work-light[data-light="running"], .work-light[data-queue="running"] { animation: none; } }
