:root {
  color-scheme: light;
  --navy-950: #071225;
  --navy-900: #0d1b34;
  --navy-800: #15294b;
  --blue-600: #2563eb;
  --blue-500: #377dff;
  --blue-100: #eaf1ff;
  --ink: #162238;
  --muted: #65738a;
  --soft: #f5f7fb;
  --line: #e3e9f2;
  --surface: #ffffff;
  --up: #d92f45;
  --down: #0e9660;
  --warn: #a96109;
  --shadow: 0 12px 34px rgba(17, 35, 64, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  background: linear-gradient(180deg, #eef3fa 0, #f7f9fc 340px, #f4f6fa 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: relative;
  color: #fff;
  background:
    radial-gradient(circle at 82% 8%, rgba(77, 140, 255, .35), transparent 35%),
    linear-gradient(128deg, var(--navy-950), #173765 72%, #1d4d91);
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.header-inner, .page-shell { width: min(1460px, calc(100% - 40px)); margin-inline: auto; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 22px 0 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand img { width: 42px; height: 42px; border-radius: 11px; box-shadow: 0 6px 16px #0005; }
.brand-copy { min-width: 0; }
.brand-name { margin: 0; font-size: clamp(20px, 2.4vw, 29px); letter-spacing: .02em; line-height: 1.2; }
.brand-subtitle { margin: 5px 0 0; color: #bdd0ef; font-size: 13px; }
.session-pill { flex: none; padding: 8px 11px; border-radius: 999px; color: #dbe8ff; background: #ffffff12; border: 1px solid #ffffff1d; font-size: 12px; }
.public-nav { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 1px; }
.public-nav::-webkit-scrollbar { display: none; }
.public-nav a { flex: none; color: #dbe7fb; text-decoration: none; padding: 11px 14px 12px; border-radius: 10px 10px 0 0; font-size: 14px; font-weight: 650; white-space: nowrap; }
.public-nav a:hover, .public-nav a[aria-current="page"] { color: #fff; background: rgba(255, 255, 255, .14); }

.page-shell { padding: 20px 0 88px; }
.page-heading { margin: 2px 0 18px; display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.page-heading h1 { margin: 0 0 4px; font-size: clamp(24px, 3vw, 34px); }
.page-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.section-card {
  position: relative;
  min-width: 0;
  margin-bottom: 18px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid rgba(217, 226, 239, .9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-card.compact { padding: 17px; }
.section-card.is-error { border-color: #f3c8cc; }
.section-card.is-loading { opacity: .92; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title-row h2, .section-card > h2 { margin: 0; font-size: clamp(18px, 2vw, 23px); }
.section-title-row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.section-link { flex: none; color: var(--blue-600); text-decoration: none; font-size: 14px; font-weight: 700; }
.section-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }

.status-box { margin: 0 0 13px; padding: 11px 13px; border-radius: 10px; background: #eef4ff; color: #405675; font-size: 14px; line-height: 1.5; }
.status-box.success { background: #eaf8f2; color: #186d4c; }
.status-box.warning { background: #fff6e8; color: #855014; }
.status-box.error { background: #fff0f1; color: #9b2d3b; }
.empty-state { padding: 38px 16px; color: #7c899c; text-align: center; }
.section-error { padding: 22px 14px; color: #9b2d3b; text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.meta-pill { display: inline-flex; align-items: center; min-height: 32px; padding: 6px 10px; border-radius: 9px; color: #52627a; background: #f2f5fa; font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric { min-width: 0; padding: 14px; border-radius: 13px; background: #f5f7fb; border: 1px solid #ebeff5; }
.metric-label { color: var(--muted); font-size: 12px; }
.metric-value { display: block; margin-top: 5px; font-size: clamp(18px, 2vw, 25px); font-weight: 800; overflow-wrap: anywhere; }
.metric-note { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.market-focus-value { font-size: clamp(14px, 1.45vw, 18px); line-height: 1.35; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: #6f7c90 !important; }

.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.data-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.data-table th { padding: 11px 9px; color: #5f6d82; background: #f7f9fc; font-size: 12px; text-align: center; white-space: nowrap; }
.data-table td { padding: 11px 9px; border-top: 1px solid var(--line); text-align: center; font-size: 13px; vertical-align: middle; }
.data-table tbody tr:hover { background: #fbfcff; }
.stock-name { color: var(--blue-600); text-decoration: none; font-weight: 750; }
.stock-code { color: #738198; font-variant-numeric: tabular-nums; }
.score { font-size: 17px; font-weight: 850; font-variant-numeric: tabular-nums; }
.rank { font-weight: 850; color: #334259; }
.rank-change { font-weight: 700; }
.stock-ranking-scroll {
  width: 100%;
  max-width: 100%;
  max-height: min(68vh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.data-table.stock-ranking-table {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.stock-ranking-table th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f7f9fc;
  box-shadow: 0 1px 0 var(--line);
}
.stock-ranking-table td { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.stock-ranking-table td.empty-state { white-space: normal; }
.stock-ranking-table .stock-col-status { overflow: hidden; text-overflow: ellipsis; }
.stock-ranking-table .action-group { gap: 4px; }
.stock-ranking-table .action-group .btn { min-height: 30px; padding: 5px 7px; font-size: 11px; }
.stock-ranking-table--top50 th:nth-child(1) { width: 6.5%; }
.stock-ranking-table--top50 th:nth-child(2) { width: 6.5%; }
.stock-ranking-table--top50 th:nth-child(3) { width: 5.5%; }
.stock-ranking-table--top50 th:nth-child(4) { width: 12%; }
.stock-ranking-table--top50 th:nth-child(5) { width: 7%; }
.stock-ranking-table--top50 th:nth-child(6) { width: 7.5%; }
.stock-ranking-table--top50 th:nth-child(7) { width: 10%; }
.stock-ranking-table--top50 th:nth-child(8) { width: 8%; }
.stock-ranking-table--top50 th:nth-child(9) { width: 8%; }
.stock-ranking-table--top50 th:nth-child(10) { width: 12%; }
.stock-ranking-table--top50 th:nth-child(11) { width: 17%; }
.stock-ranking-table--sector th:nth-child(1) { width: 8%; }
.stock-ranking-table--sector th:nth-child(2) { width: 20%; }
.stock-ranking-table--sector th:nth-child(3) { width: 11%; }
.stock-ranking-table--sector th:nth-child(4) { width: 11%; }
.stock-ranking-table--sector th:nth-child(5) { width: 17%; }
.stock-ranking-table--sector th:nth-child(6) { width: 11%; }
.stock-ranking-table--sector th:nth-child(7) { width: 11%; }
.stock-ranking-table--sector th:nth-child(8) { width: 11%; }
.reason-list { margin: 0; padding-left: 18px; text-align: left; min-width: 210px; }
.reason-list li + li { margin-top: 3px; }
.action-group { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; padding: 7px 11px; border: 1px solid #cfdaeb; border-radius: 8px; color: #2459a9; background: #fff; text-decoration: none; cursor: pointer; font-size: 12px; font-weight: 700; }
.btn:hover { background: #f3f7ff; }
.btn.primary { color: #fff; border-color: var(--blue-600); background: var(--blue-600); }
.btn:disabled { opacity: .45; cursor: default; }
.chip-row, .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.chip { border: 1px solid #cfdaeb; border-radius: 999px; padding: 7px 12px; color: #425672; background: #fff; cursor: pointer; }
.chip.active { color: #fff; border-color: var(--blue-600); background: var(--blue-600); }
.field { min-height: 38px; max-width: 100%; padding: 8px 10px; color: var(--ink); background: #fff; border: 1px solid #cbd7e7; border-radius: 8px; }

.market-search-panel { position: relative; z-index: 15; width: 100%; margin-bottom: 18px; }
.market-search { position: relative; width: 100%; }
.market-search-label { display: block; width: 100%; }
.market-search-label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.market-search-input { width: 100%; min-height: 50px; padding: 12px 16px; color: var(--ink); background: #fff; border: 1px solid #cbd7e7; border-radius: 13px; box-shadow: var(--shadow); outline: none; }
.market-search-input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(55, 125, 255, .13), var(--shadow); }
.market-search-results { position: absolute; top: calc(100% + 7px); left: 0; z-index: 40; width: 100%; max-height: min(66vh, 560px); overflow-y: auto; overscroll-behavior: contain; padding: 7px; background: #fff; border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 18px 45px rgba(17, 35, 64, .18); }
.market-search-results[hidden] { display: none; }
.market-search-group { padding: 8px 10px 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.market-search-result { display: flex; flex-direction: column; align-items: stretch; gap: 4px; width: 100%; min-height: 48px; padding: 10px; color: var(--ink); background: transparent; border: 0; border-radius: 9px; text-align: left; cursor: pointer; }
.market-search-result:hover, .market-search-result:focus-visible { background: #eef4ff; outline: none; }
.market-search-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.market-search-heading strong { overflow-wrap: anywhere; }
.market-search-code, .market-search-detail { color: var(--muted); font-size: 12px; }
.market-search-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.market-search-tag { padding: 2px 6px; color: #425672; background: #edf2fa; border-radius: 999px; font-size: 11px; line-height: 1.5; }
.market-search-message { padding: 14px 11px; color: var(--muted); font-size: 13px; }
.customer-message { margin: 0 0 13px; color: #53647c; font-size: 14px; line-height: 1.5; }
.heatmap-controls { position: sticky; top: 8px; z-index: 18; display: grid; grid-template-columns: auto minmax(260px, 1fr) auto; align-items: center; gap: 10px; overflow: visible; }
.heatmap-switcher { flex-wrap: nowrap; margin: 0; }
.heatmap-search { z-index: 19; min-width: 0; margin: 0; }
.heatmap-sort { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.heatmap-sort .field { min-height: 44px; }
.breadcrumb { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: -5px 0 10px; color: var(--muted); font-size: 13px; }
.breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--blue-600); font-weight: 700; text-decoration: none; }
.sector-detail-title { margin: 0; font-size: clamp(22px, 3vw, 31px); }
.sector-scroll-region { max-height: min(68vh, 760px); min-height: 180px; overflow: auto; overscroll-behavior: contain; padding: 2px 5px 8px 2px; scrollbar-gutter: stable; }
.sector-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 8px; }
.sector-card { display: flex; min-width: 0; min-height: 104px; padding: 10px 11px; flex-direction: column; justify-content: space-between; gap: 6px; color: var(--ink); background: #f7f9fc; border: 1px solid var(--line); border-left: 4px solid #8090a7; border-radius: 10px; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.sector-card.heat-up { background: linear-gradient(135deg, #fff8f8, #fff); border-left-color: var(--up); }
.sector-card.heat-down { background: linear-gradient(135deg, #f2fbf7, #fff); border-left-color: var(--down); }
.sector-card:hover, .sector-card:focus-visible, .sector-card.is-targeted { transform: translateY(-1px); border-color: #98b5e6; box-shadow: 0 7px 18px rgba(17, 35, 64, .1); outline: none; }
.sector-card-head, .sector-card-meta, .sector-card-foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.sector-card-head strong { min-width: 0; overflow-wrap: anywhere; font-size: 15px; }
.sector-card-head b { flex: none; font-size: 15px; }
.sector-card-meta, .sector-card-foot { color: var(--muted); font-size: 11px; line-height: 1.5; }
.sector-card-meta span, .sector-card-foot span { min-width: 0; overflow-wrap: anywhere; }
.sector-card-foot span:last-child { flex: none; text-align: right; }
.sector-load-more { display: flex; width: min(320px, 100%); min-height: 44px; margin: 14px auto 3px; }
.sector-load-more[hidden] { display: none; }
.sector-metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.sector-metric-grid .metric { padding: 10px; }
.sector-metric-grid .metric-value { font-size: 18px; }
.sector-leader { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 12px; padding: 10px 13px; color: var(--muted); background: #f7f9fc; border: 1px solid var(--line); border-radius: 11px; }
.sector-leader a { color: var(--blue-600); font-weight: 800; text-decoration: none; }
.sector-leader a small { margin-left: 4px; color: var(--muted); font-weight: 500; }
.sector-leader strong { margin-left: auto; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .7fr); gap: 18px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.summary-tile { min-width: 0; padding: 13px; border-radius: 12px; background: #f5f7fb; border: 1px solid #ebeff5; }
.summary-tile strong { display: block; margin-bottom: 5px; overflow-wrap: anywhere; }
.summary-link { color: inherit; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
.summary-link:hover, .summary-link:focus-visible { border-color: #9cb9ed; transform: translateY(-1px); outline: none; }
.dashboard-hot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dashboard-hot-grid h3 { margin: 0 0 9px; font-size: 15px; }
.dashboard-hot-grid .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.news-list { display: grid; gap: 9px; }
.news-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.news-item a { color: var(--ink); text-decoration: none; font-weight: 750; line-height: 1.5; }
.news-item a:hover { color: var(--blue-600); }
.news-summary { margin: 6px 0 0; color: #52627a; font-size: 13px; line-height: 1.55; }
.news-meta { margin-top: 5px; color: var(--muted); font-size: 12px; }
.tag { display: inline-block; padding: 2px 6px; margin-right: 4px; border-radius: 999px; color: #50617b; background: #eef2f8; font-size: 11px; }

.heat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); grid-auto-rows: 58px; grid-auto-flow: dense; gap: 9px; }
.heat-cell { min-width: 0; min-height: 0; grid-row: span var(--heat-span, 2); padding: 14px; color: #fff; border: 0; border-radius: 13px; text-align: left; cursor: pointer; box-shadow: inset 0 0 0 1px #ffffff25; overflow-wrap: anywhere; }
.heat-cell:focus-visible, .heat-cell.is-targeted { outline: 4px solid #ffd45c; outline-offset: 2px; }
.heat-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.heat-title b { min-width: 0; font-size: 16px; }
.heat-title strong { flex: none; }
.heat-cell strong { display: block; font-size: 16px; }
.heat-cell small { display: block; margin-top: 6px; opacity: .9; }
.heat-leader { display: block; width: fit-content; max-width: 100%; margin-top: 6px; color: #fff; font-size: 12px; font-weight: 750; text-decoration: underline; text-decoration-color: #ffffff88; text-underline-offset: 2px; overflow-wrap: anywhere; }
.stock-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.stock-tile { padding: 11px; border-radius: 10px; background: #f5f7fb; }
.stock-tile a { color: var(--blue-600); font-weight: 750; text-decoration: none; }
.marker { display: inline-block; margin: 6px 3px 0 0; padding: 2px 6px; border-radius: 5px; color: #73500d; background: #fff1bd; font-size: 10px; }

.support-fab { position: fixed; z-index: 20; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 7px; padding: 12px 17px; color: #fff; background: var(--blue-600); border-radius: 999px; box-shadow: 0 12px 28px rgba(37, 99, 235, .36); text-decoration: none; font-weight: 750; }
.install-banner { display: none; position: fixed; z-index: 30; left: 50%; bottom: calc(max(18px, env(safe-area-inset-bottom)) + 62px); width: min(520px, calc(100% - 28px)); max-height: calc(100vh - 110px); transform: translateX(-50%); padding: 15px 50px 15px 16px; color: #fff; background: #10213f; border: 1px solid #ffffff24; border-radius: 13px; box-shadow: 0 15px 38px #08152d55; overflow-y: auto; overflow-wrap: anywhere; }
.install-banner.show { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.install-copy { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.install-copy strong { font-size: 15px; }
.install-copy span { color: #dbe7fb; font-size: 13px; line-height: 1.55; }
.install-action { min-width: 96px; min-height: 44px; }
.install-dismiss { position: absolute; top: 4px; right: 4px; width: 44px; height: 44px; padding: 0; color: #dbe7fb; background: transparent; border: 0; border-radius: 999px; cursor: pointer; font-size: 24px; line-height: 1; }
.install-dismiss:hover, .install-dismiss:focus-visible { color: #fff; background: #ffffff18; outline: 2px solid #8bb5ff; outline-offset: -3px; }
body.install-guide-visible .page-shell { padding-bottom: 180px; }

.chat-shell { width: min(820px, calc(100% - 28px)); height: min(720px, calc(100vh - 190px)); min-height: 480px; margin: 18px auto 72px; display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chat-status { padding: 11px 15px; background: #f7f9fc; border-bottom: 1px solid var(--line); }
.messages { flex: 1; overflow-y: auto; padding: 16px; }
.message { width: fit-content; max-width: min(78%, 560px); margin: 8px 0; padding: 10px 12px; border-radius: 13px 13px 13px 4px; background: #edf2f8; overflow-wrap: anywhere; }
.message.mine { margin-left: auto; border-radius: 13px 13px 4px; background: #e8f0ff; }
.message small { display: block; margin-top: 5px; color: #738097; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; min-width: 0; resize: none; }

.chart { display: block; width: 100%; height: 320px; border: 1px solid var(--line); border-radius: 11px; }

@media (max-width: 980px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .heatmap-controls { grid-template-columns: auto 1fr; }
  .heatmap-search { grid-column: 1 / -1; grid-row: 2; }
  .sector-metric-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .header-inner, .page-shell { width: min(100% - 24px, 100%); }
  .brand-row { padding: 15px 0 12px; }
  .brand img { width: 38px; height: 38px; }
  .brand-subtitle, .session-pill { display: none; }
  .public-nav { margin-inline: -12px; padding-inline: 12px; }
  .public-nav a { padding: 10px 11px 11px; font-size: 13px; }
  .page-shell { padding-top: 13px; }
  .market-search-panel { margin-bottom: 13px; }
  .market-search-input { min-height: 48px; padding-inline: 13px; }
  .market-search-results { max-height: min(62vh, 480px); }
  .heat-grid { grid-template-columns: 1fr; grid-auto-rows: auto; }
  .heat-cell { width: 100%; min-width: 0; grid-row: auto; min-height: 48px; }
  .sector-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .sector-card { min-height: 112px; }
  .page-heading { align-items: start; flex-direction: column; margin-bottom: 13px; }
  .section-card { padding: 14px; margin-bottom: 13px; border-radius: 14px; }
  .section-title-row { align-items: flex-start; }
  .metric-grid, .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-hot-grid { grid-template-columns: 1fr; }
  .table-scroll { overflow: visible; border: 0; }
  .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
  .data-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .data-table tbody { display: grid; gap: 10px; }
  .data-table tbody tr { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 5px 15px #13213b0a; }
  .data-table tbody tr:hover { background: #fff; }
  .data-table td { display: grid; grid-template-columns: minmax(92px, .72fr) minmax(0, 1.28fr); align-items: center; gap: 10px; min-height: 34px; padding: 7px 2px; border: 0; border-bottom: 1px dashed #e7ebf2; text-align: right; overflow-wrap: anywhere; }
  .data-table td:last-child { border-bottom: 0; }
  .data-table td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
  .data-table td.mobile-title { display: block; padding: 4px 2px 10px; text-align: left; font-size: 16px; }
  .data-table td.mobile-title::before { display: none; }
  .data-table td.mobile-hide { display: none; }
  .stock-ranking-scroll { width: 100%; max-width: 100%; min-width: 0; max-height: min(66vh, 560px); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; border: 1px solid var(--line); border-radius: 10px; scrollbar-gutter: auto; }
  .data-table.stock-ranking-table { display: table; width: 100%; min-width: 0; max-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
  .data-table.stock-ranking-table thead { position: static; display: table-header-group; width: auto; height: auto; overflow: visible; clip: auto; clip-path: none; }
  .data-table.stock-ranking-table tbody { display: table-row-group; width: auto; }
  .data-table.stock-ranking-table tr { display: table-row; width: auto; height: 46px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .data-table.stock-ranking-table th,
  .data-table.stock-ranking-table td { display: table-cell; min-width: 0; height: 46px; padding: 4px 2px; border: 0; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; overflow: hidden; overflow-wrap: normal; text-overflow: ellipsis; font-size: 11px; line-height: 1.15; vertical-align: middle; }
  .data-table.stock-ranking-table th { position: sticky; top: 0; z-index: 4; height: 36px; color: #5f6d82; background: #f7f9fc; box-shadow: 0 1px 0 var(--line); }
  .data-table.stock-ranking-table td::before { display: none; content: none; }
  .data-table.stock-ranking-table td.mobile-title { display: table-cell; padding: 4px 2px; text-align: center; font-size: 11px; white-space: normal; }
  .data-table.stock-ranking-table .stock-col-desktop { display: none !important; }
  .data-table.stock-ranking-table .stock-col-rank { width: 9%; }
  .data-table.stock-ranking-table .stock-col-name { width: 27%; }
  .data-table.stock-ranking-table .stock-col-price { width: 15%; }
  .data-table.stock-ranking-table .stock-col-change { width: 17%; }
  .data-table.stock-ranking-table .stock-col-score { width: 14%; }
  .data-table.stock-ranking-table .stock-col-status { width: 18%; }
  .data-table.stock-ranking-table .stock-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; line-height: 1.15; }
  .data-table.stock-ranking-table .stock-code { display: block; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; line-height: 1.05; }
  .data-table.stock-ranking-table .stock-col-status { font-size: 10px; }
  .data-table.stock-ranking-table td.empty-state { white-space: normal; }
  .reason-list { min-width: 0; }
  .action-group { justify-content: flex-end; }
  .support-fab { width: 48px; height: 48px; padding: 0; justify-content: center; font-size: 0; }
  .support-fab::before { content: "💬"; font-size: 21px; }
}

@media (max-width: 430px) {
  .header-inner, .page-shell { width: calc(100% - 18px); }
  .brand-name { font-size: 19px; }
  .section-card { padding: 12px; }
  .sector-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .sector-card { min-height: 108px; padding: 8px; gap: 3px; }
  .sector-card-meta, .sector-card-foot { font-size: 10px; line-height: 1.35; }
  .sector-card-head, .sector-card-meta, .sector-card-foot { align-items: flex-start; }
  .sector-card-meta, .sector-card-foot { flex-direction: column; gap: 2px; }
  .sector-card-foot span:last-child { text-align: left; }
  .heatmap-controls { top: 4px; gap: 8px; }
  .heatmap-sort { justify-self: end; }
  .heatmap-sort > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sector-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .sector-leader { align-items: flex-start; flex-wrap: wrap; }
  .sector-leader strong { margin-left: 0; }
  .metric-grid, .summary-grid { grid-template-columns: 1fr 1fr; gap: 7px; }
  .metric, .summary-tile { padding: 11px; }
  .metric-value { font-size: 18px; }
  .toolbar { align-items: stretch; }
  .toolbar .field, .toolbar .btn { flex: 1 1 130px; }
  .chat-shell { height: calc(100vh - 156px); min-height: 420px; margin-top: 10px; }
  .message { max-width: 88%; }
  .composer { padding: 9px; }
  .install-banner { left: 9px; right: 9px; bottom: calc(max(12px, env(safe-area-inset-bottom)) + 58px); width: auto; max-height: calc(100vh - 96px); transform: none; padding: 14px 48px 14px 14px; }
  .install-banner.show { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .install-action { width: 100%; }
  body.install-guide-visible .page-shell { padding-bottom: 240px; }
}

@media (display-mode: standalone) {
  .site-header { padding-top: env(safe-area-inset-top); }
}
