﻿.chip-flow-section {
  margin: clamp(22px, 4vw, 46px) auto;
  max-width: 1180px;
  padding: 0 clamp(14px, 3vw, 32px);
}

@media (min-width: 1181px) {
  .chip-flow-section {
    padding-inline: 0;
  }
}

.chip-shell {
  border: 1px solid rgba(124, 191, 179, .24);
  border-radius: 26px;
  background:
    radial-gradient(circle at 12% 0%, rgba(255, 207, 117, .12), transparent 28%),
    linear-gradient(135deg, rgba(18, 67, 61, .94), rgba(10, 34, 47, .96));
  box-shadow: 0 28px 70px rgba(0, 0, 0, .28);
  color: #eaf9f3;
  overflow: hidden;
}

.chip-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 22px;
  align-items: center;
  padding: clamp(22px, 4vw, 44px);
}

.chip-head .eyebrow {
  margin: 0 0 10px;
  color: rgba(139, 231, 209, .82);
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .24em;
}

.chip-head h2 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 5.2rem);
  line-height: .96;
  letter-spacing: 0;
}

.chip-head p:not(.eyebrow) {
  max-width: 980px;
  margin: 18px 0 0;
  color: rgba(224, 244, 239, .78);
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  line-height: 1.75;
}

.chip-head-actions {
  display: grid;
  gap: 12px;
  justify-items: end;
}

.chip-time,
.chip-expand {
  border: 1px solid rgba(255, 207, 117, .28);
  border-radius: 999px;
  background: rgba(255, 242, 213, .12);
  color: #ffe1a3;
  font-weight: 900;
  white-space: nowrap;
}

.chip-time {
  padding: 10px 16px;
  font-size: .95rem;
}

.chip-expand {
  padding: 14px 22px;
  cursor: pointer;
}

.chip-market-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 0 clamp(22px, 4vw, 44px) clamp(22px, 4vw, 36px);
}

.chip-market-card {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 22px;
  border: 1px solid rgba(135, 198, 186, .22);
  border-radius: 18px;
  background: rgba(7, 29, 39, .5);
}

.chip-market-card small,
.chip-market-card em {
  color: rgba(216, 239, 233, .72);
  font-style: normal;
  font-weight: 800;
}

.chip-market-card b {
  font-size: clamp(1.55rem, 3vw, 2.4rem);
}

.chip-market-card span {
  color: #82b8f7;
  font-weight: 900;
}

.chip-market-card.up span {
  color: #ff7a61;
}

.chip-body {
  display: none;
  border-top: 1px solid rgba(124, 191, 179, .18);
  padding: clamp(18px, 3vw, 34px);
}

.chip-flow-section.is-open .chip-body {
  display: grid;
  gap: 24px;
}

.chip-flow-stock-only .chip-head {
  padding-bottom: clamp(22px, 4vw, 44px);
}

.chip-flow-stock-only .chip-body {
  border-top: 1px solid rgba(124, 191, 179, .18);
}

.chip-flow-stock-only .chip-ranking {
  background:
    radial-gradient(circle at 8% 0%, rgba(255, 207, 117, .1), transparent 28%),
    rgba(9, 33, 43, .62);
}

.chip-flow-stock-only .chip-note {
  margin: 0;
  color: rgba(218, 240, 235, .58);
  font-size: .86rem;
  line-height: 1.7;
}

.chip-bars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.chip-institution,
.chip-ranking,
.chip-sector-flow {
  border: 1px solid rgba(135, 198, 186, .2);
  border-radius: 20px;
  background: rgba(9, 33, 43, .62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.chip-institution {
  padding: 18px;
}

.chip-institution header,
.chip-ranking header,
.chip-sector-flow header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chip-institution header span,
.chip-stock-card.buy .chip-stock-data b:first-child,
.chip-sector-card.inflow em {
  color: #ffcf75;
}

.chip-institution header span.down,
.chip-stock-card.sell .chip-stock-data b:first-child,
.chip-sector-card.outflow em {
  color: #82b8f7;
}

.chip-daily-bars {
  display: flex;
  align-items: end;
  gap: 10px;
  height: 84px;
  margin-top: 18px;
}

.chip-daily-bars i {
  position: relative;
  flex: 1;
  min-width: 18px;
  border-radius: 999px 999px 4px 4px;
  background: #82b8f7;
}

.chip-daily-bars i.buy {
  background: #ff715d;
}

.chip-daily-bars span {
  position: absolute;
  left: 50%;
  bottom: -22px;
  transform: translateX(-50%);
  color: rgba(222, 241, 236, .6);
  font-size: .72rem;
  white-space: nowrap;
}

.chip-ranking,
.chip-sector-flow {
  padding: clamp(18px, 3vw, 28px);
}

.chip-ranking h3,
.chip-sector-flow h3 {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
}

.chip-ranking small,
.chip-sector-flow small {
  color: rgba(218, 240, 235, .66);
  font-weight: 800;
}

.chip-controls {
  display: grid;
  grid-template-columns: repeat(4, auto) minmax(240px, 1fr);
  gap: 12px;
  align-items: center;
  margin: 20px 0;
}

.chip-tabs,
.chip-periods,
.chip-side,
.chip-market-filter,
.chip-sector-mode {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgba(135, 198, 186, .18);
  border-radius: 14px;
  background: rgba(4, 24, 34, .5);
}

.chip-controls button,
.chip-sector-mode button {
  border: 0;
  border-radius: 10px;
  padding: 10px 13px;
  background: transparent;
  color: rgba(224, 244, 239, .72);
  font-weight: 900;
  cursor: pointer;
}

.chip-controls button.selected,
.chip-sector-mode button.selected {
  background: rgba(69, 124, 119, .92);
  color: #fff;
}

.chip-search {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0 14px;
  height: 50px;
  border: 1px solid rgba(135, 198, 186, .2);
  border-radius: 14px;
  background: rgba(3, 22, 32, .55);
}

.chip-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f3fffb;
  font: inherit;
  font-weight: 800;
}

.chip-ranking-list {
  display: grid;
  gap: 10px;
}

.chip-stock-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) minmax(430px, .95fr);
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(135, 198, 186, .18);
  border-radius: 18px;
  background: linear-gradient(90deg, rgba(255, 112, 93, .18), rgba(18, 53, 62, .72));
}

.chip-stock-card.sell {
  background: linear-gradient(90deg, rgba(130, 184, 247, .18), rgba(18, 53, 62, .72));
}

.chip-stock-rank {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: rgba(255, 242, 213, .15);
  color: #ffcf75;
  font-weight: 1000;
}

.chip-stock-main a {
  display: flex;
  gap: 12px;
  align-items: baseline;
  color: inherit;
  text-decoration: none;
}

.chip-stock-main strong {
  font-size: clamp(1.12rem, 1.7vw, 1.45rem);
}

.chip-stock-main a span,
.chip-stock-main small {
  color: rgba(218, 240, 235, .68);
  font-weight: 900;
}

.chip-stock-signals {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.chip-signal {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(255, 255, 255, .08);
  color: #eaf9f3;
  font-size: .78rem;
  font-weight: 1000;
}

.chip-signal.sun,
.chip-signal.yellow {
  color: #ffcf75;
}

.chip-signal.moon,
.chip-signal.blue {
  color: #9fc8ff;
}

.chip-signal.x {
  color: #ff9b8a;
}

.chip-stock-data {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chip-stock-data span {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(3, 22, 32, .45);
}

.chip-stock-data small {
  display: block;
  margin-bottom: 4px;
  color: rgba(218, 240, 235, .58);
  font-size: .76rem;
  font-weight: 900;
}

.chip-stock-data b {
  display: block;
  overflow-wrap: anywhere;
}

.chip-sector-flow header {
  margin-bottom: 18px;
}

.chip-sector-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.chip-sector-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 134px;
  padding: 16px;
  border: 1px solid rgba(135, 198, 186, .18);
  border-radius: 16px;
  background: rgba(5, 27, 37, .58);
  color: inherit;
  text-align: left;
  overflow: hidden;
}

.chip-sector-card span,
.chip-sector-card strong,
.chip-sector-card small {
  position: relative;
  z-index: 1;
}

.chip-sector-card span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chip-sector-card strong {
  font-size: 1.45rem;
}

.chip-sector-card i {
  position: absolute;
  inset: auto auto 0 0;
  height: 5px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, #ff715d, #ffcf75);
}

.chip-sector-card.outflow i {
  background: linear-gradient(90deg, #82b8f7, #4a7fbf);
}

.chip-note,
.chip-empty {
  margin: 0;
  color: rgba(218, 240, 235, .62);
  font-weight: 800;
}

[data-theme="soft-light"] .chip-shell {
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 207, 117, .18), transparent 28%),
    linear-gradient(135deg, rgba(224, 238, 231, .96), rgba(198, 216, 207, .96));
  color: #082330;
  border-color: rgba(63, 103, 94, .22);
  box-shadow: 0 24px 64px rgba(31, 62, 52, .18);
}

[data-theme="soft-light"] .chip-head .eyebrow {
  color: #25796f;
}

[data-theme="soft-light"] .chip-head p:not(.eyebrow),
[data-theme="soft-light"] .chip-market-card small,
[data-theme="soft-light"] .chip-market-card em,
[data-theme="soft-light"] .chip-ranking small,
[data-theme="soft-light"] .chip-sector-flow small,
[data-theme="soft-light"] .chip-note,
[data-theme="soft-light"] .chip-empty,
[data-theme="soft-light"] .chip-stock-main a span,
[data-theme="soft-light"] .chip-stock-main small {
  color: rgba(8, 55, 58, .74);
}

[data-theme="soft-light"] .chip-time,
[data-theme="soft-light"] .chip-expand {
  background: rgba(255, 239, 208, .72);
  color: #a64b36;
  border-color: rgba(202, 137, 94, .28);
}

