:root {
    --bg-green: #0DAB67;
    --bg-orange: #F6C343;
    --bg-red: #E53935;
    --badge-bg: #E64F24;
    --bar-color: #69D5FF;
    --page-bg: #e5e7eb;
    --panel: #ffffff;
    --soft-gray: #f4f5f7;
    --line: #d9d9d9;
    --text: #202124;
    --muted: #8a8f98;
    --green-soft: #dff6ec;
    --orange-soft: #fff8d9;
    --red-soft: #ffe1df;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--page-bg);
    overflow-x: hidden;
}

button {
    font: inherit;
}

.page-shell {
    width: min(980px, 100vw);
    margin: 0 auto;
    padding: 12px;
    background: var(--panel);
    overflow-x: hidden;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: end;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    margin: 0 0 6px;
    padding: 4px 16px;
    border-radius: 999px;
    background: var(--badge-bg);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1px;
}

.star-badge {
    display: none;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 8px;
    padding: 5px 15px;
    border-radius: 999px;
    background: #de5126;
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.star-badge.is-visible {
    display: inline-flex;
}

.star-badge-label {
    margin-right: 6px;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0;
    line-height: 1.2;
    white-space: nowrap;
}

.star-icons {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #ffdf66;
}

.star-icons svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
}

h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1.08;
    font-weight: 900;
}

.meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.meta-line span {
    padding-right: 8px;
    border-right: 1px solid var(--line);
}

.meta-line span:last-child {
    border-right: 0;
}

.summary-card {
    width: 238px;
    align-self: stretch;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 7px;
    background: #fff;
}

.summary-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    color: #4f5967;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.15;
}

.summary-title::after {
    content: "低估 → 高估";
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
}

.summary-bar {
    display: flex;
    overflow: hidden;
    height: 7px;
    border-radius: 999px;
    background: var(--soft-gray);
}

.summary-bar-segment {
    min-width: 0;
    height: 100%;
}

.summary-bar-segment.cheap {
    background: var(--bg-green);
}

.summary-bar-segment.normal {
    background: var(--bg-orange);
}

.summary-bar-segment.expensive {
    background: var(--bg-red);
}

.summary-counts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 5px;
}

.summary-cell {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    border: 0;
    min-width: 0;
    border-radius: 999px;
    padding: 4px 7px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.summary-cell:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.1);
}

.summary-cell:focus-visible {
    outline: 2px solid rgba(230, 79, 36, 0.55);
    outline-offset: 2px;
}

.summary-cell span {
    display: inline;
    font-size: 10px;
    font-weight: 800;
    color: #60656f;
    white-space: nowrap;
}

.summary-cell strong {
    display: inline;
    margin-top: 0;
    font-size: 18px;
    line-height: 1;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.summary-cell.cheap {
    background: var(--green-soft);
}

.summary-cell.normal {
    background: var(--orange-soft);
}

.summary-cell.expensive {
    background: var(--red-soft);
}

.toolbar {
    display: flex;
    justify-content: center;
    gap: 0;
    align-items: center;
    margin: 10px 0 8px;
}

.segmented {
    display: inline-flex;
    overflow: hidden;
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft-gray);
}

.segmented-button {
    flex: 1;
    min-width: 78px;
    border: 0;
    padding: 7px 12px;
    background: transparent;
    color: #555b63;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.segmented-button.active {
    background: var(--badge-bg);
    color: #fff;
}

.content {
    display: grid;
    gap: 10px;
}

.fold-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 8px;
}

