:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --ink: #16201d;
  --muted: #68736e;
  --line: #d8dfd9;
  --panel: #ffffff;
  --green: #17745b;
  --yellow: #a16700;
  --red: #b4372f;
  --blue: #285f94;
  --shadow: 0 10px 24px rgba(22, 32, 29, 0.08);
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] {
    --bg: #101715;
    --ink: #f1f6f2;
    --muted: #a9b7b1;
    --line: #2f3d38;
    --panel: #17211e;
    --shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  }
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101715;
  --ink: #f1f6f2;
  --muted: #a9b7b1;
  --line: #2f3d38;
  --panel: #17211e;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
  min-width: 0;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  min-height: 44px;
  padding: 0 14px;
}

button:active {
  transform: translateY(1px);
}

.shell {
  width: min(720px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(82px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 6px 0 16px;
}

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

.topbar > div,
.toolbar > *,
.panel,
.tab-page,
.stock-card,
.scan-card,
.scan-results,
.intraday-alerts,
.cards {
  min-width: 0;
  max-width: 100%;
}

.eyebrow,
.muted,
.hint {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  line-height: 1.1;
}

.icon-button {
  width: 48px;
  padding: 0;
  font-size: 24px;
}

.install-button {
  min-height: 44px;
  background: var(--green);
}

.panel,
.stock-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.add-panel {
  position: sticky;
  top: 0;
  z-index: 4;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
}

.symbol-hint {
  min-height: 18px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 0 12px;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select {
  background: #121b18;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] input,
  body[data-theme="system"] select {
    background: #121b18;
  }
}

.hint {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 2px;
}

.special-button {
  min-height: 36px;
  padding: 0 12px;
  background: var(--blue);
  white-space: nowrap;
}

.tab-page[hidden] {
  display: none;
}

.bottom-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 8px 10px max(8px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  border-top: 1px solid var(--line);
}

.tab-button {
  min-width: 0;
  min-height: 42px;
  padding: 0 8px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}

.tab-button.active {
  background: var(--ink);
  color: var(--panel);
}

.scanner-panel {
  display: grid;
  grid-template-columns: auto minmax(120px, 180px) 1fr;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}

.scanner-panel button {
  background: var(--blue);
}

.scan-results {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.fish-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 14px;
  border: 1px solid #204f63;
  border-radius: 8px;
  background: linear-gradient(135deg, #102944, #14352e);
  color: #f5fbff;
  box-shadow: var(--shadow);
}

.fish-hero p:not(.eyebrow) {
  margin-top: 6px;
  color: #bfd0d4;
  font-size: 13px;
  line-height: 1.45;
}

.fish-hero button {
  background: #f0a72f;
  color: #132019;
  font-weight: 800;
}

.fish-toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 220px) 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.fish-sea {
  position: relative;
  min-height: 590px;
  overflow: hidden;
  border: 1px solid #214c67;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(246, 174, 76, 0.18), transparent 22%),
    linear-gradient(180deg, #133454 0%, #092233 45%, #061922 100%);
  box-shadow: var(--shadow);
}

.fish-sea::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 96%, rgba(255, 255, 255, 0.04) 96%),
    linear-gradient(180deg, transparent 0 96%, rgba(255, 255, 255, 0.035) 96%);
  background-size: 42px 42px;
  pointer-events: none;
}

.fish-sea::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: -22px;
  height: 92px;
  background: linear-gradient(180deg, rgba(36, 110, 94, 0.1), rgba(30, 85, 70, 0.58));
  transform: skewY(-3deg);
  pointer-events: none;
}

.fish-current {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(159, 204, 225, 0.26);
  border-radius: 8px;
  background: rgba(5, 22, 34, 0.72);
  color: #eaf8ff;
  font-size: 13px;
  backdrop-filter: blur(6px);
}

.fish-current span {
  color: #a9c4cf;
}

.fish-empty {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 2;
  display: grid;
  gap: 8px;
  width: min(280px, calc(100% - 48px));
  padding: 16px;
  border: 1px solid rgba(159, 204, 225, 0.28);
  border-radius: 8px;
  background: rgba(7, 26, 38, 0.78);
  color: #eef9ff;
  text-align: center;
  transform: translate(-50%, -50%);
}

.fish-empty span {
  color: #b7cbd2;
  font-size: 13px;
  line-height: 1.45;
}

.fish-item {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 3;
  display: grid;
  grid-template-columns: 66px minmax(74px, 1fr);
  grid-template-rows: auto auto auto;
  column-gap: 6px;
  align-items: center;
  width: 172px;
  min-height: 74px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(8, 24, 36, 0.72);
  color: white;
  text-align: left;
  transform: translate(-50%, -50%) scale(var(--s));
  transform-origin: center;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.fish-item strong,
.fish-item small,
.fish-item em,
.fish-item .fish-reason {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fish-item strong {
  font-size: 14px;
}

.fish-item small {
  color: #c6d5da;
  font-size: 12px;
}

.fish-item em {
  color: #ffd27b;
  font-size: 11px;
  font-style: normal;
}

.fish-reason {
  grid-column: 1 / -1;
  margin-top: 4px;
  color: #a9c4cf;
  font-size: 11px;
}

.fish-body {
  position: relative;
  grid-row: 1 / 4;
  display: block;
  width: 58px;
  height: 34px;
  border-radius: 50% 58% 58% 50%;
  background: linear-gradient(135deg, #e55248, #f0a72f);
  box-shadow: inset -9px -5px 0 rgba(0, 0, 0, 0.16);
}

.fish-body::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 8px;
  border-style: solid;
  border-width: 9px 16px 9px 0;
  border-color: transparent currentColor transparent transparent;
  color: inherit;
  opacity: 0.95;
}

.fish-body::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10201e;
}

.fish-item.hot .fish-body,
.fish-item.hot .fish-body::before {
  color: #e55248;
  background: linear-gradient(135deg, #ff6b5d, #d93f38);
}

.fish-item.strong .fish-body,
.fish-item.strong .fish-body::before {
  color: #f0a72f;
  background: linear-gradient(135deg, #ffd46a, #e78d28);
}

.fish-item.watch .fish-body,
.fish-item.watch .fish-body::before {
  color: #2c9b78;
  background: linear-gradient(135deg, #55c494, #1e805f);
}

.fish-item.risk .fish-body,
.fish-item.risk .fish-body::before {
  color: #7d8797;
  background: linear-gradient(135deg, #9aa6b8, #607083);
}

.score-help,
.term-glossary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.75);
  margin-bottom: 12px;
  padding: 10px 12px;
}

.score-help summary,
.term-glossary summary {
  cursor: pointer;
  font-weight: 700;
}

.score-help p,
.term-glossary p {
  margin-top: 8px;
  color: #46524d;
  font-size: 13px;
  line-height: 1.45;
}

.term-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.term-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--blue));
  padding: 10px;
}

.term-grid strong {
  display: block;
  font-size: 14px;
}

.sector-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sector-strip span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #eef5f8;
  color: #285f94;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
}