[data-theme="soft-light"] .chip-market-card,
[data-theme="soft-light"] .chip-institution,
[data-theme="soft-light"] .chip-ranking,
[data-theme="soft-light"] .chip-sector-flow,
[data-theme="soft-light"] .chip-sector-card {
  background: rgba(241, 248, 243, .66);
  border-color: rgba(63, 103, 94, .18);
}

[data-theme="soft-light"] .chip-tabs,
[data-theme="soft-light"] .chip-periods,
[data-theme="soft-light"] .chip-side,
[data-theme="soft-light"] .chip-market-filter,
[data-theme="soft-light"] .chip-sector-mode,
[data-theme="soft-light"] .chip-search,
[data-theme="soft-light"] .chip-stock-data span {
  background: rgba(222, 235, 228, .78);
  border-color: rgba(63, 103, 94, .18);
}

[data-theme="soft-light"] .chip-controls button,
[data-theme="soft-light"] .chip-sector-mode button {
  color: rgba(8, 55, 58, .78);
}

[data-theme="soft-light"] .chip-controls button.selected,
[data-theme="soft-light"] .chip-sector-mode button.selected {
  background: rgba(68, 112, 106, .88);
  color: #fff;
}

[data-theme="soft-light"] .chip-search input {
  color: #082330;
}

[data-theme="soft-light"] .chip-stock-card {
  background: linear-gradient(90deg, rgba(255, 143, 117, .28), rgba(234, 242, 237, .86));
}

[data-theme="soft-light"] .chip-stock-card.sell {
  background: linear-gradient(90deg, rgba(130, 184, 247, .26), rgba(234, 242, 237, .86));
}

body.large-text .chip-head h2 {
  font-size: clamp(2.6rem, 6.4vw, 5.7rem);
}

body.large-text .chip-stock-card {
  grid-template-columns: 58px minmax(0, 1fr);
}

body.large-text .chip-stock-data {
  grid-column: 1 / -1;
}

