/* Futu Quotes - quote table + single-stock page
 * Single-stock page styling takes cues from Seeking Alpha / moomoo:
 * card-based layout, green-up / red-down (US convention), rating pills,
 * percentile bars, a hero price block and a sticky ticker bar.
 */

:root {
	--futu-up: #00a63e;
	--futu-down: #e02424;
	--futu-flat: #6b7280;
	--futu-accent: #2563eb;
	--futu-ai: #7c5cff;
}

/* =========================================================================
 *  Shared quote table (shortcode + /quote/ list page)
 * ====================================================================== */
.futu-quotes-wrap {
	margin: 1em 0;
	font-variant-numeric: tabular-nums;
}
.futu-quotes-title { margin: 0 0 .5em; font-size: 1.1em; }
/* Classic CSS-only "scroll shadow": a shadow layer fixed to the viewport
   (background-attachment: scroll) is covered by a same-color gradient that
   scrolls WITH the content (background-attachment: local), so each edge
   shadow only shows once the corresponding side actually has more to
   scroll to — no JS overflow-detection needed, and it disappears on its
   own once a table fits without scrolling. */
.futu-quotes-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	background-color: var(--sv-card);
	background-image:
		linear-gradient(to right, var(--sv-card) 50%, transparent),
		linear-gradient(to left, var(--sv-card) 50%, transparent),
		linear-gradient(to right, rgba(16, 24, 40, .12), transparent),
		linear-gradient(to left, rgba(16, 24, 40, .12), transparent);
	background-repeat: no-repeat;
	background-size: 20px 100%, 20px 100%, 10px 100%, 10px 100%;
	background-position: left, right, left, right;
	background-attachment: local, local, scroll, scroll;
}
.futu-quotes-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.futu-quotes-table th,
.futu-quotes-table td {
	padding: 9px 12px;
	text-align: right;
	white-space: nowrap;
	border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.futu-quotes-table th {
	font-weight: 600;
	color: #6b7280;
	background: rgba(0, 0, 0, .02);
	position: sticky;
	top: 0;
}
.futu-quotes-table tbody tr:hover { background: rgba(37, 99, 235, .04); }
.futu-quotes-table td:first-child,
.futu-quotes-table th:first-child {
	text-align: left;
	position: sticky;
	left: 0;
	background: #fff;
}
.futu-table-left th, .futu-table-left td { text-align: left; }
.futu-name { display: block; font-weight: 600; }
.futu-code { display: block; font-size: 11px; color: #9ca3af; }

.futu-dir-up .futu-last, .futu-dir-up .futu-chg, .futu-dir-up .futu-chg-rate { color: var(--futu-up); }
.futu-dir-down .futu-last, .futu-dir-down .futu-chg, .futu-dir-down .futu-chg-rate { color: var(--futu-down); }
.futu-dir-flat .futu-last, .futu-dir-flat .futu-chg, .futu-dir-flat .futu-chg-rate { color: var(--futu-flat); }

.futu-chg-inline { font-size: 12px; font-weight: 600; white-space: nowrap; }
.futu-chg-inline.futu-dir-up { color: var(--futu-up); }
.futu-chg-inline.futu-dir-down { color: var(--futu-down); }

.futu-quotes-status { margin-top: .5em; font-size: 12px; color: #9ca3af; }
.futu-quotes-stale { opacity: .5; transition: opacity .2s; }
.futu-quotes-empty { color: #9ca3af; padding: 1em 0; }
.futu-name-link { text-decoration: none; color: inherit; }
.futu-name-link:hover .futu-name { text-decoration: underline; }

/* =========================================================================
 *  Single-stock page
 * ====================================================================== */
.futu-quote-page {
	--sv-page-bg: #f5f6f8;
	--sv-card: #ffffff;
	--sv-border: #e5e7eb;
	--sv-border-strong: #d1d5db;
	--sv-text: #111827;
	--sv-muted: #6b7280;
	--sv-faint: #9ca3af;
	--sv-track: #eef0f3;
	--sv-chip: #f3f4f6;
	background: var(--sv-page-bg);
	color: var(--sv-text);
	font-variant-numeric: tabular-nums;
	-webkit-font-smoothing: antialiased;
}
.futu-quote-inner {
	max-width: 940px;
	margin: 0 auto;
	padding: 20px 16px 64px;
	line-height: 1.5;
}
/* Pages with a right rail (sidebar present) get a wider frame so the main
   column doesn't get squeezed down to make room for it. */
.futu-quote-inner.futu-has-sidebar { max-width: 1240px; }
.futu-quote-inner * { box-sizing: border-box; }
/* Neutralise theme chrome on our own elements */
.futu-quote-inner h1,
.futu-quote-inner h2,
.futu-quote-inner h3 { border: 0; padding: 0; color: inherit; font-family: inherit; }
.futu-quote-inner a { box-shadow: none; }
.futu-quote-inner dl,
.futu-quote-inner dd,
.futu-quote-inner dt,
.futu-quote-inner ul { margin: 0; padding: 0; }
.futu-quote-inner table { margin: 0; border: 0; background: none; }
.futu-quote-inner summary { list-style: none; }

.futu-quote-crumbs { font-size: 13px; color: var(--sv-faint); margin-bottom: 14px; }
.futu-quote-crumbs a { color: var(--sv-muted); text-decoration: none; }
.futu-quote-crumbs a:hover { color: var(--futu-accent); }
.futu-quote-crumbs span { margin: 0 6px; }

/* ---------- sticky ticker bar (revealed on scroll) ---------- */
.futu-stickybar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 900;
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 16px;
	background: rgba(255, 255, 255, .92);
	backdrop-filter: saturate(180%) blur(8px);
	-webkit-backdrop-filter: saturate(180%) blur(8px);
	border-bottom: 1px solid #e5e7eb;
	color: #111827;
	transform: translateY(-100%);
	transition: transform .18s ease;
	font-size: 14px;
}
.futu-stickybar.is-shown { transform: translateY(0); }
.futu-stickybar-inner { max-width: 940px; margin: 0 auto; width: 100%; display: flex; align-items: center; gap: 12px; }
.futu-stickybar-name { font-weight: 700; }
.futu-stickybar-sym { color: var(--sv-faint); font-size: 12px; }
.futu-stickybar-price { margin-left: auto; font-weight: 700; }
.futu-stickybar-move { font-weight: 600; font-size: 13px; }
.futu-dir-up .futu-stickybar-price, .futu-dir-up .futu-stickybar-move { color: var(--futu-up); }
.futu-dir-down .futu-stickybar-price, .futu-dir-down .futu-stickybar-move { color: var(--futu-down); }

/* ---------- sub-page tab nav (Seeking Alpha / moomoo style) ---------- */
.futu-tabs {
	/* sticky is opt-in: some themes (Neve) run their own fixed header that
	   would overlap it. Add .futu-tabs--sticky on the <nav> to enable. */
	margin: 14px 0 18px;
	background: var(--sv-page-bg, #f5f6f8);
	border-bottom: 1px solid var(--sv-border);
}
.futu-tabs--sticky {
	position: sticky;
	top: 0;
	z-index: 30;
}
.admin-bar .futu-tabs--sticky { top: 32px; }
@media screen and (max-width: 782px) { .admin-bar .futu-tabs--sticky { top: 46px; } }

/* ---------- trailing returns ---------- */
.futu-returns { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 1px; background: var(--sv-border); border: 1px solid var(--sv-border); border-radius: 10px; overflow: hidden; }
.futu-return { background: var(--sv-card); padding: 10px 8px; text-align: center; }
.futu-return-k { display: block; font-size: 11px; color: var(--sv-faint); text-transform: uppercase; letter-spacing: .03em; }
.futu-return-v { display: block; font-size: 14px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.futu-return.futu-dir-up .futu-return-v { color: var(--futu-up); }
.futu-return.futu-dir-down .futu-return-v { color: var(--futu-down); }
.futu-tabs-scroll {
	display: flex;
	gap: 4px;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.futu-tabs-scroll::-webkit-scrollbar { display: none; }
.futu-tab {
	flex: 0 0 auto;
	padding: 12px 14px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	color: var(--sv-muted);
	text-decoration: none;
	white-space: nowrap;
	border-bottom: 2px solid transparent;
	transition: color .15s ease, border-color .15s ease;
}
.futu-tab:hover { color: var(--sv-text); }
.futu-tab.is-active {
	color: var(--futu-accent);
	border-bottom-color: var(--futu-accent);
}
.futu-tab-content > .futu-card:first-child,
.futu-tab-content > section:first-child { margin-top: 0; }
.futu-tab-content { transition: opacity .12s ease; }
.futu-tab-content.is-loading { opacity: .5; pointer-events: none; }

/* ---------- hero ---------- */
.futu-hero {
	background: var(--sv-card);
	border: 1px solid var(--sv-border);
	border-radius: 14px;
	padding: 22px 24px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.futu-hero-top {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px 28px;
}
.futu-hero-id h1 {
	margin: 0 0 6px;
	font-size: 1.7rem;
	line-height: 1.15;
	font-weight: 700;
	letter-spacing: -.01em;
}
.futu-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.futu-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--sv-chip);
	color: var(--sv-muted);
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}
.futu-pill-exch { background: rgba(37, 99, 235, .1); color: var(--futu-accent); }

.futu-hero-price { text-align: right; line-height: 1.1; }
.futu-hero-last {
	font-size: 2.4rem;
	font-weight: 700;
	letter-spacing: -.02em;
	display: block;
}
.futu-hero-move {
	display: inline-flex;
	align-items: baseline;
	gap: 8px;
	margin-top: 6px;
	padding: 3px 10px;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 700;
}
.futu-dir-up .futu-hero-last { color: var(--futu-up); }
.futu-dir-down .futu-hero-last { color: var(--futu-down); }
.futu-dir-flat .futu-hero-last { color: var(--sv-text); }
.futu-dir-up .futu-hero-move { background: rgba(0, 166, 62, .12); color: var(--futu-up); }
.futu-dir-down .futu-hero-move { background: rgba(224, 36, 36, .1); color: var(--futu-down); }
.futu-dir-flat .futu-hero-move { background: var(--sv-chip); color: var(--sv-muted); }

.futu-hero-asof { margin-top: 10px; font-size: 12px; color: var(--sv-faint); }
.futu-live-dot {
	display: inline-block;
	width: 7px; height: 7px;
	border-radius: 50%;
	background: var(--futu-up);
	margin-right: 5px;
	vertical-align: middle;
	box-shadow: 0 0 0 0 rgba(0, 166, 62, .5);
	animation: futu-pulse 2s infinite;
}
.futu-live-dot.is-off { background: var(--sv-faint); animation: none; box-shadow: none; }
@keyframes futu-pulse {
	0% { box-shadow: 0 0 0 0 rgba(0, 166, 62, .5); }
	70% { box-shadow: 0 0 0 6px rgba(0, 166, 62, 0); }
	100% { box-shadow: 0 0 0 0 rgba(0, 166, 62, 0); }
}

/* ---------- session strip (pre / after / overnight) ---------- */
.futu-sessions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.futu-session {
	display: flex;
	align-items: baseline;
	gap: 7px;
	font-size: 12.5px;
	padding: 6px 11px;
	border: 1px solid var(--sv-border);
	border-radius: 9px;
	background: var(--sv-page-bg);
}
.futu-session-label { color: var(--sv-faint); font-weight: 600; }
.futu-session.futu-dir-up span:not(.futu-session-label) { color: var(--futu-up); }
.futu-session.futu-dir-down span:not(.futu-session-label) { color: var(--futu-down); }

/* ---------- quick stats strip ---------- */
.futu-quickstats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	gap: 1px;
	margin-top: 18px;
	background: var(--sv-border);
	border: 1px solid var(--sv-border);
	border-radius: 10px;
	overflow: hidden;
}
.futu-quickstats > div { background: var(--sv-card); padding: 10px 14px; }
.futu-quickstats dt { font-size: 11.5px; color: var(--sv-faint); margin: 0 0 3px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.futu-quickstats dd { margin: 0; font-size: 15px; font-weight: 700; }

/* ---------- cards ---------- */
.futu-card {
	background: var(--sv-card);
	border: 1px solid var(--sv-border);
	border-radius: 14px;
	padding: 20px 24px;
	margin-top: 16px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.futu-card > h2 {
	font-size: 1.05rem;
	font-weight: 700;
	margin: 0 0 16px;
	display: flex;
	align-items: baseline;
	gap: 8px;
}
.futu-card > h2 small { color: var(--sv-faint); font-weight: 500; font-size: 12.5px; }

/* ---------- key statistics ---------- */
.futu-stat-group + .futu-stat-group { margin-top: 18px; }
.futu-stat-group h3 {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--sv-faint);
	font-weight: 700;
	margin: 0 0 8px;
}
.futu-stat-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 28px; }
.futu-stat-list > div {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid var(--sv-border);
	font-size: 13.5px;
}
.futu-stat-list dt { color: var(--sv-muted); }
.futu-term { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.futu-term:hover { color: var(--futu-accent); }
.futu-glossary-list { margin-top: 24px; }
.futu-glossary-item { padding: 16px 0; border-bottom: 1px solid var(--sv-border); scroll-margin-top: 80px; }
.futu-glossary-item dt { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.futu-glossary-item dd { margin: 0; color: var(--sv-muted); font-size: 14.5px; line-height: 1.6; }
.futu-peer-self td { font-weight: 700; background: var(--sv-chip); }
.futu-stat-list dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- range bar ---------- */
.futu-range { margin-top: 18px; }
.futu-range-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	font-size: 12.5px;
	color: var(--sv-muted);
	margin-bottom: 8px;
}
.futu-range-head strong { color: var(--sv-text); font-size: 13px; }
.futu-range-track {
	position: relative;
	height: 6px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--futu-down) 0%, #f0b429 50%, var(--futu-up) 100%);
}
.futu-range-track.is-plain { background: var(--sv-track); }
.futu-range-track > span {
	position: absolute;
	top: 50%;
	width: 13px; height: 13px;
	margin-left: -6.5px;
	border-radius: 50%;
	background: var(--sv-card);
	border: 3px solid var(--sv-text);
	transform: translateY(-50%);
}
.futu-range-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--sv-faint); margin-top: 5px; }
.futu-range-note { font-size: 12px; color: var(--sv-muted); margin-top: 6px; }

/* ---------- valuation cards ---------- */
.futu-val-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.futu-val-card {
	border: 1px solid var(--sv-border);
	border-radius: 12px;
	padding: 14px 16px;
	background: var(--sv-page-bg);
}
.futu-val-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.futu-val-type { font-weight: 700; font-size: 13px; color: var(--sv-muted); }
.futu-val-now { font-size: 1.3rem; font-weight: 700; }
.futu-val-tag { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.futu-val-tag.cheap { background: rgba(0, 166, 62, .14); color: var(--futu-up); }
.futu-val-tag.fair { background: var(--sv-chip); color: var(--sv-muted); }
.futu-val-tag.rich { background: rgba(224, 36, 36, .1); color: var(--futu-down); }
.futu-val-bar { position: relative; height: 5px; border-radius: 999px; background: var(--sv-track); margin: 12px 0 6px; }
.futu-val-bar > span { position: absolute; top: -3px; width: 3px; height: 11px; border-radius: 2px; background: var(--sv-text); transform: translateX(-1.5px); }
.futu-val-meta { font-size: 11.5px; color: var(--sv-faint); }

.futu-valblock { padding: 14px 0; border-top: 1px solid var(--sv-border); }
.futu-valblock:first-of-type { border-top: 0; padding-top: 4px; }
.futu-valblock-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; margin-bottom: 4px; }
.futu-valblock-head .futu-val-now { font-size: 1.15rem; }
.futu-val-pct { font-size: 12px; color: var(--sv-faint); margin-left: auto; }

/* ---------- chart ---------- */
.futu-chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.futu-seg { display: inline-flex; background: var(--sv-chip); border-radius: 9px; padding: 3px; gap: 2px; }
.futu-seg button {
	border: 0;
	background: transparent;
	color: var(--sv-muted);
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	padding: 4px 12px;
	border-radius: 7px;
	cursor: pointer;
	line-height: 1.4;
}
.futu-seg button.is-active { background: var(--sv-card); color: var(--sv-text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.futu-chart-readout {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	font-size: 12px;
	color: var(--sv-muted);
	margin-bottom: 8px;
	min-height: 16px;
}
.futu-chart-readout b { color: var(--sv-text); font-weight: 700; margin-left: 3px; }
.futu-chart-readout .up { color: var(--futu-up); }
.futu-chart-readout .down { color: var(--futu-down); }
.futu-chart-body { position: relative; width: 100%; overflow: hidden; }
.futu-kline-svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.futu-kline-grid { stroke: var(--sv-border); stroke-width: 1; }
.futu-kline-tick { font-size: 10px; fill: var(--sv-faint); font-family: inherit; }
.futu-kline-tick-last { font-weight: 700; }
.futu-kline-cross { stroke: var(--sv-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.futu-kline-dot { fill: var(--sv-card); stroke-width: 2; }
.futu-kline-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 11px; margin-top: 8px; color: var(--sv-faint); }
.futu-kline-legend b { font-weight: 700; }
.futu-quote-chart .futu-chart-body { min-height: 260px; }

/* ---------- tab-fragment mini charts ---------- */
.futu-mini-chart { width: 100%; margin: 6px 0 2px; overflow: hidden; }
.futu-mini-svg { width: 100%; height: auto; display: block; }
.futu-mini-chart .futu-quotes-empty { margin: 12px 0; }
.futu-chart-caption { font-size: 12px; color: var(--sv-faint); margin: 2px 0 0; }

/* ---------- financials tables ---------- */
.futu-fin-toggle { margin: 4px 0 12px; }
.futu-fin-pane + .futu-fin-toggle { margin-top: 16px; }
.futu-card h3 { font-size: 13px; font-weight: 700; color: var(--sv-muted); margin: 4px 0 8px; }
.futu-card h3 small { font-weight: 500; color: var(--sv-faint); }

/* ---------- segment / holder-type bars ---------- */
.futu-segbars { display: flex; flex-direction: column; gap: 9px; margin: 6px 0 4px; }
.futu-segbar-label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 3px; }
.futu-segbar-label span:last-child { color: var(--sv-muted); font-variant-numeric: tabular-nums; }
.futu-segbar-track { height: 7px; border-radius: 999px; background: var(--sv-track); overflow: hidden; }
.futu-segbar-track > span { display: block; height: 100%; border-radius: 999px; background: var(--futu-accent); }

/* ---------- news list ---------- */
.futu-newslist { list-style: none; margin: 0; padding: 0; }
.futu-newslist li { padding: 11px 0; border-bottom: 1px solid var(--sv-border); }
.futu-newslist li:last-child { border-bottom: 0; }
.futu-news-title { color: var(--sv-text); font-weight: 600; font-size: 14px; line-height: 1.4; }
.futu-news-meta { display: block; font-size: 11.5px; color: var(--sv-faint); margin-top: 3px; }
.futu-news-tag { display: inline-block; font-size: 10.5px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; color: var(--futu-accent); background: rgba(0, 0, 0, .04); border-radius: 4px; padding: 2px 7px; margin-bottom: 5px; }

/* ---------- narrative + FAQ ---------- */
.futu-story {
	font-size: 14.5px;
	line-height: 1.65;
	color: var(--sv-text);
	background: var(--sv-card);
	border: 1px solid var(--sv-border);
	border-radius: 12px;
	padding: 14px 18px;
	margin: 0 0 14px;
}
.futu-faq details {
	border-bottom: 1px solid var(--sv-border);
	padding: 10px 0;
}
.futu-faq details:last-child { border-bottom: 0; }
.futu-faq summary {
	cursor: pointer;
	font-weight: 600;
	font-size: 14px;
	list-style: none;
}
.futu-faq summary::-webkit-details-marker { display: none; }
.futu-faq summary::before { content: '＋'; color: var(--sv-faint); margin-right: 8px; }
.futu-faq details[open] summary::before { content: '－'; }
.futu-faq p { margin: 8px 0 2px 22px; font-size: 13.5px; line-height: 1.6; color: var(--sv-muted); }

/* ---------- analyst consensus ---------- */
.futu-consensus { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.futu-rating-badge {
	font-weight: 800;
	font-size: 1.15rem;
	letter-spacing: .02em;
	padding: 8px 18px;
	border-radius: 10px;
	background: var(--sv-chip);
	color: var(--sv-muted);
	text-transform: capitalize;
}
.futu-rating-badge.buy, .futu-rating-badge.strong_buy, .futu-rating-badge.outperform { background: rgba(0, 166, 62, .14); color: var(--futu-up); }
.futu-rating-badge.sell, .futu-rating-badge.strong_sell, .futu-rating-badge.underperform { background: rgba(224, 36, 36, .1); color: var(--futu-down); }
.futu-consensus-sub { font-size: 12.5px; color: var(--sv-faint); }
.futu-consensus-sub strong { color: var(--sv-text); font-size: 1rem; display: block; }

.futu-target { margin-top: 18px; }
.futu-target-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--sv-muted); margin-bottom: 8px; }
.futu-target-track { position: relative; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--sv-border-strong), var(--futu-accent)); }
.futu-target-track .futu-target-cur {
	position: absolute; top: -5px; width: 2px; height: 16px; background: var(--sv-text);
}
.futu-target-track .futu-target-cur::after {
	content: attr(data-label);
	position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
	font-size: 10px; font-weight: 700; white-space: nowrap; color: var(--sv-text);
}
.futu-target-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--sv-faint); margin-top: 6px; }
.futu-target-ends b { display: block; color: var(--sv-text); font-size: 13px; }
.futu-target-ends > div:nth-child(2) { text-align: center; }
.futu-target-ends > div:nth-child(3) { text-align: right; }