.scan-heading {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.scan-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.scan-card-head,
.scan-card-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scan-card-head > *,
.scan-card-line > *,
.card-head > *,
.price-line > *,
.actions > * {
  min-width: 0;
}

.scan-card-head strong,
.scan-card-line span {
  overflow-wrap: anywhere;
}

.scan-score {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--red);
  color: white;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
}

.scan-reasons {
  color: #46524d;
  font-size: 13px;
  line-height: 1.35;
}

.scan-next {
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #edf8f3;
  color: var(--ink);
  padding: 8px 9px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.recommend-plan {
  display: grid;
  gap: 4px;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: #fff3f1;
  color: var(--ink);
  padding: 9px;
}

.recommend-plan strong {
  color: var(--red);
  font-size: 15px;
}

.recommend-plan span,
.recommend-plan small {
  line-height: 1.35;
}

.recommend-plan small {
  color: var(--muted);
}

.battle-brief {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf8;
}

.battle-brief div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.battle-brief span {
  color: var(--muted);
  font-size: 11px;
}

.battle-brief strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-light {
  align-content: center;
  justify-items: center;
  border-radius: 6px;
  background: rgba(40, 95, 148, 0.12);
}

.battle-light span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--blue);
}

.battle-brief.green .battle-light {
  background: rgba(23, 116, 91, 0.14);
}

.battle-brief.green .battle-light span {
  background: var(--green);
}

.battle-brief.yellow .battle-light {
  background: rgba(161, 103, 0, 0.16);
}

.battle-brief.yellow .battle-light span {
  background: var(--yellow);
}

.battle-brief.red .battle-light {
  background: rgba(180, 55, 47, 0.14);
}

.battle-brief.red .battle-light span {
  background: var(--red);
}

.scan-actions {
  display: flex;
  justify-content: flex-end;
}

.scan-actions button {
  min-height: 34px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.select-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  min-width: 0;
}