.fold-action {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    background: #fff;
    color: #4f5967;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.fold-action.active,
.fold-action:hover {
    border-color: #b8c2d3;
    background: #f8fafc;
    color: #202124;
}

.search-toggle {
    margin-left: auto;
}

.search-panel {
    margin: -2px 0 10px;
    padding: 8px;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.search-input-wrap {
    position: relative;
}

.search-input {
    width: 100%;
    min-height: 36px;
    padding: 7px 58px 7px 10px;
    border: 1px solid #cfd6e2;
    border-radius: 8px;
    background: #f9fafb;
    color: var(--text);
    font-size: 14px;
    font-weight: 700;
    outline: none;
}

.search-clear {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    border: 0;
    border-radius: 999px;
    padding: 3px 8px;
    background: #e9edf3;
    color: #4f5967;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
}

.search-clear:hover {
    background: #dce3ee;
    color: #202124;
}

.search-clear[hidden] {
    display: none;
}

.search-input:focus {
    border-color: #7da3d7;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(49, 115, 205, 0.14);
}

.search-results {
    display: grid;
    gap: 4px;
    margin-top: 7px;
}

.search-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    padding: 7px 9px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #f7f8fa;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.search-result:hover,
.search-result:focus {
    border-color: #cdd6e4;
    background: #ffffff;
}

.search-result-main {
    overflow: hidden;
    font-size: 14px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    flex: 0 0 auto;
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.search-result mark {
    border-radius: 3px;
    background: #fff0a6;
    color: inherit;
}

.search-empty {
    padding: 8px 4px 3px;
    color: #7b8490;
    font-size: 12px;
    font-weight: 700;
}

.alerts-panel {
    display: grid;
    gap: 7px;
    margin: 0 0 10px;
    padding: 8px;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

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

.alerts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.alerts-header strong {
    color: #202124;
    font-size: 14px;
    font-weight: 900;
    white-space: nowrap;
}

.alerts-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.alert-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid #d8dee8;
    border-radius: 999px;
    background: #ffffff;
    color: #687385;
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.alert-dismiss:hover,
.alert-dismiss:focus {
    border-color: #f04a24;
    color: #f04a24;
}

.alerts-header > span {
    color: #7b8490;
    font-size: 12px;
    font-weight: 700;
    text-align: right;
}

.alert-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
}

.alert-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 900;
    line-height: 1.3;
}

.alert-chip.critical {
    background: #ffe1df;
    color: #b42318;
}

.alert-chip.opportunity {
    background: #dff6ec;
    color: #08794f;
}

.alert-chip.risk {
    background: #fff1bf;
    color: #8a6100;
}

.alert-chip.observe {
    background: #eef2f7;
    color: #4f5967;
}

.alert-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
    gap: 5px;
}

.alert-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 6px;
    align-items: baseline;
    min-width: 0;
    border: 1px solid #e1e5ec;
    border-left-width: 4px;
    border-radius: 8px;
    padding: 6px 8px;
    background: #f9fafb;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.alert-item:hover,
.alert-item:focus {
    background: #ffffff;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.alert-item.critical {
    border-left-color: #e53935;
}

.alert-item.opportunity {
    border-left-color: #0dab67;
}

.alert-item.risk {
    border-left-color: #f6c343;
}

.alert-item.observe {
    border-left-color: #98a2ad;
}

.alert-type {
    display: inline-flex;
    width: fit-content;
    border-radius: 999px;
    padding: 1px 5px;
    background: #eef2f7;
    color: #4f5967;
    font-size: 10px;
    font-weight: 900;
    white-space: nowrap;
}

.alert-item.critical .alert-type {
    background: #ffe1df;
    color: #b42318;
}

.alert-item.opportunity .alert-type {
    background: #dff6ec;
    color: #08794f;
}

.alert-item.risk .alert-type {
    background: #fff1bf;
    color: #8a6100;
}

.alert-item strong {
    overflow: hidden;
    font-size: 12px;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alert-item small {
    grid-column: 1 / -1;
    overflow: hidden;
    color: #7b8490;
    font-size: 10px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.alerts-more {
    color: #7b8490;
    font-size: 11px;
    font-weight: 700;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.loading-panel,
.empty-panel {
    padding: 28px;
    border-radius: 12px;
    background: var(--soft-gray);
    text-align: center;
    color: var(--muted);
}

.browser-tip {
    border: 1px solid #f2d4b8;
    background: #fff8ef;
    color: #71512a;
    line-height: 1.6;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 8px;
    padding: 9px 12px;
    border: 1px solid #d5dbe5;
    border-left: 6px solid var(--badge-bg);
    border-radius: 8px;
    color: #202124;
    background: linear-gradient(90deg, #fff5ef 0%, #ffffff 78%);
    font-size: 17px;
    font-weight: 900;
    line-height: 1.15;
}

.fold-section {
    display: grid;
    gap: 0;
}

.fold-section > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.fold-section > summary::-webkit-details-marker {
    display: none;
}

.fold-title {
    justify-content: flex-start;
}

.fold-title.zone-cheap {
    border-left-color: var(--bg-green);
    background: linear-gradient(90deg, var(--green-soft) 0%, #ffffff 78%);
}

.fold-title.zone-normal {
    border-left-color: var(--bg-orange);
    background: linear-gradient(90deg, var(--orange-soft) 0%, #ffffff 78%);
}

.fold-title.zone-expensive {
    border-left-color: var(--bg-red);
    background: linear-gradient(90deg, var(--red-soft) 0%, #ffffff 78%);
}

.fold-title::before {
    content: "收起";
    flex: 0 0 auto;
    order: 2;
    border: 1px solid #d5dbe5;
    border-radius: 999px;
    padding: 3px 8px;
    background: #fff;
    color: #60656f;
    font-size: 11px;
    font-weight: 800;
}

.fold-section:not([open]) .fold-title::before {
    content: "展开";
}

.fold-section:not([open]) .fold-title {
    margin-bottom: 0;
}

.section-title::after {
    content: "";
    height: 2px;
    flex: 1;
    border-radius: 999px;
    background: #d5dbe5;
}

.valuation-list {
    display: grid;
    gap: 7px;
}

.valuation-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(152px, 190px) minmax(260px, 1fr) 196px;
    gap: 10px;
    align-items: center;
    min-height: 92px;
    padding: 8px 9px;
    border: 1px solid #eeeeee;
    border-left-width: 8px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: box-shadow 180ms ease, transform 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

.valuation-row.zone-cheap {
    border-left-color: var(--bg-green);
}

.valuation-row.zone-normal {
    border-left-color: var(--bg-orange);
}

.valuation-row.zone-expensive {
    border-left-color: var(--bg-red);
}

.valuation-row.is-highlighted {
    animation: row-highlight 1.8s ease;
}

@keyframes row-highlight {
    0% {
        box-shadow: 0 0 0 3px rgba(49, 115, 205, 0.28), 0 2px 8px rgba(15, 23, 42, 0.06);
    }
    100% {
        box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    }
}

.identity,
.axis-panel,
.side-panel {
    min-width: 0;
}

.name-line {
    display: block;
    min-width: 0;
}

.index-name {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16px;
    font-weight: 900;
    line-height: 1.18;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.index-name-link {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: inherit;
    text-decoration: none;
    border-radius: 5px;
    transition: color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}

.index-name-link:hover,
.index-name-link:focus {
    color: #111827;
    background: rgba(230, 79, 36, 0.08);
}

.index-name-link:active {
    background: rgba(230, 79, 36, 0.14);
    box-shadow: 0 0 0 4px rgba(230, 79, 36, 0.08);
}

.index-name-link::after {
    content: "↗";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: rgba(230, 79, 36, 0.1);
    color: #e64f24;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    transform: translateY(-1px);
}

.index-name-link:focus-visible {
    outline: 2px solid rgba(230, 79, 36, 0.36);
    outline-offset: 2px;
    border-radius: 4px;
}

.subline {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
}

.metric-note {
    color: #4f5967;
    transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.subline .status-compare {
    margin-top: 0;
}

.status-compare {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    gap: 5px;
    align-items: center;
    margin-top: 6px;
    padding: 3px 8px;
    border: 1px solid #e8dfd6;
    border-radius: 7px;
    background: #fffaf5;
    color: #6f4f1e;
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    transition: box-shadow 160ms ease, transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.status-compare span {
    flex: 0 0 auto;
}

.watch-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin-top: 0;
    border: 1px solid #d8dee8;
    border-radius: 999px;
    padding: 3px 9px;
    background: #f8fafc;
    color: #4f5967;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.watch-toggle:hover,
.watch-toggle:focus {
    border-color: #e64f24;
    background: #fff5ef;
    color: #c73f19;
}

.watch-toggle.is-selected {
    border-color: rgba(230, 79, 36, 0.45);
    background: #e64f24;
    color: #ffffff;
}

.watch-toggle:focus-visible {
    outline: 2px solid rgba(230, 79, 36, 0.34);
    outline-offset: 2px;
}

.watch-order {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 7px;
}

.watch-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 25px;
    border: 1px solid #cfd6e2;
    border-radius: 7px;
    padding: 3px 8px;
    background: #ffffff;
    color: #3f4a59;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

.watch-order-button:hover,
.watch-order-button:focus {
    border-color: #e64f24;
    background: #fff5ef;
    color: #c73f19;
}

.watch-order-button:focus-visible {
    outline: 2px solid rgba(230, 79, 36, 0.34);
    outline-offset: 2px;
}

.watch-order-button:disabled {
    border-color: #e4e8ee;
    background: #f4f6f8;
    color: #a1a9b4;
    box-shadow: none;
    cursor: default;
}

.current-value {
    display: block;
    margin-top: 7px;
}

.current-value strong {
    font-size: 26px;
    line-height: 1;
    font-weight: 900;
    color: var(--text);
    transition: color 0.2s ease;
}

.current-value.zone-cheap strong {
    color: #078955;
}

.current-value.zone-normal strong {
    color: #b97800;
}

.current-value.zone-expensive strong {
    color: #d72f2a;
}

.axis-labels {
    position: relative;
    height: 25px;
    margin: 0 1px 4px;
    font-size: 10px;
    color: #536071;
}

.axis-label {
    position: absolute;
    top: 0;
    width: 58px;
    transform: translateX(-50%);
    text-align: center;
    white-space: normal;
    line-height: 1.08;
}

.axis-label:first-child {
    transform: translateX(0);
    text-align: left;
}

.axis-label:last-child {
    transform: translateX(-100%);
    text-align: right;
}

.axis-label b {
    display: block;
    color: #222;
    font-size: 11px;
}

.axis-track {
    position: relative;
    height: 24px;
    overflow: visible;
    border-radius: 3px;
    background: var(--bg-orange);
    margin-inline: 1px;
}

.axis-segment {
    position: absolute;
    top: 0;
    bottom: 0;
}

.axis-segment.cheap {
    left: 0;
    border-radius: 3px 0 0 3px;
    background: var(--bg-green);
}

.axis-segment.normal {
    background: var(--bg-orange);
}

.axis-segment.expensive {
    right: 0;
    border-radius: 0 3px 3px 0;
    background: var(--bg-red);
}

.axis-fade {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.62);
    z-index: 2;
    pointer-events: none;
}

.threshold-line {
    position: absolute;
    top: -4px;
    bottom: -4px;
    width: 2px;
    background: #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.16);
    transform: translateX(-50%);
    z-index: 3;
}

.current-marker {
    position: absolute;
    top: 50%;
    z-index: 4;
    --marker-scale: 1;
    min-width: 35px;
    max-width: 60px;
    padding: 3px 7px 3px 8px;
    transform: translate(calc(-100% - 5px), -50%) scale(var(--marker-scale));
    transform-origin: right center;
    border: 1px solid var(--marker-stroke);
    border-radius: 5px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 46%),
        var(--marker-fill);
    color: #ffffff;
    text-align: center;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.05;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.72),
        0 1px 2px rgba(15, 23, 42, 0.2),
        inset 0 -1px 0 rgba(0, 0, 0, 0.12);
    transition: transform 160ms ease, font-size 160ms ease, box-shadow 160ms ease;
    white-space: nowrap;
    outline: none;
}

.axis-track:hover .current-marker,
.axis-track:focus-within .current-marker {
    --marker-scale: 1.18;
    z-index: 6;
    font-size: 14px;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.9),
        0 3px 8px rgba(15, 23, 42, 0.24),
        inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

.current-marker::before {
    content: "";
    position: absolute;
    right: -6px;
    top: 50%;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 6px solid var(--marker-stroke);
    transform: translateY(-50%);
}

.current-marker::after {
    content: "";
    position: absolute;
    right: -4px;
    top: 50%;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 4px solid var(--marker-fill);
    transform: translateY(-50%);
}

.current-marker.zone-cheap {
    --marker-fill: #078955;
    --marker-stroke: #066f47;
}

.current-marker.zone-normal {
    --marker-fill: #c98300;
    --marker-stroke: #986300;
}

.current-marker.zone-expensive {
    --marker-fill: #d72f2a;
    --marker-stroke: #a91f1b;
}

.current-marker.edge-left {
    transform: translate(5px, -50%) scale(var(--marker-scale));
    transform-origin: left center;
    padding: 3px 8px 3px 7px;
}

.current-marker.edge-right {
    transform: translate(calc(-100% - 5px), -50%) scale(var(--marker-scale));
    transform-origin: right center;
}

.current-marker.edge-left::before {
    right: auto;
    left: -6px;
    border-left: 0;
    border-right: 6px solid var(--marker-stroke);
}

.current-marker.edge-left::after {
    right: auto;
    left: -4px;
    border-left: 0;
    border-right: 4px solid var(--marker-fill);
}

.side-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.distance-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
}

.funds {
    display: contents;
}

.distance-card,
.fund-card {
    min-width: 0;
    padding: 4px 5px 4px 6px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #fafafa;
    overflow: hidden;
}

.distance-card {
    position: relative;
    border-left-width: 3px;
    border-left-style: solid;
}

.distance-card::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    pointer-events: none;
    z-index: 1;
}

.distance-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--fill, 0%);
    border-radius: 5px;
    opacity: 0.26;
    pointer-events: none;
    transition: width 240ms ease;
    z-index: 0;
}

.distance-fill::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0));
}

.distance-card.tone-positive {
    border-left-color: #c04b4b;
    background: #fff6f5;
}

.distance-card.tone-negative {
    border-left-color: #0a9871;
    background: #f3fbf7;
}

.distance-card.tone-flat {
    border-left-color: #98a2ad;
    background: #f6f7f9;
}

.distance-card.tone-deep-green {
    border-left-color: #0a8f5f;
    background: #e8f8f0;
}

.distance-card.tone-normal-yellow {
    border-left-color: #d4a30a;
    background: #fff9db;
}

.distance-card.tone-expensive-red {
    border-left-color: #d72f2a;
    background: #ffe9e7;
}

.distance-card.tone-deep-red {
    border-left-color: #a82020;
    background: #fce8e8;
}

.distance-card.tone-positive .distance-fill {
    background: #c04b4b;
}

.distance-card.tone-negative .distance-fill {
    background: #0a9871;
}

.distance-card.tone-flat .distance-fill {
    background: #98a2ad;
}

.distance-card.tone-deep-green .distance-fill {
    background: #0a8f5f;
}

.distance-card.tone-normal-yellow .distance-fill {
    background: #d4a30a;
}

.distance-card.tone-expensive-red .distance-fill {
    background: #d72f2a;
}

.distance-card.tone-deep-red .distance-fill {
    background: #a82020;
}

.distance-card.is-full .distance-fill {
    border-radius: 5px;
}

.distance-card.is-missing .distance-fill {
    opacity: 0;
}

.distance-card.is-fill-inactive .distance-fill {
    opacity: 0;
}

.distance-card .distance-label,
.fund-card span {
    position: relative;
    z-index: 2;
    display: block;
    overflow: hidden;
    color: #757b84;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.distance-card .distance-value {
    position: relative;
    z-index: 2;
    display: block;
    overflow: hidden;
    margin-top: 1px;
    font-size: 13px;
    font-weight: 900;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.distance-card.tone-positive .distance-value {
    color: #c04b4b;
}

.distance-card.tone-negative .distance-value {
    color: #0a9871;
}

.distance-card.tone-flat .distance-value {
    color: #435166;
}

.distance-card.tone-deep-green .distance-value {
    color: #0a7a50;
}

.distance-card.tone-normal-yellow .distance-value {
    color: #9b7400;
}

.distance-card.tone-expensive-red .distance-value {
    color: #c82420;
}

.distance-card.tone-deep-red .distance-value {
    color: #8b1a1a;
}

.distance-card .distance-hint {
    position: relative;
    z-index: 2;
    display: block;
    overflow: hidden;
    margin-top: 1px;
    color: #6f7682;
    font-size: 9px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.distance-card .distance-copy {
    position: relative;
    z-index: 2;
    display: block;
    overflow: hidden;
    color: #757b84;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.distance-card .distance-pill {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
    padding: 1px 5px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.04);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    overflow: hidden;
}

.distance-card .distance-pill-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--fill, 0%);
    border-radius: 10px;
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}

