.icf-page {
  /* 台股慣例：漲紅、跌綠 */
  --icf-rise: #dc2626;
  --icf-rise-bg: rgba(220, 38, 38, 0.08);
  --icf-fall: #16a34a;
  --icf-fall-bg: rgba(22, 163, 74, 0.1);
  /* 資金偏好／撤出（偏好＝偏熱用紅，撤出＝偏冷用綠） */
  --icf-in: var(--icf-rise);
  --icf-in-bg: var(--icf-rise-bg);
  --icf-out: var(--icf-fall);
  --icf-out-bg: var(--icf-fall-bg);
  --icf-neu: #64748b;
  --icf-neu-bg: rgba(148, 163, 184, 0.12);
}

.icf-wrap {
  max-width: var(--hub-container-dashboard, 1080px);
  margin: 0 auto;
  padding: 16px 16px 64px;
}

.icf-hdr {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 12px;
}

.icf-hdr-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icf-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.icf-status {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.icf-status.is-error {
  color: var(--red);
  background: var(--red-bg);
  border-color: rgba(220, 38, 38, 0.2);
}
.icf-warn {
  color: #b45309;
  font-weight: 600;
}

.icf-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.icf-sum-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.icf-sum-card b {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.icf-sum-card .icf-sum-val {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.icf-sum-card .icf-sum-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ink-faint);
  line-height: 1.4;
}

.icf-view-nav {
  padding: 10px 12px;
  margin-bottom: 10px;
}

.icf-view-nav .icf-tabs {
  margin: 0;
}

.icf-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

#icfMainTablePanel .icf-toolbar-row {
  margin-bottom: 10px;
}

.icf-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: rgba(241, 245, 249, 0.8);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.icf-tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
}

.icf-tab.is-active {
  background: var(--paper);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(15, 23, 41, 0.06);
}

.icf-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
}

.icf-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.icf-select-wrap select {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  font-size: 13px;
  background: var(--paper);
  color: var(--ink);
}

.icf-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.icf-table {
  width: 100%;
  min-width: 880px;
  border-collapse: collapse;
  font-size: 12px;
}

.icf-table th,
.icf-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.icf-table th:nth-child(1),
.icf-table td:nth-child(1),
.icf-table th:nth-child(2),
.icf-table td:nth-child(2),
.icf-table th:nth-child(3),
.icf-table td:nth-child(3) {
  text-align: left;
}

.icf-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  background: rgba(248, 250, 252, 0.9);
  position: sticky;
  top: 0;
  z-index: 1;
}

.icf-table thead .icf-th-cell {
  white-space: normal;
  vertical-align: top;
  min-width: 48px;
  padding-top: 8px;
  padding-bottom: 8px;
}


.icf-table tbody tr:hover {
  background: rgba(248, 250, 252, 0.65);
}

.icf-empty {
  text-align: center !important;
  color: var(--ink-soft);
  padding: 24px !important;
}

.icf-pct.is-up { color: var(--icf-rise); font-weight: 700; }
.icf-pct.is-down { color: var(--icf-fall); font-weight: 700; }
.icf-pct.is-flat { color: var(--ink-soft); }

.icf-signal {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.icf-signal.is-inflow {
  color: var(--icf-in);
  background: var(--icf-in-bg);
}

.icf-signal.is-outflow {
  color: var(--icf-out);
  background: var(--icf-out-bg);
}

.icf-signal.is-neutral {
  color: var(--icf-neu);
  background: var(--icf-neu-bg);
}

.icf-major {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-faint);
}

.icf-na {
  color: var(--ink-faint);
  font-weight: 500;
}

.icf-section-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}

.icf-muted {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.5;
}

.icf-rotation {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
}

.icf-rot-col h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-soft);
  letter-spacing: 0.04em;
}

.icf-rot-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.icf-rot-list li {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.4;
}

.icf-rot-list li.is-in { border-color: rgba(220, 38, 38, 0.22); background: var(--icf-rise-bg); }
.icf-rot-list li.is-out { border-color: rgba(22, 163, 74, 0.25); background: var(--icf-fall-bg); }

.icf-rot-list small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-soft);
}