.toolbar select {
  min-height: 36px;
  max-width: 160px;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.intraday-alerts {
  margin: 0 0 12px;
  display: grid;
  gap: 10px;
}

.intraday-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.intraday-head strong {
  font-size: 1rem;
}

.intraday-head span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.intraday-head.merged {
  padding: 9px 12px;
  box-shadow: none;
}

.intraday-head.merged span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.intraday-list {
  display: grid;
  gap: 8px;
}

.intraday-item {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
}

.intraday-item strong {
  justify-self: end;
}

.intraday-item em {
  font-style: normal;
  font-weight: 700;
}

.intraday-item small {
  color: var(--muted);
  grid-column: 1 / -1;
}

.intraday-item.add,
.intraday-signal.add {
  border-color: rgba(16, 185, 129, 0.55);
  background: rgba(16, 185, 129, 0.08);
}

.intraday-item.warning,
.intraday-signal.warning {
  border-color: rgba(245, 158, 11, 0.55);
  background: rgba(245, 158, 11, 0.1);
}

.intraday-item.danger,
.intraday-signal.danger {
  border-color: rgba(220, 38, 38, 0.55);
  background: rgba(220, 38, 38, 0.1);
}

.intraday-signal {
  display: grid;
  gap: 4px;
}

.intraday-signal span {
  color: var(--muted);
}

.backtest-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(40, 95, 148, 0.06);
  display: grid;
  gap: 10px;
}

.backtest-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.backtest-head span {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: right;
}

.backtest-grid,
.projection-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.backtest-grid article,
.projection-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: var(--panel);
}

.backtest-grid span,
.projection-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.backtest-grid strong,
.projection-grid strong {
  display: block;
  margin-top: 3px;
}

.backtest-panel p {
  margin: 0;
  color: var(--muted);
}

.backtest-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.summary-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.7);
}

.danger-count strong {
  color: var(--red);
}

.warning-count strong {
  color: var(--yellow);
}

.safe-count strong {
  color: var(--green);
}

.summary-item strong {
  display: block;
  font-size: 24px;
}

.portfolio-insights {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.portfolio-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.portfolio-head h2 {
  margin: 0;
  font-size: 18px;
}

.portfolio-head span {
  border-radius: 999px;
  background: #edf8f3;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
  white-space: nowrap;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.portfolio-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcf8;
}

.portfolio-grid span,
.portfolio-actions,
.portfolio-sectors {
  color: var(--muted);
}

.portfolio-grid strong {
  display: block;
  margin-top: 4px;
  line-height: 1.35;
}

.portfolio-actions {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  padding-left: 18px;
  line-height: 1.45;
}

.research-workflow {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf7;
  padding: 10px;
  margin: 10px 0;
}

.research-workflow > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.research-workflow ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
  line-height: 1.45;
}

.portfolio-sectors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portfolio-sectors span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
}

.cards {
  display: grid;
  gap: 12px;
}

.quant-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}

.quant-hero h2 {
  margin: 3px 0 6px;
  font-size: 24px;
}

.quant-hero p:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.quant-hero button {
  flex: 0 0 auto;
  min-height: 40px;
}

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

.quant-summary article,
.quant-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.quant-summary article {
  display: grid;
  gap: 4px;
  padding: 11px;
}

.quant-summary span,
.quant-card-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.quant-summary strong {
  font-size: 20px;
}

.quant-results {
  display: grid;
  gap: 10px;
}

.quant-card {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.quant-card.add {
  border-left: 5px solid var(--green);
}

.quant-card.warning {
  border-left: 5px solid var(--yellow);
}

.quant-card.danger {
  border-left: 5px solid var(--red);
}

.quant-card.neutral {
  border-left: 5px solid var(--blue);
}

.quant-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.quant-card-head div {
  display: grid;
  gap: 3px;
}

.quant-card-head strong {
  font-size: 17px;
}

.quant-card-head b {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: white;
  font-size: 20px;
}

.quant-card p {
  margin: 0;
  font-weight: 800;
  line-height: 1.45;
}

.quant-card ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.quant-bars {
  display: grid;
  gap: 7px;
}

.quant-bar {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.quant-bar span,
.quant-bar b {
  font-weight: 900;
}

.quant-bar div {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e3ded3;
}

.quant-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.flow-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  margin-bottom: 10px;
}

.flow-hero h2 {
  margin: 3px 0 6px;
  font-size: 24px;
}

.flow-hero p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.flow-hero button {
  flex: 0 0 auto;
  min-height: 40px;
}

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

.flow-summary article,
.flow-card,
.flow-alert {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.flow-summary article {
  display: grid;
  gap: 4px;
  padding: 11px;
}

.flow-summary span,
.flow-card-head span,
.flow-stats dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.flow-summary strong {
  font-size: 20px;
}

.flow-results {
  display: grid;
  gap: 10px;
}

.flow-card,
.flow-alert {
  display: grid;
  gap: 10px;
  padding: 13px;
}

.flow-card.add {
  border-left: 5px solid var(--green);
}

.flow-card.watch,
.flow-card.neutral {
  border-left: 5px solid var(--blue);
}

.flow-card.danger,
.flow-alert {
  border-left: 5px solid var(--red);
}

.flow-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.flow-card-head div {
  display: grid;
  gap: 3px;
}

.flow-card-head strong {
  font-size: 18px;
}

.flow-card-head b {
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #edf8f3;
  color: var(--green);
  font-size: 20px;
}

.flow-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--meter-bg);
}