.distance-card.tone-positive .distance-pill-fill {
    background: #c04b4b;
}

.distance-card.tone-negative .distance-pill-fill {
    background: #0a9871;
}

.distance-card.tone-flat .distance-pill-fill {
    background: #98a2ad;
}

.distance-card.tone-deep-green .distance-pill-fill {
    background: #0a8f5f;
}

.distance-card.tone-normal-yellow .distance-pill-fill {
    background: #d4a30a;
}

.distance-card.tone-expensive-red .distance-pill-fill {
    background: #d72f2a;
}

.distance-card.tone-deep-red .distance-pill-fill {
    background: #a82020;
}

.distance-card .distance-pill strong {
    position: relative;
    z-index: 1;
    font-weight: 700;
}

.distance-card.tone-positive .distance-pill strong {
    color: #c04b4b;
}

.distance-card.tone-negative .distance-pill strong {
    color: #0a9871;
}

.distance-card.tone-flat .distance-pill strong {
    color: #435166;
}

.distance-card.tone-deep-green .distance-pill strong {
    color: #0a7a50;
}

.distance-card.tone-normal-yellow .distance-pill strong {
    color: #9b7400;
}

.distance-card.tone-expensive-red .distance-pill strong {
    color: #c82420;
}

.distance-card.tone-deep-red .distance-pill strong {
    color: #8b1a1a;
}