.icf-rot-arrow {
  align-self: center;
  font-size: 28px;
  color: var(--ink-faint);
  padding-top: 24px;
}

.icf-guide summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--accent);
}

.icf-guide ul {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
}

.icf-guide li { margin-bottom: 6px; }

.icf-flow-panel {
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, var(--paper) 100%);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.icf-flow-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(241, 245, 249, 0.55);
}

.icf-flow-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.02em;
}

.icf-flow-sub {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.icf-flow-count {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(30, 58, 95, 0.12);
}

.icf-flow-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid rgba(217, 119, 6, 0.28);
}

.icf-flow-disclaimer {
  margin: 0;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.55;
  border-bottom: 1px solid var(--line);
  background: rgba(254, 243, 199, 0.2);
}

.icf-flow-disclaimer strong {
  color: var(--ink);
}

.icf-table-wrap--matrix {
  margin: 0;
  max-height: none;
  overflow: auto;
}

.icf-table--matrix {
  min-width: 640px;
  font-size: 11px;
}

.icf-table--matrix th,
.icf-table--matrix td {
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
  border: 1px solid var(--line);
}

.icf-mx-corner {
  min-width: 108px;
  text-align: left !important;
  background: rgba(248, 250, 252, 0.9);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-soft);
  line-height: 1.45;
}

.icf-mx-corner-cold {
  display: block;
  color: rgba(21, 128, 61, 0.85);
}

.icf-mx-corner-hot {
  display: block;
  color: rgba(185, 28, 28, 0.85);
}

.icf-mx-row-head {
  text-align: left !important;
  background: rgba(240, 253, 244, 0.45);
  min-width: 120px;
  position: sticky;
  left: 0;
  z-index: 2;
}

.icf-mx-col-head {
  text-align: center !important;
  background: rgba(254, 242, 242, 0.55);
  min-width: 96px;
  vertical-align: bottom;
}

.icf-mx-axis {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.icf-mx-axis--hot {
  align-items: center;
}

.icf-mx-axis-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}

.icf-mx-axis-mom {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-soft);
}

.icf-mx-axis--cold .icf-mx-axis-mom {
  color: rgba(21, 128, 61, 0.8);
}

.icf-mx-axis--hot .icf-mx-axis-mom {
  color: rgba(185, 28, 28, 0.8);
}

.icf-mx-axis-share {
  font-size: 9px;
  color: var(--ink-faint);
}

.icf-mx-cell {
  min-width: 52px;
}

.icf-mx-cell.is-empty {
  background: rgba(248, 250, 252, 0.65);
}

.icf-mx-cell.is-lvl-1 {
  background: rgba(241, 245, 249, 0.95);
}

.icf-mx-cell.is-lvl-2 {
  background: rgba(219, 234, 254, 0.55);
}

.icf-mx-cell.is-lvl-3 {
  background: rgba(191, 219, 254, 0.65);
}

.icf-mx-cell.is-lvl-4 {
  background: rgba(147, 197, 253, 0.55);
}

.icf-mx-cell.is-lvl-5 {
  background: rgba(96, 165, 250, 0.45);
  font-weight: 700;
}

.icf-mx-val {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--accent);
}

.icf-flow-list {
  list-style: none;
  margin: 0;
  padding: 10px 12px 6px;
  display: grid;
  gap: 8px;
}

.icf-flow-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(72px, 120px) minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 6px 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 41, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.icf-flow-row:hover {
  border-color: rgba(30, 58, 95, 0.18);
  box-shadow: 0 3px 10px rgba(15, 23, 41, 0.06);
}

.icf-flow-rank {
  grid-row: 1 / 3;
  align-self: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(241, 245, 249, 0.95);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icf-flow-node {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.icf-flow-node--out {
  align-items: flex-end;
  text-align: right;
}

.icf-flow-node--in {
  align-items: flex-start;
  text-align: left;
}

.icf-flow-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.icf-flow-node--out .icf-flow-label { color: rgba(185, 28, 28, 0.65); }
.icf-flow-node--in .icf-flow-label { color: rgba(21, 128, 61, 0.7); }

.icf-flow-name {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.icf-flow-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  line-height: 1.35;
}

.icf-flow-chip.is-up {
  color: var(--icf-in);
  background: var(--icf-in-bg);
}

.icf-flow-chip.is-down {
  color: var(--icf-out);
  background: var(--icf-out-bg);
}

.icf-flow-chip.is-flat {
  color: var(--icf-neu);
  background: var(--icf-neu-bg);
}

.icf-flow-bridge {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding-top: 2px;
}

.icf-flow-bridge-track {
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.95);
  overflow: hidden;
}

.icf-flow-bridge-fill {
  height: 100%;
  min-width: 18%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.55) 0%, rgba(239, 68, 68, 0.65) 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
}