@media (max-width: 1180px) {
  .chip-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chip-controls > * {
    width: 100%;
    justify-content: center;
  }

  .chip-stock-card {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .chip-stock-data {
    grid-column: 1 / -1;
  }

  .chip-sector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .chip-flow-section {
    padding: 0 10px;
  }

  .chip-head {
    grid-template-columns: 1fr;
  }

  .chip-head-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .chip-market-cards,
  .chip-bars {
    grid-template-columns: 1fr;
  }

  .chip-controls {
    grid-template-columns: 1fr;
  }

  .chip-tabs,
  .chip-periods,
  .chip-side,
  .chip-market-filter,
  .chip-sector-mode {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .chip-controls button,
  .chip-sector-mode button {
    flex: 0 0 auto;
  }

  .chip-sector-flow header {
    display: grid;
  }

  .chip-sector-grid {
    grid-template-columns: 1fr;
  }

  .chip-stock-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .chip-stock-rank {
    width: 38px;
    height: 38px;
  }

  .chip-stock-main a {
    align-items: start;
    justify-content: space-between;
  }

  .chip-stock-data {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .chip-table-row .chip-pending-split {
    grid-column: 2 / -1 !important;
    grid-row: 4 !important;
    justify-self: start;
    width: min(100%, 410px);
  }
}

/* Keep the institutional header controls inside the section at desktop zoom. */
.chip-flow-stock-only,
.chip-flow-stock-only .chip-shell,
.chip-flow-stock-only .chip-head {
  box-sizing: border-box;
  max-width: 100%;
}

.chip-flow-stock-only .chip-head {
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
}

.chip-flow-stock-only .chip-head > div:first-child,
.chip-flow-stock-only .chip-head-actions {
  min-width: 0;
}

.chip-flow-stock-only .chip-head-actions {
  justify-self: end;
  max-width: 100%;
}

.chip-flow-stock-only .chip-time,
.chip-flow-stock-only .chip-expand {
  box-sizing: border-box;
  max-width: 100%;
}

@media (max-width: 1180px) {
  .chip-flow-stock-only .chip-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .chip-flow-stock-only .chip-head-actions {
    justify-self: start;
  }
}

/* Preview polish: make the chip module feel native to the current scanner UI. */
.chip-institution header div {
  display: grid;
  gap: 4px;
}

.chip-institution header small {
  color: rgba(218, 240, 235, .62);
  font-weight: 900;
}

.chip-daily-bars {
  align-items: end;
  height: 118px;
  padding: 12px 6px 30px;
  border-radius: 16px;
  background: rgba(2, 20, 28, .32);
}

.chip-daily-bars i {
  display: grid;
  place-items: end center;
  min-height: 10px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.05), 0 8px 18px rgba(0,0,0,.18);
}

.chip-daily-bars i.sell {
  background: #82b8f7;
}

.chip-daily-bars i.buy {
  background: #ff7057;
}

.chip-daily-bars i b {
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  color: rgba(236, 250, 246, .78);
  font-size: .66rem;
  white-space: nowrap;
  pointer-events: none;
}

.chip-sector-card {
  padding: 0;
}

.chip-sector-card > button {
  position: relative;
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 134px;
  padding: 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
}

.chip-sector-card > button span,
.chip-sector-card > button strong,
.chip-sector-card > button small {
  position: relative;
  z-index: 1;
}

.chip-sector-card > button span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.chip-sector-card > button i {
  position: absolute;
  inset: auto auto 0 0;
  height: 6px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, #ff7057, #ffcf75);
}

.chip-sector-card.outflow > button i {
  background: linear-gradient(90deg, #82b8f7, #4f77a9);
}

.chip-sector-children {
  display: none;
  padding: 0 14px 14px;
  gap: 8px;
}

.chip-sector-card.open .chip-sector-children {
  display: grid;
}

.chip-sector-children a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
  color: inherit;
  text-decoration: none;
  font-weight: 900;
}

.chip-sector-children span {
  color: rgba(224, 244, 239, .74);
}

.chip-sector-children em {
  font-style: normal;
  color: #ffcf75;
}

.chip-sector-children em.down {
  color: #82b8f7;
}

[data-theme="soft-light"] .chip-daily-bars {
  background: rgba(230, 240, 235, .7);
}

[data-theme="soft-light"] .chip-daily-bars i b {
  color: #234844;
}

[data-theme="soft-light"] .chip-institution header small,
[data-theme="soft-light"] .chip-sector-children span {
  color: rgba(8, 55, 58, .66);
}

[data-theme="soft-light"] .chip-sector-children a {
  background: rgba(255, 255, 255, .5);
}

html[data-reading="large"] .chip-head p:not(.eyebrow),
html[data-reading="large"] .chip-ranking small,
html[data-reading="large"] .chip-sector-flow small,
html[data-reading="large"] .chip-note {
  font-size: 1.06rem;
}

html[data-reading="large"] .chip-controls button,
html[data-reading="large"] .chip-sector-mode button,
html[data-reading="large"] .chip-stock-data small,
html[data-reading="large"] .chip-sector-card small {
  font-size: .98rem;
}

@media (max-width: 760px) {
  .chip-daily-bars {
    height: 104px;
    overflow-x: auto;
  }

  .chip-daily-bars i {
    flex: 0 0 44px;
  }

  .chip-sector-card > button {
    min-height: 118px;
  }

  .chip-sector-children a {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

/* Official institutional stock-flow preview */
.chip-head-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip-head-pills span,
.chip-official-note {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border: 1px solid rgba(255, 207, 117, .2);
  border-radius: 999px;
  background: rgba(255, 242, 213, .1);
  color: #ffe0a3;
  font-weight: 1000;
}

.chip-source-note {
  display: block;
  margin-top: 0.3rem;
  max-width: 62rem;
  color: var(--muted, #77939c);
  font-size: 0.78rem;
  line-height: 1.45;
}

/* TWSE publishes the full T86 buy/sell split after the earlier IIH net data.
   Use one explicit two-column status instead of two unexplained em dashes. */
.chip-table-row .chip-pending-split {
  grid-column: 4 / span 2;
  justify-self: stretch;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid rgba(255, 216, 109, .28);
  border-radius: 999px;
  background: rgba(255, 216, 109, .07);
  color: #ffe19a;
  text-align: center;
}
.chip-table-row .chip-pending-split small {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-table-row .chip-pending-split-spacer { display: none; }

@media (max-width: 760px) {
  .chip-table-row .chip-pending-split {
    grid-column: 3 / -1;
    margin-top: 4px;
  }
  .chip-table-row .chip-pending-split small {
    font-size: 11px;
    white-space: normal;
  }
}

.chip-head-pills span {
  padding: 7px 11px;
  font-size: .82rem;
}

.chip-official-note {
  margin-top: 8px;
  padding: 6px 10px;
  font-size: .78rem;
}

.chip-ranking-list {
  gap: 14px;
}

.chip-stock-card {
  position: relative;
  grid-template-columns: 58px minmax(210px, .95fr) minmax(260px, .8fr) minmax(460px, 1fr);
  overflow: hidden;
  isolation: isolate;
}

.chip-flow-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--chip-flow-width);
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 117, 91, .3), rgba(255, 207, 117, .08));
  z-index: -1;
}

.chip-stock-card.sell .chip-flow-bar {
  background: linear-gradient(90deg, rgba(130, 184, 247, .3), rgba(130, 184, 247, .05));
}

.chip-stock-rank {
  background: linear-gradient(135deg, rgba(255, 207, 117, .24), rgba(255, 255, 255, .08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

.chip-flow-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.chip-flow-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(3, 22, 32, .48);
  color: #eaf9f3;
  font-weight: 1000;
  white-space: nowrap;
}

.chip-flow-pill b {
  color: rgba(218, 240, 235, .62);
  font-size: .78rem;
}

.chip-flow-pill.buy {
  border: 1px solid rgba(255, 207, 117, .24);
}

.chip-flow-pill.sell {
  border: 1px solid rgba(130, 184, 247, .24);
}

.chip-metric.buy b,
.chip-flow-pill.buy {
  color: #ffcf75;
}

.chip-metric.sell b,
.chip-flow-pill.sell {
  color: #9fc8ff;
}

.chip-stock-data {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chip-stock-data span {
  border: 1px solid rgba(255, 255, 255, .04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}

.chip-stock-card .chip-signal {
  border: 1px solid rgba(255, 255, 255, .08);
}

[data-theme="soft-light"] .chip-head-pills span,
[data-theme="soft-light"] .chip-official-note {
  background: rgba(255, 239, 208, .78);
  border-color: rgba(202, 137, 94, .24);
  color: #8b3f2f;
}

[data-theme="soft-light"] .chip-stock-card {
  background: linear-gradient(90deg, rgba(255, 134, 102, .16), rgba(231, 241, 234, .76));
}

[data-theme="soft-light"] .chip-stock-card.sell {
  background: linear-gradient(90deg, rgba(103, 156, 213, .18), rgba(231, 241, 234, .76));
}

[data-theme="soft-light"] .chip-flow-bar {
  background: linear-gradient(90deg, rgba(208, 115, 88, .28), rgba(255, 239, 208, .2));
}

[data-theme="soft-light"] .chip-stock-card.sell .chip-flow-bar {
  background: linear-gradient(90deg, rgba(89, 135, 186, .28), rgba(232, 240, 247, .18));
}

[data-theme="soft-light"] .chip-flow-pill,
[data-theme="soft-light"] .chip-stock-data span {
  background: rgba(255, 255, 255, .58);
  border-color: rgba(63, 103, 94, .14);
  color: #082330;
}

[data-theme="soft-light"] .chip-flow-pill b,
[data-theme="soft-light"] .chip-stock-data small {
  color: rgba(8, 55, 58, .62);
}

[data-theme="soft-light"] .chip-metric.buy b,
[data-theme="soft-light"] .chip-flow-pill.buy {
  color: #a54832;
}

[data-theme="soft-light"] .chip-metric.sell b,
[data-theme="soft-light"] .chip-flow-pill.sell {
  color: #285f9d;
}

@media (max-width: 1180px) {
  .chip-stock-card {
    grid-template-columns: 52px minmax(220px, 1fr);
  }

  .chip-flow-breakdown,
  .chip-stock-data {
    grid-column: 2;
  }

  .chip-stock-data {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .chip-head {
    grid-template-columns: 1fr;
  }

  .chip-head-actions {
    justify-items: start;
    grid-template-columns: auto auto;
  }

  .chip-controls {
    gap: 9px;
  }

  .chip-stock-card {
    grid-template-columns: 42px minmax(0, 1fr);
    border-radius: 16px;
  }

  .chip-flow-breakdown,
  .chip-stock-data {
    grid-column: 1 / -1;
  }

  .chip-flow-breakdown {
    gap: 6px;
  }

  .chip-flow-pill {
    padding: 6px 8px;
    font-size: .82rem;
  }

  .chip-stock-data {
    grid-template-columns: 1fr;
  }

  .chip-stock-data span {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .chip-stock-data small {
    margin: 0;
  }
}

/* Mitake-inspired institutional stock table */
.chip-flow-stock-only .chip-head h2 {
  font-size: clamp(2.3rem, 5.4vw, 4.8rem);
}

.chip-flow-stock-only .chip-body {
  padding: 0 clamp(14px, 3vw, 44px) clamp(18px, 4vw, 44px);
}

.chip-flow-stock-only .chip-ranking {
  display: none;
  min-width: 0;
}

.chip-flow-stock-only.is-open .chip-ranking {
  display: block;
}

.chip-flow-stock-only .chip-controls {
  display: grid;
  grid-template-columns: repeat(5, max-content) minmax(240px, 1fr);
  gap: 12px;
  align-items: center;
  margin: 18px 0;
  min-width: 0;
  max-width: 100%;
}

.chip-flow-stock-only .chip-controls > * {
  min-width: 0;
}

.chip-flow-stock-only .chip-market-filter,
.chip-flow-stock-only .chip-tabs,
.chip-flow-stock-only .chip-view-tabs,
.chip-flow-stock-only .chip-side,
.chip-flow-stock-only .chip-periods {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid rgba(132, 198, 186, .18);
  border-radius: 14px;
  background: rgba(2, 19, 29, .46);
}

.chip-flow-stock-only .chip-periods[hidden] {
  display: none;
}

.chip-flow-stock-only .chip-controls button {
  min-width: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(223, 241, 237, .72);
  padding: 10px 15px;
  font-weight: 1000;
  cursor: pointer;
  white-space: nowrap;
}

.chip-flow-stock-only .chip-controls button.selected {
  background: rgba(67, 118, 112, .92);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}

.chip-flow-stock-only .chip-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  border: 1px solid rgba(132, 198, 186, .22);
  border-radius: 14px;
  background: rgba(2, 19, 29, .42);
  padding: 0 13px;
  color: rgba(194, 225, 220, .8);
}

.chip-flow-stock-only .chip-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #eefbf7;
  font: inherit;
  font-weight: 800;
  padding: 12px 0;
}

.chip-flow-stock-only .chip-search input::placeholder {
  color: rgba(203, 229, 224, .58);
}

.chip-ranking-list {
  display: grid;
  gap: 0;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  border: 1px solid rgba(132, 198, 186, .15);
  border-radius: 18px;
  background: rgba(1, 13, 20, .36);
}

.chip-table-head,
.chip-table-row {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1.4fr) minmax(100px, .85fr) minmax(100px, .85fr) minmax(110px, .95fr) minmax(92px, .8fr);
  min-width: 760px;
  align-items: center;
}

.chip-table-head.cumulative,
.chip-table-row.cumulative {
  grid-template-columns: 44px minmax(150px, 1.35fr) repeat(4, minmax(105px, .9fr));
}

.chip-table-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(3, 20, 29, .9);
  color: rgba(226, 242, 238, .62);
  font-size: .9rem;
  font-weight: 1000;
  border-bottom: 1px solid rgba(132, 198, 186, .14);
}

.chip-table-head span,
.chip-table-row > * {
  padding: 13px 14px;
}

.chip-table-row {
  position: relative;
  border-bottom: 1px solid rgba(132, 198, 186, .12);
  color: #eefbf7;
}

.chip-table-row:last-child {
  border-bottom: 0;
}

.chip-table-row::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .42;
}

.chip-table-row.buy::before {
  background: linear-gradient(90deg, rgba(255, 104, 82, .1), transparent 56%);
}

.chip-table-row.sell::before {
  background: linear-gradient(90deg, rgba(116, 174, 240, .12), transparent 56%);
}

.chip-table-row.open {
  background: rgba(8, 42, 48, .72);
}

.chip-plus {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  justify-self: center;
  border: 1px solid rgba(224, 245, 240, .62);
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  color: #effbf7;
  font-weight: 1000;
  cursor: pointer;
}

.chip-symbol {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 3px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.chip-symbol strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1.16rem;
}

.chip-symbol small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(206, 232, 226, .7);
  font-weight: 900;
}

.chip-number {
  position: relative;
  z-index: 1;
  justify-self: end;
  font-size: 1.12rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chip-number.net {
  font-size: 1.24rem;
}

.chip-number.pos,
.chip-dynamic.buy {
  color: #ff6f59;
}

.chip-number.neg,
.chip-dynamic.sell {
  color: #7fb6ff;
}

.chip-dynamic {
  position: relative;
  z-index: 1;
  justify-self: end;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  padding: 6px 10px;
  font-weight: 1000;
  white-space: nowrap;
}

.chip-table-detail {
  grid-column: 1 / -1;
  display: grid;
  gap: 13px;
  padding: 0 18px 18px 58px;
  position: relative;
  z-index: 1;
}

.chip-detail-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: baseline;
}

.chip-detail-title strong {
  font-size: 1.2rem;
}

.chip-detail-title span {
  color: rgba(207, 232, 226, .72);
  font-weight: 900;
}

.chip-detail-signals,
.chip-detail-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-signal,
.chip-detail-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  background: rgba(1, 17, 25, .36);
  padding: 8px 11px;
  color: #eefbf7;
  font-weight: 1000;
}

.chip-detail-metrics b {
  color: rgba(195, 225, 219, .68);
  font-size: .78rem;
}

.chip-signal.sun {
  color: #ffd5bd;
  border-color: rgba(255, 111, 89, .26);
}

.chip-signal.moon {
  color: #b8d6ff;
  border-color: rgba(127, 182, 255, .24);
}

.chip-signal.channel {
  color: #ffdc71;
  border-color: rgba(255, 220, 113, .26);
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-market-filter,
[data-theme="soft-light"] .chip-flow-stock-only .chip-tabs,
[data-theme="soft-light"] .chip-flow-stock-only .chip-view-tabs,
[data-theme="soft-light"] .chip-flow-stock-only .chip-side,
[data-theme="soft-light"] .chip-flow-stock-only .chip-periods,
[data-theme="soft-light"] .chip-ranking-list,
[data-theme="soft-light"] .chip-flow-stock-only .chip-search {
  background: rgba(225, 237, 231, .76);
  border-color: rgba(61, 104, 96, .18);
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-controls button {
  color: rgba(8, 55, 58, .78);
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-controls button.selected {
  color: #fff;
  background: rgba(67, 112, 106, .9);
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-search input,
[data-theme="soft-light"] .chip-symbol,
[data-theme="soft-light"] .chip-table-row,
[data-theme="soft-light"] .chip-detail-title strong {
  color: #082330;
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-search input::placeholder,
[data-theme="soft-light"] .chip-symbol small,
[data-theme="soft-light"] .chip-detail-title span,
[data-theme="soft-light"] .chip-detail-metrics b {
  color: rgba(8, 55, 58, .64);
}

[data-theme="soft-light"] .chip-table-head {
  background: rgba(213, 229, 222, .96);
  color: rgba(8, 55, 58, .68);
}

[data-theme="soft-light"] .chip-table-row.open {
  background: rgba(227, 238, 232, .92);
}

[data-theme="soft-light"] .chip-plus,
[data-theme="soft-light"] .chip-dynamic,
[data-theme="soft-light"] .chip-signal,
[data-theme="soft-light"] .chip-detail-metrics span {
  background: rgba(255, 255, 255, .55);
  border-color: rgba(61, 104, 96, .18);
  color: #082330;
}

[data-theme="soft-light"] .chip-number.pos,
[data-theme="soft-light"] .chip-dynamic.buy {
  color: #ad442f;
}

[data-theme="soft-light"] .chip-number.neg,
[data-theme="soft-light"] .chip-dynamic.sell {
  color: #27659f;
}

@media (max-width: 1180px) {
  .chip-flow-stock-only .chip-controls {
    grid-template-columns: repeat(2, minmax(0, max-content));
  }

  .chip-flow-stock-only .chip-search {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .chip-flow-stock-only .chip-head p:not(.eyebrow),
  .chip-flow-stock-only .chip-head-pills {
    display: none;
  }

  .chip-flow-stock-only .chip-controls {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .chip-flow-stock-only .chip-market-filter,
  .chip-flow-stock-only .chip-tabs,
  .chip-flow-stock-only .chip-view-tabs,
  .chip-flow-stock-only .chip-side,
  .chip-flow-stock-only .chip-periods {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  .chip-flow-stock-only .chip-controls button {
    padding: 10px 12px;
  }

  .chip-table-head,
  .chip-table-row {
    grid-template-columns: 34px minmax(112px, 1.35fr) minmax(78px, .85fr) minmax(78px, .85fr) minmax(92px, .95fr) minmax(70px, .8fr);
    min-width: 560px;
  }

  .chip-table-head.cumulative,
  .chip-table-row.cumulative {
    grid-template-columns: 34px minmax(112px, 1.25fr) repeat(4, minmax(82px, .85fr));
    min-width: 560px;
  }

  .chip-table-head span,
  .chip-table-row > * {
    padding: 11px 9px;
  }

  .chip-plus {
    width: 25px;
    height: 25px;
  }

  .chip-symbol strong {
    font-size: 1rem;
  }

  .chip-symbol small,
  .chip-table-head {
    font-size: .78rem;
  }

  .chip-number {
    font-size: .94rem;
  }

  .chip-number.net {
    font-size: 1rem;
  }

  .chip-dynamic {
    padding: 5px 8px;
    font-size: .82rem;
  }

  .chip-table-detail {
    padding: 0 12px 14px 44px;
  }
}

/* Chip-flow polish: stock-only institutional view */
.chip-flow-stock-only .chip-head {
  align-items: flex-start;
  gap: clamp(18px, 3vw, 34px);
}

.chip-flow-stock-only .chip-head p:not(.eyebrow),
.chip-flow-stock-only .chip-head-pills {
  display: none;
}

.chip-flow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 18px;
  max-width: 980px;
  min-width: 0;
}

.chip-summary-pill {
  appearance: none;
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(133, 202, 189, .18);
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 68px;
  text-align: left;
  color: #e9fffb;
  background: linear-gradient(135deg, rgba(16, 60, 62, .92), rgba(8, 34, 43, .9));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
  cursor: pointer;
}

.chip-summary-pill span {
  display: block;
  margin-bottom: 7px;
  color: rgba(200, 231, 225, .74);
  font-size: .78rem;
  font-weight: 800;
}

.chip-summary-pill strong {
  display: block;
  color: #fff;
  font-size: clamp(.92rem, 1.2vw, 1.08rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip-summary-pill.buy {
  border-color: rgba(255, 112, 89, .28);
}

.chip-summary-pill.sell {
  border-color: rgba(119, 177, 242, .28);
}

.chip-flow-stock-only .chip-ranking {
  position: relative;
}

.chip-ranking-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
}

.chip-range-pills {
  display: inline-flex;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(130, 197, 185, .17);
  border-radius: 999px;
  background: rgba(7, 34, 42, .58);
}

.chip-range-pills button,
.chip-return-top {
  appearance: none;
  border: 1px solid rgba(139, 205, 193, .18);
  border-radius: 999px;
  padding: 8px 12px;
  color: #dff9f6;
  background: rgba(65, 114, 108, .72);
  font-weight: 900;
  cursor: pointer;
}

.chip-flow-stock-only .chip-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.chip-flow-stock-only .chip-market-filter,
.chip-flow-stock-only .chip-tabs,
.chip-flow-stock-only .chip-view-tabs,
.chip-flow-stock-only .chip-side,
.chip-flow-stock-only .chip-periods {
  display: inline-flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: auto;
  max-width: 100%;
  border-radius: 16px;
}

.chip-flow-stock-only .chip-search {
  flex: 1 1 300px;
  max-width: 560px;
}

.chip-flow-stock-only .chip-search input {
  font-variant-numeric: tabular-nums;
}

.chip-table-head,
.chip-table-row,
.chip-table-head.cumulative,
.chip-table-row.cumulative {
  grid-template-columns: 42px minmax(170px, 1.05fr) minmax(260px, 1.25fr) repeat(4, minmax(96px, .55fr)) !important;
}

.chip-table-head {
  color: rgba(205, 234, 229, .62);
}

.chip-table-row > * {
  min-width: 0;
}

.chip-symbol strong {
  line-height: 1.15;
}

.chip-symbol small,
.chip-row-info small {
  display: block;
  margin-top: 6px;
  color: rgba(197, 226, 221, .72);
  line-height: 1.45;
}

.chip-row-info {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.chip-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip-signal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  color: #fff;
  background: rgba(86, 106, 111, .68);
  border: 1px solid rgba(255, 255, 255, .1);
  font-weight: 900;
  font-size: .78rem;
  line-height: 1;
}

.chip-signal.sun {
  color: #ffd3c8;
  background: rgba(130, 55, 48, .58);
  border-color: rgba(255, 116, 94, .34);
}

.chip-signal.moon {
  color: #cce3ff;
  background: rgba(48, 83, 123, .62);
  border-color: rgba(126, 184, 249, .36);
}

.chip-signal.channel.yellow {
  color: #ffe89a;
  background: rgba(132, 106, 33, .58);
  border-color: rgba(255, 215, 83, .44);
}

.chip-signal.channel.blue {
  color: #cfe8ff;
  background: rgba(39, 91, 135, .62);
  border-color: rgba(92, 172, 255, .4);
}

.chip-signal.channel.x {
  color: #ffc2bc;
  background: rgba(121, 61, 60, .58);
  border-color: rgba(255, 116, 105, .42);
}

.chip-table-detail {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, .8fr);
  gap: 12px;
  margin: 0 12px 14px 0;
  padding: 14px;
  border: 1px solid rgba(130, 197, 185, .16);
  border-radius: 16px;
  background: rgba(7, 34, 42, .44);
}

.chip-detail-story {
  color: rgba(231, 250, 247, .9);
  font-weight: 800;
  line-height: 1.6;
}

.chip-detail-peers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  justify-content: flex-end;
}

.chip-detail-peers small {
  flex: 1 0 100%;
  color: rgba(199, 230, 224, .62);
  font-weight: 900;
  text-align: right;
}

.chip-peer-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #e8fffb;
  text-decoration: none;
  background: rgba(62, 109, 104, .72);
  border: 1px solid rgba(136, 202, 190, .18);
  font-weight: 900;
}

.chip-peer-pill.muted {
  color: rgba(202, 229, 223, .66);
}

.chip-detail-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 8px;
}

.chip-metric {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(4, 29, 36, .62);
}

.chip-metric small {
  color: rgba(196, 225, 220, .62);
  font-weight: 900;
}

.chip-metric b {
  color: #fff;
  font-size: .98rem;
}

.chip-metric.pos b {
  color: #ffad99;
}

.chip-metric.neg b {
  color: #89bdff;
}

.chip-table-detail-v2 {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.chip-table-detail-v2 .chip-detail-story {
  display: grid;
  gap: 7px;
  padding: 12px 14px;
  border: 1px solid rgba(130, 197, 185, .16);
  border-radius: 16px;
  background: rgba(4, 29, 36, .46);
}

.chip-table-detail-v2 .chip-detail-story b {
  color: #ffd77d;
  font-size: .82rem;
  letter-spacing: .03em;
}

.chip-table-detail-v2 .chip-detail-story span {
  color: rgba(236, 251, 248, .94);
  font-size: .98rem;
}

.chip-table-detail-v2 .chip-detail-peers {
  justify-content: flex-start;
  align-content: flex-start;
  padding: 12px 14px;
  border: 1px solid rgba(130, 197, 185, .16);
  border-radius: 16px;
  background: rgba(4, 29, 36, .34);
}

.chip-table-detail-v2 .chip-detail-peers small {
  text-align: left;
}

.chip-detail-insights {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
}

.chip-insight-pill {
  display: grid;
  gap: 5px;
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid rgba(130, 197, 185, .14);
  border-radius: 16px;
  background: rgba(4, 29, 36, .56);
}

.chip-insight-pill small {
  color: rgba(196, 225, 220, .66);
  font-weight: 900;
}

.chip-insight-pill b {
  color: #f3fffc;
  font-size: 1rem;
}

.chip-insight-pill.buy b {
  color: #ffad99;
}

.chip-insight-pill.sell b {
  color: #72df8b;
}

.chip-return-top {
  position: sticky;
  left: auto;
  bottom: 14px;
  float: right;
  margin: 12px;
  z-index: 3;
  box-shadow: 0 14px 30px rgba(0, 0, 0, .22);
}

[data-theme="soft-light"] .chip-summary-pill,
[data-theme="soft-light"] .chip-range-pills,
[data-theme="soft-light"] .chip-table-detail,
[data-theme="soft-light"] .chip-detail-story,
[data-theme="soft-light"] .chip-detail-peers,
[data-theme="soft-light"] .chip-insight-pill,
[data-theme="soft-light"] .chip-metric {
  background: rgba(226, 238, 232, .9);
  border-color: rgba(52, 94, 87, .18);
  color: #092b31;
}

[data-theme="soft-light"] .chip-summary-pill span,
[data-theme="soft-light"] .chip-symbol small,
[data-theme="soft-light"] .chip-row-info small,
[data-theme="soft-light"] .chip-detail-peers small,
[data-theme="soft-light"] .chip-insight-pill small,
[data-theme="soft-light"] .chip-metric small {
  color: rgba(42, 85, 78, .82);
}

[data-theme="soft-light"] .chip-summary-pill strong,
[data-theme="soft-light"] .chip-detail-story,
[data-theme="soft-light"] .chip-detail-story span,
[data-theme="soft-light"] .chip-metric b,
[data-theme="soft-light"] .chip-insight-pill b,
[data-theme="soft-light"] .chip-peer-pill {
  color: #082330;
}

[data-theme="soft-light"] .chip-table-detail-v2 .chip-detail-story b {
  color: #8c5b10;
}

[data-theme="soft-light"] .chip-insight-pill.buy b {
  color: #a54837;
}

[data-theme="soft-light"] .chip-insight-pill.sell b {
  color: #247044;
}

[data-theme="soft-light"] .chip-range-pills button,
[data-theme="soft-light"] .chip-return-top {
  color: #0a3134;
  background: rgba(231, 239, 233, .94);
  border-color: rgba(57, 96, 90, .22);
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-controls button {
  color: rgba(8, 49, 53, .78);
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-controls button.selected {
  color: #fff;
}

[data-theme="soft-light"] .chip-signal.sun {
  color: #8d382c;
  background: rgba(255, 235, 226, .92);
}

[data-theme="soft-light"] .chip-signal.moon {
  color: #164a7b;
  background: rgba(225, 238, 251, .94);
}

[data-theme="soft-light"] .chip-signal.channel.yellow {
  color: #8a6810;
  background: rgba(255, 244, 198, .94);
}

[data-theme="soft-light"] .chip-signal.channel.blue {
  color: #1e5b8b;
  background: rgba(223, 240, 255, .94);
}

[data-theme="soft-light"] .chip-signal.channel.x {
  color: #914037;
  background: rgba(255, 231, 228, .94);
}

@media (max-width: 1180px) {
  .chip-flow-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 100%;
  }

  .chip-ranking-head {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .chip-flow-stock-only .chip-search {
    flex-basis: 100%;
    max-width: none;
  }

  .chip-detail-metrics {
    grid-template-columns: repeat(3, minmax(110px, 1fr));
  }
}

@media (max-width: 760px) {
  .chip-flow-summary {
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .chip-flow-stock-only .chip-market-filter,
  .chip-flow-stock-only .chip-tabs,
  .chip-flow-stock-only .chip-view-tabs,
  .chip-flow-stock-only .chip-side,
  .chip-flow-stock-only .chip-periods {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    width: 100%;
  }

  .chip-ranking-list {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .chip-table-head,
  .chip-table-row,
  .chip-table-head.cumulative,
  .chip-table-row.cumulative {
    grid-template-columns: 34px minmax(140px, 1.1fr) minmax(190px, 1.1fr) repeat(4, minmax(86px, .7fr)) !important;
    min-width: 760px;
  }

  .chip-table-detail {
    grid-template-columns: 1fr;
  }

  .chip-detail-peers,
  .chip-detail-peers small {
    justify-content: flex-start;
    text-align: left;
  }

  .chip-detail-metrics {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}

/* 2026-09-11 institutional-flow visual refinement */
.chip-flow-stock-only .chip-shell {
  border-color: rgba(122, 203, 188, .2);
  background:
    radial-gradient(circle at 88% 2%, rgba(76, 150, 137, .14), transparent 34%),
    linear-gradient(145deg, rgba(14, 54, 55, .98), rgba(5, 29, 37, .98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .055), 0 24px 54px rgba(0, 0, 0, .2);
}

.chip-flow-stock-only .chip-ranking {
  border-color: rgba(125, 201, 188, .18);
  background: linear-gradient(155deg, rgba(12, 47, 48, .8), rgba(6, 30, 38, .86));
}

.chip-ranking-head {
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(128, 200, 188, .13);
}

.chip-ranking-head h3 {
  margin-bottom: 7px;
  letter-spacing: -.02em;
}

.chip-official-note {
  display: block;
  width: auto;
  max-width: 58rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(195, 226, 220, .72);
  font-size: .82rem;
  font-weight: 760;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.chip-ranking-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.chip-range-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  width: 176px;
  gap: 5px;
  padding: 4px;
  border-radius: 14px;
  background: rgba(3, 25, 32, .62);
}

.chip-range-pills button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(48, 103, 98, .5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07);
  line-height: 1;
}

.chip-range-pills button span {
  color: rgba(201, 231, 225, .68);
  font-size: .67rem;
  font-weight: 760;
}

.chip-range-pills button b {
  color: #f1fffb;
  font-size: .88rem;
  letter-spacing: .02em;
}

.chip-match-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 207, 117, .2);
  border-radius: 999px;
  color: #f3d897;
  background: rgba(255, 207, 117, .07);
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.chip-table-row {
  border-color: rgba(126, 197, 185, .11);
  background: linear-gradient(105deg, rgba(9, 39, 43, .88), rgba(5, 29, 37, .72));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .025);
}

.chip-table-row.open {
  border-color: rgba(123, 213, 196, .3);
  background: linear-gradient(105deg, rgba(20, 67, 64, .84), rgba(5, 30, 38, .92));
  box-shadow: inset 3px 0 0 rgba(111, 218, 197, .58), 0 15px 32px rgba(0, 0, 0, .16);
}

.chip-table-detail-v2 {
  gap: 10px;
  padding: 12px;
  border-color: rgba(127, 208, 193, .2);
  background: linear-gradient(145deg, rgba(5, 34, 41, .82), rgba(3, 25, 32, .7));
}

.chip-table-detail-v2 .chip-detail-story {
  position: relative;
  padding: 14px 16px 14px 18px;
  border-radius: 14px;
  background: rgba(4, 28, 35, .7);
}

.chip-table-detail-v2 .chip-detail-story::before {
  content: '';
  position: absolute;
  inset: 12px auto 12px 0;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(#f4c968, #70d6c2);
}

.chip-table-detail-v2 .chip-detail-story b {
  font-size: .78rem;
  letter-spacing: .09em;
}

.chip-table-detail-v2 .chip-detail-story span {
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.68;
}

.chip-detail-insights {
  gap: 7px;
}

.chip-insight-pill {
  min-height: 68px;
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(11, 45, 49, .8), rgba(4, 29, 36, .7));
}

[data-theme="soft-light"] .chip-flow-stock-only .chip-shell,
[data-theme="soft-light"] .chip-flow-stock-only .chip-ranking {
  background: linear-gradient(145deg, rgba(222, 237, 230, .98), rgba(207, 224, 217, .95));
  border-color: rgba(53, 99, 91, .17);
}

[data-theme="soft-light"] .chip-official-note {
  color: rgba(39, 79, 73, .76);
  background: transparent;
}

[data-theme="soft-light"] .chip-range-pills {
  background: rgba(54, 92, 85, .08);
  border-color: rgba(52, 94, 87, .16);
}

[data-theme="soft-light"] .chip-range-pills button {
  background: rgba(221, 236, 230, .96);
  border-color: rgba(52, 94, 87, .18);
}

[data-theme="soft-light"] .chip-range-pills button span {
  color: rgba(36, 77, 70, .7);
}

[data-theme="soft-light"] .chip-range-pills button b {
  color: #123c3c;
}

[data-theme="soft-light"] .chip-match-count {
  color: #75530e;
  background: rgba(255, 246, 212, .72);
  border-color: rgba(164, 127, 38, .2);
}

[data-theme="soft-light"] .chip-table-row {
  background: linear-gradient(105deg, rgba(235, 244, 239, .95), rgba(220, 234, 227, .86));
  border-color: rgba(50, 94, 87, .13);
}

[data-theme="soft-light"] .chip-table-row.open {
  background: linear-gradient(105deg, rgba(224, 239, 232, .98), rgba(207, 226, 218, .94));
  border-color: rgba(47, 117, 105, .3);
}

@media (max-width: 1180px) {
  .chip-ranking-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    justify-items: stretch;
  }

  .chip-ranking-actions {
    align-self: end;
  }
}

@media (max-width: 760px) {
  .chip-ranking-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .chip-ranking-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    justify-content: stretch;
  }

  .chip-range-pills {
    width: min(210px, 100%);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chip-range-pills button {
    min-height: 42px;
  }

  .chip-match-count {
    align-self: center;
    min-height: 32px;
    font-size: .76rem;
  }

  .chip-table-detail-v2 .chip-detail-story {
    padding: 11px 12px 11px 15px;
  }

  .chip-table-detail-v2 .chip-detail-story span {
    display: block;
    overflow: visible;
    font-size: .9rem;
    line-height: 1.58;
    -webkit-line-clamp: initial;
  }
}

@media (max-width: 430px) {
  .chip-ranking-actions {
    grid-template-columns: 1fr;
  }

  .chip-range-pills {
    width: 100%;
  }

  .chip-match-count {
    justify-self: start;
  }
}

@media (max-width: 1180px) {
  html[data-reading="large"] .chip-ranking-head {
    grid-template-columns: 1fr;
  }

  html[data-reading="large"] .chip-ranking-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
  }

  html[data-reading="large"] .chip-range-pills {
    width: min(236px, 100%);
  }

  html[data-reading="large"] .chip-range-pills button {
    min-height: 48px;
  }

  html[data-reading="large"] .chip-official-note {
    font-size: .92rem;
    line-height: 1.55;
  }
}

@media (max-width: 520px) {
  html[data-reading="large"] .chip-ranking-actions {
    grid-template-columns: 1fr;
  }

  html[data-reading="large"] .chip-match-count {
    justify-self: start;
  }
}

/* Institutional flow refinement: clearer semantics, colors, and long-list ergonomics. */
.chip-flow-summary {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
}

.chip-summary-pill.buy {
  border-color: rgba(255, 112, 89, .34);
  background:
    linear-gradient(135deg, rgba(103, 35, 30, .42), rgba(8, 34, 43, .88));
}

.chip-summary-pill.sell {
  border-color: rgba(86, 206, 112, .3);
  background:
    linear-gradient(135deg, rgba(29, 91, 55, .36), rgba(8, 34, 43, .88));
}

.chip-summary-pill strong {
  color: #f6fffb;
}

.chip-summary-pill.buy em,
.chip-number.buy-flow,
.chip-number.pos {
  color: #ff735d;
}

.chip-summary-pill.sell em,
.chip-number.sell-flow,
.chip-number.neg {
  color: #5fdb78;
}

.chip-summary-pill em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.chip-plus {
  line-height: 1;
}

.chip-plus span {
  display: block;
  transform: translateY(-1px);
}

.chip-symbol small {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.chip-table-head,
.chip-table-row,
.chip-table-head.cumulative,
.chip-table-row.cumulative {
  grid-template-columns: 42px minmax(180px, 1.08fr) minmax(270px, 1.24fr) repeat(3, minmax(102px, .56fr)) minmax(150px, .74fr) !important;
}

.chip-table-row.sell::before {
  background: linear-gradient(90deg, rgba(66, 179, 94, .11), transparent 56%);
}

.chip-dynamic {
  justify-self: end;
  min-width: max-content;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, .08);
}

.chip-dynamic.buy {
  color: #ff735d;
  background: rgba(114, 45, 39, .54);
  border-color: rgba(255, 112, 89, .26);
}

.chip-dynamic.sell {
  color: #67df7e;
  background: rgba(31, 86, 50, .56);
  border-color: rgba(88, 210, 112, .26);
}

.chip-dynamic.mixed {
  color: #ffe0a3;
  background: rgba(106, 91, 48, .5);
  border-color: rgba(255, 207, 117, .26);
}

.chip-theme-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
}

.chip-theme-pills span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(136, 202, 190, .18);
  border-radius: 999px;
  color: #eafffb;
  background: rgba(5, 30, 38, .58);
  font-weight: 900;
  line-height: 1.35;
}

.chip-theme-pills b {
  color: rgba(255, 207, 117, .92);
  font-size: .78rem;
}

.chip-row-theme-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-row-theme-pills span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 4px 9px;
  border: 1px solid rgba(136, 202, 190, .14);
  border-radius: 999px;
  color: rgba(218, 240, 235, .78);
  background: rgba(255, 255, 255, .06);
  font-size: .78rem;
  font-weight: 900;
  line-height: 1.2;
}

.chip-return-top {
  position: fixed;
  right: clamp(18px, 4vw, 72px);
  bottom: 108px;
  left: auto;
  float: none;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: fit-content;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 207, 117, .28);
  border-radius: 999px;
  background: rgba(10, 33, 41, .9);
  color: #ffe1a3;
  box-shadow: 0 16px 34px rgba(0, 0, 0, .28);
  backdrop-filter: blur(12px);
  z-index: 40;
}

.chip-return-top::before {
  content: '↑';
}

[data-theme="soft-light"] .chip-return-top {
  border-color: rgba(112, 91, 37, .22);
  background: rgba(237, 241, 231, .92);
  color: #234b45;
  box-shadow: 0 14px 30px rgba(47, 68, 61, .18);
}

@media (max-width: 760px) {
  .chip-table-detail-v2 {
    grid-template-columns: 1fr;
    margin-right: 0;
  }

  .chip-detail-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chip-insight-pill {
    min-height: 58px;
    padding: 10px;
  }

  .chip-return-top {
    right: 16px;
    bottom: 88px;
    min-height: 38px;
    padding: 8px 11px;
    font-size: .82rem;
  }
}

@media (max-width: 430px) {
  .chip-detail-insights {
    grid-template-columns: 1fr;
  }
}

[data-theme="soft-light"] .chip-summary-pill.buy {
  background: linear-gradient(135deg, rgba(255, 226, 214, .92), rgba(231, 241, 234, .9));
  border-color: rgba(181, 88, 66, .24);
}

[data-theme="soft-light"] .chip-summary-pill.sell {
  background: linear-gradient(135deg, rgba(218, 243, 222, .92), rgba(231, 241, 234, .9));
  border-color: rgba(62, 145, 78, .22);
}

[data-theme="soft-light"] .chip-summary-pill strong,
[data-theme="soft-light"] .chip-theme-pills span {
  color: #082330;
}

[data-theme="soft-light"] .chip-summary-pill.buy em,
[data-theme="soft-light"] .chip-number.buy-flow,
[data-theme="soft-light"] .chip-number.pos,
[data-theme="soft-light"] .chip-dynamic.buy {
  color: #a94331;
}

[data-theme="soft-light"] .chip-summary-pill.sell em,
[data-theme="soft-light"] .chip-number.sell-flow,
[data-theme="soft-light"] .chip-number.neg,
[data-theme="soft-light"] .chip-dynamic.sell {
  color: #18713a;
}

[data-theme="soft-light"] .chip-dynamic.buy {
  background: rgba(255, 230, 221, .86);
  border-color: rgba(181, 88, 66, .25);
}

[data-theme="soft-light"] .chip-dynamic.sell {
  background: rgba(220, 244, 225, .88);
  border-color: rgba(62, 145, 78, .24);
}

[data-theme="soft-light"] .chip-dynamic.mixed {
  color: #71530d;
  background: rgba(255, 246, 210, .9);
  border-color: rgba(184, 145, 46, .22);
}

[data-theme="soft-light"] .chip-theme-pills span {
  background: rgba(255, 255, 255, .58);
  border-color: rgba(61, 104, 96, .18);
}

[data-theme="soft-light"] .chip-theme-pills b {
  color: #8a5520;
}

[data-theme="soft-light"] .chip-row-theme-pills span {
  color: rgba(8, 55, 58, .78);
  background: rgba(255, 255, 255, .58);
  border-color: rgba(61, 104, 96, .16);
}

@media (max-width: 760px) {
  .chip-table-head,
  .chip-table-row,
  .chip-table-head.cumulative,
  .chip-table-row.cumulative {
    grid-template-columns: 34px minmax(150px, 1.1fr) minmax(210px, 1.12fr) repeat(3, minmax(92px, .72fr)) minmax(130px, .78fr) !important;
    min-width: 830px;
  }

  .chip-dynamic {
    padding: 5px 9px;
    font-size: .78rem;
  }

  .chip-theme-pills span {
    min-height: 30px;
    padding: 6px 10px;
  }
}

/* Mobile polish for the institutional flow list.  Keep the dense desktop
   table on larger screens, but turn phones into compact readable cards. */
@media (max-width: 760px) {
  .chip-flow-stock-only .chip-head {
    padding: 20px 16px 16px;
    gap: 12px;
  }

  .chip-flow-stock-only .chip-head h2 {
    font-size: clamp(1.75rem, 7.2vw, 2.35rem);
    line-height: 1.08;
  }

  .chip-flow-stock-only .chip-body {
    padding-inline: 10px;
  }

  .chip-flow-stock-only .chip-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .chip-flow-stock-only .chip-market-filter,
  .chip-flow-stock-only .chip-tabs,
  .chip-flow-stock-only .chip-view-tabs,
  .chip-flow-stock-only .chip-side,
  .chip-flow-stock-only .chip-periods {
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
    padding: 4px;
    border-radius: 15px;
  }

  .chip-flow-stock-only .chip-controls button {
    min-width: 0;
    min-height: 42px;
    padding: 8px 6px;
    border-radius: 12px;
    font-size: .9rem;
    line-height: 1.12;
    white-space: nowrap;
  }

  .chip-flow-stock-only .chip-search {
    min-height: 46px;
    padding: 0 12px;
    border-radius: 14px;
  }

  .chip-range-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    padding: 5px;
    border-radius: 999px;
  }

  .chip-range-pills button {
    min-height: 44px;
    padding: 7px 4px;
    border-radius: 999px;
    font-size: .84rem;
    line-height: 1.15;
  }

  .chip-summary-row {
    align-items: stretch;
    gap: 8px;
  }

  .chip-summary-pill {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 16px;
  }

  .chip-summary-pill span {
    font-size: .76rem;
  }

  .chip-summary-pill strong {
    font-size: .94rem;
  }

  .chip-ranking-list {
    overflow-x: hidden;
  }

  .chip-table-head,
  .chip-table-head.cumulative {
    display: none;
  }

  .chip-table-row,
  .chip-table-row.cumulative {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    min-width: 0 !important;
    width: 100%;
    gap: 7px 9px;
    padding: 11px 9px;
    overflow: hidden;
  }

  .chip-table-row > * {
    min-width: 0;
    padding: 0;
  }

  .chip-plus {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 31px;
    height: 31px;
    align-self: start;
  }

  .chip-symbol {
    grid-column: 2;
    grid-row: 1;
  }

  .chip-symbol strong {
    font-size: 1.02rem;
    line-height: 1.16;
  }

  .chip-symbol small {
    margin-top: 5px;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: .78rem;
    line-height: 1.34;
  }

  .chip-row-info {
    grid-column: 2;
    grid-row: 2;
    display: grid;
    gap: 6px;
  }

  .chip-signals,
  .chip-row-theme-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
  }

  .chip-signal,
  .chip-row-theme-pills span,
  .chip-theme-pills span {
    max-width: 100%;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: .76rem;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chip-number.buy-flow,
  .chip-number.sell-flow {
    display: none;
  }

  .chip-number.net {
    grid-column: 2;
    grid-row: 3;
    justify-self: start;
    width: fit-content;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(8, 30, 38, .54);
    font-size: .98rem;
    line-height: 1.1;
  }

  .chip-number.net::before {
    content: '買賣超 ';
    color: rgba(207, 231, 226, .72);
    font-size: .72rem;
    font-weight: 800;
  }

  .chip-table-row.cumulative > span.chip-number.net {
    grid-column: 2;
    grid-row: auto;
    justify-self: stretch;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }

  .chip-table-row.cumulative > span.chip-number.net::before {
    content: '累計 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(1)::before {
    content: '當日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(2)::before {
    content: '近5日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(3)::before {
    content: '近20日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(4)::before {
    content: '近60日 ';
  }

  .chip-dynamic {
    grid-column: 2;
    grid-row: 4;
    justify-self: start;
    max-width: 100%;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: .8rem;
    line-height: 1.16;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .chip-table-detail,
  .chip-table-detail-v2 {
    grid-column: 1 / -1;
    width: 100%;
    margin: 8px 0 0;
    padding: 10px;
    overflow: hidden;
  }

  .chip-table-detail-v2 {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .chip-table-detail-v2 .chip-detail-story,
  .chip-table-detail-v2 .chip-detail-peers,
  .chip-detail-insights,
  .chip-insight-pill {
    min-width: 0;
    max-width: 100%;
  }

  .chip-table-detail-v2 .chip-detail-story span,
  .chip-insight-pill b,
  .chip-insight-pill span {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .chip-peer-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chip-return-top {
    right: 12px;
    bottom: 74px;
    min-height: 34px;
    padding: 7px 10px;
    font-size: .76rem;
    opacity: .92;
  }
}

@media (max-width: 430px) {
  .chip-flow-stock-only .chip-body {
    padding-inline: 8px;
  }

  .chip-flow-stock-only .chip-controls button {
    min-height: 39px;
    font-size: .84rem;
  }

  .chip-range-pills button {
    font-size: .8rem;
  }

  .chip-summary-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  html[data-reading="large"] .chip-flow-stock-only .chip-controls button {
    min-height: 44px;
    font-size: .9rem;
  }

  html[data-reading="large"] .chip-symbol small {
    -webkit-line-clamp: 2;
    font-size: .82rem;
  }

  html[data-reading="large"] .chip-signal,
  html[data-reading="large"] .chip-row-theme-pills span,
  html[data-reading="large"] .chip-theme-pills span {
    font-size: .78rem;
  }

  html[data-reading="large"] .chip-number.net,
  html[data-reading="large"] .chip-dynamic {
    font-size: .9rem;
  }
}

@media (max-width: 760px) {
  [data-theme="soft-light"] .chip-number.net {
    background: rgba(255, 255, 255, .62);
  }

  [data-theme="soft-light"] .chip-number.net::before {
    color: rgba(43, 82, 76, .74);
  }

  [data-theme="soft-light"] .chip-dynamic {
    color: #123a3c;
  }
}

/* Tablet polish: avoid the desktop table being clipped in medium viewports. */
@media (min-width: 761px) and (max-width: 1180px) {
  .chip-flow-stock-only .chip-body {
    padding-inline: 14px;
  }

  .chip-flow-stock-only .chip-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .chip-flow-stock-only .chip-search {
    grid-column: 1 / -1;
  }

  .chip-flow-stock-only .chip-market-filter,
  .chip-flow-stock-only .chip-tabs,
  .chip-flow-stock-only .chip-view-tabs,
  .chip-flow-stock-only .chip-side,
  .chip-flow-stock-only .chip-periods {
    width: 100%;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .chip-flow-stock-only .chip-controls button {
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .chip-ranking-list {
    overflow-x: hidden;
  }

  .chip-table-head,
  .chip-table-head.cumulative {
    display: none;
  }

  .chip-table-row,
  .chip-table-row.cumulative {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1.1fr);
    min-width: 0 !important;
    width: 100%;
    gap: 9px 12px;
    padding: 14px 12px;
    overflow: hidden;
  }

  .chip-table-row > * {
    min-width: 0;
    padding: 0;
  }

  .chip-plus {
    grid-column: 1;
    grid-row: 1 / span 3;
    width: 34px;
    height: 34px;
    align-self: start;
  }

  .chip-symbol {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .chip-symbol small {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .chip-row-info {
    grid-column: 3;
    grid-row: 1 / span 2;
    display: grid;
    gap: 6px;
  }

  .chip-row-theme-pills,
  .chip-signals {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    overflow: hidden;
  }

  .chip-row-theme-pills span,
  .chip-signal {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chip-number.buy-flow,
  .chip-number.sell-flow {
    display: none;
  }

  .chip-number.net,
  .chip-dynamic {
    grid-column: 2 / -1;
    justify-self: start;
    width: fit-content;
    max-width: 100%;
    border-radius: 999px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .chip-number.net {
    grid-row: 3;
    padding: 6px 11px;
    background: rgba(8, 30, 38, .5);
    font-size: 1rem;
  }

  .chip-number.net::before {
    content: '買賣超 ';
    color: rgba(207, 231, 226, .72);
    font-size: .76rem;
    font-weight: 800;
  }

  .chip-dynamic {
    grid-row: 4;
    padding: 6px 11px;
    font-size: .86rem;
  }

  .chip-table-row.cumulative > span.chip-number.net {
    grid-column: 2 / -1;
    justify-self: stretch;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }

  .chip-table-row.cumulative > span.chip-number.net::before {
    content: '累計 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(1)::before {
    content: '當日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(2)::before {
    content: '近5日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(3)::before {
    content: '近20日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net:nth-of-type(4)::before {
    content: '近60日 ';
  }

  .chip-table-detail,
  .chip-table-detail-v2 {
    grid-column: 1 / -1;
    width: 100%;
    margin: 8px 0 0;
    overflow: hidden;
  }

  .chip-table-detail-v2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .chip-table-detail-v2 .chip-detail-story,
  .chip-table-detail-v2 .chip-detail-peers,
  .chip-detail-insights,
  .chip-insight-pill {
    min-width: 0;
    max-width: 100%;
  }

  .chip-table-detail-v2 .chip-detail-story span,
  .chip-insight-pill b,
  .chip-insight-pill span {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .chip-peer-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chip-return-top {
    right: 16px;
    bottom: 82px;
    padding: 8px 12px;
    font-size: .82rem;
  }

  [data-theme="soft-light"] .chip-number.net {
    background: rgba(255, 255, 255, .62);
  }

  [data-theme="soft-light"] .chip-number.net::before {
    color: rgba(43, 82, 76, .74);
  }
}

/* Final small-screen density pass for chip-flow. */
@media (max-width: 1180px) {
  .chip-flow-stock-only[data-view="cumulative"] .chip-period-value {
    display: none !important;
  }

  .chip-flow-stock-only[data-period="d1"] .chip-period-d1,
  .chip-flow-stock-only[data-period="d5"] .chip-period-d5,
  .chip-flow-stock-only[data-period="d20"] .chip-period-d20,
  .chip-flow-stock-only[data-period="d60"] .chip-period-d60 {
    display: inline-flex !important;
  }

  .chip-table-row.cumulative > span.chip-number.net {
    justify-self: start !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .chip-table-row.cumulative > span.chip-number.net::before {
    content: '累計 ';
  }

  .chip-table-row.cumulative > span.chip-number.net.chip-period-d1::before {
    content: '當日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net.chip-period-d5::before {
    content: '近5日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net.chip-period-d20::before {
    content: '近20日 ';
  }

  .chip-table-row.cumulative > span.chip-number.net.chip-period-d60::before {
    content: '近60日 ';
  }

  .chip-table-detail,
  .chip-table-detail-v2,
  .chip-detail-insights,
  .chip-insight-pill,
  .chip-detail-story {
    box-sizing: border-box;
    max-width: 100%;
  }

  .chip-table-detail-v2 .chip-detail-story span {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

@media (min-width: 761px) and (max-width: 1180px) {
  .chip-table-row,
  .chip-table-row.cumulative {
    grid-template-columns: 36px minmax(150px, .9fr) minmax(210px, 1fr) minmax(120px, .55fr) !important;
    padding: 12px 10px;
  }

  .chip-symbol small {
    -webkit-line-clamp: 2;
  }

  .chip-row-theme-pills span {
    max-width: 100%;
  }

  .chip-number.net {
    grid-column: 2 / 3 !important;
    grid-row: 3 !important;
    padding: 5px 10px;
    font-size: .96rem;
  }

  .chip-dynamic {
    grid-column: 3 / -1 !important;
    grid-row: 3 !important;
    padding: 5px 10px;
    font-size: .82rem;
  }

  .chip-table-row.cumulative > span.chip-number.net {
    grid-column: 2 / -1 !important;
    grid-row: 3 !important;
    justify-self: start !important;
  }

  .chip-table-detail,
  .chip-table-detail-v2 {
    grid-column: 1 / -1 !important;
    padding: 10px;
  }

  .chip-table-detail-v2 {
    grid-template-columns: 1fr !important;
  }

  .chip-detail-insights {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .chip-insight-pill {
    min-height: 62px;
    padding: 10px;
  }
}

@media (max-width: 760px) {
  .chip-flow-stock-only .chip-head {
    padding: 14px 12px 12px;
  }

  .chip-flow-stock-only .chip-head h2 {
    font-size: clamp(1.35rem, 6.4vw, 1.9rem);
  }

  .chip-range-pills {
    width: min(190px, 100%);
    gap: 4px;
    padding: 4px;
  }

  .chip-range-pills button {
    min-height: 36px;
    padding: 5px 4px;
    font-size: .74rem;
    line-height: 1.08;
  }

  .chip-match-count {
    writing-mode: horizontal-tb !important;
    align-self: center;
    white-space: nowrap;
    font-size: .82rem;
    line-height: 1.2;
  }

  .chip-flow-stock-only .chip-controls {
    gap: 6px;
  }

  .chip-flow-stock-only .chip-controls button {
    min-height: 36px;
    padding: 6px 4px;
    border-radius: 11px;
    font-size: .78rem;
  }

  .chip-flow-stock-only .chip-market-filter,
  .chip-flow-stock-only .chip-tabs,
  .chip-flow-stock-only .chip-view-tabs,
  .chip-flow-stock-only .chip-side,
  .chip-flow-stock-only .chip-periods {
    padding: 4px;
    border-radius: 13px;
  }

  .chip-flow-stock-only .chip-search {
    min-height: 38px;
    padding: 0 10px;
    border-radius: 12px;
  }

  .chip-flow-stock-only .chip-search input {
    font-size: .86rem;
  }

  .chip-table-row,
  .chip-table-row.cumulative {
    grid-template-columns: 30px minmax(0, 1fr) !important;
    gap: 5px 8px;
    padding: 8px;
    border-radius: 14px;
  }

  .chip-plus {
    width: 28px;
    height: 28px;
  }

  .chip-symbol strong {
    font-size: .94rem;
  }

  .chip-symbol small {
    margin-top: 3px;
    font-size: .72rem;
    line-height: 1.25;
    -webkit-line-clamp: 1;
  }

  .chip-row-info {
    gap: 4px;
  }

  .chip-row-theme-pills span:nth-child(2) {
    display: none;
  }

  .chip-signal,
  .chip-row-theme-pills span,
  .chip-theme-pills span {
    min-height: 21px;
    padding: 2px 7px;
    font-size: .7rem;
  }

  .chip-number.net {
    padding: 4px 8px;
    font-size: .86rem;
  }

  .chip-number.net::before {
    font-size: .68rem;
  }

  .chip-dynamic {
    padding: 4px 8px;
    font-size: .72rem;
  }

  .chip-table-row.cumulative > span.chip-number.net {
    grid-column: 2 !important;
    justify-self: start !important;
    width: auto !important;
  }

  .chip-table-detail,
  .chip-table-detail-v2 {
    margin-top: 6px;
    padding: 8px;
    border-radius: 14px;
  }

  .chip-table-detail-v2 .chip-detail-story {
    padding: 9px 10px;
    gap: 4px;
    border-radius: 13px;
  }

  .chip-table-detail-v2 .chip-detail-story b {
    font-size: .72rem;
  }

  .chip-table-detail-v2 .chip-detail-story span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: .86rem;
    line-height: 1.42;
  }

  .chip-detail-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px;
  }

  .chip-insight-pill {
    min-height: 45px;
    padding: 8px;
    border-radius: 13px;
  }

  .chip-insight-pill small {
    font-size: .7rem;
  }

  .chip-insight-pill b {
    font-size: .84rem;
    line-height: 1.18;
  }
}

@media (max-width: 430px) {
  .chip-detail-insights {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html[data-reading="large"] .chip-flow-stock-only .chip-controls button {
    font-size: .8rem;
    min-height: 38px;
  }

  html[data-reading="large"] .chip-symbol small {
    -webkit-line-clamp: 1;
  }
}

/* Entry-summary safety pass: the feature tile should land on a compact
   overview first, with no right-edge clipping on tablet or phone. */
@media (max-width: 1180px) {
  .chip-flow-stock-only {
    max-width: 100%;
    overflow: hidden;
  }

  .chip-flow-stock-only .chip-head {
    grid-template-columns: 1fr;
  }

  .chip-flow-stock-only .chip-head-actions {
    justify-items: start;
    width: 100%;
  }

  .chip-flow-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 760px) {
  .chip-flow-summary {
    grid-template-columns: 1fr !important;
  }

  .chip-flow-stock-only .chip-head-actions {
    grid-template-columns: auto auto;
    justify-content: start;
    align-items: center;
  }

  .chip-flow-stock-only .chip-time,
  .chip-flow-stock-only .chip-expand {
    max-width: 100%;
    padding: 8px 12px;
    font-size: .82rem;
  }
}

/* Final override: keep the refined ranking header stable after legacy media rules. */
.chip-ranking-head {
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 18px;
}

.chip-official-note {
  display: block;
  width: auto;
  max-width: 58rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.chip-ranking-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.chip-range-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  width: 176px;
  gap: 5px;
  padding: 4px;
  border-radius: 14px;
}

.chip-range-pills button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-width: 0;
  min-height: 48px;
  padding: 6px 8px;
  border-radius: 10px;
  line-height: 1;
}

.chip-match-count {
  writing-mode: horizontal-tb !important;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .chip-ranking-head,
  html[data-reading="large"] .chip-ranking-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .chip-ranking-actions,
  html[data-reading="large"] .chip-ranking-actions {
    display: grid;
    grid-column: 1 !important;
    grid-row: 2 !important;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
    width: 100%;
  }

  .chip-range-pills,
  html[data-reading="large"] .chip-range-pills {
    width: min(236px, 100%);
  }
}

@media (max-width: 760px) {
  .chip-range-pills {
    width: min(210px, 100%);
  }

  .chip-range-pills button {
    min-height: 42px;
  }

  .chip-table-detail-v2 .chip-detail-story span {
    display: block;
    overflow: visible;
    font-size: .9rem;
    line-height: 1.58;
    -webkit-line-clamp: initial;
  }
}

@media (max-width: 430px) {
  .chip-ranking-actions,
  html[data-reading="large"] .chip-ranking-actions {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start !important;
    box-sizing: border-box;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100%;
    justify-self: stretch !important;
    overflow: hidden;
  }

  .chip-range-pills {
    flex: 1 1 190px;
    width: min(210px, 100%);
    min-width: 0;
    max-width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 4px;
    padding: 3px;
  }

  .chip-range-pills button {
    min-width: 0;
    max-width: 100%;
  }

  .chip-match-count {
    flex: 0 0 auto;
    justify-self: start;
    max-width: 100%;
  }
}

/* Current company context inside the expanded institutional row. */
.chip-detail-story-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.chip-table-detail-v2 .chip-detail-story-head b {
  margin-bottom: 0;
}

.chip-detail-story-head small {
  color: rgba(169, 209, 202, .72);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .04em;
  white-space: nowrap;
}

/* Phone ranking pager: keep the two page buttons and result count on
   separate rows so large reading mode cannot compress their labels. */
@media (max-width: 520px) {
  .chip-ranking-actions,
  html[data-reading="large"] .chip-ranking-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch;
    gap: 10px;
    width: 100% !important;
    overflow: visible;
  }

  .chip-range-pills,
  html[data-reading="large"] .chip-range-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    min-width: 0;
    max-width: none;
    flex: none;
  }

  .chip-range-pills button,
  html[data-reading="large"] .chip-range-pills button {
    min-height: 48px;
    padding: 7px 6px;
  }

  .chip-match-count {
    justify-self: start;
    max-width: 100%;
    white-space: normal;
    text-align: left;
  }
}

.chip-market-snapshot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: baseline;
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px solid rgba(113, 207, 193, .14);
}

.chip-market-snapshot small {
  color: #70d1c3;
  font-size: .76rem;
  font-weight: 900;
  white-space: nowrap;
}

.chip-market-snapshot strong {
  color: rgba(229, 247, 243, .88);
  font-size: .82rem;
  line-height: 1.55;
}

[data-theme="soft-light"] .chip-detail-story-head small {
  color: #54746f;
}

[data-theme="soft-light"] .chip-market-snapshot {
  border-top-color: rgba(42, 102, 94, .16);
}

[data-theme="soft-light"] .chip-market-snapshot small {
  color: #126d64;
}

[data-theme="soft-light"] .chip-market-snapshot strong {
  color: #234a45;
}

@media (max-width: 430px) {
  .chip-detail-story-head,
  .chip-market-snapshot {
    align-items: flex-start;
  }

  .chip-detail-story-head {
    flex-direction: column;
    gap: 3px;
  }

  .chip-market-snapshot {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

/* Compact, readable stock identity on phones. */
@media (max-width: 760px) {
  .chip-symbol small,
  html[data-reading="large"] .chip-symbol small {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px 7px;
    margin-top: 5px;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    -webkit-box-orient: initial;
    -webkit-line-clamp: unset;
    line-clamp: unset;
  }

  .chip-symbol-code,
  .chip-symbol-role,
  .chip-symbol-date {
    display: block;
    min-width: 0;
  }

  .chip-symbol-code {
    color: rgba(188, 221, 215, .86);
    white-space: nowrap;
  }

  .chip-symbol-role {
    overflow-wrap: anywhere;
  }

  .chip-symbol-date {
    grid-column: 1 / -1;
    color: rgba(151, 190, 184, .68);
    font-size: .68rem;
  }
}

@media (min-width: 761px) {
  .chip-symbol-code::after,
  .chip-symbol-role::after {
    content: '・';
  }
}

[data-theme="soft-light"] .chip-symbol-code {
  color: #426a65;
}

[data-theme="soft-light"] .chip-symbol-date {
  color: #67817d;
}