.distance-card.is-plain .distance-copy {
    color: #9aa3ad;
}

.distance-card.is-focus-distance {
    box-shadow: 0 0 0 1.5px rgba(59, 91, 219, 0.25);
}

.fund-card strong,
.fund-link {
    display: block;
    overflow: hidden;
    margin-top: 2px;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.08;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #263242;
}

.fund-link {
    text-decoration: none;
    text-underline-offset: 3px;
}

.fund-link:hover,
.fund-link:focus {
    color: #0f5fb8;
    text-decoration: underline;
}

.fund-link:focus-visible {
    outline: 2px solid rgba(230, 79, 36, 0.36);
    outline-offset: 2px;
    border-radius: 4px;
}

@media (max-width: 820px) {
    body {
        background: #f5f6f8;
    }

    .page-shell {
        width: 100%;
        padding: 10px;
        background: #f5f6f8;
    }

    .hero {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: start;
        padding-bottom: 8px;
        border-bottom: 0;
    }

    .eyebrow {
        margin-bottom: 5px;
        padding: 3px 12px;
        font-size: 11px;
    }

    h1 {
        font-size: 23px;
        line-height: 1.15;
    }

    .meta-line {
        gap: 6px;
        font-size: 12px;
    }

    .summary-card {
        width: 100%;
        border-radius: 10px;
        padding: 7px 8px;
    }

    .summary-title {
        margin-bottom: 5px;
        font-size: 13px;
    }

    .summary-title::after {
        font-size: 11px;
    }

    .summary-bar {
        height: 7px;
    }

    .summary-counts {
        gap: 5px;
        margin-top: 5px;
    }

    .summary-cell {
        min-height: 28px;
        padding: 4px 8px;
    }

    .summary-cell span {
        font-size: 12px;
    }

    .summary-cell strong {
        font-size: 20px;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
        gap: 0;
        margin: 9px 0 7px;
    }

    .segmented {
        width: 100%;
    }

    .segmented-button {
        flex: 1;
        padding: 8px 10px;
        font-size: 13px;
    }

    .content {
        gap: 9px;
    }

    .fold-actions {
        gap: 5px;
    }

    .fold-action {
        padding: 6px 10px;
        font-size: 12px;
    }

    .search-panel {
        padding: 7px;
        border-radius: 9px;
    }

    .search-input {
        font-size: 16px;
    }

    .search-result {
        align-items: flex-start;
        flex-direction: column;
        gap: 2px;
        padding: 7px 8px;
    }

    .search-result-main,
    .search-result-meta {
        max-width: 100%;
    }

    .alerts-panel {
        gap: 6px;
        margin-bottom: 8px;
        padding: 7px;
        border-radius: 9px;
    }

    .alert-list {
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 1px;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }

    .alert-item {
        flex: 0 0 178px;
        scroll-snap-align: start;
    }

    .alerts-header strong {
        font-size: 13px;
    }

    .alert-chips {
        flex-wrap: nowrap;
    }

    .section-title {
        margin: 10px 0 8px;
        padding: 8px 10px;
        border-left-width: 5px;
        font-size: 16px;
    }

    .valuation-list {
        gap: 7px;
    }

    .valuation-row {
        grid-template-columns: 1fr;
        gap: 7px;
        min-height: 0;
        padding: 8px 9px;
        border-left-width: 6px;
        border-radius: 10px;
    }

    .valuation-row.is-scroll-active {
        transform: translateY(-1px);
        box-shadow:
            inset 0 0 0 1px rgba(71, 85, 105, 0.1),
            0 6px 16px rgba(15, 23, 42, 0.12);
    }

    .valuation-row.is-scroll-active::before {
        content: none;
    }

    .valuation-row.is-scroll-active::after {
        content: none;
    }

    .valuation-row.is-scroll-active .current-marker {
        --marker-scale: 1.22;
        z-index: 6;
        font-size: 15px;
        box-shadow:
            0 0 0 2px rgba(255, 244, 190, 0.95),
            0 0 13px rgba(245, 190, 60, 0.42),
            0 4px 10px rgba(15, 23, 42, 0.22),
            inset 0 -1px 0 rgba(0, 0, 0, 0.12);
    }

    .valuation-row.is-scroll-active .metric-note {
        border: 1px solid rgba(226, 171, 32, 0.55);
        background: #fff3b8;
        color: #4f3a07;
        box-shadow:
            0 0 0 2px rgba(255, 246, 200, 0.9),
            0 0 12px rgba(245, 190, 60, 0.32);
        transform: translateY(-1px);
    }

    .valuation-row.is-scroll-active .status-compare {
        border-color: rgba(226, 171, 32, 0.6);
        background: #fffaf5;
        color: #6f4f1e;
        box-shadow:
            0 0 0 2px rgba(255, 246, 200, 0.9),
            0 0 12px rgba(245, 190, 60, 0.3);
        transform: translateY(-1px);
    }

    .identity {
        position: relative;
        display: block;
        min-height: 24px;
        padding-right: 150px;
    }

    .name-line {
        display: block;
        min-width: 0;
    }

    .index-name {
        display: block;
        overflow: visible;
        font-size: 17px;
        line-height: 1.16;
        overflow-wrap: normal;
        word-break: keep-all;
        -webkit-line-clamp: unset;
    }

    .index-name-link {
        display: inline-flex;
        padding: 1px 3px 2px 0;
    }

    .index-name-text {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
    }

    .index-name-link::after {
        width: 17px;
        height: 17px;
        font-size: 11px;
        transform: translateY(-2px);
    }

    .subline {
        position: absolute;
        top: 0;
        right: 0;
        flex-wrap: nowrap;
        justify-content: flex-end;
        gap: 4px;
        margin-top: 0;
        font-size: 11px;
        white-space: nowrap;
    }

    .code-note {
        display: none;
    }

    .metric-note {
        display: inline-flex;
        align-items: center;
        min-height: 20px;
        padding: 2px 6px;
        border-radius: 999px;
        background: #eef2f7;
        color: #4f5967;
        font-weight: 800;
    }

    .status-compare {
        margin-top: 0;
        padding: 2px 5px;
        font-size: 10px;
    }

    .subline .status-compare {
        flex: 0 0 auto;
    }

    .watch-toggle {
        flex: 0 0 auto;
        padding: 2px 6px;
        font-size: 10px;
    }

    .watch-order {
        flex-wrap: nowrap;
        margin-top: 6px;
    }

    .watch-order-button {
        flex: 1 1 0;
        min-height: 26px;
        padding: 4px 6px;
        font-size: 11px;
    }

    .current-value {
        display: none;
    }

    .axis-labels {
        height: 30px;
        margin-bottom: 4px;
        font-size: 11px;
    }

    .axis-label {
        width: 62px;
        line-height: 1.12;
    }

    .axis-label b {
        font-size: 12px;
    }

    .axis-track {
        height: 27px;
        border-radius: 4px;
    }

    .current-marker {
        min-width: 40px;
        max-width: 68px;
        padding: 3px 7px;
        font-size: 13px;
    }

    .current-marker.edge-left {
        transform: translate(9px, -50%) scale(var(--marker-scale));
    }

    .side-panel {
        gap: 4px;
    }

    .distance-card,
    .fund-card {
        min-height: 28px;
        padding: 4px 6px;
        border-radius: 7px;
    }

    .distance-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 4px;
    }

    .distance-card .distance-copy {
        flex: 1 1 auto;
        min-width: 0;
    }

    .distance-card .distance-pill {
        flex: 0 0 auto;
        margin-top: 0;
        padding: 1px 4px;
        font-size: 10px;
    }

    .fund-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 5px;
    }

    .distance-card .distance-label,
    .fund-card span {
        flex: 0 0 auto;
        font-size: 10px;
    }

    .distance-card .distance-value {
        font-size: 13px;
    }

    .distance-card .distance-hint {
        font-size: 10px;
    }

    .fund-card strong,
    .fund-link {
        margin-top: 0;
        font-size: 13px;
        text-align: right;
    }
}