.icf-flow-bridge-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--ink-faint);
  text-align: center;
  letter-spacing: 0.02em;
}

.icf-flow-meta {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding-top: 2px;
  border-top: 1px dashed rgba(226, 232, 240, 0.95);
  font-size: 10px;
  color: var(--ink-soft);
}

.icf-flow-meta-arrow {
  color: var(--ink-faint);
  font-weight: 700;
}

.icf-flow-footnote {
  margin: 0;
  padding: 8px 14px 12px;
  font-size: 10px;
  color: var(--ink-faint);
  line-height: 1.45;
  border-top: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.45);
}

.icf-flow-empty {
  padding: 20px 16px 18px;
  text-align: center;
}

.icf-flow-empty-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-soft);
}

.icf-flow-empty-desc {
  margin: 0;
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.55;
  max-width: 520px;
  margin-inline: auto;
}

.icf-flow-empty-desc code {
  font-size: 11px;
}

.icf-table--tech thead th {
  vertical-align: top;
  text-align: right;
  padding-top: 8px;
  padding-bottom: 8px;
  white-space: normal;
}

.icf-table--tech thead th:nth-child(1),
.icf-table--tech thead th:nth-child(2) {
  text-align: left;
}

.icf-table--tech th:nth-child(1),
.icf-table--tech td:nth-child(1),
.icf-table--tech th:nth-child(2),
.icf-table--tech td:nth-child(2) {
  text-align: left;
}

.icf-sub-name-cell {
  min-width: 148px;
}

.icf-sub-name-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.icf-sub-name-text {
  min-width: 0;
}

.icf-sub-name-text strong {
  display: block;
  font-size: 13px;
  line-height: 1.3;
}

.icf-sub-meta {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-faint);
}

.icf-sub-toggle {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(248, 250, 252, 0.95);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icf-sub-toggle:hover {
  border-color: rgba(30, 58, 95, 0.22);
  color: var(--accent);
  background: #fff;
}

.icf-sub-toggle-icon {
  display: block;
  width: 0;
  height: 0;
  margin: 7px auto 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid currentColor;
  transition: transform 0.15s ease;
}

.icf-sub-toggle.is-open .icf-sub-toggle-icon {
  transform: rotate(90deg);
}

.icf-sub-row.is-expanded {
  background: rgba(248, 250, 252, 0.55);
}

.icf-sub-detail-row td {
  padding: 0 10px 10px !important;
  border-top: none !important;
  background: rgba(248, 250, 252, 0.45);
}

.icf-sub-detail-panel {
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.icf-sub-detail-note {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.45;
}

.icf-seg-list {
  display: grid;
  gap: 6px;
}

.icf-seg {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.55);
  overflow: hidden;
}

.icf-seg-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.icf-seg-summary::-webkit-details-marker {
  display: none;
}

.icf-seg-summary::before {
  content: "▸";
  margin-right: 6px;
  color: var(--ink-faint);
  transition: transform 0.15s ease;
}

.icf-seg[open] > .icf-seg-summary::before {
  transform: rotate(90deg);
}

.icf-seg-label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.icf-seg-count {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(30, 58, 95, 0.1);
  border-radius: 999px;
  padding: 2px 8px;
}

.icf-stock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 10px 10px;
}

.icf-stock-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.25;
}

.icf-stock-chip b {
  font-weight: 800;
  color: var(--ink);
}

.icf-th-stack {
  display: grid;
  grid-template-rows: minmax(2.75em, auto) minmax(2.5em, auto) minmax(2.85em, auto);
  gap: 3px;
  align-content: start;
  width: 100%;
  text-align: inherit;
}