.futu-bhs { display: flex; overflow: hidden; border-radius: 8px; margin-top: 16px; font-size: 11px; font-weight: 700; color: #fff; height: 22px; }
.futu-bhs span { display: flex; align-items: center; justify-content: center; white-space: nowrap; min-width: 0; }
.futu-bhs-buy { background: var(--futu-up); }
.futu-bhs-hold { background: #9ca3af; }
.futu-bhs-sell { background: var(--futu-down); }

/* ---------- morningstar ---------- */
.futu-ms-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 6px; }
.futu-ms-stars { color: #f0b429; font-size: 1.15rem; letter-spacing: 2px; }
.futu-ms-metric {
	display: inline-flex; flex-direction: column; gap: 1px;
	padding: 6px 12px; border-radius: 9px; background: var(--sv-page-bg); border: 1px solid var(--sv-border);
	font-size: 12px; color: var(--sv-muted);
}
.futu-ms-metric b { font-size: 13.5px; color: var(--sv-text); font-weight: 700; }

/* ---------- collapsible detail blocks ---------- */
.futu-details { margin-top: 10px; border-top: 1px solid var(--sv-border); padding-top: 10px; }
.futu-details summary {
	cursor: pointer;
	font-size: 13px;
	font-weight: 600;
	color: var(--sv-text);
	list-style: none;
	display: flex;
	align-items: center;
	gap: 6px;
}
.futu-details summary::-webkit-details-marker { display: none; }
.futu-details summary::before { content: "\25B8"; color: var(--sv-faint); transition: transform .15s; }
.futu-details[open] summary::before { transform: rotate(90deg); }
.futu-details p { font-size: 13px; line-height: 1.65; color: var(--sv-muted); margin: 10px 0 4px; }

/* ---------- dividends / splits / sectors ---------- */
.futu-inline-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.futu-inline-list li { border: 1px solid var(--sv-border); border-radius: 9px; padding: 6px 12px; font-size: 13px; background: var(--sv-page-bg); }
.futu-inline-list span { color: var(--sv-faint); margin-left: 6px; font-size: 11.5px; }

.futu-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.futu-chip { background: var(--sv-chip); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: var(--sv-muted); font-weight: 500; }

.futu-quote-meta { font-size: 12px; color: var(--sv-faint); margin-top: 18px; text-align: center; }
.futu-quote-disclaimer { font-size: 11.5px; color: var(--sv-faint); margin-top: 6px; text-align: center; }
.futu-quote-list { list-style: none; padding: 0; }
.futu-quote-list a { text-decoration: none; }
.futu-quote-list span { color: var(--sv-faint); font-size: 12px; margin-left: 6px; }

/* ---------- two-column layout: main content + right rail ---------- */
.futu-quote-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 300px;
	gap: 20px;
	align-items: start;
}
.futu-quote-main { min-width: 0; }
.futu-quote-sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.futu-tabs--sticky ~ .futu-quote-layout .futu-quote-sidebar { top: 60px; }
.futu-side-card { padding: 16px 18px; margin-top: 0; }
.futu-side-card > h2 { font-size: 14px; margin-bottom: 10px; }
.futu-side-card > h2 small { font-weight: 500; color: var(--sv-faint); font-size: 11.5px; }
.futu-side-list { list-style: none; margin: 0; padding: 0; }
.futu-side-list li { border-bottom: 1px solid var(--sv-border); }
.futu-side-list li:last-child { border-bottom: 0; }
.futu-side-list a {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
	padding: 9px 0;
	text-decoration: none;
	color: inherit;
}
.futu-side-list a:hover .futu-side-name { text-decoration: underline; }
.futu-side-name { display: flex; flex-direction: column; font-size: 13px; font-weight: 600; }
.futu-side-name b { font-weight: 500; font-size: 11px; color: var(--sv-faint); }
.futu-side-price { text-align: right; font-size: 13px; font-weight: 700; white-space: nowrap; }
.futu-side-price em { display: block; font-style: normal; font-size: 11px; font-weight: 600; }
.futu-dir-up .futu-side-price, .futu-dir-up .futu-side-price em { color: var(--futu-up); }
.futu-dir-down .futu-side-price, .futu-dir-down .futu-side-price em { color: var(--futu-down); }
.futu-side-reads { list-style: none; margin: 0; padding: 0; }
.futu-side-reads li { padding: 9px 0; border-bottom: 1px solid var(--sv-border); }
.futu-side-reads li:last-child { border-bottom: 0; }
.futu-side-reads a { font-size: 13px; font-weight: 600; text-decoration: none; color: inherit; line-height: 1.4; }
.futu-side-reads a:hover { text-decoration: underline; }
.futu-side-tag {
	display: block;
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: var(--futu-accent);
	margin-bottom: 3px;
}

/* [futu_quotes_active layout="list"]: reuses .futu-card/.futu-side-list,
   which normally get their --sv-* tokens from the .futu-quote-page wrapper
   on the single-stock template. This shortcode runs anywhere (front page,
   theme sidebar widgets) with no such wrapper, so it carries its own copy
   of just the tokens those classes need. */
.futu-active-widget {
	--sv-card: #ffffff;
	--sv-border: #e5e7eb;
	--sv-faint: #9ca3af;
}

/* ---------- AI features ---------- */
.futu-ai-pill {
	background: rgba(124, 92, 255, .12);
	color: var(--futu-ai);
	text-decoration: none;
	cursor: help;
}
.futu-ai-pill b { font-weight: 800; }
.futu-ai-pill.futu-ai-grade-a, .futu-ai-pill.futu-ai-grade-b { background: rgba(0, 166, 62, .12); color: var(--futu-up); }
.futu-ai-pill.futu-ai-grade-d, .futu-ai-pill.futu-ai-grade-f { background: rgba(224, 36, 36, .1); color: var(--futu-down); }

.futu-ai-card { border-color: rgba(124, 92, 255, .35); background: linear-gradient(180deg, rgba(124, 92, 255, .05), var(--sv-card) 70px); }
.futu-ai-spark { color: var(--futu-ai); }
.futu-ai-card > h2 small a { color: var(--futu-ai); text-decoration: none; font-weight: 600; }
.futu-ai-card > h2 small a:hover { text-decoration: underline; }
.futu-ai-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.futu-ai-block { border: 1px solid var(--sv-border); border-radius: 12px; padding: 14px 16px; background: var(--sv-page-bg); }
.futu-ai-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.futu-ai-label { font-size: 12px; font-weight: 700; color: var(--sv-muted); text-transform: uppercase; letter-spacing: .02em; }
.futu-ai-grade { font-weight: 800; font-size: 1.1rem; margin-left: auto; }
.futu-ai-grade-a, .futu-ai-grade-b { color: var(--futu-up); }
.futu-ai-grade-c { color: var(--sv-muted); }
.futu-ai-grade-d, .futu-ai-grade-f { color: var(--futu-down); }
.futu-ai-score { font-size: 12px; color: var(--sv-faint); }
.futu-ai-tag { margin-left: auto; font-weight: 700; font-size: 13px; padding: 2px 9px; border-radius: 999px; background: var(--sv-chip); }
.futu-ai-tag.futu-dir-up { background: rgba(0, 166, 62, .14); color: var(--futu-up); }
.futu-ai-tag.futu-dir-down { background: rgba(224, 36, 36, .1); color: var(--futu-down); }
.futu-ai-tag.futu-dir-flat { color: var(--sv-muted); }
.futu-ai-gauge { position: relative; height: 6px; border-radius: 999px; margin: 4px 0 12px; background: linear-gradient(90deg, var(--futu-down), var(--sv-track) 50%, var(--futu-up)); }
.futu-ai-gauge > span { position: absolute; top: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: var(--sv-card); border: 3px solid var(--sv-text); transform: translateY(-50%); }
.futu-ai-reasons { list-style: none; margin: 0; padding: 0; font-size: 12.5px; line-height: 1.55; color: var(--sv-muted); }
.futu-ai-reasons li { padding: 3px 0 3px 14px; position: relative; }
.futu-ai-reasons li::before { content: '·'; position: absolute; left: 2px; color: var(--futu-ai); font-weight: 800; }
.futu-ai-disclaimer { font-size: 11.5px; color: var(--sv-faint); margin: 14px 0 0; }

/* Single-metric mini cards on non-Overview tabs (Valuation/Analysts/
   Ownership/Financials): same visuals, minus the outer grid/box since
   there's only one block, and the h2 already carries the metric name. */
.futu-ai-mini .futu-ai-block { border: 0; padding: 0; background: transparent; }
.futu-ai-mini .futu-ai-grade, .futu-ai-mini .futu-ai-tag { margin-left: 0; }
.futu-ai-mini .futu-ai-score { margin-left: 6px; }

/* AI Analyst Revision Trend: stacked upgrade/downgrade count bar. */
.futu-ai-bar { display: flex; height: 22px; border-radius: 7px; overflow: hidden; margin: 2px 0 6px; background: var(--sv-track); }
.futu-ai-bar span { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; min-width: 0; }
.futu-ai-bar-up { background: var(--futu-up); }
.futu-ai-bar-down { background: var(--futu-down); }
.futu-ai-bar-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--sv-muted); margin-bottom: 10px; }
.futu-ai-bar-legend b { font-style: normal; margin-right: 4px; }
.futu-ai-bar-legend b.futu-dir-up { color: var(--futu-up); }
.futu-ai-bar-legend b.futu-dir-down { color: var(--futu-down); }