.flow-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--yellow));
}

.flow-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.flow-stats div {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.flow-stats dd {
  margin: 3px 0 0;
  font-weight: 900;
}

.flow-card p,
.flow-alert span {
  margin: 0;
  line-height: 1.45;
  font-weight: 700;
}

.flow-leaders {
  display: grid;
  gap: 6px;
}

.flow-leaders button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.flow-leaders span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
}

.flow-leaders em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.flow-leaders small {
  border-radius: 999px;
  background: var(--ink);
  color: var(--panel);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 900;
}

.cards.cards-collapsed .stock-card {
  gap: 6px;
}

.cards.cards-collapsed .stock-card:not(.card-expanded) .intro,
.cards.cards-collapsed .stock-card:not(.card-expanded) .meter,
.cards.cards-collapsed .stock-card:not(.card-expanded) .metrics,
.cards.cards-collapsed .stock-card:not(.card-expanded) .signals {
  display: none;
}

.cards.cards-collapsed .stock-card:not(.card-expanded) .actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.cards.cards-collapsed .stock-card:not(.card-expanded) .board-mode,
.cards.cards-collapsed .stock-card:not(.card-expanded) .pin-widget,
.cards.cards-collapsed .stock-card:not(.card-expanded) .goodinfo-link {
  display: none;
}

.cards.cards-collapsed .stock-card:not(.card-expanded) .remove {
  min-height: 32px;
  padding: 0 10px;
  margin-left: 0;
}

.cards.cards-collapsed .card-head,
.cards.cards-collapsed .price-line {
  margin: 0;
}

.stock-card {
  padding: 14px;
}

.card-head,
.price-line,
.actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stock-title {
  min-width: 0;
}

.name {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.intro {
  margin-top: 5px;
  color: #46524d;
  font-size: 12px;
  line-height: 1.35;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  color: white;
  padding: 6px 10px;
  font-size: 13px;
  min-width: 52px;
  text-align: center;
}

.badge.safe {
  background: var(--green);
}

.badge.warning {
  background: var(--yellow);
}

.badge.danger {
  background: var(--red);
}

.price-line {
  margin-top: 16px;
}

.expand-card {
  display: none;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.cards.cards-collapsed .expand-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quick-decision {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.quick-decision p {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}

.quick-warning {
  border-left: 4px solid var(--yellow);
  border-radius: 6px;
  background: color-mix(in srgb, var(--yellow) 13%, var(--panel));
  padding: 8px 10px;
}

.quick-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: color-mix(in srgb, var(--panel) 82%, var(--blue));
}

.quick-status span,
.quick-levels span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quick-status strong {
  font-size: 16px;
}

.quick-status.add {
  border-color: color-mix(in srgb, var(--green) 46%, var(--line));
  background: color-mix(in srgb, var(--green) 13%, var(--panel));
}

.quick-status.warning {
  border-color: color-mix(in srgb, var(--yellow) 50%, var(--line));
  background: color-mix(in srgb, var(--yellow) 15%, var(--panel));
}

.quick-status.danger {
  border-color: color-mix(in srgb, var(--red) 48%, var(--line));
  background: color-mix(in srgb, var(--red) 12%, var(--panel));
}

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

.quick-levels div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: color-mix(in srgb, var(--panel) 92%, var(--ink));
}

.quick-levels strong {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.close {
  font-size: 32px;
  line-height: 1;
}

.change {
  color: var(--muted);
}

.change.up {
  color: var(--red);
}

.change.down {
  color: var(--green);
}

.meter {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e3ded3;
  margin: 14px 0;
}

.meter span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--green);
}

.meter.warning span {
  background: var(--yellow);
}

.meter.danger span {
  background: var(--red);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 0;
}

.metrics div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  min-width: 0;
}

.metrics dt {
  color: var(--muted);
  font-size: 12px;
}

