/* AI supply-chain research workspace. Core text is at least 14px. */
:root {
  color-scheme: light;
  --bg: #f5f7f8; --panel: #ffffff; --surface-soft: #f7f9f9; --surface-muted: #edf1f2;
  --text: #202b30; --text-soft: #46565d; --muted: #617177; --line: #e1e7e8; --line-strong: #cbd5d7;
  --brand: #087f7a; --brand-2: #076e69; --brand-soft: #e7f4f1;
  --upstream: #087f7a; --midstream: #7461a8; --downstream: #a66b14;
  --warn: #93640f; --warn-bg: #fbf6e9; --risk: #b83d45; --risk-bg: #fbeef0;
  --up: #c63c49; --down: #14805b; --flat: #617177; --ok: #147654; --ok-bg: #e7f4ec;
  --pending: #617177; --pending-bg: #f0f3f4; --sidebar-width: 238px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; color: var(--text); background: var(--bg); font: 15px/1.55 "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif; letter-spacing: 0; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; letter-spacing: 0; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button { cursor: pointer; background: none; }
button, input, select { color: var(--text); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .55; }
input, select { min-width: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
h1, h2, h3, p { margin-top: 0; }
.icon { display: inline-block; width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; padding: 0; border: 1px solid transparent; border-radius: 6px; color: var(--muted); background: transparent; }
.icon-btn:hover { background: var(--surface-muted); color: var(--text); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 250; padding: 10px 16px; background: var(--panel); border: 2px solid var(--brand); border-radius: 4px; }
.skip-link:focus { top: 12px; }
.skeleton { color: transparent; background: var(--surface-muted); border-radius: 4px; }

/* The directory stays visible while comparing segments. */
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; display: flex; flex-direction: column; width: var(--sidebar-width); padding: 28px 18px 18px; border-right: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 11px; margin: 0 8px 31px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { display: flex; align-items: center; justify-content: center; width: 38px; height: 42px; border-radius: 7px; color: #fff; background: var(--brand); }
.brand-mark .icon { width: 26px; height: 26px; stroke-width: 1.5; }
.brand strong { display: block; font-size: 20px; line-height: 1.35; font-weight: 750; }
.brand small { display: block; margin-top: 2px; font-size: 14px; color: var(--muted); }
.primary-nav { display: grid; gap: 5px; margin-bottom: 28px; }
.nav-item { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 44px; padding: 9px 12px; border: 0; border-radius: 6px; color: var(--text-soft); font-size: 15px; text-align: left; }
.nav-item.active { color: var(--brand-2); background: var(--brand-soft); font-weight: 650; }
.nav-item:hover { background: var(--surface-soft); }
.nav-item.active:hover { background: var(--brand-soft); }
.nav-count { margin-left: auto; color: var(--muted); font: 14px "Helvetica Neue", sans-serif; font-variant-numeric: tabular-nums; }
.nav-item.active .nav-count { color: var(--brand); }
.nav-label { display: flex; justify-content: space-between; margin: 0 12px 12px; color: var(--muted); font-size: 14px; }
.layer-tabs { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.layer-group { margin-bottom: 7px; }
.layer-button { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 43px; padding: 8px 10px; border: 0; border-radius: 5px; color: var(--text-soft); text-align: left; font-size: 15px; font-weight: 600; }
.layer-button:hover, .layer-button.active { background: var(--surface-soft); }
.layer-button.active { color: var(--brand); }
.layer-dot { width: 8px; height: 8px; margin: 0 4px; border-radius: 2px; background: var(--layer-color, var(--brand)); }
.layer-button .icon { width: 16px; height: 16px; flex-basis: 16px; color: var(--muted); }
.category-list { display: grid; gap: 2px; margin: 4px 0 10px 20px; padding-left: 13px; border-left: 1px solid var(--line); }
.category-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 5px 9px; border: 0; border-radius: 4px; color: var(--muted); text-align: left; font-size: 14px; }
.category-item span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-item:hover { background: var(--surface-soft); color: var(--text); }
.category-item.active { background: var(--brand-soft); color: var(--brand-2); font-weight: 600; }
.sidebar-foot { display: flex; align-items: flex-start; gap: 9px; margin-top: auto; padding: 21px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.sidebar-foot .icon { color: var(--brand); margin-top: 2px; }
.sidebar-foot small { font-size: 14px; }
.sidebar-close, .mobile-menu, .insights-toggle { display: none; }
.app-shell { margin-left: var(--sidebar-width); min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 70px; padding: 0 32px; border-bottom: 1px solid var(--line); background: var(--panel); }
.topbar-path, .topbar-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-path { color: var(--muted); font-size: 14px; white-space: nowrap; }
.topbar-path strong { color: var(--text-soft); font-weight: 550; }
.breadcrumb-icon { width: 14px; height: 14px; flex-basis: 14px; opacity: .5; }
.topbar-actions { gap: 10px; }
.market-session { display: flex; align-items: center; gap: 7px; padding-right: 10px; color: var(--muted); font-size: 14px; }
.market-session::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.market-session.fresh::before { background: var(--ok); }
.download-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text-soft); background: var(--panel); font-size: 14px; white-space: nowrap; }
.download-btn:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.download-btn .icon { width: 17px; height: 17px; flex-basis: 17px; }
.workspace { max-width: 1750px; margin: auto; padding: 26px 32px 24px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { margin-bottom: 6px; font-size: 28px; line-height: 1.4; font-weight: 700; }
.page-heading p { margin-bottom: 0; color: var(--muted); font-size: 14px; }
.heading-date { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.heading-date .icon { width: 16px; height: 16px; flex-basis: 16px; }
.stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding-bottom: 20px; }
.stat { display: grid; grid-template-columns: auto 1fr; grid-template-areas: 'label label' 'value suffix'; align-items: end; gap: 3px 8px; padding-left: 24px; border-left: 1px solid var(--line); }
.stat:first-child { padding-left: 0; border-left: 0; }
.stat-label { grid-area: label; color: var(--muted); font-size: 14px; }
.stat-num { grid-area: value; font: 600 30px/1.35 "Avenir Next", "Helvetica Neue", sans-serif; font-variant-numeric: tabular-nums; color: var(--text); }
.stat-suffix { grid-area: suffix; padding-bottom: 5px; color: var(--muted); font-size: 14px; }
.stat:last-child .stat-num { color: var(--brand); }
.trust-banner { margin-bottom: 20px; border: 1px solid #e8dfc5; border-radius: 5px; background: var(--warn-bg); color: var(--warn); font-size: 14px; }
.trust-row { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 8px 12px; }
.trust-row > .icon { width: 17px; height: 17px; flex-basis: 17px; }
.trust-row > div { flex: 1; }
.trust-row strong { font-weight: 600; }
.trust-toggle { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0; border: 0; color: inherit; font-size: 14px; white-space: nowrap; }
.trust-toggle .icon { width: 15px; height: 15px; flex-basis: 15px; }
.trust-toggle[aria-expanded='true'] .icon { transform: rotate(180deg); }
.trust-detail { padding: 0 38px 12px; }
.trust-banner.verified { background: var(--ok-bg); border-color: #bbd8c8; color: var(--ok); }
.quote-banner { margin: -8px 0 16px; padding: 0 2px; color: var(--muted); font-size: 14px; }
.quote-banner strong { color: var(--warn); font-weight: 600; }
.workspace-grid { display: grid; grid-template-columns: minmax(0,1fr) 264px; grid-template-areas: 'research insights'; gap: 28px; align-items: start; }
.research-area { min-width: 0; grid-area: research; }
.toolbar { display: grid; gap: 10px; }
.search-wrap { position: relative; }
.search-icon { position: absolute; top: 13px; left: 13px; color: var(--muted); width: 18px; height: 18px; pointer-events: none; }
.search { display: block; width: 100%; height: 44px; padding: 10px 44px 10px 40px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); font-size: 14px; outline: none; }
.search::placeholder { color: var(--muted); opacity: 1; }
.search:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.search::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; top: 2px; right: 2px; }
.filter-row { display: flex; align-items: center; gap: 8px; }
.filter-selects { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; flex: 1; }
.select-control { min-width: 0; }
.select-control select { width: 100%; height: 38px; padding: 6px 22px 6px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); font-size: 14px; color: var(--text-soft); cursor: pointer; }
.select-control select:focus { border-color: var(--brand); }
.reset-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 38px; padding: 5px 8px; border: 0; border-radius: 5px; color: var(--muted); font-size: 14px; }
.reset-btn:hover { background: var(--surface-muted); color: var(--brand); }
.reset-btn .icon { width: 16px; height: 16px; flex-basis: 16px; }
.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 0 4px; }
.results-heading > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 5px 10px; }
.results-heading h2 { margin: 0; font-size: 18px; font-weight: 650; }
.result-count { color: var(--muted); font-size: 14px; white-space: nowrap; }
.view-toggle { display: flex; gap: 2px; flex: 0 0 auto; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.view-btn { width: 31px; height: 30px; flex-basis: 31px; border-radius: 3px; }
.view-btn .icon { width: 17px; height: 17px; }
.view-btn.active { color: var(--brand); background: var(--brand-soft); }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 0; }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; min-height: 30px; padding: 3px 7px 3px 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--text-soft); font-size: 14px; }
.filter-chip .icon { width: 14px; height: 14px; flex-basis: 14px; }
.layer-section { margin: 16px 0 30px; }
.layer-title { display: flex; align-items: center; gap: 9px; min-height: 36px; padding-bottom: 9px; border-bottom: 1px solid var(--line-strong); color: var(--text); }
.layer-title .layer-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--layer-color); background: var(--surface-muted); border-radius: 5px; }
.layer-title h3 { margin: 0; font-size: 17px; font-weight: 650; }
.layer-description { color: var(--muted); font-size: 14px; }
.layer-badge { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }
.subcat-block { margin: 14px 0 18px; }
.subcat-toggle { display: flex; align-items: center; gap: 7px; width: 100%; min-height: 36px; padding: 0 0 7px; border: 0; color: var(--text-soft); font-size: 14px; text-align: left; font-weight: 600; }
.subcat-meta { color: var(--muted); font-size: 14px; font-weight: 400; }
.subcat-chevron { margin-left: auto; color: var(--muted); transition: transform .15s ease; }
.subcat-chevron .icon { width: 16px; height: 16px; }
.subcat-block.collapsed .subcat-chevron { transform: rotate(-90deg); }
.subcat-block.collapsed .cards-grid { display: none; }
.cards-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.card-wrap { position: relative; display: grid; min-width: 0; }
.card { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 220px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); background: var(--panel); transition: border-color .15s ease, box-shadow .15s ease; }
.card:hover { border-color: #94bcba; box-shadow: 0 3px 12px #223d3a08; text-decoration: none; }
.card-meta { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--muted); font-size: 14px; }
.card-id { font-variant-numeric: tabular-nums; }
.card-meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong); }
.bookmark-btn { position: absolute; top: 6px; right: 7px; width: 36px; height: 36px; flex-basis: 36px; z-index: 1; }
.bookmark-btn .icon { width: 17px; height: 17px; }
.bookmark-btn[aria-pressed='true'] { color: var(--brand); }
.bookmark-btn[aria-pressed='true'] .icon { fill: var(--brand-soft); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding-right: 4px; }
.card-name { overflow-wrap: anywhere; font-size: 17px; line-height: 1.5; font-weight: 650; }
.card-strength { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 11px; color: var(--muted); font-size: 14px; }
.strength-scale { display: flex; align-items: center; gap: 3px; }
.strength-scale i { display: block; width: 14px; height: 4px; border-radius: 1px; background: var(--surface-muted); }
.strength-scale i.filled { background: var(--layer-color, var(--brand)); }
.strength-scale b { margin-left: 4px; color: var(--text-soft); font-size: 14px; font-weight: 500; }
.level-5 .strength-scale i.filled { background: var(--warn); }
.card-bottleneck { display: -webkit-box; overflow: hidden; margin: 9px 0 0; color: var(--text-soft); font-size: 14px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.stock-mini { display: grid; gap: 7px; margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line); }
.stock-row { display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.stock-identity { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.stock-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.stock-code { flex: 0 0 auto; color: var(--muted); font: 14px "Helvetica Neue", sans-serif; font-variant-numeric: tabular-nums; }
.stock-price { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.stock-change { width: 58px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; }
.quote-up { color: var(--up); font-weight: 600; }
.quote-down { color: var(--down); font-weight: 600; }
.quote-flat { color: var(--flat); font-weight: 500; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 7px; margin-top: auto; padding-top: 12px; color: var(--muted); font-size: 14px; }
.card-statuses { display: flex; flex-wrap: wrap; gap: 4px 7px; min-width: 0; }
.evidence-badge, .mapping-badge, .status-badge { font-size: 14px; }
.evidence-badge { display: inline-flex; align-items: center; gap: 4px; }
.evidence-badge .icon { width: 14px; height: 14px; flex-basis: 14px; }
.evidence-badge.verified { color: var(--ok); }
.evidence-badge.pending { color: var(--muted); }
.card-quote-state { font-size: 14px; color: var(--muted); }
.card-quote-state.fresh { color: var(--ok); }
.card-detail-arrow { width: 16px; height: 16px; flex-basis: 16px; color: var(--muted); }
.news-tag { color: var(--brand); font-size: 14px; }
.view-list .cards-grid { grid-template-columns: 1fr; gap: 0; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.view-list .card { display: grid; grid-template-columns: minmax(0,1fr) minmax(210px,1.2fr) 110px; align-items: center; gap: 5px 16px; min-height: 106px; padding: 15px 40px 15px 16px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.view-list .card-wrap:last-child .card { border-bottom: 0; }
.view-list .card-meta { margin: 0; grid-column: 1; }
.view-list .card-head { grid-column: 1; grid-row: 2; }
.view-list .card-name { font-size: 15px; }
.view-list .stock-mini { grid-column: 2; grid-row: 1 / span 3; margin: 0; padding: 0; border: 0; }
.view-list .stock-identity { flex-wrap: wrap; gap: 0 5px; }
.view-list .card-strength { grid-column: 3; grid-row: 2; margin: 0; }
.view-list .card-strength > span:first-child { display: none; }
.view-list .card-foot { grid-column: 3; grid-row: 3; padding-top: 0; margin: 0; }
.view-list .card-quote-state, .view-list .card-detail-arrow { display: none; }
.view-list .card-bottleneck { grid-column: 1 / -1; }
.empty-state { margin: 22px 0; padding: 48px 20px; border: 1px dashed var(--line-strong); border-radius: 6px; text-align: center; color: var(--muted); }
.empty-icon { width: 32px; height: 32px; margin-bottom: 15px; color: var(--brand); }
.empty-state h3 { margin: 0 0 6px; font-size: 18px; color: var(--text); }
.empty-state p { margin-bottom: 12px; font-size: 14px; }
.text-button { min-height: 36px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--brand); background: var(--panel); font-size: 14px; }
.workspace-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 16px; padding: 20px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* Insights are unframed sections, not a second wall of cards. */
.insights { grid-area: insights; position: sticky; top: 24px; display: grid; gap: 24px; min-width: 0; padding-left: 22px; border-left: 1px solid var(--line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel-heading > .icon { width: 16px; height: 16px; color: var(--muted); }
.panel-note { color: var(--muted); font-size: 14px; }
.chips { display: grid; }
.chip { display: grid; grid-template-columns: 29px minmax(0,1fr) 16px; align-items: center; gap: 8px; width: 100%; min-height: 54px; padding: 9px 0; border: 0; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; }
.chip:hover { color: var(--brand); }
.chip-mark { display: flex; align-items: center; justify-content: center; width: 28px; height: 30px; color: var(--warn); background: var(--warn-bg); border-radius: 4px; }
.chip-mark .icon { width: 17px; height: 17px; }
.chip-name { min-width: 0; }
.chip-name strong { display: block; overflow-wrap: anywhere; font-size: 14px; font-weight: 550; }
.chip small { display: block; color: var(--muted); font-size: 14px; }
.chip > .icon { width: 15px; height: 15px; color: var(--muted); }
.market-tabs { display: inline-flex; gap: 8px; }
.market-tab { min-height: 30px; padding: 2px 1px; border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; }
.market-tab.active { border-bottom-color: var(--brand); color: var(--brand); }
.market-list { display: grid; gap: 12px; }
.market-row { display: grid; grid-template-columns: 18px minmax(0,1fr) auto; gap: 7px; align-items: center; font-size: 14px; }
.market-rank { color: var(--muted); font-size: 14px; }
.market-name strong { display: block; font-size: 14px; font-weight: 550; }
.market-name small { color: var(--muted); font-size: 14px; }
.market-empty { padding: 16px 12px; background: var(--surface-muted); border-radius: 5px; color: var(--muted); font-size: 14px; text-align: center; }
.market-empty .icon { width: 25px; height: 25px; margin-bottom: 7px; }
.market-empty strong { display: block; margin-bottom: 4px; color: var(--text-soft); font-size: 14px; font-weight: 550; }
.market-empty p { margin: 0; font-size: 14px; }
.status-strip { display: grid; gap: 17px; }
.status-pill { min-width: 0; font-size: 14px; }
.status-label { display: flex; align-items: center; gap: 6px; color: var(--text-soft); margin-bottom: 5px; }
.status-label .icon { width: 16px; height: 16px; flex-basis: 16px; color: var(--muted); }
.status-state { margin-left: auto; padding: 0 5px; border-radius: 3px; color: var(--warn); background: var(--warn-bg); font-size: 14px; }
[data-state='ok'] .status-state { color: var(--ok); background: var(--ok-bg); }
[data-state='fail'] .status-state { color: var(--risk); background: var(--risk-bg); }
.status-pill > strong { display: block; color: var(--text-soft); font-size: 14px; font-weight: 450; font-variant-numeric: tabular-nums; }
.status-pill > small { display: block; color: var(--muted); font-size: 14px; }
.evidence-progress { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.evidence-progress > div { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 14px; }
.evidence-progress strong { color: var(--text-soft); font-size: 14px; font-weight: 500; }
progress { display: block; width: 100%; height: 5px; margin-top: 8px; border: 0; border-radius: 3px; overflow: hidden; background: var(--surface-muted); accent-color: var(--brand); }
progress::-webkit-progress-bar { background: var(--surface-muted); }
progress::-webkit-progress-value { background: var(--brand); }
.generated-note { margin-top: 16px; color: var(--muted); font-size: 14px; }
.generated-note time { display: block; }
.load-error { padding: 24px; border: 1px solid var(--risk); border-radius: 6px; color: var(--risk); background: var(--panel); }
.load-error h2 { font-size: 18px; }
.load-error p { font-size: 14px; }

/* The detail sheet keeps the evidence hierarchy of the overview. */
.modal-bg { position: fixed; inset: 0; z-index: 150; display: none; justify-content: flex-end; background: #192d3359; backdrop-filter: blur(3px); }
.modal-bg.open { display: flex; }
body.modal-open { overflow: hidden; }
.modal { position: relative; width: min(720px,100%); height: 100%; padding: 0 28px 28px; overflow: auto; background: var(--panel); box-shadow: -12px 0 40px #142d3514; }
.modal-close { position: sticky; top: 22px; float: right; z-index: 3; margin-top: 22px; background: var(--panel); border-color: var(--line); }
.modal-header { position: sticky; top: 0; z-index: 2; padding: 28px 53px 20px 0; background: var(--panel); border-bottom: 1px solid var(--line); }
.modal h2 { margin: 3px 0 10px; font-size: 26px; line-height: 1.4; font-weight: 650; overflow-wrap: anywhere; }
.detail-eyebrow { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.detail-eyebrow .layer-dot { margin: 0; }
.meta-line { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; }
.detail-link { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0; border: 0; color: var(--brand); font-size: 14px; }
.detail-link .icon { width: 15px; height: 15px; flex-basis: 15px; }
.detail-link:hover { text-decoration: underline; }
.modal-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin: 24px 0; }
.summary-card { min-width: 0; padding-right: 7px; border-right: 1px solid var(--line); }
.summary-card:last-child { border: 0; }
.summary-label { display: block; color: var(--muted); font-size: 14px; }
.summary-value { display: block; margin-top: 5px; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.research-notice { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; background: var(--warn-bg); border-radius: 5px; color: var(--warn); font-size: 14px; }
.research-notice > .icon { width: 18px; height: 18px; flex-basis: 18px; margin-top: 2px; }
.research-notice strong { font-size: 14px; font-weight: 600; }
.research-notice p { margin: 3px 0 0; }
.modal-section { margin-top: 27px; }
.modal-section h3 { margin: 0 0 12px; font-size: 16px; font-weight: 650; }
.modal-section p, .modal-section li { font-size: 14px; line-height: 1.8; }
.stock-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px 12px; padding: 15px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.stock-main strong { font-size: 15px; font-weight: 600; }
.stock-main p { margin: 4px 0; color: var(--muted); font-size: 14px; }
.company-link { display: inline-flex; align-items: center; gap: 3px; color: var(--brand); font-size: inherit; max-width: 100%; overflow-wrap: anywhere; }
.company-link:hover { text-decoration: underline; }
.company-link .icon { width: 14px; height: 14px; flex-basis: 14px; }
.company-directory { display: flex; flex-wrap: wrap; gap: 12px 20px; padding: 0; margin: 12px 0 0; list-style: none; }
.company-meta { display: flex; flex-wrap: wrap; gap: 9px 16px; align-items: center; margin: 12px 0; color: var(--muted); font-size: 14px; }
.company-back { margin-bottom: 12px; }
.company-back .icon { transform: rotate(180deg); }
.company-products { padding-left: 20px; }
.company-products li { margin: 8px 0; }
.company-segments, .company-sources { list-style: none; margin: 0; padding: 0; }
.company-segments li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.company-relation-status, .modal-section .company-aliases, .modal-section .source-meta { color: var(--muted); font-size: 14px; }
.company-sources li { padding: 12px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.company-sources p { margin: 6px 0 0; }
.company-sources .evidence-link { display: inline-flex; align-items: center; gap: 5px; }
.company-sources .icon { width: 14px; height: 14px; flex-basis: 14px; }
.quote-box { text-align: right; font-variant-numeric: tabular-nums; }
.quote-box small { display: block; margin-top: 4px; color: var(--muted); font-size: 14px; }
.stock-item-footer { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.status-badge, .mapping-badge { display: inline-flex; padding: 1px 6px; border-radius: 3px; color: var(--muted); background: var(--pending-bg); font-size: 14px; }
.status-badge[data-status='ok'], .mapping-badge.verified { color: var(--ok); background: var(--ok-bg); }
.status-badge[data-status='fail'] { color: var(--risk); background: var(--risk-bg); }
.evidence-link { font-size: 14px; }
.daily-news-list { display: grid; gap: 12px; }
.daily-news-item, .event-item { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.daily-news-item a { font-weight: 550; }
.daily-news-item small, .news-source { display: block; margin-top: 5px; color: var(--muted); font-size: 14px; }
.event-date { margin-right: 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.news-empty { padding: 13px; background: var(--surface-soft); border-radius: 5px; color: var(--muted); font-size: 14px; }
.news-empty.news-fail { color: var(--risk); }
.trust-note { margin: 0 0 7px; color: var(--muted); font-size: 14px; }
.toast { position: fixed; bottom: 24px; left: 50%; z-index: 250; max-width: calc(100% - 32px); padding: 10px 18px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); color: var(--text); box-shadow: 0 6px 20px #172d3521; transform: translateX(-50%); font-size: 14px; }
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: calc(100% + 7px); left: 50%; z-index: 200; width: max-content; max-width: 280px; padding: 7px 9px; border-radius: 4px; background: var(--text); color: var(--panel); font-size: 14px; white-space: pre-line; transform: translateX(-50%); pointer-events: none; }

@media (min-width: 1750px) { .cards-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media (max-width: 1250px) {
  :root { --sidebar-width: 216px; }
  .workspace { padding: 26px 24px; }
  .topbar { padding: 0 24px; }
  .workspace-grid { grid-template-columns: minmax(0,1fr) 228px; gap: 20px; }
  .insights { padding-left: 18px; }
  .heading-date { display: none; }
  .stock-code { display: none; }
  .view-list .card { grid-template-columns: minmax(0,1fr) minmax(0,1.1fr); }
  .view-list .card-strength { grid-column: 1; grid-row: 3; }
  .view-list .card-foot { grid-column: 2; grid-row: 4; }
  .view-list .stock-mini { grid-row: 1 / span 3; }
}
@media (max-width: 1120px) {
  .workspace-grid { grid-template-columns: minmax(0,1fr); grid-template-areas: 'insights' 'research'; gap: 0; }
  .insights-toggle { display: inline-flex; }
  .insights-toggle[aria-expanded='true'] { color: var(--brand); background: var(--brand-soft); }
  .insights { display: none; position: static; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0 0 22px; margin-bottom: 22px; border-left: 0; border-bottom: 1px solid var(--line); gap: 24px; }
  .insights.open { display: grid; }
  .data-panel { grid-column: 1 / -1; }
  .data-panel .status-strip { grid-template-columns: 1fr 1fr; }
  .evidence-progress { max-width: 50%; }
  .generated-note time { display: inline; margin-left: 6px; }
  .stock-code { display: inline; }
}
@media (max-width: 800px) {
  .sidebar { z-index: 120; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 10px 0 30px #162e3414; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: inline-flex; position: absolute; top: 25px; right: 10px; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 110; background: #192d3359; }
  .sidebar-foot { padding-top: 12px; }
  body.sidebar-open { overflow: hidden; }
  .app-shell { margin-left: 0; }
  .mobile-menu { display: inline-flex; }
  .topbar { height: 60px; padding: 0 18px 0 8px; }
  .topbar-path { gap: 7px; }
  .topbar-path > span, .breadcrumb-icon, .market-session { display: none; }
  .topbar-path strong { font-size: 15px; }
  .topbar-actions { gap: 4px; }
  .workspace { padding: 22px 20px; }
  .page-heading { margin-bottom: 18px; }
  h1 { font-size: 25px; }
  .stats { padding-bottom: 20px; }
  .stat { padding-left: 18px; }
  .stat-num { font-size: 27px; }
  .trust-banner { margin-bottom: 20px; }
  .layer-description { display: none; }
  .cards-grid { gap: 10px; }
  .card { padding: 15px; }
  .modal { width: min(660px,100%); padding-left: 22px; padding-right: 22px; }
}
@media (max-width: 580px) {
  .workspace { padding: 20px 16px; }
  h1 { font-size: 23px; }
  .page-heading p { max-width: 32em; line-height: 1.7; }
  .download-btn { padding: 6px 9px; }
  .stat { grid-template-columns: 1fr; grid-template-areas: 'label' 'value'; padding-left: 12px; }
  .stat-num { font-size: 25px; }
  .stat-label { white-space: nowrap; }
  .stat-suffix { display: none; }
  .trust-row { align-items: flex-start; gap: 7px; padding: 10px; }
  .trust-row > .icon { margin-top: 3px; }
  #trustHeadline { display: none; }
  .trust-row > div { align-self: center; }
  .trust-detail { padding: 0 12px 12px; }
  .filter-selects { gap: 6px; }
  .select-control select { padding: 6px 16px 6px 7px; }
  .reset-btn { width: 34px; padding: 5px; }
  .reset-btn span { display: none; }
  .results-heading { margin-top: 21px; }
  .results-heading > div:first-child { gap: 0 8px; }
  .results-heading h2 { font-size: 17px; }
  .layer-section { margin-top: 15px; }
  .layer-title h3 { font-size: 16px; }
  .cards-grid { grid-template-columns: 1fr; }
  .card { min-height: 216px; padding: 15px 17px; }
  .bookmark-btn { width: 44px; height: 44px; top: 1px; right: 1px; }
  .stock-code { display: inline; }
  .stock-mini { gap: 7px; }
  .stock-change { width: 59px; }
  .view-list .card { grid-template-columns: minmax(0,1fr) 90px; gap: 5px 10px; padding: 12px 14px; }
  .view-list .card-meta { grid-column: 1; }
  .view-list .card-head { grid-column: 1; }
  .view-list .card-strength { grid-column: 2; grid-row: 2; justify-content: flex-end; }
  .view-list .stock-mini { grid-column: 1 / -1; grid-row: 4; margin-top: 7px; padding-top: 9px; border-top: 1px solid var(--line); }
  .view-list .card-foot { grid-column: 1 / -1; grid-row: 5; padding-top: 5px; }
  .view-list .card-quote-state { display: inline; }
  .view-list .bookmark-btn { top: 5px; right: 7px; }
  .view-list .card-bottleneck { grid-row: 3; }
  .insights { grid-template-columns: 1fr; }
  .data-panel { grid-column: auto; }
  .evidence-progress { max-width: none; }
  .generated-note time { display: block; margin-left: 0; }
  .modal { width: 100%; padding: 0 18px 24px; }
  .modal-header { padding-top: 23px; padding-bottom: 17px; }
  .modal h2 { font-size: 23px; }
  .modal-close { top: 17px; margin-top: 17px; }
  .modal-summary { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px 12px; margin: 21px 0; }
  .summary-card:nth-child(2) { border-right: 0; }
  .summary-value { font-size: 15px; }
  .stock-item { grid-template-columns: minmax(0,1fr); }
  .quote-box { text-align: left; }
  .stock-item-footer { flex-wrap: wrap; }
  .research-notice { padding: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media (hover: none) { [data-tooltip]:hover::after { display: none; } }
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #171e20; --panel: #1d2729; --surface-soft: #232f31; --surface-muted: #2a373a;
  --text: #e7eded; --text-soft: #c1ced0; --muted: #9badb1; --line: #344346; --line-strong: #45585b;
  --brand: #69c9bc; --brand-2: #7dd6c9; --brand-soft: #263e3b;
  --upstream: #69c9bc; --midstream: #b3a0dd; --downstream: #d1ac65;
  --warn: #d8b771; --warn-bg: #363225; --risk: #f0959b; --risk-bg: #402a30;
  --up: #f08a96; --down: #7dd0aa; --flat: #a2b3b7; --ok: #8bd0b4; --ok-bg: #293f37;
  --pending: #9badb1; --pending-bg: #2a373a;
}
:root[data-theme='dark'] .brand-mark { background: #287b71; color: #fff; }
:root[data-theme='dark'] .trust-banner { border-color: #514b34; }
:root[data-theme='dark'] .card:hover { border-color: #699c96; }
@media print {
  .sidebar, .topbar, .toolbar, .insights, .view-toggle, .bookmark-btn, .modal-bg, .workspace-footer { display: none !important; }
  .app-shell { margin-left: 0; }
  .workspace { padding: 0; }
  .workspace-grid { display: block; }
  .card { break-inside: avoid; }
}