/* AI Fair Value: implied price-range bar (avg-P/E band x EPS), current
   price marked against it - same idea as the analyst target-price bar,
   styled in the AI accent to read as a distinct module. */
.futu-ai-range { margin: 2px 0 6px; }
.futu-ai-range-track { position: relative; height: 6px; border-radius: 999px; background: linear-gradient(90deg, var(--futu-up), var(--sv-track) 50%, var(--futu-down)); margin-top: 14px; }
.futu-ai-range-mid { position: absolute; top: -4px; width: 2px; height: 14px; background: var(--sv-faint); }
.futu-ai-range-cur { position: absolute; top: -6px; width: 3px; height: 18px; border-radius: 2px; background: var(--futu-ai); }
.futu-ai-range-cur::after {
	content: attr(data-label);
	position: absolute; top: -17px; left: 50%; transform: translateX(-50%);
	font-size: 10.5px; font-weight: 700; white-space: nowrap; color: var(--futu-ai);
}
.futu-ai-range-ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--sv-faint); margin-top: 6px; }
.futu-ai-range-ends > div:nth-child(2), .futu-ai-range-ends span:nth-child(2) { text-align: center; }

/* Tablet (e.g. iPad portrait, ~768-1024px): the grids already reflow via
   auto-fit/minmax, but padding/type scale were untouched above 560px, so
   this width sat squarely between "full desktop" and "mobile" with neither
   treatment. Trim spacing without going all the way to the phone layout. */