.metrics dd {
  margin: 2px 0 0;
  font-weight: 700;
}

.signals {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.signal {
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #eef5f8;
  padding: 9px 10px;
  font-size: 14px;
}

.signal.warning {
  border-color: var(--yellow);
  background: #fff4dd;
}

.signal.danger {
  border-color: var(--red);
  background: #ffebe9;
}

.signal.decision {
  border-color: var(--green);
  background: #edf8f3;
  font-weight: 700;
}

.signal.checklist {
  border-color: #6a5acd;
  background: #f1f0ff;
}

.signal.add-signal {
  display: grid;
  gap: 4px;
  border-color: var(--green);
  background: #eaf8ef;
}

.signal.add-signal strong {
  font-size: 16px;
}

.signal.add-signal span {
  line-height: 1.45;
}

.signal.add-signal.warning {
  border-color: var(--yellow);
  background: #fff4dd;
}

.signal.add-signal.danger {
  border-color: var(--red);
  background: #ffebe9;
}

.signal.add-signal.neutral {
  border-color: var(--blue);
  background: #eef5f8;
}

.plain-plan {
  display: grid;
  gap: 8px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #eefaf3;
  padding: 11px 12px;
}

.plain-plan strong {
  font-size: 17px;
}

.plain-plan p {
  margin: 0;
  font-weight: 800;
  line-height: 1.45;
}

.plain-plan ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.plain-plan.warning {
  border-color: var(--yellow);
  background: #fff7e6;
}

.plain-plan.danger {
  border-color: var(--red);
  background: #ffefee;
}

.plain-plan.neutral {
  border-color: var(--blue);
  background: #eef5f8;
}

.decision-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf7;
  padding: 10px;
}

.decision-panel div {
  display: grid;
  gap: 2px;
}

.decision-panel span {
  color: var(--muted);
  font-size: 12px;
}

.decision-panel strong {
  font-size: 13px;
  line-height: 1.35;
}

.decision-panel p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.wave-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
  padding: 10px;
}

.wave-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.wave-panel-head span,
.wave-panel p {
  color: var(--muted);
}

.wave-panel p {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.45;
}

.wave-chart {
  display: block;
  width: 100%;
  height: auto;
  min-height: 132px;
}

.wave-channel {
  fill: rgba(40, 95, 148, 0.08);
}

.wave-reward-zone {
  fill: rgba(176, 129, 15, 0.22);
}

.wave-risk-zone {
  fill: rgba(25, 120, 91, 0.2);
}

.wave-support,
.wave-resistance {
  stroke: #285f94;
  stroke-width: 2;
}

.wave-resistance {
  stroke-dasharray: 5 5;
}