@media (max-width: 420px) {
    .page-shell {
        padding: 8px;
    }

    .star-badge {
        padding: 5px 13px;
    }

    .star-badge-label {
        font-size: 15px;
    }

    .star-icons {
        gap: 1px;
    }

    .star-icons svg {
        width: 21px;
        height: 21px;
    }

    .meta-line span {
        padding-right: 6px;
    }

    h1 {
        font-size: 22px;
    }

    .index-name {
        font-size: 16px;
    }

    .axis-label {
        width: 55px;
        font-size: 10px;
    }

    .current-marker {
        min-width: 46px;
        max-width: 72px;
        font-size: 13px;
    }

    .current-marker.edge-left {
        transform: translate(10px, -50%) scale(var(--marker-scale));
    }

    .distance-card,
    .fund-card {
        padding: 4px 5px;
    }

    .distance-card .distance-value {
        font-size: 12px;
    }

    .fund-card strong,
    .fund-link {
        font-size: 12px;
    }
}

/* ── Mobile export layout ── */
body.mobile-export {
    background: #ffffff;
}

body.mobile-export .page-shell {
    width: 100%;
    max-width: 100%;
}

/* ── Footer ── */
.page-footer {
    margin-top: 32px;
    padding: 16px 0 128px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.page-footer p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    line-height: 1.6;
}