@media (max-width: 1024px) {
	.futu-quote-inner { padding: 24px 20px 48px; }
	.futu-hero { padding: 22px 20px; }
	.futu-card { padding: 20px; }
	.futu-hero-last { font-size: 2.4rem; }

	/* Right rail stacks below the main content instead of squeezing it. */
	.futu-quote-layout { grid-template-columns: 1fr; }
	.futu-quote-sidebar { position: static; }
	.futu-ai-grid { grid-template-columns: 1fr; }

	/* Tables were flat 14px/9-12px padding at every width. On a tablet the
	   text is still comfortably legible a notch smaller, and the tighter
	   padding lets a couple more columns (e.g. financials' year columns)
	   sit on screen before the horizontal scroll shadow kicks in. */
	.futu-quotes-table { font-size: 13.5px; }
	.futu-quotes-table th,
	.futu-quotes-table td { padding: 8px 10px; }
}

@media (max-width: 560px) {
	.futu-quote-inner { padding: 16px 12px 48px; }
	.futu-hero { padding: 18px 16px; }
	.futu-card { padding: 16px; border-radius: 12px; }
	.futu-hero-top { flex-direction: column; }
	.futu-hero-price { text-align: left; }
	.futu-hero-last { font-size: 2rem; }
	.futu-stat-list { grid-template-columns: 1fr; }

	/* Chart control rows (style / period / range / indicator) were full
	   desktop size, so 4 wrapped rows ate most of the first screen before
	   the chart itself appeared. Shrink the buttons so more fit per row. */
	.futu-chart-head { gap: 6px 8px; }
	.futu-seg { padding: 2px; gap: 1px; }
	.futu-seg button { padding: 4px 8px; font-size: 11.5px; }

	/* Phone width: drop one more notch from the tablet size above and trim
	   padding further so 3-4 columns are visible without scrolling on a
	   ~375px screen, while staying above the ~12px floor that starts
	   hurting legibility for tabular numerals. The sticky first column
	   also gets a touch narrower so it doesn't eat too much of the
	   viewport before the scrollable columns even start. */
	.futu-quotes-table { font-size: 12.5px; }
	.futu-quotes-table th,
	.futu-quotes-table td { padding: 7px 8px; }
	.futu-quotes-table td:first-child,
	.futu-quotes-table th:first-child { max-width: 108px; }
	.futu-code { font-size: 10px; }
}