.wave-route {
  fill: none;
  stroke: var(--red);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.wave-route.down {
  stroke: var(--green);
}

.wave-target {
  stroke: var(--red);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}

.wave-target.secondary {
  opacity: 0.45;
}

.wave-stop {
  stroke: var(--green);
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.wave-current {
  fill: var(--ink);
  stroke: var(--panel);
  stroke-width: 2;
}

.wave-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.wave-label.strong {
  fill: var(--red);
}

.wave-label.stop {
  fill: var(--green);
}

body[data-theme="dark"] .stock-card,
body[data-theme="dark"] .summary-item,
body[data-theme="dark"] .portfolio-insights,
body[data-theme="dark"] .portfolio-grid article,
body[data-theme="dark"] .research-workflow,
body[data-theme="dark"] .quant-hero,
body[data-theme="dark"] .quant-summary article,
body[data-theme="dark"] .quant-card,
body[data-theme="dark"] .flow-hero,
body[data-theme="dark"] .flow-summary article,
body[data-theme="dark"] .flow-card,
body[data-theme="dark"] .flow-alert,
body[data-theme="dark"] .metrics div,
body[data-theme="dark"] .scan-card,
body[data-theme="dark"] .sector-strip,
body[data-theme="dark"] .score-help,
body[data-theme="dark"] .battle-brief,
body[data-theme="dark"] .decision-panel,
body[data-theme="dark"] .plain-plan,
body[data-theme="dark"] .wave-panel {
  background: #17211e;
  color: #f1f6f2;
}

body[data-theme="dark"] .signal,
body[data-theme="dark"] .scan-next {
  background: #162b33;
  color: #f1f6f2;
}

body[data-theme="dark"] .recommend-plan {
  background: #3a1917;
  color: #ffeceb;
}

body[data-theme="dark"] .recommend-plan small {
  color: #f1c8c4;
}

body[data-theme="dark"] .signal.warning {
  background: #362a11;
  color: #fff6df;
}

body[data-theme="dark"] .signal.danger {
  background: #3a1917;
  color: #ffeceb;
}

body[data-theme="dark"] .signal.decision {
  background: #133127;
  color: #e9fff7;
}

body[data-theme="dark"] .signal.checklist {
  background: #25213d;
  color: #f1f0ff;
}

body[data-theme="dark"] .signal.add-signal {
  background: #153326;
  color: #effff8;
}

body[data-theme="dark"] .signal.add-signal.warning {
  background: #362a11;
  color: #fff6df;
}

body[data-theme="dark"] .signal.add-signal.danger {
  background: #3a1917;
  color: #ffeceb;
}

body[data-theme="dark"] .plain-plan.warning {
  background: #362a11;
}

body[data-theme="dark"] .plain-plan.danger {
  background: #3a1917;
}

body[data-theme="dark"] .scan-reasons,
body[data-theme="dark"] .battle-brief span,
body[data-theme="dark"] .plain-plan ul,
body[data-theme="dark"] .score-help p,
body[data-theme="dark"] .portfolio-grid span,
body[data-theme="dark"] .portfolio-actions,
body[data-theme="dark"] .research-workflow > span,
body[data-theme="dark"] .portfolio-sectors,
body[data-theme="dark"] .quant-hero p:last-child,
body[data-theme="dark"] .quant-summary span,
body[data-theme="dark"] .quant-card-head span,
body[data-theme="dark"] .quant-card ul,
body[data-theme="dark"] .flow-hero p:last-child,
body[data-theme="dark"] .flow-summary span,
body[data-theme="dark"] .flow-card-head span,
body[data-theme="dark"] .flow-stats dt,
body[data-theme="dark"] .flow-leaders em,
body[data-theme="dark"] .decision-panel p,
body[data-theme="dark"] .decision-panel span,
body[data-theme="dark"] .wave-panel p,
body[data-theme="dark"] .wave-panel-head span,
body[data-theme="dark"] .symbol-hint,
body[data-theme="dark"] .intro,
body[data-theme="dark"] .name {
  color: #c7d4ce;
}

body[data-theme="dark"] .wave-channel {
  fill: rgba(108, 158, 205, 0.14);
}

body[data-theme="dark"] .wave-reward-zone {
  fill: rgba(224, 180, 67, 0.24);
}

body[data-theme="dark"] .wave-risk-zone {
  fill: rgba(80, 180, 137, 0.24);
}

body[data-theme="dark"] .wave-support,
body[data-theme="dark"] .wave-resistance {
  stroke: #6c9ecd;
}

@media (prefers-color-scheme: dark) {
  body[data-theme="system"] .stock-card,
  body[data-theme="system"] .summary-item,
  body[data-theme="system"] .portfolio-insights,
  body[data-theme="system"] .portfolio-grid article,
  body[data-theme="system"] .research-workflow,
  body[data-theme="system"] .quant-hero,
  body[data-theme="system"] .quant-summary article,
  body[data-theme="system"] .quant-card,
  body[data-theme="system"] .flow-hero,
  body[data-theme="system"] .flow-summary article,
  body[data-theme="system"] .flow-card,
  body[data-theme="system"] .flow-alert,
  body[data-theme="system"] .metrics div,
  body[data-theme="system"] .scan-card,
  body[data-theme="system"] .sector-strip,
  body[data-theme="system"] .score-help,
  body[data-theme="system"] .battle-brief,
  body[data-theme="system"] .decision-panel,
  body[data-theme="system"] .plain-plan,
  body[data-theme="system"] .wave-panel {
    background: #17211e;
    color: #f1f6f2;
  }

  body[data-theme="system"] .signal,
  body[data-theme="system"] .scan-next {
    background: #162b33;
    color: #f1f6f2;
  }

  body[data-theme="system"] .recommend-plan {
    background: #3a1917;
    color: #ffeceb;
  }

  body[data-theme="system"] .recommend-plan small {
    color: #f1c8c4;
  }

  body[data-theme="system"] .signal.warning {
    background: #362a11;
    color: #fff6df;
  }

  body[data-theme="system"] .signal.danger {
    background: #3a1917;
    color: #ffeceb;
  }

  body[data-theme="system"] .signal.decision {
    background: #133127;
    color: #e9fff7;
  }

  body[data-theme="system"] .signal.checklist {
    background: #25213d;
    color: #f1f0ff;
  }

  body[data-theme="system"] .signal.add-signal {
    background: #153326;
    color: #effff8;
  }

  body[data-theme="system"] .signal.add-signal.warning {
    background: #362a11;
    color: #fff6df;
  }

  body[data-theme="system"] .signal.add-signal.danger {
    background: #3a1917;
    color: #ffeceb;
  }

  body[data-theme="system"] .plain-plan.warning {
    background: #362a11;
  }

  body[data-theme="system"] .plain-plan.danger {
    background: #3a1917;
  }

  body[data-theme="system"] .scan-reasons,
  body[data-theme="system"] .battle-brief span,
  body[data-theme="system"] .plain-plan ul,
  body[data-theme="system"] .score-help p,
  body[data-theme="system"] .portfolio-grid span,
  body[data-theme="system"] .portfolio-actions,
  body[data-theme="system"] .research-workflow > span,
  body[data-theme="system"] .portfolio-sectors,
  body[data-theme="system"] .quant-hero p:last-child,
  body[data-theme="system"] .quant-summary span,
  body[data-theme="system"] .quant-card-head span,
  body[data-theme="system"] .quant-card ul,
  body[data-theme="system"] .flow-hero p:last-child,
  body[data-theme="system"] .flow-summary span,
  body[data-theme="system"] .flow-card-head span,
  body[data-theme="system"] .flow-stats dt,
  body[data-theme="system"] .flow-leaders em,
  body[data-theme="system"] .decision-panel p,
  body[data-theme="system"] .decision-panel span,
  body[data-theme="system"] .wave-panel p,
  body[data-theme="system"] .wave-panel-head span,
  body[data-theme="system"] .symbol-hint,
  body[data-theme="system"] .intro,
  body[data-theme="system"] .name {
    color: #c7d4ce;
  }

  body[data-theme="system"] .wave-channel {
    fill: rgba(108, 158, 205, 0.14);
  }

  body[data-theme="system"] .wave-reward-zone {
    fill: rgba(224, 180, 67, 0.24);
  }

  body[data-theme="system"] .wave-risk-zone {
    fill: rgba(80, 180, 137, 0.24);
  }

  body[data-theme="system"] .wave-support,
  body[data-theme="system"] .wave-resistance {
    stroke: #6c9ecd;
  }
}

.actions {
  margin-top: 12px;
}

.remove,
.board-mode,
.pin-widget,
.goodinfo-link {
  margin-left: auto;
  min-height: 38px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.pin-widget {
  margin-left: 0;
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.board-mode {
  margin-left: 0;
  background: var(--blue);
  border-color: var(--blue);
  color: white;
}

.goodinfo-link {
  margin-left: 0;
}

.board {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background: var(--bg);
  color: var(--ink);
  padding: 24px;
  text-align: center;
}

.board[hidden] {
  display: none;
}

.board-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 44px;
  padding: 0;
  border-radius: 999px;
}

.board-mascot {
  width: 112px;
  height: 150px;
  background:
    radial-gradient(circle at 50% 22%, #10231f 0 28%, transparent 29%),
    radial-gradient(circle at 50% 31%, #f8d3bd 0 31%, transparent 32%),
    linear-gradient(78deg, transparent 0 58%, #16201d 59% 61%, transparent 62%),
    linear-gradient(100deg, transparent 0 62%, #17745b 63% 84%, transparent 85%),
    linear-gradient(#e85d4f 0 0);
  background-size: 100% 50%, 100% 54%, 100% 64%, 100% 48%, 58% 42%;
  background-position: center top, center 12px, center top, center 0, center bottom;
  background-repeat: no-repeat;
  border-radius: 22px;
}

.board-name {
  font-size: 22px;
  font-weight: 700;
}

.board-change {
  border-radius: 22px;
  color: white;
  font-size: 48px;
  line-height: 1;
  padding: 12px 22px;
}

.board-change.up {
  background: var(--red);
}

.board-change.down {
  background: var(--green);
}

.board-cheer {
  color: var(--green);
  font-size: 28px;
  font-weight: 700;
}

.board-updated {
  color: var(--muted);
  font-size: 14px;
}

body.board-open {
  overflow: hidden;
}

.empty-card {
  min-height: 110px;
  display: grid;
  align-content: center;
}

@media (max-width: 560px) {
  .shell {
    width: 100%;
    max-width: 100vw;
    padding: max(10px, env(safe-area-inset-top)) 10px calc(76px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 10px;
    padding: 2px 0 10px;
  }

  .topbar > div:first-child {
    flex: 1 1 auto;
  }

  .top-actions {
    flex: 0 0 auto;
  }

  .eyebrow {
    font-size: 11px;
    margin-bottom: 2px;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 18px;
  }

  button,
  input,
  select {
    min-height: 40px;
  }

  button {
    padding: 0 12px;
  }

  .icon-button {
    width: 40px;
    min-height: 40px;
    font-size: 20px;
  }

  .install-button {
    min-height: 40px;
    padding: 0 10px;
  }

  .panel,
  .stock-card {
    box-shadow: 0 8px 20px rgba(22, 32, 29, 0.08);
  }

  .panel {
    padding: 11px;
  }

  .row {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.82fr) 56px;
    gap: 6px;
  }

  .row button {
    padding: 0 8px;
  }

  .toolbar {
    align-items: stretch;
    flex-flow: row wrap;
    gap: 8px;
    padding: 10px 2px;
    font-size: 13px;
  }

  .toolbar .select-label {
    flex: 1 1 100%;
  }

  .toolbar .select-label span {
    flex: 0 0 auto;
  }

  .toolbar select {
    flex: 1 1 auto;
    max-width: none;
  }

  .special-button {
    flex: 1 1 calc(50% - 4px);
    padding: 0 8px;
  }

  #updatedAt {
    flex: 1 1 100%;
  }

  .scanner-panel {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .scanner-panel button,
  .scanner-panel select {
    width: 100%;
  }

  .scanner-panel .muted {
    grid-column: 1 / -1;
  }

  .fish-hero {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .fish-toolbar {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .fish-sea {
    min-height: 640px;
  }

  .fish-current {
    display: grid;
  }

  .fish-item {
    grid-template-columns: 52px minmax(68px, 1fr);
    width: 150px;
    min-height: 70px;
    padding: 7px;
  }

  .fish-body {
    width: 48px;
    height: 30px;
  }

  .toolbar select {
    min-height: 34px;
    padding: 0 8px;
  }

  .scan-card-head,
  .scan-card-line {
    align-items: flex-start;
  }

  .scan-card-line {
    flex-wrap: wrap;
  }

  .scan-reasons {
    flex: 1 1 100%;
  }

  .summary {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
    margin-bottom: 10px;
  }

  .portfolio-insights {
    padding: 11px;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-head h2 {
    font-size: 16px;
  }

  .quant-hero {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .quant-hero h2 {
    font-size: 20px;
  }

  .quant-hero button {
    width: 100%;
  }

  .flow-hero {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

  .flow-hero h2 {
    font-size: 20px;
  }

  .flow-hero button {
    width: 100%;
  }

  .quant-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .flow-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .quant-summary article,
  .quant-card,
  .flow-summary article,
  .flow-card {
    padding: 10px;
  }

  .quant-card-head b {
    min-width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .quant-bar {
    grid-template-columns: 64px minmax(0, 1fr) 30px;
    gap: 6px;
  }

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

  .flow-leaders button {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .flow-leaders em {
    grid-column: 1 / -1;
  }

  .summary-item {
    padding: 8px 7px;
  }

  .summary-item strong {
    font-size: 19px;
    line-height: 1;
  }

  .summary-item span {
    font-size: 12px;
  }

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

  .battle-light {
    justify-items: start;
    padding: 6px;
  }

  .cards {
    gap: 9px;
  }

  .stock-card {
    padding: 11px;
  }

  .card-head,
  .price-line,
  .actions {
    align-items: flex-start;
    gap: 8px;
  }

  .badge {
    padding: 5px 8px;
    font-size: 12px;
    max-width: 112px;
    text-align: center;
    white-space: normal;
  }

  .price-line {
    margin-top: 10px;
  }

  .close {
    font-size: 26px;
  }

  .meter {
    margin: 10px 0;
  }

  .metrics {
    gap: 6px;
  }

  .metrics div {
    padding: 7px;
  }

  .signals {
    gap: 6px;
    margin-top: 9px;
  }

  .signal {
    padding: 8px 9px;
    font-size: 13px;
  }

  .hint {
    font-size: 12px;
    line-height: 1.35;
  }

  .remove {
    min-height: 34px;
  }

  .pin-widget {
    min-height: 34px;
  }

  .board-mode {
    min-height: 34px;
  }

  .goodinfo-link {
    min-height: 34px;
  }
}

@media (max-width: 380px) {
  .top-actions {
    gap: 6px;
  }

  h1 {
    font-size: 21px;
  }

  .row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.72fr) 52px;
    gap: 5px;
  }

  input {
    padding: 0 8px;
  }

  button {
    padding: 0 8px;
  }

  .bottom-tabs {
    gap: 5px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .tab-button {
    padding: 0 5px;
    font-size: 13px;
  }

  .badge {
    max-width: 96px;
  }
}