.footer-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.feedback-btn,
.install-footer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.feedback-btn {
    background: #f4f5f7;
    color: #202124;
}

.feedback-btn:hover {
    background: #202124;
    color: #ffffff;
    border-color: #202124;
}

.install-footer-btn {
    gap: 5px;
    background: #ffffff;
    color: #4f5967;
}

.install-footer-btn[hidden] {
    display: none;
}

.install-fab-title {
    font-weight: 800;
}

.install-fab-hint {
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
}

.install-footer-btn.is-guide {
    max-width: min(520px, 100%);
    border-radius: 10px;
    align-items: flex-start;
    padding-block: 9px;
    text-align: left;
}

.install-footer-btn.is-guide .install-fab-hint {
    display: block;
    line-height: 1.35;
}

@media (max-width: 420px) {
    .page-footer {
        padding-bottom: 152px;
    }

    .footer-actions {
        gap: 9px;
    }

    .feedback-btn,
    .install-footer-btn {
        min-width: 138px;
    }

    .install-footer-btn.is-guide {
        width: 100%;
        justify-content: flex-start;
    }
}

.back-to-top {
    position: fixed;
    right: max(14px, calc((100vw - 980px) / 2 + 14px));
    bottom: 18px;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(32, 33, 36, 0.14);
    border-radius: 999px;
    padding: 9px 12px;
    background: rgba(32, 33, 36, 0.92);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
    cursor: pointer;
}

.back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top::before {
    content: "↑";
    font-size: 15px;
    line-height: 1;
}

body.mobile-export .install-footer-btn {
    display: none !important;
}