/* =========================================================================
 *  Dark mode
 * ====================================================================== */
@media (prefers-color-scheme: dark) {
	.futu-quotes-table th { background: rgba(255, 255, 255, .04); color: #9ca3af; }
	.futu-quotes-table td:first-child,
	.futu-quotes-table th:first-child { background: #14161a; }
	.futu-quotes-table th,
	.futu-quotes-table td { border-bottom-color: rgba(255, 255, 255, .09); }
	.futu-code { color: #6b7280; }

	.futu-active-widget {
		--sv-card: #16181d;
		--sv-border: #262a31;
		--sv-faint: #6b7280;
	}

	.futu-quote-page {
		--sv-page-bg: #0e1013;
		--sv-card: #16181d;
		--sv-border: #262a31;
		--sv-border-strong: #363b44;
		--sv-text: #e5e7eb;
		--sv-muted: #9ca3af;
		--sv-faint: #6b7280;
		--sv-track: #262a31;
		--sv-chip: #22252b;
		--futu-ai: #a389ff;
	}
	.futu-hero, .futu-card { box-shadow: none; }
	.futu-stickybar { background: rgba(22, 24, 29, .92); border-bottom-color: #262a31; color: #e5e7eb; }
	.futu-stickybar-sym { color: #6b7280; }
	.futu-kline-dot { fill: #16181d; }
	.futu-ai-card { background: linear-gradient(180deg, rgba(124, 92, 255, .1), var(--sv-card) 70px); }
	.futu-ai-pill { background: rgba(124, 92, 255, .18); }
}