.icf-th-stack[title] {
  cursor: help;
}

.icf-th-main {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
  letter-spacing: 0.01em;
  align-self: start;
}

.icf-th-sub {
  display: block;
  margin: 0;
  font-size: 9px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0;
  white-space: normal;
  line-height: 1.3;
  align-self: start;
}

.icf-th-pro {
  display: block;
  margin: 0;
  font-size: 8px;
  font-weight: 600;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  white-space: normal;
  line-height: 1.25;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  align-self: start;
}

.icf-th-sub:empty,
.icf-th-pro:empty {
  visibility: hidden;
  min-height: inherit;
}

.icf-tech-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 8px;
}

.icf-date-legend {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(241, 245, 249, 0.75);
  border: 1px solid var(--line);
  font-size: 11px;
}

.icf-twse-tag {
  display: block;
  font-size: 9px;
  color: var(--ink-faint);
  margin-top: 1px;
}

.icf-history-panel,
.icf-history-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.icf-history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.icf-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.icf-toolbar-row--hist {
  margin: 0;
}

.icf-hist-note {
  font-size: 11px;
  margin: 0;
}

.icf-hist-archive {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.5;
}

.icf-table-wrap--hist {
  max-height: 420px;
  overflow: auto;
}

.icf-table--hist {
  min-width: 640px;
  font-size: 11px;
}

.icf-table--hist th,
.icf-table--hist td {
  padding: 5px 7px;
  text-align: right;
  white-space: nowrap;
}

.icf-table--hist th.icf-sticky,
.icf-table--hist td.icf-sticky {
  position: sticky;
  left: 0;
  z-index: 2;
  text-align: left;
  background: var(--paper);
  box-shadow: 2px 0 4px rgba(15, 23, 41, 0.04);
}

.icf-table--hist th.icf-sticky-2,
.icf-table--hist td.icf-sticky-2 {
  position: sticky;
  left: 88px;
  z-index: 2;
  text-align: right;
  background: var(--paper);
  box-shadow: 2px 0 4px rgba(15, 23, 41, 0.04);
}

.icf-table--hist thead th {
  top: 0;
  z-index: 3;
  background: rgba(248, 250, 252, 0.98);
}

.icf-table--hist thead th.icf-sticky,
.icf-table--hist thead th.icf-sticky-2 {
  z-index: 4;
}

.icf-table--hist tbody tr.is-today {
  background: rgba(254, 243, 199, 0.35);
}

/* 證交所：顯示上漲家數比；工作台：顯示成交占比（各顯示其一） */
.icf-page[data-view="twse"] .icf-col-wb {
  display: none;
}

.icf-page[data-view="workbench"] .icf-col-breadth {
  display: none;
}

.icf-gainers {
  display: grid;
  gap: 10px;
}

.icf-gain-cluster {
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.7);
}

.icf-gain-cluster strong {
  margin-right: 8px;
}

.icf-gain-count {
  font-size: 11px;
  color: var(--ink-soft, #64748b);
}

.icf-gain-stocks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 6px;
}

.icf-gain-stock {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.icf-chain-narr {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(241, 245, 249, 0.8);
  font-size: 12px;
}

.icf-inst-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 10px;
}

.icf-tabs--sub .icf-tab {
  font-size: 12px;
  padding: 5px 10px;
}

.icf-inst-totals {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
}

.icf-inst-net.is-up {
  color: var(--icf-rise);
  font-weight: 600;
}

.icf-inst-net.is-down {
  color: var(--icf-fall);
  font-weight: 600;
}

.icf-table--inst td,
.icf-table--inst th {
  white-space: nowrap;
}

.icf-page[data-view="institutional"] .icf-view-nav .icf-tab[data-view="institutional"] {
  font-weight: 700;
}

@media (max-width: 720px) {
  .icf-flow-row {
    grid-template-columns: 26px 1fr 1fr;
    grid-template-rows: auto auto auto auto;
  }

  .icf-flow-bridge {
    grid-column: 2 / -1;
  }

  .icf-flow-meta {
    grid-column: 2 / -1;
  }
}

