/* --- General Body and Layout --- */
:root {
    --eye-page-bg: #f6f8fb;
    --eye-surface: #ffffff;
    --eye-surface-soft: #f6f8fb;
    --eye-border: #e1e6ed;
}

.refresh-diagnostics {
    margin: 22px 0 10px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    color: #2f3b52;
}
.refresh-diagnostics-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:10px; }
.refresh-diagnostics-head h2 { margin:0; font-size:15px; font-weight:600; }
.refresh-diagnostics-head span { color:#8a94a6; font-size:12px; }
.refresh-diagnostics-table-wrap { overflow-x:auto; }
.refresh-diagnostics table { width:100%; min-width:900px; border-collapse:collapse; }
.refresh-diagnostics th,
.refresh-diagnostics td { padding:7px 8px; border-bottom:1px solid #edf1f6; text-align:left; white-space:nowrap; font-size:12px; font-weight:400; }
.refresh-diagnostics th { color:#6b7280; background:#f8fafc; }
.refresh-diagnostics td:nth-child(2) { max-width:300px; overflow:hidden; text-overflow:ellipsis; }
.refresh-diagnostics-error { color:#c0392b; }
body.dark .refresh-diagnostics { border-color:#252525; background:#121212; color:#e3e3e3; }
body.dark .refresh-diagnostics th { color:#858585; background:#1e1e1e; }
body.dark .refresh-diagnostics th,
body.dark .refresh-diagnostics td { border-color:#252525; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--eye-page-bg);
    color: #333;
    margin: 0;
    padding: 10px 20px 20px;
}

.container {
    width: 90%;
    margin: 0 auto;
    background: var(--eye-surface);
    padding: 12px 25px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* --- Header and Navigation --- */
.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 8px;
    margin-bottom: 10px;
}

.header-icon-tools {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    margin-right: 10px;
}

.mobile-nav-toggle,
.mobile-search-toggle {
    display: none;
}

#realtime-title {
    color: #1a2b4d;
    font-size: 24px;
    margin: 0;
}

nav a {
    margin-left: 15px;
    text-decoration: none;
    color: #555;
    padding: 8px 12px;
    font-size: 14px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

nav a.nav-secondary,
nav .nav-dropdown.nav-secondary .nav-dropdown-toggle {
    font-size: 12px;
    padding: 7px 10px;
}

nav a.active,
nav .nav-dropdown.active .nav-dropdown-toggle {
    background-color: #f7f2e7;
    color: #253a62;
    box-shadow: inset 0 -2px 0 #d6b06a;
    font-weight: 700;
}

nav a:hover {
    background-color: #e9ecef;
}

.nav-icon {
    display: inline-block;
    margin-right: 4px;
    line-height: 1;
    vertical-align: -1px;
}

.nav-dropdown {
    position: relative;
    display: inline-block;
    margin-left: 15px;
}

.nav-dropdown-toggle {
    display: inline-block;
    cursor: pointer;
    color: #555;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
    user-select: none;
}

.nav-dropdown > .nav-dropdown-toggle {
    margin-left: 0;
}

.nav-dropdown-toggle::after {
    content: " ▾";
    font-size: 10px;
    opacity: 0.7;
}

.nav-dropdown:hover .nav-dropdown-toggle {
    background-color: #e9ecef;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    min-width: 100%;
    padding: 6px;
    padding-top: 12px;
    background: var(--eye-surface);
    border: 1px solid var(--eye-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
    z-index: 1100;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    margin: 0;
    padding: 7px 9px;
    border-radius: 5px;
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
}

.nav-dropdown-menu a + a {
    margin-top: 2px;
}

.search-container {
    position: relative; /* 为建议列表的定位提供基准 */
    display: flex;
    align-items: center;
}

.autocomplete-results {
    display: none;
    position: absolute;
    top: 100%; /* 位于输入框正下方 */
    left: 0;
    right: 0;
    border: 1px solid var(--eye-border);
    border-top: none;
    background-color: var(--eye-surface);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    border-radius: 0 0 5px 5px;
}

.autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.autocomplete-item:hover {
    background-color: var(--eye-surface-soft);
}

#search-form {
    display: flex;
}

#search-input {
    border: 1px solid var(--eye-border);
    border-right: none;
    background: #fffefa;
    padding: 6px 12px;
    border-radius: 5px 0 0 5px;
    font-size: 14px;
}

#search-form button {
    border: 1px solid #253a62;
    background-color: #253a62;
    color: white;
    padding: 6px 12px;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    font-size: 14px;
}

/* --- Tables --- */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 0;
    border-bottom: 1px solid #e8edf2;
    padding: 10px 14px;
    text-align: left;
    vertical-align: middle;
    font-size: 12px;
    font-weight: 400;
    font-variant-numeric: tabular-nums;
}

thead th {
    background-color: #f7f9fb;
    color: #bdc4cb;
    font-size: 11px;
    font-weight: 400;
    position: sticky;
    top: 0;
}

tbody tr:nth-child(even) {
    background-color: transparent;
}

tbody tr:hover td {
    background: #f7f9fc;
}

/* --- Utility Classes (Red for Up, Green for Down) --- */
.positive, .up {
    color: #f6465d;
}

.negative, .down {
    color: #2ebd85;
}

.sortable {
    cursor: pointer;
}

.sortable::after {
    content: ' \2195';
    opacity: 0.3;
}

.sortable.asc::after {
    content: ' \25B2';
    opacity: 1;
}

.sortable.desc::after {
    content: ' \25BC';
    opacity: 1;
}

.error {
    color: #f6465d;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

/* --- Forms and Controls --- */
.control-panel {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: flex-start;
}

.input-group {
/* Limit textarea width on index page */
    flex-grow: 1;
}

.input-group-left {
    flex: 1;
/* Limit textarea width on tracker page */
}

#codes {
    width: 100%;
    height: 120px;
    border-radius: 5px;
    border: 1px solid var(--eye-border);
    background: #fffefa;
    padding: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

body:not(.dark) input,
body:not(.dark) select,
body:not(.dark) textarea {
    background-color: #fffefa;
    border-color: var(--eye-border);
}

.control-panel button {
    padding: 8px 15px;
    font-size: 14px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background-color: #253a62;
    color: white;
    transition: background-color 0.3s;
}

.control-panel button:hover {
    background-color: #2c4f93;
}

/* --- Target Groups Page --- */
.target-groups-page {
    padding: 8px 0 24px;
}

.target-groups-market-summary {
    display: grid;
    grid-template-columns: minmax(260px, 0.62fr) minmax(390px, 1fr) auto;
    align-items: stretch;
    justify-content: start;
    gap: 12px;
    margin-bottom: 12px;
    padding: 8px;
    border: 1px solid var(--eye-border);
    border-radius: 8px;
    background: var(--eye-surface);
}

.market-summary-amounts {
    display: grid;
    grid-template-columns: minmax(188px, 210px) repeat(2, minmax(240px, 280px));
    gap: 6px;
}

.market-summary-breadth {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    justify-self: start;
    margin-right: 6px;
    padding: 7px 9px;
    border: 1px solid var(--eye-border);
    border-radius: 6px;
    background: var(--eye-surface-soft);
}

.market-summary-breadth-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    position: relative;
}

.market-summary-breadth-head strong {
    font-size: .86rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.market-summary-down-count {
    color: #1eaa59;
}

.market-summary-up-count {
    color: #e7354b;
}

.market-summary-breadth-bar {
    display: flex;
    align-items: stretch;
    width: 100%;
    height: 6px;
    margin-top: 7px;
    margin-left: auto;
    margin-right: auto;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf3;
}

.market-summary-down-bar {
    width: var(--down-width, 0%);
    background: #18b765;
}

.market-summary-flat-bar {
    width: var(--flat-width, 0%);
    min-width: var(--flat-min-width, 0);
    background: #a7adb8;
    box-shadow: inset 2px 0 0 rgba(255,255,255,.86), inset -2px 0 0 rgba(255,255,255,.86);
}

.market-summary-up-bar {
    width: var(--up-width, 0%);
    background: #ff304b;
}

.market-summary-flat-count {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    color: #7b8495;
    font-size: .68rem;
    font-weight: 500;
    white-space: nowrap;
}

.market-summary-item {
    min-width: 0;
    padding: 7px 9px;
    border: 1px solid var(--eye-border);
    border-radius: 6px;
    background: var(--eye-surface-soft);
}

.market-summary-chart-trigger {
    width: 100%;
    color: inherit;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.market-summary-chart-trigger:hover,
.market-summary-chart-trigger:focus-visible {
    border-color: #E0E0E0;
    outline: none;
}

.market-summary-label {
    display: block;
    color: #6b7486;
    font-size: 0.72rem;
    line-height: 1.2;
    white-space: nowrap;
}

.market-summary-item strong {
    display: flex;
    align-items: baseline;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 3px;
    color: #1f2a44;
    font-size: .88rem;
    font-weight: 500;
    line-height: 1.15;
}

.market-summary-item strong.up {
    color: #c0392b;
}

.market-summary-item strong.down {
    color: #1e8449;
}

.market-summary-item .up {
    color: #c0392b;
}

.market-summary-item .down {
    color: #1e8449;
}

.market-summary-pair-value {
    gap: 4px;
}

.market-summary-pair-value span {
    white-space: nowrap;
}

.market-summary-flow-card {
    min-width: 0;
}

.market-summary-flow-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin-top: 3px;
}

.market-summary-flow-row .market-summary-pair-value {
    flex: 0 0 auto;
    margin-top: 0;
}

.market-summary-main-spark {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    height: 18px;
}

.market-summary-main-spark svg {
    display: block;
    width: 100%;
    height: 100%;
}

.market-summary-main-spark-zero,
.market-summary-main-spark-line {
    fill: none;
    vector-effect: non-scaling-stroke;
}

.market-summary-main-spark-zero {
    stroke: rgba(154, 163, 178, .45);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.market-summary-main-spark-line {
    stroke: #9aa3b2;
    stroke-width: 1.8;
}

.market-summary-main-spark-line.up {
    stroke: #c0392b;
}

.market-summary-main-spark-line.down {
    stroke: #1e8449;
}

.market-summary-turnover-spark-today,
.market-summary-turnover-spark-previous {
    fill: none;
    vector-effect: non-scaling-stroke;
}

.market-summary-turnover-spark-today {
    stroke: #4a90d9;
    stroke-width: 1.8;
}

.market-summary-turnover-spark-previous {
    stroke: #9aa3b2;
    stroke-width: 1.4;
    stroke-dasharray: 3 2;
}

.market-summary-separator {
    color: #9aa3b2;
}

.market-summary-change {
    font-style: normal;
    font-size: .72rem;
    font-weight: 500;
}

.market-summary-change.up {
    color: #c0392b;
}

.market-summary-change.down {
    color: #1e8449;
}

.market-summary-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 150px;
    color: #7b8495;
    font-size: 0.74rem;
    line-height: 1.35;
    text-align: right;
}

.target-groups-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.target-groups-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    width: 100%;
}

.target-groups-title-row .target-groups-subtitle {
    margin: 0;
}

.target-groups-head h2 {
    margin: 0;
    font-size: 1.15rem;
    color: #253a62;
}

.target-groups-manage-section {
    margin-top: 26px;
    padding-top: 18px;
    border-top: 1px solid var(--eye-border);
}

.target-groups-subtitle {
    margin: 4px 0 0;
    color: #67748c;
    font-size: 0.82rem;
}

.target-groups-count {
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef3ff;
    color: #2c4f93;
    font-size: 0.76rem;
    font-weight: 700;
    white-space: nowrap;
}

.target-groups-view-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 3px;
    background: var(--eye-surface-soft);
    border: 1px solid var(--eye-border);
    border-radius: 8px;
}

.target-groups-toggle-btn {
    border: 0;
    background: transparent;
    color: #59657e;
    border-radius: 5px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.segmented-control {
    --segmented-count: 2;
    --segmented-index: 0;
    position: relative;
    display: inline-grid;
    grid-template-columns: repeat(var(--segmented-count), minmax(max-content, 1fr));
    align-items: center;
    gap: 0;
    max-width: 100%;
    padding: 3px;
    border: 1px solid var(--eye-border);
    border-radius: 999px;
    background: var(--eye-surface-soft);
    overflow-x: auto;
    scrollbar-width: none;
}

.segmented-control::-webkit-scrollbar {
    display: none;
}

.segmented-control::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc((100% - 6px) / var(--segmented-count));
    border-radius: 999px;
    background: #253a62;
    transform: translateX(calc(var(--segmented-index) * 100%));
    transition: transform .22s ease;
    pointer-events: none;
}

.segmented-control > button,
.segmented-control > .stock-meta-tab,
.segmented-control > .note-detail-tab-btn {
    position: relative;
    z-index: 1;
    border: 0;
    border-radius: 999px;
    background: transparent;
    box-shadow: none;
    color: #59657e;
    white-space: nowrap;
}

.segmented-control > button:hover,
.segmented-control > .stock-meta-tab:hover,
.segmented-control > .note-detail-tab-btn:hover {
    background: transparent;
}

.segmented-control > button.active,
.segmented-control > .stock-meta-tab.active,
.segmented-control > .note-detail-tab-btn.active {
    background: transparent;
    color: #fff;
}

.target-groups-view-toggle.segmented-control,
.note-flow-tabs.segmented-control,
.compare-tabs.segmented-control,
.etf-tabs.segmented-control,
.stock-meta-tabs.segmented-control,
.note-detail-tabs.segmented-control {
    display: inline-grid;
    flex-wrap: nowrap;
    gap: 0;
}

.segmented-control > button.active,
.segmented-control > .stock-meta-tab.active,
.segmented-control > .note-detail-tab-btn.active,
body.dark .segmented-control > button.active,
body.dark .segmented-control > .stock-meta-tab.active,
body.dark .segmented-control > .note-detail-tab-btn.active {
    background: transparent;
    border-color: transparent;
    color: #fff;
    box-shadow: none;
}

.segmented-control > button:not(.active):hover,
.segmented-control > .stock-meta-tab:not(.active):hover,
.segmented-control > .note-detail-tab-btn:not(.active):hover,
body.dark .segmented-control > button:not(.active):hover,
body.dark .segmented-control > .stock-meta-tab:not(.active):hover,
body.dark .segmented-control > .note-detail-tab-btn:not(.active):hover {
    background: transparent;
}

body.dark .segmented-control {
    background: #121212;
    border-color: #252525;
}

body.dark .segmented-control::before {
    background: #303030;
}

body.dark .segmented-control > button,
body.dark .segmented-control > .stock-meta-tab,
body.dark .segmented-control > .note-detail-tab-btn {
    color: #858585;
}

.target-groups-toggle-btn.active {
    background: transparent;
    color: #fff;
}

.target-groups-compact-btn {
    margin-left: auto;
    position: relative;
    display: inline-grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    width: 112px;
    height: 31px;
    padding: 3px;
    border: 1px solid var(--eye-border);
    border-radius: 999px;
    background: var(--eye-surface-soft);
    color: #59657e;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35);
}

.target-groups-compact-btn::before {
    content: "";
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    background: #253a62;
    border-radius: 999px;
    transition: transform .22s ease;
}

.target-groups-compact-btn.active::before {
    transform: translateX(calc(100% + 3px));
}

.target-groups-compact-label {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    line-height: 1;
    transition: color .18s ease;
}

.target-groups-compact-label-normal {
    color: #fff;
}

.target-groups-compact-label-compact {
    color: #59657e;
}

.target-groups-compact-btn.active .target-groups-compact-label-normal {
    color: #59657e;
}

.target-groups-compact-btn.active .target-groups-compact-label-compact {
    color: #fff;
}

.target-groups-compact-btn:hover,
.target-groups-compact-btn:focus-visible {
    border-color: #b8c7e6;
    outline: none;
}

.target-groups-note-cloud {
    margin-top: 8px;
}

.target-groups-note-cloud-float-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    min-height: 34px;
    margin: 0;
    padding: 0;
    border: 1px solid #c9d6e8;
    border-radius: 999px;
    background: #fff;
    color: #38557d;
    box-shadow: 0 3px 12px rgba(34, 60, 96, .16);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.target-groups-note-cloud-float-btn span {
    display: none;
}

.target-groups-note-cloud-float-btn:hover,
.target-groups-note-cloud-float-btn:focus-visible {
    border-color: #8fa9cb;
    outline: none;
}

.target-groups-note-cloud-modal-mask {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 22px;
    background: rgba(15, 23, 42, .48);
}

.target-groups-note-cloud-modal-mask.open {
    display: flex;
}

.target-groups-note-cloud-modal {
    display: flex;
    flex-direction: column;
    width: min(calc(90vw + 18px), calc(100vw - 44px));
    height: min(calc(80vh - 76px), 622px);
    overflow: hidden;
    border: 1px solid #d8e1ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 20px 55px rgba(15, 23, 42, .32);
}

.target-groups-note-cloud-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    padding: 0 14px;
    border-bottom: 1px solid #e6edf5;
    cursor: grab;
    user-select: none;
}

.target-groups-note-cloud-modal-head h2 {
    margin: 0;
    color: #253a62;
    font-size: 15px;
    font-weight: 700;
}

.target-groups-note-cloud-modal-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6c7890;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.target-groups-note-cloud-modal-close:hover,
.target-groups-note-cloud-modal-close:focus-visible {
    background: #eef3fb;
    outline: none;
}

.target-groups-note-cloud-modal-content {
    flex: 1;
    min-height: 0;
    margin: 0;
}

.target-groups-note-cloud-modal-content .note-cloud-map {
    height: 100%;
}

.global-note-cloud-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 8px;
}

.global-note-cloud-content .note-cloud-map {
    height: 100%;
}

.global-note-cloud-frame {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #fff;
}

.global-note-cloud-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
    gap: 8px;
}

.global-note-cloud-category {
    margin: 0 0 14px;
}

.global-note-cloud-category h3 {
    margin: 0 0 6px;
    color: #253a62;
    font-size: 14px;
    font-weight: 700;
}

.global-note-cloud-tile {
    min-height: 62px;
    padding: 8px;
    border: 1px solid #d9e2ee;
    border-radius: 7px;
    background: #f8fafc;
    color: #334155;
    text-decoration: none;
}

.global-note-cloud-tile:hover { border-color: #9db3ce; text-decoration: none; }
.global-note-cloud-tile.up { border-left: 4px solid #c0392b; }
.global-note-cloud-tile.down { border-left: 4px solid #1e8449; }
.global-note-cloud-tile-name { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:700; }
.global-note-cloud-tile-meta { display:block; margin-top:5px; color:#718096; font-size:12px; }
.global-note-cloud-tile .up { color:#c0392b; }
.global-note-cloud-tile .down { color:#1e8449; }

body.dark .target-groups-note-cloud-float-btn {
    border-color: #3b4654;
    background: #1e1e1e;
    color: #e3e3e3;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .32);
}

body.dark .target-groups-note-cloud-modal {
    border-color: #252525;
    background: #121212;
}

body.dark .target-groups-note-cloud-modal-head {
    border-color: #252525;
}

body.dark .target-groups-note-cloud-modal-head h2 {
    color: #e3e3e3;
}

body.dark .target-groups-note-cloud-modal-close {
    color: #858585;
}

body.dark .target-groups-note-cloud-modal-close:hover,
body.dark .target-groups-note-cloud-modal-close:focus-visible {
    background: #1e1e1e;
}

body.dark .global-note-cloud-category h3 { color:#e3e3e3; }
body.dark .global-note-cloud-tile { border-color:#252525; background:#1e1e1e; color:#e3e3e3; }
body.dark .global-note-cloud-tile:hover { border-color:#4c637d; }
body.dark .global-note-cloud-tile-meta { color:#858585; }
body.dark .global-note-cloud-frame { background:#121212; }

@media (max-width: 900px) {
    .target-groups-market-summary {
        grid-template-columns: 1fr;
    }

    .market-summary-breadth {
        width: 100%;
    }

    .market-summary-meta {
        justify-content: flex-start;
        text-align: left;
    }
}

@media (max-width: 700px) {
    .market-summary-amounts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .market-summary-flow-card,
    .market-summary-spark-card {
        grid-column: 1 / -1;
    }
}

.note-cloud-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 6px;
    color: #7c8798;
    font-size: 12px;
    font-weight: 700;
}

.note-cloud-toolbar-up {
    color: #c0392b;
}

.note-cloud-toolbar-down {
    color: #27ae60;
}

.note-cloud-map {
    position: relative;
    width: 100%;
    height: clamp(400px, calc(80vh - 138px), 560px);
    background: #222a35;
    overflow: hidden;
}

.note-cloud-category {
    position: absolute;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
    background: #222a35;
    border: 1px solid #222a35;
}

.note-cloud-category-title {
    position: absolute;
    display: flex;
    align-items: center;
    left: 1px;
    top: 1px;
    right: 1px;
    margin: 0;
    color: #f7f9fc;
    background: #303846;
    padding: 6px 8px;
    font-size: var(--category-title-size, 15px);
    line-height: 1.2;
    font-weight: 900;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    z-index: 2;
}

.note-cloud-category-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-cloud-category-performance {
    margin-left: 6px;
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
}

.note-cloud-category-performance.up {
    color: #ff5263;
}

.note-cloud-category-performance.down {
    color: #27c467;
}

.note-cloud-category-performance.flat {
    color: rgba(247,249,252,0.64);
}

.note-cloud-category-title .note-cloud-change {
    position: static;
    display: inline-flex;
    flex: 0 0 auto;
    margin-left: auto;
}

.note-cloud-tiles {
    position: absolute;
    inset: var(--category-title-height, 22px) 1px 1px 1px;
    background: #222a35;
    overflow: hidden;
}

.note-cloud-tile {
    position: absolute;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    padding: 1px 3px;
    border: 1px solid var(--tile-border, rgba(255,255,255,0.08));
    border-radius: 2px;
    color: #fff;
    text-decoration: none;
    line-height: 1.1;
    background: var(--tile-bg, #46515f);
}

.note-cloud-tile:hover {
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.38);
    text-decoration: none;
}

.note-cloud-tile.flat {
    background: #46515f;
}

.note-cloud-name {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    font-size: var(--tile-name-size, 13px);
    font-weight: 900;
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: var(--tile-name-lines, 2);
    -webkit-box-orient: vertical;
}

.note-cloud-pct {
    margin-top: 1px;
    color: rgba(255,255,255,0.88);
    font-size: var(--tile-pct-size, 12px);
    font-weight: 700;
}

.note-cloud-count {
    position: absolute;
    right: 2px;
    bottom: 1px;
    color: rgba(255,255,255,0.68);
    font-size: 9px;
}

.note-cloud-count[role="button"] {
    z-index: 3;
    cursor: pointer;
}

.note-cloud-count[role="button"]::before {
    content: '';
    position: absolute;
    inset: -7px -6px;
}

.note-cloud-change {
    position: absolute;
    top: 2px;
    right: 2px;

    padding: 1px 4px;
    border-radius: 4px;
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(120, 128, 140, 0.76);
    box-shadow: 0 1px 4px rgba(0,0,0,0.22);
}

.note-cloud-change.up {
    background: rgba(192, 57, 43, 0.86);
}

.note-cloud-change.down {
    background: rgba(39, 174, 96, 0.86);
}

.note-cloud-change.flat {
    background: rgba(120, 128, 140, 0.76);
}

.note-cloud-empty {
    padding: 22px;
    text-align: center;
    color: #67748c;
    background: var(--eye-surface-soft);
    border: 1px solid var(--eye-border);
    border-radius: 8px;
}

@media (max-width: 980px) {
    .note-cloud-map {
        height: clamp(384px, calc(80vh - 130px), 544px);
    }
}

@media (max-width: 640px) {
    .note-cloud-map {
        height: clamp(400px, calc(80vh - 120px), 592px);
    }
}

.target-groups-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr)) auto;
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
    padding: 12px;
    background: var(--eye-surface-soft);
    border: 1px solid var(--eye-border);
    border-radius: 8px;
}

.target-groups-form label {
    display: block;
    margin-bottom: 5px;
    font-size: 12px;
    color: #59657e;
    font-weight: 600;
}

.target-groups-form input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--eye-border);
    border-radius: 5px;
    padding: 8px;
    font-size: 14px;
}

.target-groups-stocks-field {
    grid-column: 1 / 3;
}

.target-groups-form textarea {
    width: 100%;
    min-height: 92px;
    box-sizing: border-box;
    border: 1px solid var(--eye-border);
    border-radius: 5px;
    padding: 8px;
    font-size: 14px;
    resize: vertical;
}

.target-groups-actions {
    display: flex;
    gap: 8px;
    align-self: end;
}

.target-groups-actions .button,
.target-groups-mini-btn {
    border: 1px solid #253a62;
    background: #253a62;
    color: #fff;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
}

.target-groups-actions .button.secondary,
.target-groups-mini-btn {
    background: #fffefa;
    color: #2c4f93;
    border-color: #b8c7e6;
}

.target-groups-mini-btn {
    padding: 4px 8px;
    font-size: 12px;
}

.target-groups-mini-btn:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.target-groups-mini-btn.danger {
    color: #a33b3b;
    border-color: #e2c8c8;
    background: #fff6f6;
}

.target-groups-maintenance {
    overflow-x: auto;
    margin-bottom: 16px;
}

.target-groups-table {
    margin-top: 0;
}

.target-groups-table th,
.target-groups-table td {
    padding: 7px 9px;
    font-size: 13px;
}

.target-groups-stock-list {

    white-space: normal;
    line-height: 1.6;
}

.target-groups-update-time {
    margin-bottom: 10px;
    color: #6c757d;
    font-size: 13px;
}

.target-groups-monitor-section {
    margin-bottom: 18px;
}

.target-groups-monitor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 10px;
    background: #eef3fb;
    border: 1px solid var(--eye-border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}

.target-groups-monitor-head h3 {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
    color: #253a62;
    font-size: 0.95rem;
}

.target-groups-monitor-count {
    color: #67748c;
    font-size: 0.78rem;
}

.target-groups-monitor-tools {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

.target-groups-inline-add {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 0 14px;
}

.target-groups-inline-code-input {
    width: 78px;
    height: 26px;
    padding: 3px 7px;
    border: 1px solid var(--eye-border);
    border-radius: 6px;
    background: #fff;
    color: #1f2a44;
    font-size: 12px;
    line-height: 1.2;
}

.target-groups-add-submit-btn {
    min-width: 34px;
    height: 26px;
    padding: 0 8px;
    font-size: 17px;
    line-height: 1;
}

.target-groups-row-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 17px;
    margin: 0;
    padding: 0;
    border: 1px solid #98d8ad;
    border-radius: 999px;
    background: #ecfff2;
    color: #16833a;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
}

.target-groups-row-delete-btn:hover,
.target-groups-row-delete-btn:focus {
    background: #d9fbe4;
    border-color: #3fbf63;
}

.target-groups-monitor-table-wrap {
    overflow-x: visible;
    width: 100%;
}

.concept-summary {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--rv-line-soft, var(--eye-border));
}

.concept-summary-title { margin-bottom: 8px; color: var(--rv-muted, #8a94a6); font-size: .8em; font-weight: 800; }
.concept-summary-list { display: flex; flex-wrap: wrap; gap: 8px; }
.concept-summary-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid #dce6f4; border-radius: 14px; background: #eef3fb; color: #38557d; font-size: 12px; font-weight: 400; cursor: pointer; }
.concept-summary-item:hover { border-color: #b8cdee; background: #e5edf9; }
.concept-summary-item.active { border-color: #b8cdee; background: #dce8fb; }
.concept-summary-count { color: #8a5a14; font-weight: 700; }
.concept-summary-chart-link { display: inline-flex; align-items: center; justify-content: center; color: inherit; font-size: .95em; line-height: 1; text-decoration: none; }
.concept-summary-chart-link:hover, .concept-summary-chart-link:focus { transform: translateY(-1px); text-decoration: none; }
.concept-filter-reset { margin-left: 8px; padding: 4px 10px; border: 1px solid #d8dde6; border-radius: 5px; background: #f0f2f5; color: #556274; font-size: .78em; cursor: pointer; }
.concept-filter-reset:hover { background: #e7ebf2; }
.target-groups-limit-up-concept-summary { margin-bottom: 12px; }

.target-groups-monitor-table {
    width: 100%;
    table-layout: auto;
    margin-top: 0;
    border-collapse: collapse;
}

.target-groups-page.target-groups-table-compact .target-groups-monitor-table {
    width: auto;
    max-width: 100%;
}

.target-groups-monitor-table th,
.target-groups-monitor-table td {
    padding: 8px 8px 2px 8px;
    border-bottom: 1px solid var(--eye-border);
    font-size: 14px;
    white-space: nowrap;
}

.target-groups-monitor-table td {
    height: 42px;
    box-sizing: border-box;
}

.target-groups-monitor-table th {
    background: var(--eye-surface-soft);
    color: #56637a;
    cursor: pointer;
}

.target-groups-th-help-wrap {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.target-groups-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1px solid #cbd5e1;
    border-radius: 50%;
    background: #fff;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    cursor: help;
}

.target-groups-help-btn:hover,
.target-groups-help-btn:focus {
    border-color: #79b8ff;
    color: #253a62;
    outline: none;
}

.target-groups-monitor-table .target-groups-spark-col {
    padding-left: 7px !important;
    padding-right: 7px !important;
    text-align: center;
}

.target-groups-monitor-table .target-groups-candle-col {
    /* padding-left: 10px; */
    /* padding-right: 10px; */
    text-align: center;
}

.target-groups-monitor-table .col-code,
.target-groups-monitor-table .col-name,
.target-groups-monitor-table .col-price,
.target-groups-monitor-table .col-pct {
    padding-left: 10px;
    padding-right: 10px;
    box-sizing: border-box;
}

.target-groups-monitor-table .col-money,
.target-groups-monitor-table .col-activity,
.target-groups-monitor-table .col-turnover-change,
.target-groups-monitor-table .col-deviation-combo,
.target-groups-monitor-table .col-hot {
    padding-left: 15px;
    padding-right: 15px;
    box-sizing: border-box;
}

.target-groups-monitor-table .col-code,
.target-groups-monitor-table .col-name {
    width: calc(4em + 30px);
    min-width: calc(4em + 30px);
}

.target-groups-monitor-table .target-groups-stock-name,
.target-groups-monitor-table .target-groups-stock-code,
.target-groups-monitor-table .target-groups-price-change,
.target-groups-monitor-table .target-groups-current-price {
    display: block;
    font-weight: 400;
    line-height: 1.35;
}

.target-groups-monitor-table .target-groups-stock-name,
.target-groups-monitor-table .target-groups-stock-name:hover,
.target-groups-monitor-table .target-groups-stock-name:focus {
    text-decoration: none;
}

.target-groups-monitor-table .col-flow-pair {
    width: 124px;
    min-width: 124px;
    max-width: 124px;
    padding-left: 4px !important;
    padding-right: 4px !important;
    box-sizing: border-box;
    cursor: pointer;
}

.target-groups-flow-pair {
    display: inline-grid;
    grid-template-columns: 50px 16px 50px;
    width: 116px;
    align-items: center;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.target-groups-flow-pair > :last-child {
    text-align: left;
}

.target-groups-flow-pair > * {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.target-groups-flow-separator {
    text-align: center;
    color: #8a96a8;
    white-space: pre;
}

.target-groups-monitor-table .col-flow-pair .graymarket-history-value {
    text-decoration: none;
}

.target-groups-flow-sort {
    padding: 0;
    border: 0;
    background: transparent !important;
    box-shadow: none;
    color: inherit;
    font: inherit;
    text-align: right;
    cursor: pointer;
}

.target-groups-monitor-table .target-groups-stock-code,
.target-groups-monitor-table .target-groups-current-price {
    margin-top: 3px;
    font-size: 12px;
    color: #66758b;
}

.target-groups-monitor-table .target-groups-current-price {
    text-align: right;
}

body.dark .target-groups-monitor-table .target-groups-stock-code,
body.dark .target-groups-monitor-table .target-groups-current-price {
    color: #858585 !important;
}

.target-groups-monitor-table .col-price,
.target-groups-monitor-table .col-pct {
    width: calc(3em + 30px);
    min-width: calc(3em + 30px);
}

.target-groups-monitor-table .col-money {
    width: calc(4em + 30px);
    min-width: calc(4em + 30px);
}

.target-groups-monitor-table .col-deviation-combo {
    width: calc(4em + 30px);
    min-width: calc(4em + 30px);
}

.target-groups-monitor-table .col-hot {
    width: calc(2em + 30px);
    min-width: calc(2em + 30px);
}

.target-groups-monitor-table .col-activity,
.target-groups-monitor-table .col-turnover-change {
    width: calc(4em + 18px);
    min-width: calc(4em + 18px);
    padding-left: 9px;
    padding-right: 9px;
}

.target-groups-page.target-groups-table-compact .target-groups-monitor-table .target-groups-candle-col,
.target-groups-page.target-groups-table-compact .target-groups-monitor-table .col-behavior,
.target-groups-page.target-groups-table-compact .target-groups-monitor-table .col-hot {
    display: none;
}

.target-groups-monitor-table .col-action {
    width: 86px;
    min-width: 86px;
}

.target-groups-monitor-table .col-behavior,
.target-groups-monitor-table .col-note,
.target-groups-monitor-table .col-action {
    padding-left: 5px;
    padding-right: 5px;
}

.target-groups-monitor-table .col-hot,
.target-groups-monitor-table .col-action { text-align: center; }

.target-groups-monitor-row {
    cursor: grab;
}

.target-groups-monitor-row:active {
    cursor: grabbing;
}

.target-groups-monitor-row.dragging td {
    opacity: .55;
    background: #eef5ff;
}

.target-groups-monitor-row.drag-over-before td:first-child,
.target-groups-monitor-row.drag-over-after td:first-child {
    position: relative;
}

.target-groups-monitor-row.drag-over-before td:first-child::before,
.target-groups-monitor-row.drag-over-after td:first-child::after {
    content: "";
    position: absolute;
    left: 0;
    right: -9999px;
    height: 2px;
    background: #2f81f7;
    pointer-events: none;
    z-index: 3;
}

.target-groups-monitor-row.drag-over-before td:first-child::before {
    top: -1px;
}

.target-groups-monitor-row.drag-over-after td:first-child::after {
    bottom: -1px;
}

.target-groups-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.target-groups-row-actions .target-groups-row-delete-btn {
    width: 25px;
    height: 25px;
    border: none;
    background: transparent;
    font-size: 15px;
}

.target-groups-row-actions .target-groups-row-monitor-plan-btn {
    position: relative;
    width: 30px;
    height: 30px;
    font-size: 18px;
    overflow: visible;
}

.target-groups-row-actions .target-groups-monitor-plan-badge {
    position: absolute;
    top: -5px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    border-radius: 999px;
    background: #d93025;
    color: #fff;
    font-size: 9px;
    line-height: 1;
    font-weight: 800;
    box-shadow: 0 0 0 2px rgba(217, 48, 37, .12);
    pointer-events: none;
}

body.dark .target-groups-row-actions .target-groups-monitor-plan-badge {
    background: #f6465d;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(248, 81, 73, .16);
}

.target-groups-row-actions .target-groups-row-delete-btn:not(.target-groups-row-monitor-plan-btn) {
    width: 12.5px;
    height: 12.5px;
    font-size: 7.5px;
}

.target-groups-row-actions .target-groups-row-delete-btn,
.target-groups-row-actions .target-groups-row-delete-btn:hover,
.target-groups-row-actions .target-groups-row-delete-btn:focus,
body.dark .target-groups-row-actions .target-groups-row-delete-btn,
body.dark .target-groups-row-actions .target-groups-row-delete-btn:hover,
body.dark .target-groups-row-actions .target-groups-row-delete-btn:focus {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none;
}
body.dark .target-groups-row-actions {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

.target-groups-row-actions .target-groups-row-delete-btn:hover,
.target-groups-row-actions .target-groups-row-delete-btn:focus {
    background: transparent;
    border-color: transparent;
}

.target-groups-monitor-table .col-note {
    white-space: normal;
    word-break: break-word;
}

.target-groups-monitor-table .col-note span {
    white-space: normal;
}

.target-groups-monitor-table .target-groups-note-link {
    display: inline;
   /** margin-right: 5px;**/
    color: #253a62;
    font-weight: 300;
    text-decoration: none;
}

.target-groups-monitor-table .target-groups-note-link:hover,
.target-groups-monitor-table .target-groups-note-link:focus {
    color: #253a62;
    text-decoration: none;
}

.target-groups-monitor-table .target-groups-note-pct {
    margin-left: 1px;
    font-weight: 400;
}

.target-groups-monitor-table .target-groups-note-pct.up {
    color: #f6465d;
}

.target-groups-monitor-table .target-groups-note-pct.down {
    color: #2ebd85;
}

.target-groups-dark-behavior {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    padding: 3px 7px;
    border-radius: 999px;
    background: #f2f5f9;
    border: 1px solid #dbe3ee;
    color: #4b5568;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.15;
    vertical-align: middle;
}

.target-groups-dark-behavior span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.target-groups-dark-behavior em {
    flex: 0 0 auto;
    font-style: normal;
    color: #8a94a6;
    font-size: 10px;
    font-weight: 800;
}

.target-groups-dark-behavior-bullish,
.target-groups-dark-behavior-wash_buy,
.target-groups-dark-behavior-accumulate {
    background: #fff0f1;
    border-color: #ffd1d6;
    color: #c0392b;
}

.target-groups-dark-behavior-t_trade,
.target-groups-dark-behavior-distribution {
    background: #fff7e6;
    border-color: #f4d7a1;
    color: #a35b00;
}

.target-groups-dark-behavior-bearish {
    background: #eef8f1;
    border-color: #cfead7;
    color: #1e8449;
}

.target-groups-dark-behavior-diverge {
    background: #eef3fb;
    border-color: #d6e0ee;
    color: #38557d;
}

.target-groups-monitor-table td a {
    white-space: nowrap;
}

.target-groups-empty {
    padding: 18px;
    text-align: center;
    color: #6c757d;
    background: var(--eye-surface-soft);
    border: 1px solid var(--eye-border);
    border-radius: 8px;
}

.target-groups-help-mask {
    position: fixed;
    inset: 0;
    z-index: 2200;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.48);
}

.target-groups-help-modal {
    width: min(620px, 96vw);
    max-height: 86vh;
    overflow: auto;
    border-radius: 8px;
    background: #fff;
    color: #243047;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.28);
}

.target-groups-help-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--eye-border);
}

.target-groups-help-head h3 {
    margin: 0;
    font-size: 1rem;
    color: #253a62;
}

.target-groups-help-close {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #64748b;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.target-groups-help-close:hover {
    background: #e2e8f0;
    color: #1f2a44;
}

.target-groups-help-body {
    padding: 14px 16px 16px;
    font-size: 13px;
    line-height: 1.65;
}

.target-groups-help-body p {
    margin: 0 0 10px;
}

.target-groups-help-body dl {
    margin: 0;
}

.target-groups-help-body dt {
    margin-top: 10px;
    color: #1f2a44;
    font-weight: 800;
}

.target-groups-help-body dd {
    margin: 4px 0 0;
    color: #526078;
}

.target-groups-help-map-table {
    width: 100%;
    margin-top: 6px;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
}

.target-groups-help-map-table th,
.target-groups-help-map-table td {
    padding: 7px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
    white-space: nowrap;
}

.target-groups-help-map-table th {
    background: #f8fafc;
    color: #526078;
    font-weight: 800;
}

.target-groups-help-map-table tr:last-child td {
    border-bottom: 0;
}

.target-groups-help-map-table td:last-child {
    white-space: normal;
    color: #64748b;
}

.target-groups-help-map-table .target-groups-dark-behavior {

}

.help-flow-in {
    color: #c0392b;
    font-weight: 800;
}

.help-flow-out {
    color: #1e8449;
    font-weight: 800;
}

.target-groups-help-note {
    margin-top: 12px !important;
    color: #8a5a14;
}

.target-groups-page #resultTable .graymarket-history-clickable,
.target-groups-monitor-table .graymarket-history-clickable {
    transition: background-color 0.16s ease, box-shadow 0.16s ease;
}

.target-groups-page #resultTable .graymarket-history-clickable:hover,
.target-groups-page #resultTable .graymarket-history-clickable:focus,
.target-groups-monitor-table .graymarket-history-clickable:hover,
.target-groups-monitor-table .graymarket-history-clickable:focus {
    background: #e8ede3;
    box-shadow: inset 0 0 0 1px #dfe8d8;
    outline: none;
}

.target-groups-page #resultTable .graymarket-history-clickable:active,
.target-groups-monitor-table .graymarket-history-clickable:active {
    background: #e5eddf;
}

/* Keep mini-chart canvases transparent without changing table-cell backgrounds. */
svg.target-groups-price-spark,
svg.target-groups-candle-spark,
body.dark svg.target-groups-price-spark,
body.dark svg.target-groups-candle-spark {
    background: transparent;
}

.target-groups-price-spark {
    display: block;
    width: 138px;
    height: 24px;
    margin: 0 auto;
}

.target-groups-price-spark path {
    fill: none;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.target-groups-price-spark .zero-axis {
    stroke: rgba(88, 112, 138, 0.55);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}

.target-groups-price-spark.up path {
    stroke: #c0392b;
}

.target-groups-price-spark.down path {
    stroke: #1e8449;
}

.target-groups-price-spark.flat path {
    stroke: #58708a;
}

.target-groups-spark-empty {
    display: inline-block;
    width: 138px;
    color: #8b95a7;
    text-align: center;
}

.target-groups-candle-spark {
    display: block;
    width: 92px;
    height: 32px;
    margin: 0 auto;
}

.target-groups-candle-spark line {
    stroke-width: 1.2;
}

.target-groups-candle-spark rect {
    stroke-width: 1.1;
}

.target-groups-candle-spark .up line,
.target-groups-candle-spark .up rect {
    stroke: #c0392b;
}

.target-groups-candle-spark .up rect {
    fill: #c0392b;
}

.target-groups-candle-spark .down line,
.target-groups-candle-spark .down rect {
    stroke: #1e8449;
}

.target-groups-candle-spark .down rect {
    fill: #1e8449;
}

.target-groups-candle-empty {
    display: inline-block;
    width: 92px;
    color: #8b95a7;
    text-align: center;
}

/* --- Stat Panels --- */
.stat-card {
    background-color: var(--eye-surface-soft);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    text-align: center;
}

.stat-label {
    font-size: 13px;
    color: #6c757d;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: #1a2b4d;
}

/* --- Industry Stats Grid --- */
#industry-stats-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

/* --- Modal Styles --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--eye-surface);
    padding: 25px;
    border-radius: 8px;
    width: 90%;

    box-shadow: 0 5px 20px rgba(0,0,0,0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.close-button {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    text-shadow: 0 1px 0 #F7F8FA;
    opacity: .5;
    cursor: pointer;
}

.close-button:hover {
    opacity: .75;
}

#top300HistoryPanel h5 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 8px;
}

.tracker-page {
    display: grid;
    gap: 14px;
}

.tracker-panel,
.tracker-page .control-panel {
    background: #F7F8FA;
    border: 1px solid #e0e6ef;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}

.tracker-panel {
    padding: 14px 16px;
}

.tracker-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dde4ef;
}

.tracker-panel-head h5 {
    margin: 0;
    color: #253a62;
    font-size: .88rem;
    font-weight: 800;
}

.tracker-mini-toggle {
    border: 1px solid #d9e1ec;
    background: #f3f6fb;
    color: #34435f;
    border-radius: 7px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.tracker-mini-toggle:hover {
    background: #e8eef8;
}

#top300-dates-content {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
    transition: max-height .18s ease;
}

#top300-dates-content.tracker-dates-collapsed {
    max-height: 27px;
    overflow: hidden;
}

#top300-dates-content.tracker-dates-expanded {
    overflow: visible;
}

.date-link {
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(232, 237, 244, .62);
    border: 1px solid rgba(191, 202, 218, .62);
    color: #4c5870;
    font-size: 11px;
    line-height: 1.45;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s, color 0.3s;
}

.date-link:hover {
    background-color: rgba(219, 227, 239, .9);
}

.date-link.active {
    background-color: #253a62;
    border-color: #253a62;
    color: white;
}

.tracker-page .control-panel {
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 16px;
    margin-bottom: 0;
}

.tracker-code-input {
    flex: 0 1 380px;
    width: 380px;
}

.tracker-query-actions {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 10px;
}

.tracker-query-actions .button-group {
    display: flex;
    gap: 8px;
}

.tracker-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    text-align: center;
}

.industry-stat-card {
    text-align: left;
    padding: 9px 12px;
    min-width: 150px;
    cursor: pointer;
}

.industry-stat-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.industry-stat-card-head {
    margin-bottom: 8px;
}

.industry-stat-card-sub {
    color: #5a667f;
    font-size: 12px;
    margin-top: 4px;
}

.industry-stat-name {
    color: #253046;
    font-size: 13px;
    font-weight: 700;
}

.industry-stat-muted {
    color: #6b7588;
    font-size: 12px;
    white-space: nowrap;
}

/* --- Dark Mode Toggle Button --- */
.dark-toggle {
    background: none;
    border: 1px solid #ced4da;
    border-radius: 5px;
    padding: 5px 9px;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    margin-left: 0;
    line-height: 1;
    transition: background-color 0.2s;
    vertical-align: middle;
}
.dark-toggle:hover { background-color: #e9ecef; }

/* Shared rise-count progress used by note flow list and detail pages. */
.note-count {
    position: relative;
    display: inline-block;
    flex: 0 0 86px;
    width: 86px;
    height: 14px;
    overflow: hidden;
    border-radius: 3px;
    background: #eef1f5;
    color: var(--nf-muted, #59657e);
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}
.note-count-fill {
    position: absolute;
    inset: 0 auto 0 0;
    background: rgba(217, 83, 79, 0.58);
    border-radius: 3px;
}
.note-count-text {
    position: relative;
    z-index: 1;
    font-weight: 700;
}

/* --- Dark Mode --- */
body.dark {
    background-color: #000000;
    color: #e3e3e3;
}
body.dark .container {
    background: #000;
    box-shadow: none;
}
body.dark .header-container { border-bottom-color: #252525; }
body.dark #realtime-title { color: #79b8ff; }
body.dark nav a,
body.dark .nav-dropdown-toggle { color: #858585; }
body.dark nav a:hover,
body.dark .nav-dropdown:hover .nav-dropdown-toggle { background-color: #1e1e1e; }
body.dark nav a.active,
body.dark .nav-dropdown.active .nav-dropdown-toggle {
    background-color: #2a261d;
    color: #f0c36a;
    box-shadow: inset 0 -2px 0 #d6b06a;
}
body.dark .nav-dropdown-menu { background: #121212; border-color: #252525; }
body.dark .nav-dropdown-menu a { color: #858585; }
body.dark .autocomplete-results { background-color: #121212; border-color: #252525; color: #e3e3e3; }
body.dark .autocomplete-item:hover { background-color: #1e1e1e; }
body.dark #search-input {
    border-color: #252525;
    background: #000000;
    color: #e3e3e3;
}
body.dark .note-count {
    background: #000000;
    color: #e3e3e3;
}
body.dark th, body.dark td { border-color: #252525; }
body.dark thead th { background-color: #121212; color: #858585; }
body.dark tbody tr:nth-child(even) { background-color: transparent; }
body.dark tbody tr:hover td { background: #191919; }
body.dark .stat-card { background-color: #1e1e1e; border-color: #252525; }
body.dark .stat-label { color: #858585; }
body.dark .stat-value { color: #79b8ff; }
body.dark .modal-content { background: #121212; color: #e3e3e3; }
body.dark .modal-header { border-bottom-color: #252525; }
body.dark .close-button { color: #e3e3e3; text-shadow: none; }
body.dark .date-link {
    background: rgba(27, 36, 48, .58);
    border-color: rgba(52, 66, 86, .7);
    color: #aab6c7;
}
body.dark .date-link:hover { background-color: rgba(36, 49, 67, .92); color: #dbe7f5; }
body.dark .date-link.active { background-color: #253a62; border-color: #253a62; color: #F7F8FA; }
body.dark .tracker-panel,
body.dark .tracker-page .control-panel {
    background: #141a22;
    border-color: #2b3542;
    box-shadow: 0 8px 24px rgba(0,0,0,0.24);
}
body.dark .tracker-panel-head {
    border-bottom-color: #2b3542;
}
body.dark .tracker-panel-head h5 {
    color: #d6e2f0;
}
body.dark .tracker-mini-toggle {
    background: #1b2430;
    border-color: #344256;
    color: #c8d3e1;
}
body.dark .tracker-mini-toggle:hover {
    background: #243143;
    border-color: #4a5d78;
}
body.dark .industry-stat-card {
    background: #18202b;
    border: 1px solid #2b3542;
}
body.dark .industry-stat-card:hover {
    background: #202a36;
}
body.dark .industry-stat-name {
    color: #dbe7f5;
}
body.dark .industry-stat-muted,
body.dark .industry-stat-card-sub {
    color: #95a3b8;
}
body.dark .error { background-color: #3d1a1c; border-color: #6e2a2e; color: #f8a5a5; }
body.dark .dark-toggle { border-color: #252525; color: #858585; }
body.dark .dark-toggle:hover { background-color: #1e1e1e; }
body.dark #codes { background: #000000; color: #e3e3e3; border-color: #252525; }
body.dark input, body.dark select, body.dark textarea {
    background: #000000;
    color: #e3e3e3;
    border-color: #252525;
}
body.dark button:not(.dark-toggle):not(nav a) {
    border-color: #252525;
}

body.dark .target-groups-market-summary {
    background: #121212;
    border-color: #252525;
}

body.dark .market-summary-item {
    background: #121212;
    border-color: #252525;
}

body.dark .market-summary-breadth {
    background: #121212;
    border-color: #252525;
}

body.dark .market-summary-breadth-bar {
    background: #252525;
}

body.dark .market-summary-flat-bar {
    background: #858585;
    box-shadow: inset 2px 0 0 rgba(22,27,34,.9), inset -2px 0 0 rgba(22,27,34,.9);
}

body.dark .market-summary-label,
body.dark .market-summary-meta,
body.dark .market-summary-flat-count {
    color: #858585;
}

body.dark .market-summary-item strong {
    color: #e3e3e3;
}

body.dark .market-summary-item strong.up {
    color: #f6465d;
}

body.dark .market-summary-item strong.down {
    color: #2ebd85;
}

body.dark .market-summary-item .up {
    color: #f6465d;
}

body.dark .market-summary-item .down {
    color: #2ebd85;
}

body.dark .market-summary-change.up {
    color: #f6465d;
}

body.dark .market-summary-change.down {
    color: #2ebd85;
}

body.dark .market-summary-main-spark-zero {
    stroke: rgba(139, 148, 158, .55);
}

body.dark .market-summary-main-spark-line {
    stroke: #858585;
}

body.dark .market-summary-main-spark-line.up {
    stroke: #f6465d;
}

body.dark .market-summary-main-spark-line.down {
    stroke: #2ebd85;
}

body.dark .market-summary-turnover-spark-today {
    stroke: #79b8ff;
}

body.dark .market-summary-turnover-spark-previous {
    stroke: #858585;
}

body.dark .market-summary-chart-trigger:hover,
body.dark .market-summary-chart-trigger:focus-visible {
    border-color: #E0E0E0;
}

/* --- Dark Mode: template-level overrides ---
   Covers inline <style> blocks in individual templates.
   body.dark .classname has higher specificity than .classname so no !important needed,
   except for inline style="" attributes which need !important.
-------------------------------------------------*/

/* Containers: daily_review */
body.dark .rv, body.dark .rv-header,
body.dark .panel, body.dark .panel-full,
body.dark .summary-card, body.dark .review-split,
body.dark .tabs, body.dark .tab-content,
body.dark .concept-summary, body.dark .concept-summary-list,
body.dark .concept-summary-item, body.dark .two-col, body.dark .chart-split,
/* Containers: notes */
body.dark .notes-layout, body.dark .notes-main,
body.dark .note-item, body.dark .view-pane, body.dark .edit-pane,
body.dark .empty-pane, body.dark .view-toolbar, body.dark .edit-actions,
/* Containers: stock_detail */
body.dark .stock-meta-card, body.dark .stock-meta-note,
body.dark .analysis-modal, body.dark .concepts-container,
/* Containers: index_compare */
body.dark .compare-container, body.dark .chart-card,
body.dark .chart-wrapper, body.dark .diff-chart-wrapper,
body.dark .etf-tab-card, body.dark .etf-tab-panel, body.dark .etf-combined-chart {
    background-color: #121212;
    border-color: #252525;
    color: #e3e3e3;
}

/* Prefixed class families (safe substring match within our codebase) */
body.dark [class*="wash-"],
body.dark [class*="runner-"] { background-color: #121212; border-color: #252525; color: #e3e3e3; }
body.dark [class*="followed-"],
body.dark [class*="target-groups-"],
body.dark [class*="date-group"] { background-color: #121212; border-color: #252525; color: #e3e3e3; }

/* Sidebar/header sub-containers need slightly deeper dark */
body.dark .notes-sidebar, body.dark .notes-list, body.dark .sidebar-header {
    background-color: #121212;
    border-color: #252525;
    color: #e3e3e3;
}

/* Heading colors inside dark containers */
body.dark .rv-header h2, body.dark .sidebar-title, body.dark .view-title,
body.dark .runner-title, body.dark .wash-hero-title,
body.dark .concept-summary-title, body.dark .date-group-label,
body.dark .followed-head h2, body.dark .target-groups-head h2 { color: #79b8ff; }

/* Muted label text */
body.dark .sec-title, body.dark .panel-title, body.dark .sub-title,
body.dark .blbl, body.dark .blbl-sub, body.dark .view-meta,
body.dark .edit-label, body.dark .ri-type, body.dark .ri-flow, body.dark .ri-pct,
body.dark .inline-hint, body.dark .concept-summary-count,
body.dark .followed-subtitle, body.dark .target-groups-subtitle,
body.dark .date-group-cnt { color: #858585; }
body.dark .ri-name { color: #e3e3e3; }

/* Row separators */
body.dark .row-item { border-bottom-color: #1e1e1e; }

/* Tables inside templates */
body.dark .stk-table th, body.dark .followed-tight-table th, body.dark .target-groups-table th {
    background-color: #1e1e1e; color: #858585; border-color: #252525;
}
body.dark .stk-table td, body.dark .followed-tight-table td, body.dark .target-groups-table td {
    border-color: #465b76; color: #e3e3e3;
}
body.dark .target-groups-monitor-head,
body.dark .target-groups-empty {
    background: #121212;
    border-color: #252525;
    color: #858585;
}
body.dark .target-groups-monitor-head h3 {
    color: #79b8ff;
}
body.dark .target-groups-monitor-count {
    color: #858585;
}
body.dark .target-groups-inline-code-input {
    background: #000000;
    border-color: #252525;
    color: #e3e3e3;
}
body.dark .target-groups-row-delete-btn {
    background: #12331f;
    border-color: #2ea043;
    color: #3a9b43;
}
body.dark .target-groups-row-delete-btn:hover,
body.dark .target-groups-row-delete-btn:focus {
    background: #164827;
    border-color: #2ebd85;
}
body.dark .target-groups-row-actions .target-groups-row-delete-btn,
body.dark .target-groups-row-actions .target-groups-row-delete-btn:hover,
body.dark .target-groups-row-actions .target-groups-row-delete-btn:focus {
    background: transparent;
    border-color: transparent;
}
body.dark .target-groups-view-toggle {
    background: #121212;
    border-color: #252525;
}
body.dark .target-groups-toggle-btn {
    color: #858585;
}
body.dark .target-groups-toggle-btn.active {
    background: transparent;
    color: #fff;
}
body.dark .target-groups-compact-btn {
    background: transparent;
    border-color: #252525;
    color: #858585;
    box-shadow: none;
}
body.dark .target-groups-compact-label-normal,
body.dark .target-groups-compact-btn.active .target-groups-compact-label-compact {
    color: #F7F8FA;
}
body.dark .target-groups-compact-label-compact,
body.dark .target-groups-compact-btn.active .target-groups-compact-label-normal {
    color: #858585;
}
body.dark .target-groups-compact-btn:hover,
body.dark .target-groups-compact-btn:focus-visible {
    border-color: #79b8ff;
}
body.dark .note-cloud-map,
body.dark .note-cloud-category,
body.dark .note-cloud-tiles {
    background: #1b222c;
}
body.dark .note-cloud-category {
    border-color: #1b222c;
}
body.dark .note-cloud-category-title {
    background: #2b333f;
    color: #e6edf3;
}
body.dark .note-cloud-tile.flat {
    background: #354152;
}
body.dark .note-cloud-empty {
    background: #121212;
    border-color: #252525;
    color: #858585;
}
body.dark .target-groups-monitor-table th {
    background: #1e1e1e;
    color: #858585;
    border-color: #252525;
}
body.dark .target-groups-help-btn {
    background: #121212;
    border-color: #252525;
    color: #858585;
}
body.dark .target-groups-help-btn:hover,
body.dark .target-groups-help-btn:focus {
    border-color: #79b8ff;
    color: #79b8ff;
}
body.dark .target-groups-monitor-table td {
    background: #121212;
    color: #e3e3e3;
    border-color: #252525;
}
body.dark .target-groups-monitor-table :is(
    .target-groups-stock-name,
    .target-groups-stock-code,
    .target-groups-price-change,
    .target-groups-current-price,
    .target-groups-flow-pair,
    .target-groups-flow-separator,
    .target-groups-flow-sort
) {
    background: transparent;
    border: 0;
    box-shadow: none;
}
body.dark .target-groups-monitor-table td.up {
    color: #f6465d !important;
}
body.dark .target-groups-monitor-table td.down {
    color: #2ebd85 !important;
}
body.dark .target-groups-monitor-table span.up {
    color: #f6465d !important;
}
body.dark .target-groups-monitor-table span.down {
    color: #2ebd85 !important;
}
body.dark .target-groups-monitor-table .target-groups-note-link,
body.dark .target-groups-monitor-table .target-groups-note-link:hover,
body.dark .target-groups-monitor-table .target-groups-note-link:focus {
    color: #e3e3e3;
    text-decoration: none;
}
body.dark .target-groups-monitor-table tbody tr:nth-child(even) td {
    background: #121212;
}
body.dark .target-groups-monitor-table tbody tr:hover td {
    background: #191919;
}
body.dark .target-groups-page table tbody tr td,
body.dark .target-groups-page table tbody tr:nth-child(even) td {
    background: #121212;
}
body.dark .target-groups-page table tbody tr:hover td {
    background: #191919;
}
.limit-badge {
    display: inline-flex;
    align-items: baseline;
    justify-content: center;
    min-width: 38px;
    padding: 2px 7px;
    border: 1px solid var(--limit-border, #d7e8da);
    border-radius: 4px;
    background: var(--limit-bg, #eef6ef);
    color: var(--limit-fg, #42724a);
    font-weight: 800;
    line-height: 1.15;
}
.limit-badge .limit-num { font-size: 1.06em; }
.limit-badge .limit-unit {
    margin-left: 1px;
    font-size: .72em;
    font-weight: 700;
}
body.dark .limit-badge {
    background: #1b2d20;
    border-color: #2f5d3a;
}
body.dark .target-groups-monitor-row.dragging td {
    background: #1d2b3f;
}
body.dark .target-groups-monitor-row.drag-over-before td:first-child::before,
body.dark .target-groups-monitor-row.drag-over-after td:first-child::after {
    background: #79b8ff;
}
body.dark .target-groups-dark-behavior {
    background: #1e1e1e;
    border-color: #252525;
    color: #e3e3e3;
}
body.dark .target-groups-dark-behavior em {
    color: #858585;
}
body.dark .target-groups-dark-behavior-bullish,
body.dark .target-groups-dark-behavior-wash_buy,
body.dark .target-groups-dark-behavior-accumulate {
    background: rgba(248, 81, 73, 0.14);
    border-color: rgba(248, 81, 73, 0.32);
    color: #ff7b72;
}
body.dark .target-groups-dark-behavior-t_trade,
body.dark .target-groups-dark-behavior-distribution {
    background: rgba(210, 153, 34, 0.16);
    border-color: rgba(210, 153, 34, 0.34);
    color: #e3b341;
}
body.dark .target-groups-dark-behavior-bearish {
    background: rgba(63, 185, 80, 0.13);
    border-color: rgba(63, 185, 80, 0.3);
    color: #2ebd85;
}
body.dark .target-groups-dark-behavior-diverge {
    background: rgba(125, 168, 216, 0.12);
    border-color: rgba(125, 168, 216, 0.3);
    color: #79b8ff;
}
body.dark .target-groups-help-mask {
    background: rgba(1, 4, 9, 0.64);
}
body.dark .target-groups-help-modal {
    background: #121212;
    color: #e3e3e3;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.46);
}
body.dark .target-groups-help-head {
    border-color: #252525;
}
body.dark .target-groups-help-head h3,
body.dark .target-groups-help-body dt {
    color: #e6edf3;
}
body.dark .target-groups-help-close {
    background: #1e1e1e;
    color: #858585;
}
body.dark .target-groups-help-close:hover {
    background: #252525;
    color: #e6edf3;
}
body.dark .target-groups-help-body dd {
    color: #858585;
}
body.dark .target-groups-help-map-table {
    border-color: #252525;
}
body.dark .target-groups-help-map-table th,
body.dark .target-groups-help-map-table td {
    border-color: #252525;
}
body.dark .target-groups-help-map-table th {
    background: #1e1e1e;
    color: #858585;
}
body.dark .target-groups-help-map-table td:last-child {
    color: #858585;
}
body.dark .help-flow-in {
    color: #ff7b72;
}
body.dark .help-flow-out {
    color: #2ebd85;
}
body.dark .target-groups-help-note {
    color: #e3b341;
}
body.dark .target-groups-page #resultTable .graymarket-history-clickable:hover,
body.dark .target-groups-page #resultTable .graymarket-history-clickable:focus,
body.dark .target-groups-monitor-table .graymarket-history-clickable:hover,
body.dark .target-groups-monitor-table .graymarket-history-clickable:focus {
    background: #191919;
    box-shadow: inset 0 0 0 1px #252525;
    outline: none;
}
body.dark .target-groups-page #resultTable .graymarket-history-clickable:active,
body.dark .target-groups-monitor-table .graymarket-history-clickable:active {
    background: #263141;
}
body.dark .target-groups-price-spark.flat path {
    stroke: #858585;
}
body.dark .target-groups-spark-empty {
    color: #858585;
}

/* Tab / page navigation buttons */
body.dark .tab-btn, body.dark .nav-btn, body.dark .small-btn,
body.dark .etf-tab-btn, body.dark .range-btn {
    background-color: #1e1e1e; color: #e3e3e3; border-color: #252525;
}
body.dark .tab-btn.active, body.dark .etf-tab-btn.active, body.dark .range-btn.active {
    background-color: #253a62; color: #F7F8FA; border-color: #253a62;
}
body.dark .tab-btn:hover, body.dark .nav-btn:hover,
body.dark .etf-tab-btn:hover, body.dark .range-btn:hover,
body.dark .concept-filter-reset:hover { background-color: #1e1e1e; }

/* Interactive item hover/active states */
body.dark .note-item:hover, body.dark .concept-summary-item:hover,
body.dark .date-group-header:hover { background-color: #1e1e1e; }
body.dark .note-item.active { background-color: #121212; border-left-color: #253a62; }
body.dark .concept-summary-item.active { background-color: #121212; border-color: #253a62; }

/* md-body markdown content (stock_detail + notes) */
body.dark .md-body { color: #e3e3e3; }
body.dark .md-body h1, body.dark .md-body h2, body.dark .md-body h3,
body.dark .md-body strong { color: #79b8ff; }
body.dark .md-body h2, body.dark .md-body h1 { border-bottom-color: #252525; }
body.dark .md-body code { background: #1e1e1e; color: #e6edf3; }
body.dark .md-body blockquote { border-left-color: #79b8ff; background: #121212; color: #858585; }
body.dark .md-body th { background: #1e1e1e; color: #e3e3e3; }
body.dark .md-body th, body.dark .md-body td { border-color: #252525; }

/* Chips (daily_review) */
body.dark .chip-time, body.dark .chip-zha, body.dark .chip {
    background-color: #1e1e1e; color: #858585; border-color: #252525;
}

/* Runner-specific states */
body.dark .runner-menu-btn { background: transparent; color: #e3e3e3; border-color: transparent; }
body.dark .runner-menu-btn:hover { background: #1e1e1e; }
body.dark .runner-menu-btn.active { background: #121212; border-left-color: #253a62; color: #79b8ff; }
body.dark .runner-btn { background: #253a62; color: #F7F8FA; border-color: #253a62; }
body.dark .runner-btn:hover { background: #2c4f93; }
body.dark .runner-msg.error { background: #3d1a1c; color: #f8a5a5; border-color: #6e2a2e; }
body.dark .runner-msg.success { background: #0a2a1a; color: #7ce38b; border-color: #1a5f2e; }
body.dark .runner-log pre { background: #000000; color: #e3e3e3; border-color: #252525; }

/* Notes edit form */
body.dark .btn-add, body.dark .btn-save { background: #253a62; color: #F7F8FA; border-color: #253a62; }
body.dark .btn-add:hover, body.dark .btn-save:hover { background: #2c4f93; }
body.dark .btn-edit:hover { background: #1e1e1e; color: #79b8ff; }
body.dark .btn-del:hover { background: #3d1a1c; color: #f8a5a5; border-color: #6e2a2e; }
body.dark .btn-cancel { background: #1e1e1e; color: #e3e3e3; }
body.dark .btn-cancel:hover { background: #252525; }
body.dark .edit-name, body.dark .edit-content {
    background: #000000; color: #e3e3e3; border-color: #252525;
}
body.dark .edit-name:focus, body.dark .edit-content:focus { border-color: #253a62; }

/* Follow/unfollow buttons */
body.dark .follow-btn { background: #1e1e1e; color: #e3e3e3; border-color: #252525; }
body.dark .follow-btn.followed { background: #253a62; color: #F7F8FA; border-color: #253a62; }
body.dark .unfollow-btn { background: #3d1a1c; color: #f8a5a5; border-color: #6e2a2e; }
body.dark .unfollow-btn:hover { background: #4d2022; }

/* Analysis modal (stock_detail) */
body.dark .analysis-modal-btn { background: #1e1e1e; color: #e3e3e3; border-color: #252525; }
body.dark .analysis-modal-btn.primary { background: #253a62; color: #F7F8FA; border-color: #253a62; }

/* Index page inline-styled panels (need !important to override inline style="") */
body.dark #top300HistoryPanel,
body.dark #statsPanel,
body.dark #industryStatsPanel { background: #141a22 !important; border-color: #2b3542 !important; color: #dbe7f5 !important; }
body.dark #top300HistoryPanel h5,
body.dark #statsPanel h5,
body.dark #industryStatsPanel h5 { color: #d6e2f0 !important; border-bottom-color: #2b3542 !important; }

/* stock_detail AI analysis panel (inline style) */
body.dark #analysis-panel { background: #121212 !important; color: #e3e3e3 !important; border-color: #252525 !important; }
body.dark #btn-analysis { background: #1e1e1e !important; color: #e3e3e3 !important; border-color: #252525 !important; }

/* Misc hints / empty states */
body.dark .empty-hint, body.dark .note-text.empty { color: #6e7681; }
body.dark #loading-msg { color: #6e7681; }
body.dark #error-msg { color: #f8a5a5; }
body.dark .concept-filter-reset { color: #858585; }
body.dark .emotion-block .sub-title { color: #858585; }

/* --- Dark Mode: link colors & remaining overrides --- */

/* Global link color — !important overrides JS-generated inline style="color:#333" */
body.dark a { color: #E0E0E0 !important; }
body.dark a:hover { color: #fff !important; }

/* stock_detail: concept tag links */
body.dark .concepts-container a {
    background-color: #1e1e1e;
    color: #79b8ff;
    border-color: #252525;
}
body.dark .concepts-container a:hover { background-color: #252525; }

/* stock_detail: meta-card chips */
body.dark .stock-meta-card .meta-chip,
body.dark .stock-meta-card a {
    background-color: #1e1e1e;
    color: #E0E0E0;
    border-color: #252525;
}
body.dark .stock-meta-card .meta-chip:hover,
body.dark .stock-meta-card a:hover { background-color: #252525; }

/* daily_review: table stock-code links */
body.dark .stk-table .code-a { color: #79b8ff; }

/* stock_detail: analysis panel buttons and spans (inline style override) */
body.dark #analysis-panel button {
    background: #1e1e1e !important;
    color: #e3e3e3 !important;
    border-color: #252525 !important;
}
body.dark #analysis-panel span[style] { color: #e3e3e3 !important; }
body.dark .stock-meta-note div[style] { color: #e3e3e3 !important; border-color: #252525 !important; }

/* stock_detail: fund-flow progress bar (inline style background:#f0f0f0) */
body.dark div[style*="background:#f0f0f0"] { background: #1e1e1e !important; }

/* Quant selector menu: /tickets and children */
body.dark .selector-page,
body.dark .selector-hero,
body.dark .selector-panel,
body.dark .selector-table-card,
body.dark .selector-empty,
body.dark .selector-summary-card,
body.dark .selector-model-card {
    background: #121212;
    border-color: #252525;
    color: #e3e3e3;
    box-shadow: 0 1px 4px rgba(0, 0, 0, .24);
}
body.dark .selector-hero {
    border-left-color: #79b8ff;
}
body.dark .selector-hero h2,
body.dark .selector-summary-value,
body.dark .selector-model-card strong,
body.dark .selector-table-head h3 {
    color: #e3e3e3;
}
body.dark .selector-hero p,
body.dark .selector-panel h3,
body.dark .selector-field label,
body.dark .selector-summary-label,
body.dark .selector-model-card span,
body.dark .selector-rule-list,
body.dark .selector-note,
body.dark .selector-rank,
body.dark .selector-spark-label {
    color: #858585;
}
body.dark .selector-field input,
body.dark .selector-field textarea,
body.dark .selector-field select {
    background: #000000;
    color: #e3e3e3;
    border-color: #252525;
}
body.dark .selector-field input:focus,
body.dark .selector-field textarea:focus,
body.dark .selector-field select:focus {
    border-color: #79b8ff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(125, 168, 216, .15);
}
body.dark .selector-table th,
body.dark .selector-table td {
    border-color: #252525;
}
body.dark .selector-table th {
    background: #1e1e1e;
    color: #858585;
}
body.dark .selector-table td {
    background: #121212;
    color: #e3e3e3;
}
body.dark .selector-table tbody tr:nth-child(even) td {
    background: #121212;
}
body.dark .selector-table td.selector-positive,
body.dark .selector-table .selector-positive {
    color: #c0392b !important;
}
body.dark .selector-table td.selector-negative,
body.dark .selector-table .selector-negative {
    color: #4cae4c !important;
}
body.dark .selector-table tbody tr:hover td {
    background: #262626;
}
body.dark .selector-table th.sortable:hover {
    background: #252525;
    color: #f0f6fc;
}
body.dark .selector-table th.sortable.asc::after,
body.dark .selector-table th.sortable.desc::after {
    color: #79b8ff;
}

/* 量化筛选菜单下的其余数据表，与股票详情表保持同一深色标准。 */
body.dark #resultTable tbody td,
body.dark #industryDetailTable tbody td,
body.dark .strategy-table tbody td,
body.dark .rebound-table tbody td,
body.dark #resultTable tbody tr:nth-child(even) td,
body.dark #industryDetailTable tbody tr:nth-child(even) td,
body.dark .strategy-table tbody tr:nth-child(even) td,
body.dark .rebound-table tbody tr:nth-child(even) td {
    background: #121212;
}
body.dark #resultTable tbody tr:hover td,
body.dark #industryDetailTable tbody tr:hover td,
body.dark .strategy-table tbody tr:hover td,
body.dark .rebound-table tbody tr:hover td {
    background: #262626;
}
body.dark .selector-link {
    color: #79b8ff;
}
body.dark .selector-link:hover {
    color: #79b8ff;
}
body.dark .selector-badge,
body.dark .selector-chip {
    background: #1e1e1e;
    border-color: #252525;
    color: #858585;
}
body.dark .selector-checks,
body.dark .selector-models {
    color: #858585;
}
body.dark .selector-chip:hover {
    background: #252525;
    color: #e3e3e3;
}
body.dark .selector-link-switch {
    background: #000000;
    border-color: #252525;
}
body.dark .selector-link-option {
    background: transparent;
    border-color: #252525;
    color: #858585;
}
body.dark .selector-link-option:hover {
    background: #1e1e1e;
    color: #e3e3e3;
}
body.dark .selector-link-option.active,
body.dark .selector-submit {
    background: #253a62;
    border-color: #253a62;
    color: #F7F8FA;
}
body.dark .selector-submit:hover {
    background: #2c4f93;
    border-color: #2c4f93;
}
body.dark .selector-reset {
    background: #1e1e1e;
    border-color: #252525;
    color: #e3e3e3;
}
body.dark .selector-reset:hover {
    background: #252525;
    color: #f0f6fc;
}
body.dark .selector-positive { color: #c0392b; }
body.dark .selector-negative { color: #4cae4c; }
body.dark .selector-spark svg {
    background: #121212;
    border-color: #252525;
}

/* /tickets and /tracker legacy table pages */
body.dark .conditions-bar,
body.dark .control-panel,
body.dark .input-item,
body.dark .input-group,
body.dark #resultTable,
body.dark .status-bar {
    background: #121212;
    border-color: #252525;
    color: #e3e3e3;
}
body.dark .conditions-bar,
body.dark .status-bar,
body.dark .index-note-cell,
body.dark .index-note-empty,
body.dark .loading {
    color: #858585 !important;
}
body.dark .control-panel button,
body.dark .control-panel .button,
body.dark #queryBtn,
body.dark #exportBtn {
    background: #253a62;
    border-color: #253a62;
    color: #F7F8FA;
}
body.dark .control-panel button:hover,
body.dark .control-panel .button:hover,
body.dark #queryBtn:hover,
body.dark #exportBtn:hover {
    background: #2c4f93;
    border-color: #2c4f93;
}
body.dark #resultTable th {
    background: #1e1e1e;
    color: #858585;
    border-color: #252525;
}
body.dark #resultTable td {
    background: #121212;
    color: #e3e3e3;
    border-color: #252525;
}
body.dark #resultTable td.positive,
body.dark #resultTable td.up,
body.dark #resultTable .positive,
body.dark #resultTable .up {
    color: #f6465d !important;
}
body.dark #resultTable td.negative,
body.dark #resultTable td.down,
body.dark #resultTable .negative,
body.dark #resultTable .down {
    color: #2ebd85 !important;
}
body.dark #resultTable tbody tr:nth-child(even) td {
    background: #121212;
}
body.dark #resultTable tbody tr:hover td {
    background: #1e1e1e;
}
body.dark .industry-stats-header {
    border-bottom-color: #252525;
}
body.dark .industry-stats-header h5,
body.dark #modalTitle {
    color: #e3e3e3 !important;
}
body.dark .industry-stats-toggle,
body.dark .index-follow-btn {
    background: #1e1e1e;
    border-color: #252525;
    color: #e3e3e3;
}
body.dark .industry-stats-toggle:hover,
body.dark .index-follow-btn:hover {
    background: #252525;
}
body.dark .index-follow-btn.followed {
    background: #253a62;
    border-color: #253a62;
    color: #F7F8FA;
}
body.dark #top300HistoryPanel,
body.dark #statsPanel,
body.dark #industryStatsPanel,
body.dark #top300HistoryPanel[style],
body.dark #statsPanel[style],
body.dark #industryStatsPanel[style] {
    background: #141a22 !important;
    border-color: #2b3542 !important;
    color: #dbe7f5 !important;
}

/* Analyze runner, in the same quant workflow */
body.dark .runner-layout,
body.dark .runner-main,
body.dark .runner-logic,
body.dark .runner-info-card,
body.dark .runner-schedule {
    background: #121212;
    border-color: #252525;
    color: #e3e3e3;
}
body.dark .runner-sidebar,
body.dark .runner-sidebar-head,
body.dark .runner-schedule-title {
    background: #121212;
    border-color: #252525;
    color: #858585;
}
body.dark .runner-info-label,
body.dark .runner-schedule-name {
    color: #e3e3e3;
}
body.dark .runner-info-text,
body.dark .runner-schedule-meta,
body.dark .runner-menu-last-run {
    color: #858585;
}
body.dark .runner-script-name,
body.dark .runner-schedule-script {
    color: #f0b76f;
}
body.dark .runner-schedule-row {
    border-bottom-color: #252525;
}

/* sector_detail: copy button (inline style background:#f5f5f5) */
body.dark #copy-names-btn {
    background: #1e1e1e !important;
    border-color: #252525 !important;
    color: #e3e3e3 !important;
}

/* Catch-all for ah_activity / emotion_calendar / concept_flow template classes */
body.dark [class*="activity-"],
body.dark [class*="calendar-"],
body.dark [class*="emotion-"],
body.dark [class*="concept-flow"] {
    background-color: #121212;
    border-color: #252525;
    color: #e3e3e3;
}

/* --- Responsive Design for Mobile --- */
@media (max-width: 768px) {
    body {
        padding: 5px 10px 10px;
    }

    .container {
        box-sizing: border-box;
        width: 100%;
        padding: 8px 15px 15px;
    }

    .header-container {
        position: relative;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding-bottom: 10px;
        margin-bottom: 14px;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        width: 38px;
        height: 36px;
        padding: 8px 9px;
        flex-direction: column;
        align-items: stretch;
        justify-content: space-between;
        border: 1px solid var(--eye-border);
        border-radius: 7px;
        background: var(--eye-surface-soft);
        color: #253a62;
        cursor: pointer;
    }

    .mobile-nav-toggle span {
        display: block;
        width: 100%;
        height: 2px;
        border-radius: 999px;
        background: currentColor;
        transition: transform .18s ease, opacity .18s ease;
    }

    .mobile-nav-toggle[aria-expanded="true"] span:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }

    .mobile-nav-toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .mobile-nav-toggle[aria-expanded="true"] span:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }

    .header-icon-tools {
        display: flex;
        justify-content: flex-end;
        gap: 6px;
        min-width: 0;
        margin: 0;
    }

    .header-icon-tools > button,
    .mobile-search-toggle {
        box-sizing: border-box;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        min-width: 34px;
        margin: 0;
        padding: 0;
        border-radius: 50%;
        line-height: 1;
    }

    .mobile-search-toggle {
        border: 1px solid var(--eye-border);
        background: var(--eye-surface-soft);
        color: #38557d;
        cursor: pointer;
    }

    #primaryNav {
        grid-column: 1 / -1;
        display: none;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        max-height: min(68vh, 560px);
        margin: 0;
        padding: 10px;
        overflow-y: auto;
        border: 1px solid var(--eye-border);
        border-radius: 9px;
        background: var(--eye-surface-soft);
        box-shadow: 0 8px 22px rgba(29, 45, 70, .1);
    }

    #primaryNav.mobile-open {
        display: grid;
    }

    #primaryNav > a {
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        min-height: 38px;
        margin: 0;
        padding: 8px;
        text-align: center;
    }

    #primaryNav .nav-dropdown {
        display: block;
        grid-column: 1 / -1;
        margin: 0;
        padding: 7px;
        border: 1px solid var(--eye-border);
        border-radius: 8px;
        background: var(--eye-surface);
    }

    #primaryNav .nav-dropdown-toggle {
        display: block;
        margin: 0 0 6px;
        padding: 4px 6px 7px;
        color: #253a62;
        font-size: 13px;
        font-weight: 700;
        text-align: left;
    }

    #primaryNav .nav-dropdown-toggle::after {
        display: none;
    }

    #primaryNav .nav-dropdown-menu,
    #primaryNav .nav-dropdown:hover .nav-dropdown-menu,
    #primaryNav .nav-dropdown:focus-within .nav-dropdown-menu {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        width: auto;
        min-width: 0;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        transform: none;
    }

    #primaryNav .nav-dropdown-menu a {
        display: flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        min-height: 34px;
        margin: 0;
        padding: 6px;
        white-space: normal;
    }

    .search-container {
        grid-column: 1 / -1;
        display: none;
        width: 100%;
    }

    .search-container.mobile-open {
        display: block;
    }

    #search-form {
        width: 100%;
    }

    #search-input {
        min-width: 0;
        flex-grow: 1; /* 让输入框占据更多空间 */
    }

    body.dark .mobile-nav-toggle,
    body.dark .mobile-search-toggle,
    body.dark #primaryNav {
        border-color: #252525;
        background: #1e1e1e;
        color: #e3e3e3;
    }

    body.dark #primaryNav .nav-dropdown {
        border-color: #252525;
        background: #121212;
    }

    body.dark #primaryNav .nav-dropdown-toggle {
        color: #e3e3e3;
    }

    .control-panel {
        flex-direction: column;
    }

    .input-group, .input-group-left {

        width: 100%;
    }
    .tracker-page .control-panel {
        flex-direction: column;
    }
    .tracker-code-input {
        flex-basis: auto;
        width: 100%;
    }
}