@media (max-width: 960px) {
  .icf-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .icf-rotation {
    grid-template-columns: 1fr;
  }

  .icf-rot-arrow {
    display: none;
  }
}

@media (max-width: 520px) {
  .icf-summary {
    grid-template-columns: 1fr;
  }
}

/* 外圍市場提示（P0） */
.icf-external {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.55;
}

.icf-external--volatile {
  border-color: rgba(217, 119, 6, 0.45);
  background: linear-gradient(135deg, rgba(254, 243, 199, 0.55), var(--paper));
}

.icf-external--calm {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(248, 250, 252, 0.85);
}

.icf-external--loading {
  border-color: rgba(59, 130, 246, 0.25);
  background: rgba(239, 246, 255, 0.9);
}

.icf-ext-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.icf-ext-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(30, 64, 175, 0.1);
  color: #1e40af;
}

.icf-ext-cache {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
  border: 1px solid rgba(100, 116, 139, 0.2);
}

.icf-ext-links {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icf-ext-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #1a73e8);
  text-decoration: none;
}

.icf-ext-link:hover {
  text-decoration: underline;
}

.icf-ext-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.icf-ext-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.icf-ext-chip b {
  font-weight: 700;
  color: var(--ink-soft);
}

.icf-ext-chip.is-up {
  border-color: rgba(220, 38, 38, 0.25);
  color: var(--icf-rise);
}

.icf-ext-chip.is-down {
  border-color: rgba(22, 163, 74, 0.3);
  color: var(--icf-fall);
}

.icf-ext-pairs {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.icf-ext-pair {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
  font-size: 12px;
}

.icf-ext-pair strong {
  display: block;
  margin-bottom: 2px;
}

.icf-ext-pair span {
  color: var(--ink-soft);
}

.icf-ext-pair--is-sync {
  border-color: rgba(22, 163, 74, 0.28);
  background: rgba(220, 252, 231, 0.35);
}

.icf-ext-pair--is-diverge,
.icf-ext-pair--diverge {
  border-color: rgba(217, 119, 6, 0.35);
  background: rgba(254, 243, 199, 0.4);
}

.icf-ext-pair--is-risk {
  border-color: rgba(220, 38, 38, 0.28);
  background: rgba(254, 226, 226, 0.35);
}

.icf-ext-hint,
.icf-ext-calm {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}

.icf-ext-rule {
  color: var(--ink-muted, #64748b);
}

/* 外圍對照高亮 + RS×法人背離（P1） */
.icf-row--us-hint > td {
  background: rgba(251, 191, 36, 0.08);
}

.icf-row--us-hint > td:first-child {
  box-shadow: inset 3px 0 0 rgba(217, 119, 6, 0.75);
}

.icf-name-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.icf-us-hint-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  border: 1px solid rgba(217, 119, 6, 0.25);
}

.icf-div-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
}

.icf-div-tag.is-sync-strong {
  background: rgba(220, 38, 38, 0.08);
  color: var(--icf-rise);
  border-color: rgba(220, 38, 38, 0.2);
}

.icf-div-tag.is-sync-weak {
  background: rgba(22, 163, 74, 0.1);
  color: var(--icf-fall);
  border-color: rgba(22, 163, 74, 0.25);
}

.icf-div-tag.is-contrarian-buy {
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.25);
}

.icf-div-tag.is-chip-out {
  background: rgba(124, 58, 237, 0.1);
  color: #6d28d9;
  border-color: rgba(124, 58, 237, 0.25);
}

/* ── 盤中/分段 ── */
.icf-session-panel {
  margin-top: 14px;
}
.icf-session-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.icf-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.icf-session-token {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
}
.icf-session-token input {
  font: inherit;
  font-size: 12px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 200px;
}
.icf-session-meta {
  margin: 0 0 10px;
  font-size: 12px;
}
.icf-table--session th:nth-child(2),
.icf-table--session td:nth-child(2),
.icf-table--session th:nth-child(3),
.icf-table--session td:nth-child(3) {
  text-align: left;
}
.icf-session-live {
  font-weight: 700;
}
.icf-session-proxy {
  font-size: 10px;
  color: var(--ink-faint);
  margin-left: 4px;
}
