:root {
  --bg: #f7f2e8;
  --paper: #fffdf8;
  --panel: #ffffff;
  --panel-2: #f8f2e5;
  --panel-3: #fbf7ef;
  --ink: #172033;
  --muted: #6f7788;
  --line: #ded2bd;
  --royal: #173b73;
  --royal-2: #24508f;
  --gold: #b8892f;
  --gold-soft: #f4e6c6;
  --green: #11835b;
  --yellow: #b7791f;
  --red: #c2413a;
  --gray: #838b98;
  --shadow: 0 20px 48px rgba(44, 35, 21, 0.12);
}

/* Mobile v2: app-style phone layout. Desktop rules above remain unchanged. */
@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    padding: 0 0 calc(92px + env(safe-area-inset-bottom));
    background:
      linear-gradient(rgba(84, 214, 255, 0.045) 1px, transparent 1px),
      linear-gradient(90deg, rgba(84, 214, 255, 0.04) 1px, transparent 1px),
      #020711;
    background-size: 26px 26px, 26px 26px, auto;
  }

  .app-shell {
    width: 100%;
    padding: 0 8px 18px;
  }

  .command-header {
    position: sticky;
    top: 0;
    z-index: 170;
    display: grid;
    gap: 7px;
    margin: 0 -8px 8px;
    padding: calc(7px + env(safe-area-inset-top)) 10px 8px;
    border-width: 0 0 1px;
    border-radius: 0 0 12px 12px;
    background:
      linear-gradient(180deg, rgba(3, 12, 24, 0.98), rgba(4, 16, 31, 0.95)),
      radial-gradient(circle at 92% 0%, rgba(84, 214, 255, 0.2), transparent 35%);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
    backdrop-filter: none;
  }

  .eyebrow,
  .subline {
    display: none;
  }

  .command-header h1 {
    margin: 0;
    color: #e7f4ff;
    font-size: 18px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .command-header h1 span {
    display: inline;
  }

  .command-header h1 span + span::before {
    content: " ";
  }

  .header-actions {
    display: block;
    margin: 0;
    width: 100%;
  }

  .header-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .header-buttons .ghost-button,
  .header-buttons .primary-button {
    min-width: 0;
    height: 32px;
    min-height: 32px;
    padding: 0 7px;
    border-radius: 9px;
    font-size: 11px;
    white-space: nowrap;
  }

  .bottom-nav {
    position: fixed !important;
    left: 10px;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    z-index: 260;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: auto;
    min-width: 0;
    height: 56px;
    margin: 0;
    padding: 5px;
    border: 1px solid rgba(84, 214, 255, 0.32);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(3, 13, 27, 0.96);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46), inset 0 0 24px rgba(84, 214, 255, 0.1);
    backdrop-filter: blur(18px);
  }

  .nav-item {
    min-width: 0;
    height: 44px;
    min-height: 44px;
    padding: 0 2px;
    border: 0;
    border-radius: 13px;
    font-size: 11px;
    line-height: 1;
  }

  .nav-item.active {
    background: linear-gradient(180deg, rgba(84, 214, 255, 0.32), rgba(255, 209, 102, 0.18));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.42), 0 8px 18px rgba(84, 214, 255, 0.12);
  }

  .system-strip {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 7px;
    margin: 0 0 7px;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .system-strip::-webkit-scrollbar {
    display: none;
  }

  .system-strip div,
  .system-strip label,
  .system-strip div:nth-of-type(n + 4),
  .system-strip div:nth-of-type(n + 5),
  .system-strip label {
    display: grid !important;
    flex: 0 0 132px;
    min-height: 48px;
    padding: 7px 9px;
    border: 1px solid rgba(84, 214, 255, 0.18);
    border-radius: 12px;
    background: rgba(5, 18, 34, 0.86);
    scroll-snap-align: start;
  }

  .system-strip span,
  .system-strip label span {
    margin-bottom: 3px;
    font-size: 9px;
    line-height: 1;
  }

  .system-strip strong,
  .system-strip input {
    min-width: 0;
    font-size: 12px;
    line-height: 1.2;
  }

  .live-tape {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    min-height: 46px;
    height: 46px;
    margin: 0 0 8px;
    padding: 0;
    overflow: hidden;
    border-radius: 13px;
  }

  .live-tape-head {
    padding-left: 9px;
    font-size: 10px;
  }

  .live-tape-track {
    display: flex !important;
    gap: 8px;
    width: max-content !important;
    min-width: max-content !important;
    overflow: visible !important;
    transform: translate3d(0, 0, 0);
    animation: tapeMove 34s linear infinite !important;
    will-change: transform;
  }

  .live-tape:hover .live-tape-track {
    animation-play-state: running;
  }

  .tape-chip {
    flex: 0 0 206px !important;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 7px;
    max-width: 206px;
    min-height: 32px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
  }

  .tape-chip span,
  .tape-chip strong,
  .tape-chip em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tape-chip em {
    grid-column: 1 / -1;
    font-size: 10px;
  }

  #view-dashboard .dashboard-grid,
  .dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px;
    overflow: visible !important;
    padding: 0;
    scroll-snap-type: none;
  }

  #view-dashboard .dashboard-grid > .panel,
  .dashboard-grid > .panel {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    scroll-snap-align: none;
    content-visibility: auto;
    contain-intrinsic-size: 360px;
  }

  #view-dashboard .panel-title {
    position: static;
    margin: 0 0 10px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
  }

  #view-dashboard .panel-title h2,
  #view-watch .panel-title h2,
  #view-signals .panel-title h2,
  #view-portfolio .panel-title h2,
  #view-intel .panel-title h2,
  #view-journal .panel-title h2 {
    font-size: 20px;
    line-height: 1.18;
  }

  #view-dashboard .market-panel {
    order: 1;
    contain-intrinsic-size: 430px;
  }

  #view-dashboard .radar-panel {
    order: 2;
  }

  #view-dashboard .alerts-panel {
    order: 3;
  }

  #view-dashboard .global-panel {
    order: 4;
  }

  #view-dashboard .sector-panel {
    order: 5;
  }

  #view-dashboard .sector-flow-panel {
    order: 6;
  }

  #view-dashboard .outlook-panel {
    order: 7;
  }

  #view-dashboard .buy-panel {
    order: 8;
  }

  #view-dashboard .holding-panel {
    order: 9;
  }

  #view-dashboard .market-panel .index-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 9px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  #view-dashboard .market-panel .index-grid::-webkit-scrollbar {
    display: none;
  }

  #view-dashboard .market-panel .index-card {
    flex: 0 0 82%;
    width: auto !important;
    max-width: none !important;
    min-height: 124px;
    scroll-snap-align: start;
  }

  .index-card strong {
    font-size: 36px;
    line-height: 1;
  }

  .judgement {
    font-size: 15px;
    line-height: 1.48;
  }

  .alerts-panel,
  .global-panel,
  .sector-panel,
  .sector-flow-panel,
  .outlook-panel,
  .radar-panel,
  .buy-panel,
  .holding-panel {
    max-height: 430px;
  }

  .alert-list,
  .buy-list,
  .sector-list,
  .sector-flow-grid,
  .global-grid,
  .radar-grid,
  .portfolio-metrics {
    max-height: 318px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .global-grid,
  .radar-grid,
  .sector-flow-grid,
  .portfolio-metrics {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-columns: auto;
  }

  .panel {
    padding: 14px;
    border-radius: 15px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24), inset 0 0 22px rgba(84, 214, 255, 0.045);
  }

  .panel:hover,
  .stock-tile:hover {
    transform: none !important;
    filter: none !important;
  }

  #view-watch > .panel,
  #view-portfolio > .panel {
    display: flex;
    flex-direction: column;
  }

  #watchPriorityBoard {
    order: 1;
  }

  #watchCards,
  #holdingCards {
    order: 2;
  }

  #watchTableWrap,
  #holdingTableWrap {
    order: 3;
  }

  #watchForm,
  #holdingForm {
    order: 4;
  }

  #view-portfolio .portfolio-news-panel {
    order: 5;
  }

  #view-portfolio .portfolio-history-panel {
    order: 6;
  }

  .form-grid,
  .holdings-form,
  .journal-form,
  .technical-controls {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .form-grid input,
  .form-grid select,
  .journal-form input,
  .journal-form select,
  .technical-controls input,
  .technical-controls select {
    min-height: 42px;
  }

  .stock-view-grid,
  .stock-view-grid.compact,
  .stock-view-grid.list {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .stock-tile,
  .stock-view-grid.compact .stock-tile {
    min-height: 0;
    padding: 12px;
    border-radius: 14px;
  }

  .stock-tile-head,
  .tile-price-row,
  .tile-actions {
    gap: 8px;
  }

  .stock-tile-head strong,
  .stock-view-grid.compact .stock-tile-head strong {
    font-size: 19px;
  }

  .tile-price-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(96px, max-content);
    align-items: end;
  }

  .tile-price-row strong,
  .stock-view-grid.compact .tile-price-row strong {
    font-size: 29px;
    line-height: 1;
  }

  .tile-price-row em {
    max-width: none;
    min-width: 96px;
    justify-self: end;
    white-space: nowrap;
    text-align: right;
    font-size: 13px;
  }

  .mini-k-chart,
  .stock-view-grid.compact .mini-k-chart {
    height: 96px;
    margin: 9px 0;
  }

  .tile-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .tile-stat-grid > div:nth-child(n + 5),
  .stock-view-grid.compact .tile-stat-grid > div:nth-child(n + 5) {
    display: grid;
  }

  .stock-tile p {
    min-height: 0;
    font-size: 12px;
    line-height: 1.45;
  }

  .panel-actions,
  .layout-switch,
  .mode-switch,
  .priority-actions,
  .chart-action-row {
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .panel-actions::-webkit-scrollbar,
  .layout-switch::-webkit-scrollbar,
  .mode-switch::-webkit-scrollbar,
  .priority-actions::-webkit-scrollbar,
  .chart-action-row::-webkit-scrollbar {
    display: none;
  }

  .layout-button,
  .mode-button,
  .small-button {
    flex: 0 0 auto;
  }

  .watch-priority-panel,
  .trader-personality-panel,
  .stock-qa-card,
  .portfolio-news-panel,
  .portfolio-history-panel {
    border-radius: 14px;
  }

  .watch-priority-panel .small-button,
  .chart-action-row .small-button,
  .small-button {
    border-color: rgba(84, 214, 255, 0.32);
    background: rgba(7, 28, 49, 0.92);
    color: #e7f4ff;
  }

  .table-wrap {
    max-width: 100%;
    max-height: 58vh;
    overflow: auto;
    border-radius: 12px;
  }

  table {
    min-width: 720px;
  }

  .technical-panel {
    padding: 14px;
  }

  .technical-box,
  .technical-head,
  .stock-lab,
  .stock-lab > *,
  .advisor-card,
  .chart-card {
    min-width: 0;
  }

  .stock-lab {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stock-detail-nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
  }

  .stock-detail-nav::-webkit-scrollbar {
    display: none;
  }

  .stock-detail-tab {
    flex: 0 0 auto;
    min-width: 92px;
    white-space: nowrap;
  }

  #kChart {
    height: 350px !important;
  }

  #indicatorChart {
    height: 200px !important;
  }
}

/* Mobile final polish: keep controls readable and stop old horizontal grids from clipping cards. */
@media (max-width: 720px) {
  .panel-title {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px;
    align-items: start;
  }

  .panel-title > .pill,
  .panel-title > .count-badge {
    justify-self: start;
  }

  .panel-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px;
    width: 100%;
    justify-content: stretch;
    overflow: visible;
  }

  .panel-actions > .pill {
    justify-self: start;
    min-height: 26px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .layout-switch,
  .mode-switch {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    overflow: hidden;
  }

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

  .layout-button,
  .mode-button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
  }

  #view-dashboard .global-grid,
  #view-dashboard .radar-grid,
  #view-dashboard .sector-flow-grid,
  .global-grid,
  .radar-grid,
  .sector-flow-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto;
  }

  .global-card,
  .radar-card,
  .flow-row {
    width: 100%;
    max-width: 100%;
  }

  #view-dashboard .radar-panel .panel-title h2,
  #view-watch .panel-title h2,
  #view-portfolio .panel-title h2 {
    font-size: 19px;
  }
}

/* Mobile v5 final pass: this block intentionally lives last and overrides older phone experiments. */
@media (max-width: 720px) {
  body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .command-header h1 {
    font-size: 16px !important;
    line-height: 1.1;
  }

  .system-strip div,
  .system-strip label,
  .system-strip div:nth-of-type(n + 4),
  .system-strip div:nth-of-type(n + 5) {
    flex-basis: 122px !important;
    min-height: 44px !important;
    padding: 6px 8px !important;
  }

  .system-strip strong,
  .system-strip input {
    font-size: 11.5px !important;
    line-height: 1.12 !important;
  }

  .live-tape {
    grid-template-columns: 74px minmax(0, 1fr) !important;
    height: 42px !important;
    min-height: 42px !important;
    background: rgba(3, 14, 28, 0.96) !important;
  }

  .live-tape-head {
    position: relative !important;
    z-index: 3 !important;
    min-height: 42px !important;
    padding-left: 8px !important;
    background:
      linear-gradient(90deg, rgba(4, 16, 31, 0.99), rgba(4, 16, 31, 0.98) 78%, rgba(4, 16, 31, 0.76)) !important;
    box-shadow: 14px 0 18px rgba(2, 7, 17, 0.9) !important;
  }

  .live-tape-track {
    position: relative !important;
    z-index: 1 !important;
    align-items: center !important;
  }

  .tape-chip {
    flex: 0 0 178px !important;
    max-width: 178px !important;
    min-height: 30px !important;
    padding: 5px 8px !important;
    border-radius: 14px !important;
  }

  #view-dashboard .market-panel {
    contain-intrinsic-size: 270px !important;
  }

  #view-dashboard .market-panel .panel-title {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
  }

  #view-dashboard .market-panel .panel-title .pill {
    justify-self: end !important;
  }

  #view-dashboard .market-panel .index-grid,
  .market-panel .index-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
    scroll-snap-type: none !important;
  }

  #view-dashboard .market-panel .index-card,
  .market-panel .index-grid > .index-card {
    flex: none !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 98px !important;
    padding: 12px !important;
    border-radius: 15px !important;
    scroll-snap-align: none !important;
  }

  #view-dashboard .market-panel .index-card:nth-child(3) {
    grid-column: 1 / -1 !important;
    min-height: 82px !important;
  }

  #view-dashboard .market-panel .index-card strong {
    margin-top: 8px !important;
    font-size: 25px !important;
    line-height: 1 !important;
    font-variant-numeric: tabular-nums;
  }

  #view-dashboard .market-panel .index-card:nth-child(3) strong {
    font-size: 28px !important;
  }

  #view-dashboard .market-panel .index-card em {
    margin-top: 7px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  #view-dashboard .market-panel .judgement {
    margin-top: 10px !important;
    padding: 12px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
  }

  #view-dashboard .global-panel {
    max-height: 540px !important;
  }

  #view-dashboard .global-grid,
  .global-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    gap: 9px !important;
    max-height: 408px !important;
    overflow: auto !important;
    padding-right: 1px !important;
  }

  .global-card {
    display: grid !important;
    align-content: start !important;
    gap: 6px !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 132px !important;
    padding: 11px !important;
    border-radius: 16px !important;
  }

  .global-card-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 5px !important;
    align-items: start !important;
  }

  .global-card span {
    overflow: hidden !important;
    color: #e7f4ff !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .global-symbol {
    max-width: 52px !important;
    border: 1px solid rgba(84, 214, 255, 0.2) !important;
    border-radius: 999px !important;
    padding: 2px 6px !important;
    color: #9edfff !important;
    font-size: 9.5px !important;
    line-height: 1.15 !important;
    text-align: center !important;
  }

  .global-card .sector-tag {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 3px 7px !important;
    overflow: hidden !important;
    color: #ffe6a9 !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .global-card strong {
    margin: 2px 0 0 !important;
    color: #f6fbff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }

  .global-card em {
    width: fit-content !important;
    margin: 0 !important;
    border-radius: 999px !important;
    padding: 3px 7px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }

  .global-time {
    color: #9fb9ce !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
  }

  .global-card::before,
  .radar-card::before,
  .index-card::before,
  .buy-row::before,
  .signal-row::before {
    display: none !important;
  }

  .global-card:active,
  .radar-card:active,
  .index-card:active,
  .stock-tile:active,
  .sector-chip:active,
  .flow-row:active {
    transform: scale(0.99) !important;
  }

  .view.active {
    animation: mobileViewIn 0.18s ease both;
  }
}

@keyframes mobileViewIn {
  from {
    opacity: 0.78;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mobile v4 cockpit polish: compact first screen and turn global markets into usable tiles. */
@media (max-width: 720px) {
  body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .app-shell {
    padding-inline: 7px;
  }

  .command-header {
    gap: 6px;
    margin-inline: -7px;
    padding: calc(7px + env(safe-area-inset-top)) 9px 8px;
  }

  .command-header h1 {
    font-size: 16px;
    line-height: 1.1;
  }

  .header-buttons {
    gap: 5px;
  }

  .header-buttons .ghost-button,
  .header-buttons .primary-button {
    height: 31px;
    min-height: 31px;
    border-radius: 10px;
    font-size: 11px;
  }

  .system-strip {
    gap: 6px;
    margin-bottom: 6px;
  }

  .system-strip div,
  .system-strip label,
  .system-strip div:nth-of-type(n + 4),
  .system-strip div:nth-of-type(n + 5) {
    flex-basis: 122px;
    min-height: 44px;
    padding: 6px 8px;
    border-radius: 13px;
    background:
      linear-gradient(180deg, rgba(9, 28, 50, 0.96), rgba(5, 16, 31, 0.92));
  }

  .system-strip strong,
  .system-strip input {
    font-size: 11.5px;
    line-height: 1.12;
  }

  .live-tape {
    grid-template-columns: 74px minmax(0, 1fr);
    height: 42px;
    min-height: 42px;
    border-color: rgba(84, 214, 255, 0.28);
    background: rgba(3, 14, 28, 0.96);
  }

  .live-tape-head {
    position: relative;
    z-index: 3;
    min-height: 42px;
    padding-left: 8px;
    background:
      linear-gradient(90deg, rgba(4, 16, 31, 0.98), rgba(4, 16, 31, 0.96) 78%, rgba(4, 16, 31, 0.72));
    box-shadow: 14px 0 18px rgba(2, 7, 17, 0.88);
  }

  .live-tape-track {
    position: relative;
    z-index: 1;
    align-items: center;
  }

  .tape-chip {
    flex-basis: 178px !important;
    max-width: 178px;
    min-height: 30px;
    padding: 5px 8px;
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(17, 47, 76, 0.96), rgba(8, 30, 54, 0.9));
  }

  #view-dashboard .panel {
    padding: 13px;
    border-radius: 18px;
    background:
      radial-gradient(circle at 88% 0%, rgba(84, 214, 255, 0.1), transparent 34%),
      linear-gradient(180deg, rgba(8, 22, 40, 0.94), rgba(5, 15, 30, 0.92));
  }

  #view-dashboard .market-panel {
    contain-intrinsic-size: 270px;
  }

  #view-dashboard .market-panel .panel-title {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center;
  }

  #view-dashboard .market-panel .panel-title .pill {
    justify-self: end;
  }

  #view-dashboard .market-panel .index-grid,
  .market-panel .index-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
    overflow: visible !important;
    padding-bottom: 0;
    scroll-snap-type: none;
  }

  #view-dashboard .market-panel .index-card,
  .market-panel .index-grid > .index-card {
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 98px;
    padding: 12px;
    border-radius: 15px;
    scroll-snap-align: none;
  }

  #view-dashboard .market-panel .index-card:nth-child(3) {
    grid-column: 1 / -1;
    min-height: 82px;
  }

  #view-dashboard .market-panel .index-card span {
    font-size: 11px;
  }

  #view-dashboard .market-panel .index-card strong {
    margin-top: 8px;
    font-size: 25px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  #view-dashboard .market-panel .index-card:nth-child(3) strong {
    font-size: 28px;
  }

  #view-dashboard .market-panel .index-card em {
    margin-top: 7px;
    font-size: 12px;
    line-height: 1.25;
  }

  #view-dashboard .market-panel .judgement {
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
  }

  #view-dashboard .global-panel {
    max-height: 540px;
  }

  #view-dashboard .global-grid,
  .global-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px;
    max-height: 408px;
    overflow: auto !important;
    padding-right: 1px;
  }

  .global-card {
    position: relative;
    display: grid;
    align-content: start;
    gap: 6px;
    min-height: 132px;
    width: auto;
    padding: 11px;
    border-radius: 16px;
    background:
      radial-gradient(circle at 100% 0%, rgba(84, 214, 255, 0.18), transparent 42%),
      linear-gradient(180deg, rgba(12, 35, 61, 0.98), rgba(6, 19, 36, 0.96));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  }

  .global-card.index-global {
    border-color: rgba(84, 214, 255, 0.28);
  }

  .global-card.sector-global {
    border-color: rgba(255, 209, 102, 0.22);
  }

  .global-card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px;
    align-items: start;
  }

  .global-card span,
  .global-card small {
    min-width: 0;
  }

  .global-card span {
    overflow: hidden;
    color: #e7f4ff;
    font-size: 12px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .global-symbol {
    max-width: 52px;
    border: 1px solid rgba(84, 214, 255, 0.2);
    border-radius: 999px;
    padding: 2px 6px;
    color: #9edfff !important;
    font-size: 9.5px !important;
    line-height: 1.15;
    text-align: center;
  }

  .global-card .sector-tag {
    max-width: 100%;
    margin: 0;
    padding: 3px 7px;
    overflow: hidden;
    color: #ffe6a9;
    font-size: 10px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .global-card strong {
    margin: 2px 0 0;
    color: #f6fbff;
    font-size: 22px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }

  .global-card em {
    width: fit-content;
    margin: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.04);
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .global-time {
    color: #9fb9ce !important;
    font-size: 10px !important;
    line-height: 1.25;
  }

  .global-card::before,
  .radar-card::before,
  .index-card::before,
  .buy-row::before,
  .signal-row::before {
    display: none;
  }

  .global-card:active,
  .radar-card:active,
  .index-card:active,
  .stock-tile:active,
  .sector-chip:active,
  .flow-row:active {
    transform: scale(0.99) !important;
  }

  .radar-grid,
  .stock-view-grid {
    gap: 9px;
  }

  .radar-card,
  .stock-tile {
    border-radius: 16px;
    background:
      radial-gradient(circle at 95% 0%, rgba(84, 214, 255, 0.11), transparent 35%),
      linear-gradient(180deg, rgba(9, 29, 51, 0.96), rgba(5, 17, 32, 0.94));
  }

  .view.active {
    animation: mobileViewIn 0.18s ease both;
  }
}

@keyframes mobileViewIn {
  from {
    opacity: 0.78;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Mobile final polish: keep controls readable and stop old horizontal grids from clipping cards. */
@media (max-width: 720px) {
  .panel-title {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px;
    align-items: start;
  }

  .panel-title > .pill,
  .panel-title > .count-badge {
    justify-self: start;
  }

  .panel-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px;
    width: 100%;
    justify-content: stretch;
    overflow: visible;
  }

  .panel-actions > .pill {
    justify-self: start;
    min-height: 26px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .layout-switch,
  .mode-switch {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    overflow: hidden;
  }

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

  .layout-button,
  .mode-button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
  }

  #view-dashboard .global-grid,
  #view-dashboard .radar-grid,
  #view-dashboard .sector-flow-grid,
  .global-grid,
  .radar-grid,
  .sector-flow-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto;
  }

  .global-card,
  .radar-card,
  .flow-row {
    width: 100%;
    max-width: 100%;
  }

  #view-dashboard .radar-panel .panel-title h2,
  #view-watch .panel-title h2,
  #view-portfolio .panel-title h2 {
    font-size: 19px;
  }
}

/* Mobile final polish: keep controls readable and stop old horizontal grids from clipping cards. */
@media (max-width: 720px) {
  .panel-title {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: start;
  }

  .panel-title > .pill,
  .panel-title > .count-badge {
    justify-self: start;
  }

  .panel-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    width: 100%;
    justify-content: stretch;
    overflow: visible;
  }

  .panel-actions > .pill {
    justify-self: start;
    min-height: 26px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .layout-switch,
  .mode-switch {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    overflow: hidden;
  }

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

  .layout-button,
  .mode-button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
  }

  #view-dashboard .global-grid,
  #view-dashboard .radar-grid,
  #view-dashboard .sector-flow-grid,
  .global-grid,
  .radar-grid,
  .sector-flow-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto;
  }

  .global-card,
  .radar-card,
  .flow-row {
    width: 100%;
    max-width: 100%;
  }

  #view-dashboard .radar-panel .panel-title h2,
  #view-watch .panel-title h2,
  #view-portfolio .panel-title h2 {
    font-size: 19px;
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 0;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96) 0, rgba(255, 253, 248, 0.55) 290px, transparent 520px),
    radial-gradient(circle at top left, rgba(184, 137, 47, 0.18), transparent 310px),
    linear-gradient(135deg, #f9f4ea, #eef3fb 58%, #f7efe2);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.app-shell {
  width: min(1340px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 34px;
}

.command-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid rgba(184, 137, 47, 0.38);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 253, 248, 0.94), rgba(244, 230, 198, 0.46));
  box-shadow: var(--shadow);
}

.command-header > div {
  min-width: 0;
}

.eyebrow,
.kicker {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: var(--royal);
  font-size: clamp(30px, 4.2vw, 56px);
  line-height: 1.04;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

h1 span {
  display: inline-block;
}

h2 {
  margin-bottom: 0;
  color: var(--royal);
  font-size: 20px;
}

.subline {
  margin-bottom: 0;
  color: var(--muted);
  font-weight: 800;
}

.muted-note {
  color: #a8cee6;
}

.header-actions {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 10px;
}

.header-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.ghost-button {
  min-width: 108px;
  height: 42px;
  border-radius: 8px;
  font-weight: 950;
}

.primary-button {
  border: 1px solid #0f315f;
  background: linear-gradient(180deg, var(--royal-2), var(--royal));
  color: #fff;
  box-shadow: 0 10px 22px rgba(23, 59, 115, 0.22);
}

.ghost-button {
  border: 1px solid rgba(184, 137, 47, 0.55);
  background: #fffaf0;
  color: var(--royal);
}

.system-strip,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.system-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 14px;
}

.system-strip div,
.system-strip label {
  display: grid;
  gap: 6px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.76);
}

.system-strip span,
.system-strip label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.system-strip strong {
  color: var(--royal);
  font-size: 16px;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

input::placeholder {
  color: #9aa2ad;
}

.view {
  display: none;
  opacity: 0;
  transform: translateY(10px) scale(0.995);
}

.view.active {
  display: block;
  animation: view-enter 0.28s ease both;
}

.panel,
.index-card,
.stock-tile,
.metric-card {
  position: relative;
}

.panel::after,
.index-card::after,
.stock-tile::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 0%, rgba(84, 214, 255, 0.12) 42%, transparent 72%);
  opacity: 0;
  transform: translateX(-24%);
  transition: opacity 0.18s ease, transform 0.36s ease;
}

.panel:hover::after,
.index-card:hover::after,
.stock-tile:hover::after {
  opacity: 1;
  transform: translateX(24%);
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
  gap: 14px;
}

.radar-panel,
.buy-panel,
.holding-panel {
  grid-column: 1 / -1;
}

.global-panel,
.sector-panel,
.sector-flow-panel,
.news-panel,
.outlook-panel {
  min-height: 230px;
}

.panel-explain {
  margin: -4px 0 12px;
  color: #bcd7ea;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.65;
}

.panel {
  padding: 16px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title.compact {
  margin-bottom: 10px;
}

.pill,
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 10px;
  border: 1px solid rgba(184, 137, 47, 0.42);
  border-radius: 999px;
  background: #fff8e8;
  color: var(--royal);
  font-size: 12px;
  font-weight: 950;
}

.pill.green,
.signal.green,
.lamp.green {
  color: var(--green);
}

.pill.yellow,
.signal.yellow,
.lamp.yellow {
  color: var(--yellow);
}

.pill.red,
.signal.red,
.lamp.red {
  color: var(--red);
}

.pill.gray,
.signal.gray,
.lamp.gray,
.muted {
  color: var(--gray);
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.index-card,
.metric-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--panel-3));
}

.index-card {
  min-height: 116px;
  padding: 14px;
  box-shadow: inset 0 3px 0 rgba(184, 137, 47, 0.22);
}

.index-card span,
.metric-card span,
.mini-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.index-card strong {
  display: block;
  margin: 10px 0 6px;
  color: var(--royal);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
}

.index-card em {
  font-style: normal;
  font-weight: 950;
}

.futures-card {
  overflow: hidden;
  border-color: rgba(84, 214, 255, 0.34);
  background:
    radial-gradient(circle at 18% 18%, rgba(84, 214, 255, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(5, 19, 36, 0.96), rgba(8, 31, 54, 0.88));
}

.futures-card span,
.futures-card em {
  color: #a8cee6;
}

.futures-card strong {
  color: #f6fbff;
  text-shadow: 0 0 22px rgba(84, 214, 255, 0.28);
}

.futures-card::before {
  content: "";
  position: absolute;
  inset: -40% -20%;
  pointer-events: none;
  background: conic-gradient(from 90deg, transparent, rgba(84, 214, 255, 0.12), transparent, rgba(255, 209, 102, 0.08), transparent);
  opacity: 0.7;
  animation: futuresOrbit 8s linear infinite;
}

@keyframes futuresOrbit {
  to {
    transform: rotate(360deg);
  }
}

.judgement {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(23, 59, 115, 0.18);
  border-radius: 8px;
  background: #eef4fb;
  color: var(--royal);
  line-height: 1.55;
  font-weight: 800;
}

.alert-list,
.buy-list,
.signal-board,
.journal-list,
.sector-list,
.news-list {
  display: grid;
  gap: 10px;
}

.alert-item,
.buy-row,
.signal-row,
.journal-item,
.news-item,
.sector-chip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.global-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.global-card {
  min-height: 128px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbf6ec);
}

.global-card span,
.global-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.sector-tag {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  border: 1px solid rgba(84, 214, 255, 0.22);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(84, 214, 255, 0.08);
  color: #54d6ff;
  font-size: 11px;
  font-weight: 950;
}

.global-card.sox-global {
  border-color: rgba(77, 255, 209, 0.45);
  box-shadow:
    0 0 0 1px rgba(77, 255, 209, 0.16),
    0 18px 40px rgba(0, 255, 209, 0.12);
}

.global-card.sox-proxy-global {
  border-color: rgba(255, 207, 80, 0.35);
}

.global-card strong {
  display: block;
  margin: 10px 0 6px;
  color: var(--royal);
  font-size: 27px;
  line-height: 1;
}

.global-card em {
  display: block;
  margin-bottom: 10px;
  font-style: normal;
  font-weight: 950;
}

.sector-chip strong {
  display: block;
  margin-bottom: 4px;
  color: var(--royal);
}

.sector-chip span,
.news-item span {
  color: var(--muted);
  font-size: 13px;
}

.sector-heat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  align-items: center;
  gap: 10px;
}

.sector-heat em {
  color: #f6fbff;
  font-style: normal;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.heat-meter {
  height: 9px;
  overflow: hidden;
  border: 1px solid rgba(84, 214, 255, 0.22);
  border-radius: 999px;
  background: rgba(84, 214, 255, 0.08);
}

.heat-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #13b981, #ffd166, #ff5f6d);
  box-shadow: 0 0 18px rgba(84, 214, 255, 0.22);
}

.news-quote-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.news-quote-chips > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 999px;
  background: rgba(231, 244, 255, 0.06);
  color: #d9e9f6;
  font-size: 12px;
  font-weight: 850;
}

.quote-chip.up {
  border-color: rgba(255, 95, 109, 0.35);
  color: #ffd7dc;
}

.quote-chip.down {
  border-color: rgba(19, 185, 129, 0.35);
  color: #c8f8e7;
}

.news-item {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.news-item strong {
  display: block;
  margin-bottom: 5px;
  color: var(--royal);
  line-height: 1.45;
}

.outlook-box {
  padding: 14px;
  border: 1px solid rgba(184, 137, 47, 0.36);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffaf0, #ffffff);
  color: var(--ink);
  line-height: 1.65;
}

.outlook-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--royal);
  font-size: 22px;
}

.outlook-box p {
  margin-bottom: 8px;
}

.technical-panel {
  margin-top: 14px;
}

.technical-controls {
  display: grid;
  grid-template-columns: 1fr 150px 120px 120px;
  gap: 10px;
  margin-bottom: 12px;
}

.technical-box {
  padding: 14px;
  border: 1px solid rgba(184, 137, 47, 0.36);
  border-radius: 8px;
  background: #fff;
  line-height: 1.6;
}

.technical-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.technical-head strong,
.technical-grid strong {
  color: var(--royal);
}

.technical-head span,
.technical-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

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

.technical-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.technical-summary {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(23, 59, 115, 0.18);
  border-radius: 8px;
  background: #eef4fb;
}

.technical-summary strong {
  display: block;
  color: var(--royal);
  font-size: 18px;
}

.technical-summary span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.technical-detail {
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.technical-detail h3 {
  margin: 0 0 8px;
  color: var(--royal);
  font-size: 16px;
}

.technical-detail ul {
  margin: 0;
  padding-left: 20px;
}

.technical-detail li {
  margin-bottom: 6px;
}

.clickable-stock {
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.clickable-stock:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 22px 46px rgba(8, 84, 139, 0.16);
}

/* Futuristic cockpit skin */
:root {
  --bg: #07111d;
  --paper: rgba(247, 251, 255, 0.92);
  --panel: rgba(248, 252, 255, 0.9);
  --panel-2: rgba(230, 244, 255, 0.72);
  --panel-3: rgba(241, 247, 252, 0.94);
  --ink: #102033;
  --muted: #607287;
  --line: rgba(74, 133, 174, 0.24);
  --royal: #0a2b58;
  --royal-2: #0d5f9e;
  --gold: #c89d45;
  --gold-soft: #fff0c8;
  --green: #00a878;
  --yellow: #c98a15;
  --red: #d83b53;
  --gray: #7d8a9a;
  --tech: #08b8ff;
  --mint: #2ce7b4;
  --shadow: 0 24px 70px rgba(5, 18, 34, 0.18);
}

body {
  background:
    linear-gradient(rgba(8, 184, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(8, 184, 255, 0.08) 1px, transparent 1px),
    linear-gradient(135deg, #eef8ff 0%, #f9fcff 42%, #fff8e8 100%);
  background-size: 34px 34px, 34px 34px, auto;
  font-family: "Aptos Display", "Noto Sans TC", "PingFang TC", sans-serif;
}

.command-header {
  position: relative;
  overflow: hidden;
  border-color: rgba(8, 184, 255, 0.22);
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.94), rgba(226, 246, 255, 0.9) 54%, rgba(255, 242, 211, 0.82));
}

.command-header::after {
  content: "";
  position: absolute;
  inset: auto 22px 0 22px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--tech), var(--gold), transparent);
}

.eyebrow,
.kicker {
  color: #0576ad;
}

.primary-button {
  border-color: rgba(8, 184, 255, 0.55);
  background: linear-gradient(135deg, #08345f, #0a77b7 58%, #0f345c);
  box-shadow: 0 12px 26px rgba(8, 84, 139, 0.25);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(8, 184, 255, 0.28);
}

.system-strip,
.panel,
.bottom-nav {
  backdrop-filter: blur(18px);
  border-color: rgba(8, 184, 255, 0.18);
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(241, 248, 255, 0.86));
}

.index-card,
.radar-card,
.global-card,
.metric-card,
.mini-card,
.alert-item,
.buy-row,
.signal-row,
.journal-item,
.news-item,
.sector-chip,
.technical-box {
  border-color: rgba(8, 184, 255, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 248, 255, 0.9));
}

.radar-card,
.global-card {
  box-shadow: 0 16px 34px rgba(7, 43, 77, 0.1);
}

.pill,
.count-badge {
  border-color: rgba(8, 184, 255, 0.2);
  background: rgba(232, 247, 255, 0.82);
}

.bottom-nav {
  background: rgba(249, 253, 255, 0.9);
}

.nav-item.active {
  background: linear-gradient(180deg, rgba(218, 244, 255, 0.95), rgba(255, 240, 200, 0.9));
}

.stock-lab {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.advisor-card {
  grid-column: span 4;
}

.scan-card {
  grid-column: span 12;
}

.chart-card {
  grid-column: span 8;
}

.institution-card,
.intraday-card {
  grid-column: span 6;
}

.chips-card {
  grid-column: span 12;
}

.company-card {
  grid-column: span 5;
}

.position-card {
  grid-column: span 7;
}

.anomaly-signal-card {
  grid-column: span 12;
}

.advisor-card,
.chart-card,
.company-card,
.position-card,
.scan-card,
.anomaly-signal-card,
.chips-card,
.institution-card,
.intraday-card {
  border: 1px solid rgba(8, 184, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(235, 247, 255, 0.92));
  box-shadow: 0 14px 30px rgba(7, 43, 77, 0.08);
  padding: 14px;
}

.advisor-card {
  min-height: 210px;
}

.advisor-card span,
.chart-toolbar span,
.company-card span,
.position-card span,
.scan-card span,
.anomaly-signal-card span,
.chips-card span,
.institution-card p,
.intraday-card p {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.advisor-card strong {
  display: block;
  margin: 8px 0;
  color: var(--royal);
  font-size: 24px;
  line-height: 1.15;
}

.advisor-card p {
  margin: 0;
  color: #26384a;
  line-height: 1.7;
}

.advisor-evidence {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.advisor-evidence i {
  display: block;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.08);
  padding: 8px;
  color: #ccecff;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
  line-height: 1.45;
}

.advisor-news {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.advisor-news a,
.advisor-news small {
  color: #9ee8ff;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
  text-decoration: none;
}

.strategy-score-card {
  grid-column: span 12;
  border: 1px solid rgba(84, 214, 255, 0.2);
  border-radius: 8px;
  background:
    radial-gradient(circle at top right, rgba(255, 95, 109, 0.12), transparent 36%),
    linear-gradient(180deg, rgba(7, 19, 36, 0.98), rgba(6, 26, 47, 0.9));
  padding: 14px;
}

.strategy-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
}

.strategy-total strong {
  color: #ff5f6d;
  font-size: 44px;
  line-height: 1;
  text-shadow: 0 0 24px rgba(255, 95, 109, 0.22);
}

.strategy-total span {
  color: #9fb9ce;
  font-size: 12px;
  font-weight: 950;
}

.strategy-bars {
  display: grid;
  gap: 8px;
}

.strategy-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 44px minmax(0, 1.4fr);
  align-items: center;
  gap: 9px;
}

.strategy-row span,
.strategy-row em {
  color: #bcd7ea;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.strategy-row div {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(231, 244, 255, 0.08);
}

.strategy-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #54d6ff, #ff5f6d);
}

.chart-range-control {
  display: grid;
  grid-template-columns: minmax(190px, 0.45fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 8px 0 12px;
}

.chart-range-control span {
  color: #bcd7ea;
  font-size: 12px;
  font-weight: 900;
}

.chart-range-control input {
  accent-color: #54d6ff;
}

.chart-live-strip {
  display: grid;
  grid-template-columns: 1.05fr 1.15fr 0.9fr 1.5fr;
  gap: 8px;
  margin: 10px 0 12px;
}

.chart-live-strip div {
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(84, 214, 255, 0.1), rgba(84, 214, 255, 0.035)),
    rgba(3, 11, 24, 0.38);
  padding: 10px;
  min-width: 0;
}

.chart-live-strip span,
.chart-live-strip em {
  display: block;
  color: #9fc7dd;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.chart-live-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.scan-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  overflow: hidden;
}

.scan-orb {
  display: grid;
  place-items: center;
  width: 130px;
  height: 130px;
  border: 1px solid rgba(84, 214, 255, 0.35);
  border-radius: 50%;
  background:
    conic-gradient(from 180deg, rgba(84, 214, 255, 0.95) var(--scan-score), rgba(84, 214, 255, 0.08) 0),
    radial-gradient(circle, rgba(5, 15, 30, 1) 54%, rgba(84, 214, 255, 0.12) 56%);
  box-shadow: 0 0 38px rgba(84, 214, 255, 0.16), inset 0 0 30px rgba(2, 7, 17, 0.9);
  animation: scanPulse 1.8s ease-in-out infinite alternate;
}

.scan-orb strong {
  color: #fff;
  font-size: 34px;
  line-height: 1;
}

.scan-orb span {
  color: #54d6ff;
}

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

.scan-steps div,
.anomaly-signal,
.pretrade-dashboard div {
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
  padding: 10px;
}

.scan-steps strong,
.anomaly-signal strong,
.pretrade-dashboard strong {
  display: block;
  margin-top: 4px;
  color: #f6fbff;
}

@keyframes scanPulse {
  to {
    filter: brightness(1.22);
    transform: scale(1.015);
  }
}

.anomaly-signal-list,
.pretrade-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.pretrade-simulator {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.pretrade-simulator label,
.pretrade-simulator div {
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
  padding: 9px;
}

.pretrade-simulator span {
  display: block;
  color: #9fb9ce;
  font-size: 11px;
  font-weight: 900;
}

.pretrade-simulator input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(84, 214, 255, 0.22);
  background: transparent;
  color: #f6fbff;
  font-weight: 950;
  outline: 0;
}

.pretrade-simulator strong {
  display: block;
  margin-top: 3px;
  color: #f6fbff;
  font-size: 15px;
}

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

.chips-grid div {
  padding: 10px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
}

.chips-grid strong,
.chips-grid em {
  display: block;
}

.chips-grid strong {
  margin-top: 4px;
  color: #f6fbff;
}

.chips-grid em {
  margin-top: 5px;
  color: #9fb9ce;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.chips-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chips-note span {
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(84, 214, 255, 0.07);
}

.anomaly-signal span {
  color: #54d6ff;
}

.anomaly-signal.warn span {
  color: #ffd166;
}

.anomaly-signal.fail span {
  color: #ff5f6d;
}

.anomaly-signal p {
  margin: 6px 0 0;
  color: #c2d8ea;
  font-size: 12px;
  line-height: 1.5;
}

.credibility-badge {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 9px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
}

.credibility-badge strong {
  color: #f6fbff;
}

.credibility-badge.pass {
  border-color: rgba(84, 214, 255, 0.36);
}

.credibility-badge.warn {
  border-color: rgba(255, 209, 102, 0.42);
}

.credibility-badge.fail {
  border-color: rgba(255, 95, 109, 0.42);
}

.company-intro,
.position-card p {
  margin: 0 0 12px;
  color: #26384a;
  line-height: 1.7;
}

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

.company-grid div,
.position-list li {
  border: 1px solid rgba(8, 184, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  padding: 10px;
}

.company-grid strong,
.position-list strong {
  display: block;
  margin-top: 4px;
  color: var(--royal);
  font-size: 14px;
}

.company-actions,
.concept-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.company-actions span,
.profile-link,
.concept-pills span {
  border: 1px solid rgba(8, 184, 255, 0.22);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(8, 184, 255, 0.08);
  color: var(--royal);
  font-size: 12px;
  font-weight: 950;
  text-decoration: none;
}

.classification-note {
  display: grid;
  gap: 5px;
  margin: 10px 0 12px;
  padding: 10px;
  border: 1px solid rgba(255, 209, 102, 0.2);
  border-radius: 8px;
  background: rgba(255, 209, 102, 0.07);
}

.classification-note strong {
  color: #ffd166;
  font-size: 13px;
}

.classification-note span {
  color: #c2d8ea;
  line-height: 1.55;
}

.position-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.position-list span {
  margin-top: 4px;
  line-height: 1.55;
}

.technical-loading {
  border: 1px solid rgba(84, 214, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(7, 19, 36, 0.98), rgba(6, 26, 47, 0.9));
  color: #e7f4ff;
  padding: 16px;
}

.technical-loading strong,
.technical-loading span {
  display: block;
}

.technical-loading span {
  margin-top: 4px;
  color: #a8cee6;
  font-size: 12px;
  font-weight: 850;
}

.loading-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.loading-grid i {
  display: block;
  height: 64px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(84, 214, 255, 0.08), rgba(84, 214, 255, 0.2), rgba(84, 214, 255, 0.08));
}

.advisor-card.positive {
  border-color: rgba(216, 59, 83, 0.28);
}

.advisor-card.caution {
  border-color: rgba(201, 138, 21, 0.38);
}

.advisor-card.defense {
  border-color: rgba(0, 168, 120, 0.3);
}

.chart-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.chart-toolbar strong {
  color: var(--royal);
}

#kChart {
  display: block;
  width: 100%;
  height: 500px;
  border: 1px solid rgba(8, 184, 255, 0.18);
  border-radius: 8px;
  background: #07111d;
}

.indicator-drawer {
  margin-top: 12px;
  border: 1px solid rgba(8, 184, 255, 0.18);
  border-radius: 8px;
  background: rgba(7, 17, 29, 0.96);
  overflow: hidden;
}

.indicator-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 0 12px;
  color: #e7f4ff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 950;
  list-style: none;
}

.indicator-drawer summary::-webkit-details-marker {
  display: none;
}

.indicator-drawer summary::after {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(84, 214, 255, 0.32);
  border-radius: 50%;
  color: #54d6ff;
}

.indicator-drawer[open] summary::after {
  content: "-";
}

.indicator-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 10px;
}

.indicator-tab {
  min-width: 72px;
  height: 34px;
  border: 1px solid rgba(84, 214, 255, 0.22);
  border-radius: 8px;
  background: rgba(231, 244, 255, 0.08);
  color: rgba(231, 244, 255, 0.78);
  font-size: 12px;
  font-weight: 950;
}

.indicator-tab.active {
  border-color: rgba(84, 214, 255, 0.62);
  background: linear-gradient(135deg, rgba(8, 184, 255, 0.36), rgba(200, 157, 69, 0.26));
  color: #fff;
}

.timeframe-switch {
  display: inline-grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  padding: 3px;
  border: 1px solid rgba(84, 214, 255, 0.24);
  border-radius: 8px;
  background: rgba(2, 7, 17, 0.56);
}

.timeframe-button,
.pretrade-trigger {
  border: 1px solid rgba(84, 214, 255, 0.22);
  border-radius: 7px;
  background: rgba(84, 214, 255, 0.08);
  color: #dff7ff;
  font-size: 12px;
  font-weight: 950;
}

.timeframe-button {
  min-width: 54px;
  height: 28px;
  border: 0;
  background: transparent;
}

.timeframe-button.active {
  background: linear-gradient(135deg, rgba(84, 214, 255, 0.32), rgba(255, 209, 102, 0.16));
  color: #fff;
}

.pretrade-trigger {
  width: fit-content;
  min-height: 36px;
  margin-top: 12px;
  padding: 0 12px;
}

#indicatorChart {
  display: block;
  width: calc(100% - 24px);
  height: 270px;
  margin: 0 12px 12px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: #07111d;
}

.institution-grid {
  display: grid;
  gap: 8px;
}

.institution-grid div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(8, 184, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.institution-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.institution-grid strong {
  color: var(--royal);
}

.institution-empty {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 240, 200, 0.7);
  color: #6f4a07;
}

.orderbook-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
  min-width: 460px;
}

.orderbook-table th,
.orderbook-table td {
  padding: 7px 5px;
  border-bottom: 1px solid rgba(84, 214, 255, 0.14);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.orderbook-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 8px;
}

.stock-detail-shell {
  grid-column: span 12;
  display: grid;
  gap: 12px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 8% 0%, rgba(84, 214, 255, 0.12), transparent 34%),
    rgba(3, 11, 24, 0.42);
  padding: 12px;
}

.stock-detail-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(2, 7, 17, 0.58);
}

.stock-detail-tab {
  min-height: 34px;
  border: 1px solid rgba(84, 214, 255, 0.2);
  border-radius: 7px;
  background: rgba(84, 214, 255, 0.06);
  color: #bfe8f8;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.stock-detail-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(84, 214, 255, 0.54);
  box-shadow: 0 10px 28px rgba(84, 214, 255, 0.12);
}

.stock-detail-tab.active {
  border-color: rgba(255, 209, 102, 0.55);
  background: linear-gradient(135deg, rgba(84, 214, 255, 0.18), rgba(255, 95, 109, 0.12));
  color: #ffffff;
}

.stock-tab-panel {
  min-width: 0;
  animation: tabReveal 0.22s ease both;
}

@keyframes tabReveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.stock-brief-grid,
.financial-grid,
.company-deep-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.stock-brief-grid > div,
.financial-grid > div,
.company-deep-grid article,
.peer-grid section,
.peer-grid button,
.peer-grid section > div,
.stock-news-list a {
  min-width: 0;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
  padding: 10px;
}

.stock-brief-grid span,
.financial-grid span,
.financial-grid em,
.company-deep-grid span,
.peer-grid span,
.peer-grid em,
.stock-news-list span,
.financial-note {
  color: #9fb9ce;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.stock-brief-grid strong,
.financial-grid strong,
.company-deep-grid strong,
.peer-grid strong,
.stock-news-list strong {
  display: block;
  margin-top: 4px;
  color: #f6fbff;
}

.stock-brief-grid p,
.company-deep-grid p,
.financial-note,
.peer-grid p {
  margin: 6px 0 0;
  color: #d9e9f6;
  font-size: 12px;
  line-height: 1.55;
}

.financial-card,
.company-deep-card,
.stock-news-card {
  display: grid;
  gap: 10px;
}

.peer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.peer-grid section {
  display: grid;
  gap: 7px;
}

.peer-grid button {
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.peer-grid button:hover,
.stock-news-list a:hover {
  border-color: rgba(84, 214, 255, 0.52);
  background: rgba(84, 214, 255, 0.11);
}

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

.stock-news-list a {
  color: inherit;
  text-decoration: none;
}

.stock-news-list a > em {
  display: block;
  margin-top: 6px;
  color: #79e2ff;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.watch-priority-panel,
.trader-personality-panel,
.stock-qa-card {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(7, 19, 36, 0.96), rgba(6, 26, 47, 0.88)),
    radial-gradient(circle at top right, rgba(84, 214, 255, 0.12), transparent 38%);
  color: #e7f4ff;
}

.priority-actions,
.chart-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.priority-grid,
.personality-grid,
.qa-grid,
.chart-insight-strip {
  display: grid;
  gap: 10px;
}

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

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

.chart-insight-strip {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 10px 0;
}

.priority-card,
.personality-card,
.qa-grid article,
.chart-insight-strip div {
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
}

.priority-card {
  color: inherit;
  text-align: left;
  transition: transform 0.16s ease, filter 0.16s ease, border-color 0.16s ease;
}

.priority-card:hover {
  transform: translateY(-2px);
  border-color: rgba(84, 214, 255, 0.48);
  filter: brightness(1.13);
}

.priority-card span,
.personality-card span,
.qa-grid span,
.chart-insight-strip span {
  display: block;
  color: #a8cee6;
  font-size: 12px;
  font-weight: 900;
}

.priority-card strong,
.personality-card strong,
.chart-insight-strip strong {
  display: block;
  margin-top: 4px;
  color: #f6fbff;
}

.priority-card strong {
  font-size: 28px;
  line-height: 1;
}

.priority-card em,
.personality-card p,
.qa-grid p {
  display: block;
  margin: 7px 0 0;
  color: #d9e9f6;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.55;
}

.personality-card.risk {
  border-color: rgba(255, 95, 109, 0.42);
}

.personality-card.warn {
  border-color: rgba(255, 209, 102, 0.36);
}

.personality-card.stable {
  border-color: rgba(19, 185, 129, 0.34);
}

.personality-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.personality-stats span {
  padding: 5px 9px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 999px;
  color: #bcd7ea;
  font-size: 12px;
  font-weight: 900;
}

.stock-qa-card {
  margin: 0;
}

.chart-toolbar-advanced {
  align-items: flex-start;
  flex-wrap: wrap;
}

.chart-title-stack {
  display: grid;
  gap: 4px;
  min-width: min(360px, 100%);
}

.chart-focus-button {
  min-height: 32px;
  padding: 0 11px;
  border: 1px solid rgba(84, 214, 255, 0.32);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(84, 214, 255, 0.2), rgba(255, 209, 102, 0.12));
  color: #e7f4ff;
  font-size: 12px;
  font-weight: 950;
}

body.chart-focus-active {
  overflow: hidden;
}

body.chart-focus-active .view.active {
  transform: none !important;
  filter: none !important;
  animation: none !important;
}

body.chart-focus-active .technical-panel {
  backdrop-filter: none !important;
}

body.chart-focus-active::before {
  content: none;
}

body.chart-focus-active .anomaly-radar,
body.chart-focus-active .quick-peek {
  display: none !important;
}

body.chart-focus-active .command-header,
body.chart-focus-active .system-strip,
body.chart-focus-active .live-tape,
body.chart-focus-active #view-signals > .panel:first-child {
  visibility: hidden !important;
}

.chart-card.chart-focus {
  position: fixed;
  inset: 14px;
  z-index: 80;
  display: block;
  overflow: auto;
  padding: 16px;
  border-color: rgba(84, 214, 255, 0.5);
  background:
    linear-gradient(180deg, rgba(5, 13, 25, 0.99), rgba(6, 26, 47, 0.98)),
    radial-gradient(circle at 80% 0%, rgba(84, 214, 255, 0.18), transparent 38%);
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.62);
}

.chart-card.chart-focus #kChart {
  height: min(62vh, 720px);
}

.chart-card.chart-focus #indicatorChart {
  height: min(30vh, 360px);
}

.technical-summary {
  background: linear-gradient(135deg, rgba(226, 246, 255, 0.96), rgba(255, 244, 214, 0.8));
}

.analysis-cue {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(8, 184, 255, 0.24);
  border-radius: 999px;
  background: rgba(226, 246, 255, 0.82);
  color: #05628f;
  font-size: 12px;
  font-weight: 950;
}

.buy-row .analysis-cue,
.signal-row .analysis-cue {
  display: inline-flex;
  margin-top: 7px;
}

.technical-panel {
  position: relative;
  overflow: hidden;
}

.technical-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 16%, rgba(8, 184, 255, 0.06) 16% 17%, transparent 17% 100%),
    radial-gradient(circle at 88% 8%, rgba(8, 184, 255, 0.16), transparent 210px);
}

.technical-panel > * {
  position: relative;
}

.technical-controls {
  align-items: center;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 150px;
  height: 42px;
  padding: 3px;
  border: 1px solid rgba(8, 184, 255, 0.26);
  border-radius: 8px;
  background: rgba(230, 244, 255, 0.86);
}

.mode-button {
  min-width: 0;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 950;
}

.mode-button.active {
  background: linear-gradient(135deg, #0a2b58, #08b8ff);
  color: #fff;
  box-shadow: 0 10px 20px rgba(8, 84, 139, 0.2);
}

.technical-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(8, 184, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(226, 246, 255, 0.82));
}

.technical-head strong {
  display: block;
  color: var(--royal);
  font-size: 22px;
}

.technical-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

@media (max-width: 1120px) {
  .stock-lab {
    grid-template-columns: 1fr;
  }

  .advisor-card,
  .chart-card,
  .company-card,
  .position-card,
  .scan-card,
  .anomaly-signal-card,
  .chips-card,
  .institution-card,
  .intraday-card,
  .pretrade-card {
    grid-column: auto;
  }

  #kChart {
    height: 360px;
  }

  #indicatorChart {
    height: 210px;
  }

  .scan-card,
  .scan-steps,
  .chips-grid,
  .anomaly-signal-list,
  .pretrade-dashboard {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .chart-toolbar,
  .pretrade-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .pretrade-list {
    grid-template-columns: 1fr;
  }
}

.alert-item strong {
  display: block;
  margin-bottom: 4px;
}

.alert-item span,
.buy-row span,
.signal-row span,
.journal-item span {
  color: var(--muted);
  font-size: 13px;
}

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

.radar-grid.list {
  grid-template-columns: 1fr;
}

.radar-grid.list .radar-card {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) 180px minmax(360px, 2fr) auto;
  align-items: center;
  gap: 14px;
}

.radar-grid.list .radar-head,
.radar-grid.list .price,
.radar-grid.list .delta,
.radar-grid.list .stat-grid,
.radar-grid.list .analysis-cue {
  margin: 0;
}

.radar-grid.list .stat-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.radar-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.radar-grid.compact .radar-card {
  min-height: 150px;
}

.radar-grid.compact .stat-grid,
.radar-grid.compact .analysis-cue {
  display: none;
}

.radar-grid.compact .price {
  font-size: 28px;
}

.radar-card {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #fbf6ec);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(44, 35, 21, 0.08);
}

.radar-head,
.buy-head,
.signal-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.symbol {
  color: var(--muted);
  font-size: 12px;
  font-weight: 950;
}

.name {
  margin-top: 3px;
  color: var(--royal);
  font-size: 20px;
  font-weight: 950;
}

.price {
  margin: 16px 0 8px;
  color: var(--royal);
  font-size: 38px;
  line-height: 1;
  font-weight: 950;
}

.delta {
  font-weight: 950;
}

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

.mini-card {
  padding: 9px;
}

.mini-card strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
}

.lamp {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85), 0 0 16px currentColor;
}

.buy-row {
  display: grid;
  grid-template-columns: 1fr 110px 1.5fr 150px;
  align-items: center;
  gap: 12px;
}

.zone-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.zone-line div {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(84, 214, 255, 0.1), rgba(5, 13, 25, 0.72));
  color: #e7f4ff;
}

.zone-line span {
  display: block;
  color: #a9c5d9;
  font-size: 12px;
  font-weight: 900;
}

.zone-line strong {
  display: block;
  overflow-wrap: anywhere;
  color: #f6fbff;
  font-size: 15px;
  line-height: 1.2;
}

.portfolio-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}

.metric-card {
  padding: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  color: var(--royal);
  font-size: 20px;
}

.risk-box {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(184, 137, 47, 0.36);
  border-radius: 8px;
  background: #fff8e8;
  color: #6f4a07;
  font-weight: 800;
}

.form-grid,
.journal-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.form-grid {
  grid-template-columns: repeat(4, 1fr) 130px;
}

.holdings-form {
  grid-template-columns: repeat(6, 1fr) 130px;
}

.journal-form {
  grid-template-columns: repeat(4, 1fr);
}

.journal-form .primary-button {
  grid-column: span 1;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.portfolio-history-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 20, 37, 0.88), rgba(9, 29, 51, 0.7)),
    radial-gradient(circle at top left, rgba(84, 214, 255, 0.12), transparent 34%);
}

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

.history-stat,
.history-event {
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
  padding: 10px;
}

.history-stat span,
.history-event span {
  display: block;
  color: #a8cee6;
  font-size: 12px;
  font-weight: 900;
}

.history-stat strong,
.history-event strong {
  display: block;
  margin-top: 4px;
  color: #f6fbff;
  font-size: 16px;
}

.history-stat p {
  margin: 6px 0 0;
  color: #bcd7ea;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.history-stat.good-card strong {
  color: #ff9aa4;
}

.history-stat.danger-card strong {
  color: #6ee7c2;
}

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

.history-event p {
  margin: 6px 0 0;
  color: #c2d8ea;
  font-size: 12px;
  line-height: 1.55;
}

.history-event.snapshot {
  border-color: rgba(255, 209, 102, 0.24);
}

.history-event.abnormal,
.detail-table div.abnormal {
  border-color: rgba(19, 185, 129, 0.38);
  background: rgba(19, 185, 129, 0.08);
}

.timeline-dot {
  position: relative;
  padding-left: 18px;
}

.timeline-dot::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 16px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #54d6ff;
  box-shadow: 0 0 16px rgba(84, 214, 255, 0.5);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 14px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid #eadfcd;
  text-align: right;
  white-space: nowrap;
}

th {
  color: #72551d;
  background: #fff5df;
  font-size: 12px;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.small-button {
  min-width: 34px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--royal);
  font-weight: 950;
}

.good {
  color: var(--red);
}

.danger {
  color: var(--green);
}

.warn {
  color: var(--yellow);
}

.num-jump {
  display: inline-block;
  transform-origin: center bottom;
  will-change: transform, filter, text-shadow;
}

.price.num-jump,
.global-card strong.num-jump,
.global-card em.num-jump,
.mini-card strong.num-jump,
.metric-card strong.num-jump,
.tile-price-row strong.num-jump,
.tile-price-row em.num-jump,
.tile-stat-grid strong.num-jump,
.technical-grid strong.num-jump,
.chips-grid strong.num-jump,
.chips-grid em.num-jump,
.institution-grid strong.num-jump,
.intraday-card strong.num-jump,
.pretrade-dashboard strong.num-jump {
  display: block;
}

.num-jump.num-jumping {
  animation: number-pop 0.68s cubic-bezier(0.2, 0.9, 0.22, 1);
}

.num-jump.num-up {
  color: #ff5f6d;
  text-shadow: 0 0 16px rgba(255, 95, 109, 0.72);
}

.num-jump.num-down {
  color: #13b981;
  text-shadow: 0 0 16px rgba(19, 185, 129, 0.72);
}

@keyframes number-pop {
  0% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
  28% {
    transform: translateY(-7px) scale(1.13);
    filter: brightness(1.45);
  }
  54% {
    transform: translateY(2px) scale(0.98);
  }
  76% {
    transform: translateY(-2px) scale(1.04);
  }
  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

.small-button.danger {
  color: var(--red);
}

.signal-row {
  display: grid;
  grid-template-columns: 1fr 120px 120px 120px 1.4fr;
  align-items: center;
  gap: 12px;
}

.journal-item {
  display: grid;
  grid-template-columns: 140px 110px 1fr;
  gap: 12px;
}

.bottom-nav {
  position: static;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  width: min(650px, 56vw);
  min-width: 510px;
  transform: none;
  border: 1px solid rgba(8, 184, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 14px 30px rgba(7, 43, 77, 0.1);
  overflow: hidden;
}

.nav-item {
  height: 42px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 950;
}

.nav-item:last-child {
  border-right: 0;
}

.nav-item.active {
  background: linear-gradient(180deg, #fff5df, #f2dfb5);
  color: var(--royal);
}

@media (max-width: 1080px) {
  .dashboard-grid,
  .index-grid,
  .global-grid,
  .radar-grid,
  .portfolio-metrics,
  .system-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid,
  .holdings-form,
  .journal-form,
  .buy-row,
  .signal-row,
  .technical-grid,
  .technical-controls,
  .chart-live-strip,
  .advisor-evidence,
  .pretrade-simulator,
  .health-summary,
  .strategy-row {
    grid-template-columns: 1fr 1fr;
  }

  .flow-row,
  .health-source-row,
  .chart-range-control {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 0;
  }

  .command-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .system-strip,
  .dashboard-grid,
  .index-grid,
  .global-grid,
  .radar-grid,
  .portfolio-metrics,
  .form-grid,
  .holdings-form,
  .journal-form,
  .buy-row,
  .signal-row,
  .technical-grid,
  .technical-controls,
  .chart-live-strip,
  .advisor-evidence,
  .pretrade-simulator,
  .health-summary,
  .strategy-row,
  .journal-item,
  .portfolio-history-grid,
  .portfolio-history-list {
    grid-template-columns: 1fr;
  }

  .price {
    font-size: 34px;
  }

  .bottom-nav {
    width: 100%;
    min-width: 0;
  }

  .nav-item {
    height: 42px;
    font-size: 13px;
  }
}

/* Dark tactical cockpit override */
:root {
  --bg: #020711;
  --paper: rgba(5, 13, 25, 0.9);
  --panel: rgba(8, 18, 34, 0.82);
  --panel-2: rgba(12, 29, 52, 0.84);
  --panel-3: rgba(9, 23, 42, 0.94);
  --ink: #e7f4ff;
  --muted: #8faac1;
  --line: rgba(84, 214, 255, 0.2);
  --royal: #dff7ff;
  --royal-2: #54d6ff;
  --gold: #ffd166;
  --gold-soft: rgba(255, 209, 102, 0.14);
  --green: #13b981;
  --yellow: #ffd166;
  --red: #ff5f6d;
  --gray: #778899;
  --tech: #54d6ff;
  --mint: #2ce7b4;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
}

html {
  background: #020711;
}

body {
  color: var(--ink);
  background:
    linear-gradient(rgba(84, 214, 255, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(84, 214, 255, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #020711 0%, #07111d 48%, #0b1220 100%);
  background-size: 36px 36px, 36px 36px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 7px),
    linear-gradient(120deg, transparent 0 18%, rgba(84, 214, 255, 0.08) 18% 18.4%, transparent 18.4% 100%),
    linear-gradient(60deg, transparent 0 64%, rgba(255, 209, 102, 0.07) 64% 64.4%, transparent 64.4% 100%);
  mix-blend-mode: screen;
}

.command-header,
.system-strip,
.panel,
.technical-box,
.bottom-nav {
  border-color: rgba(84, 214, 255, 0.24);
  background: linear-gradient(145deg, rgba(8, 18, 34, 0.92), rgba(7, 28, 48, 0.76));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.panel,
.index-card,
.radar-card,
.global-card,
.metric-card,
.mini-card,
.alert-item,
.buy-row,
.signal-row,
.journal-item,
.news-item,
.sector-chip {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.panel:hover,
.index-card:hover,
.radar-card:hover,
.global-card:hover,
.metric-card:hover,
.mini-card:hover,
.alert-item:hover,
.buy-row:hover,
.signal-row:hover,
.journal-item:hover,
.news-item:hover,
.sector-chip:hover {
  transform: translateY(-3px);
  border-color: rgba(84, 214, 255, 0.52);
  filter: brightness(1.14);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.35), 0 0 32px rgba(84, 214, 255, 0.12);
}

.sector-flow-grid,
.source-health-center {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.flow-head,
.flow-row,
.health-source-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 120px 120px;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.06);
  padding: 10px;
}

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

.flow-head span,
.flow-row em,
.health-source-row small,
.health-source-row em {
  color: #9fb9ce;
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.flow-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(231, 244, 255, 0.08);
}

.flow-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #54d6ff, #ff5f6d);
  box-shadow: 0 0 18px rgba(84, 214, 255, 0.3);
}

.flow-row.cold .flow-track i {
  background: linear-gradient(90deg, #54d6ff, #13b981);
}

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

.health-summary article {
  border: 1px solid rgba(84, 214, 255, 0.14);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.06);
  padding: 10px;
}

.health-summary span {
  color: #9fb9ce;
  font-size: 12px;
  font-weight: 850;
}

.health-summary strong {
  display: block;
  margin-top: 4px;
  color: #f6fbff;
  font-size: 24px;
}

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

.health-source-row {
  grid-template-columns: 120px 74px 74px minmax(0, 1fr);
}

.health-source-row.ok {
  border-color: rgba(255, 95, 109, 0.25);
}

.health-source-row.stale,
.health-source-row.pending {
  border-color: rgba(255, 209, 102, 0.32);
}

.health-source-row.error {
  border-color: rgba(19, 185, 129, 0.35);
}

.cred-dot {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(84, 214, 255, 0.2);
  border-radius: 999px;
  padding: 2px 7px;
  color: #dff7ff;
  font-size: 11px;
  font-weight: 950;
}

.cred-dot.live {
  border-color: rgba(84, 214, 255, 0.34);
  color: #54d6ff;
}

.cred-dot.mixed {
  border-color: rgba(141, 235, 214, 0.34);
  color: #8debd6;
}

.cred-dot.indicative {
  border-color: rgba(255, 209, 102, 0.34);
  color: #ffe29a;
}

.cred-dot.closed,
.cred-dot.delayed {
  border-color: rgba(255, 209, 102, 0.32);
  color: #ffd166;
}

.cred-dot.fallback,
.cred-dot.cache {
  border-color: rgba(255, 209, 102, 0.32);
  color: #ffd166;
}

.cred-dot.warning,
.cred-dot.missing {
  border-color: rgba(255, 95, 109, 0.38);
  color: #ff9aa4;
}

.command-header {
  align-items: flex-start;
}

.command-header h1 {
  color: #f3fbff;
  text-shadow: 0 0 26px rgba(84, 214, 255, 0.26);
}

.subline,
.system-strip span,
.technical-head span,
.technical-grid span,
.alert-item span,
.buy-row span,
.signal-row span,
.journal-item span,
.sector-chip span,
.news-item span,
.global-card span,
.global-card small,
.advisor-card span,
.chart-toolbar span,
.institution-card p {
  color: var(--muted);
}

.eyebrow,
.kicker {
  color: #54d6ff;
}

.header-buttons .ghost-button,
.ghost-button,
.primary-button,
.nav-item,
.mode-button,
.indicator-tab {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.primary-button {
  border-color: rgba(84, 214, 255, 0.58);
  background: linear-gradient(135deg, #06456c, #0ba4dd 54%, #0b2b4a);
  box-shadow: 0 14px 34px rgba(11, 164, 221, 0.24);
}

.ghost-button {
  border-color: rgba(84, 214, 255, 0.28);
  background: rgba(231, 244, 255, 0.06);
  color: #dff7ff;
}

.primary-button:hover,
.ghost-button:hover,
.nav-item:hover,
.mode-button:hover,
.indicator-tab:hover {
  transform: translateY(-1px);
  border-color: rgba(84, 214, 255, 0.68);
  box-shadow: 0 14px 34px rgba(84, 214, 255, 0.18);
}

.system-strip div,
.system-strip label,
.index-card,
.radar-card,
.global-card,
.metric-card,
.mini-card,
.alert-item,
.buy-row,
.signal-row,
.journal-item,
.news-item,
.sector-chip,
.advisor-card,
.chart-card,
.company-card,
.position-card,
.chips-card,
.institution-card,
.intraday-card,
.technical-head,
.technical-grid div,
.technical-detail,
.technical-summary,
.institution-grid div,
.institution-empty,
.orderbook-table,
.orderbook-table th,
.orderbook-table td,
.judgement,
.risk-box,
.table-wrap {
  border-color: rgba(84, 214, 255, 0.18);
  background: linear-gradient(180deg, rgba(8, 20, 37, 0.86), rgba(9, 29, 51, 0.66));
  color: var(--ink);
}

table,
thead,
tbody,
tr,
th,
td {
  color: var(--ink);
}

th {
  background: rgba(84, 214, 255, 0.08);
  color: #dff7ff;
}

td {
  border-color: rgba(84, 214, 255, 0.12);
}

.radar-card,
.index-card,
.global-card,
.buy-row,
.signal-row,
.news-item {
  overflow: hidden;
}

.radar-card::before,
.index-card::before,
.global-card::before,
.buy-row::before,
.signal-row::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(115deg, transparent, rgba(84, 214, 255, 0.1), transparent);
  opacity: 0;
  transform: translateX(-35%);
  transition: opacity 0.18s ease, transform 0.3s ease;
}

.radar-card:hover::before,
.index-card:hover::before,
.global-card:hover::before,
.buy-row:hover::before,
.signal-row:hover::before {
  opacity: 1;
  transform: translateX(35%);
}

.panel-title h2,
.index-card strong,
.global-card strong,
.metric-card strong,
.mini-card strong,
.radar-card .name,
.technical-head strong,
.technical-grid strong,
.technical-summary strong,
.advisor-card strong,
.chart-toolbar strong,
.institution-grid strong,
.intraday-card strong,
.sector-chip strong,
h2 {
  color: #f4fbff;
}

.panel-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(84, 214, 255, 0.3);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.09);
  color: #f6fbff;
  font-size: 24px;
  font-weight: 950;
}

.layout-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border: 1px solid rgba(84, 214, 255, 0.24);
  border-radius: 8px;
  background: rgba(2, 7, 17, 0.56);
}

.layout-button {
  min-width: 54px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c2d8ea;
  font-size: 12px;
  font-weight: 950;
}

.layout-button.active {
  background: linear-gradient(135deg, rgba(84, 214, 255, 0.28), rgba(255, 209, 102, 0.16));
  color: #fff;
}

input,
select,
textarea {
  border-color: rgba(84, 214, 255, 0.24);
  background: rgba(2, 7, 17, 0.64);
  color: #f4fbff;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(84, 214, 255, 0.28);
  border-color: rgba(84, 214, 255, 0.66);
}

.bottom-nav {
  background: rgba(5, 13, 25, 0.82);
}

.nav-item {
  color: #94b6cc;
}

.nav-item.active,
.mode-button.active {
  background: linear-gradient(135deg, rgba(84, 214, 255, 0.26), rgba(255, 209, 102, 0.18));
  color: #fff;
  box-shadow: inset 0 0 24px rgba(84, 214, 255, 0.18);
}

.pill,
.count-badge,
.analysis-cue {
  border-color: rgba(84, 214, 255, 0.28);
  background: rgba(84, 214, 255, 0.1);
  color: #dff7ff;
}

.good,
.red {
  color: #ff5f6d;
}

.danger,
.green {
  color: #13b981;
}

.lamp {
  box-shadow: 0 0 16px currentColor;
}

.technical-panel::before {
  background:
    linear-gradient(90deg, transparent 0 16%, rgba(84, 214, 255, 0.08) 16% 17%, transparent 17% 100%),
    repeating-linear-gradient(135deg, rgba(84, 214, 255, 0.045) 0 1px, transparent 1px 16px);
}

#kChart,
#indicatorChart,
.indicator-drawer {
  border-color: rgba(84, 214, 255, 0.24);
  box-shadow: inset 0 0 38px rgba(84, 214, 255, 0.08), 0 18px 40px rgba(0, 0, 0, 0.24);
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 4, 10, 0.72);
  backdrop-filter: blur(14px);
}

.detail-overlay[hidden] {
  display: none;
}

.detail-modal {
  width: min(980px, 100%);
  max-height: min(82vh, 820px);
  overflow: auto;
  position: relative;
  padding: 22px;
  border: 1px solid rgba(84, 214, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 18, 34, 0.98), rgba(5, 13, 25, 0.96));
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.55), inset 0 0 40px rgba(84, 214, 255, 0.06);
}

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  height: 34px;
  border: 1px solid rgba(84, 214, 255, 0.32);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.08);
  color: #e7f4ff;
  font-weight: 950;
}

.detail-body {
  display: grid;
  gap: 14px;
}

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

.outlook-card {
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(8, 20, 37, 0.9), rgba(9, 29, 51, 0.72));
  color: #e7f4ff;
  transition: transform 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.outlook-card:hover {
  transform: translateY(-2px);
  border-color: rgba(84, 214, 255, 0.52);
  filter: brightness(1.12);
}

.outlook-card span {
  color: #8faac1;
  font-size: 12px;
  font-weight: 950;
}

.outlook-card strong {
  display: block;
  margin: 7px 0;
  color: #f4fbff;
  font-size: 20px;
}

.outlook-card p {
  margin-bottom: 0;
  color: #b9cde0;
  line-height: 1.6;
}

.detail-snapshot,
.detail-note {
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(8, 20, 37, 0.9), rgba(9, 29, 51, 0.72));
  color: #dff7ff;
}

.detail-note p,
.detail-snapshot p {
  color: #b9cde0;
}

.detail-chart {
  width: 100%;
  height: 420px;
  border: 1px solid rgba(84, 214, 255, 0.2);
  border-radius: 8px;
  background: #07111d;
}

.detail-chart.small {
  height: 260px;
}

.detail-table {
  display: grid;
  gap: 8px;
}

.detail-table div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(84, 214, 255, 0.14);
  border-radius: 8px;
  background: rgba(231, 244, 255, 0.05);
}

.detail-news-link {
  display: block;
  margin-top: 8px;
  padding: 10px 11px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.055);
  color: #dff7ff;
  line-height: 1.55;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.detail-news-link:hover {
  border-color: rgba(84, 214, 255, 0.48);
  background: rgba(84, 214, 255, 0.11);
  transform: translateX(3px);
}

.source-matrix-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.source-matrix-summary article,
.sector-leaderboard section {
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 20, 37, 0.92), rgba(6, 22, 40, 0.78));
}

.source-matrix-summary span,
.sector-leaderboard span {
  color: #9fb9ce;
  font-size: 12px;
  font-weight: 950;
}

.source-matrix-summary strong {
  display: block;
  margin-top: 6px;
  color: #f6fbff;
  font-size: 30px;
  line-height: 1;
}

.source-matrix {
  display: grid;
  gap: 8px;
}

.source-matrix-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) 92px 92px 92px minmax(0, 1.6fr);
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(84, 214, 255, 0.14);
  border-radius: 8px;
  background: rgba(231, 244, 255, 0.045);
}

.source-matrix-row.ok {
  border-color: rgba(255, 95, 109, 0.24);
}

.source-matrix-row.stale,
.source-matrix-row.pending {
  border-color: rgba(255, 209, 102, 0.28);
}

.source-matrix-row.error {
  border-color: rgba(19, 185, 129, 0.3);
}

.source-matrix-row strong {
  color: #f6fbff;
}

.source-matrix-row small,
.source-matrix-row span {
  color: #c2d8ea;
}

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

.sector-leaderboard strong {
  display: block;
  margin-bottom: 8px;
  color: #f6fbff;
}

.sector-leaderboard p {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  padding: 7px 0;
  border-bottom: 1px solid rgba(84, 214, 255, 0.1);
  color: #d9e9f6;
}

.sector-leaderboard p:last-child {
  border-bottom: 0;
}

.modal-open {
  overflow: hidden;
}

/* Readability and chart clarity pass */
:root {
  --ink: #f6fbff;
  --muted: #c2d8ea;
}

p,
span,
small,
td,
th,
label,
.subline,
.system-strip span,
.technical-head span,
.technical-grid span,
.alert-item span,
.buy-row span,
.signal-row span,
.journal-item span,
.sector-chip span,
.news-item span,
.global-card span,
.global-card small,
.advisor-card span,
.chart-toolbar span,
.institution-card p,
.intraday-card p,
.outlook-card p,
.detail-note p,
.detail-snapshot p {
  color: #d9e9f6;
}

.outlook-card span,
.indicator-tab,
.nav-item {
  color: #c2d8ea;
}

.detail-table div strong,
.sector-quote-table strong {
  white-space: nowrap;
}

.scan-card,
.anomaly-signal-card,
.advisor-card,
.chart-card,
.company-card,
.position-card,
.chips-card,
.institution-card,
.intraday-card,
.pretrade-card {
  border-color: rgba(84, 214, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(9, 25, 44, 0.98), rgba(4, 14, 28, 0.95)),
    radial-gradient(circle at 88% 0%, rgba(84, 214, 255, 0.12), transparent 34%);
  color: #e7f4ff;
}

.advisor-card p,
.company-intro,
.position-card p,
.intraday-card p,
.institution-card p,
.technical-summary span,
.technical-detail li,
.classification-note span,
.position-list span,
.anomaly-signal p {
  color: #c2d8ea;
}

.advisor-card strong,
.company-grid strong,
.position-list strong,
.chart-toolbar strong,
.scan-steps strong,
.anomaly-signal strong,
.pretrade-dashboard strong,
.institution-grid strong,
.technical-head strong {
  color: #f6fbff;
}

.scan-steps div,
.anomaly-signal,
.pretrade-dashboard div,
.company-grid div,
.position-list li,
.institution-grid div {
  border-color: rgba(84, 214, 255, 0.18);
  background: rgba(84, 214, 255, 0.065);
}

.technical-head,
.technical-summary,
.mode-switch {
  border-color: rgba(84, 214, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(9, 25, 44, 0.96), rgba(4, 14, 28, 0.9));
}

.institution-empty {
  background: rgba(255, 209, 102, 0.1);
  color: #ffe2a3;
}

@media (max-width: 720px) {
  .detail-grid,
  .outlook-grid,
  .source-matrix-summary,
  .sector-leaderboard {
    grid-template-columns: 1fr;
  }

  .source-matrix-row {
    grid-template-columns: 1fr;
  }
}

[hidden] {
  display: none !important;
}

.stock-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(282px, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.stock-view-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(218px, 1fr));
  gap: 10px;
}

.stock-tile {
  position: relative;
  overflow: hidden;
  min-height: 312px;
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(9, 25, 44, 0.96), rgba(4, 14, 28, 0.94)),
    radial-gradient(circle at 18% 0%, rgba(84, 214, 255, 0.12), transparent 34%);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22), inset 0 0 28px rgba(84, 214, 255, 0.045);
  color: #e7f4ff;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.stock-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 0 28%, rgba(84, 214, 255, 0.06) 28% 29%, transparent 29% 100%),
    repeating-linear-gradient(135deg, rgba(84, 214, 255, 0.035) 0 1px, transparent 1px 15px);
  opacity: 0.62;
}

.stock-tile:hover {
  border-color: rgba(84, 214, 255, 0.68);
  box-shadow: 0 26px 62px rgba(0, 0, 0, 0.34), 0 0 34px rgba(84, 214, 255, 0.16), inset 0 0 34px rgba(84, 214, 255, 0.08);
  filter: brightness(1.08);
  transform: translateY(-3px);
}

.stock-tile > * {
  position: relative;
  z-index: 1;
}

.stock-tile-head,
.tile-price-row,
.tile-actions {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.stock-tile-head {
  margin-bottom: 10px;
}

.stock-tile-head strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 22px;
  line-height: 1.12;
}

.stock-tile .symbol,
.stock-tile span,
.stock-tile p {
  color: rgba(213, 235, 250, 0.74);
}

.tile-price-row {
  align-items: flex-end;
  margin-bottom: 10px;
}

.tile-price-row strong {
  display: block;
  color: #fff;
  font-size: 30px;
  line-height: 1;
}

.tile-price-row em {
  font-style: normal;
  font-size: 16px;
  font-weight: 950;
  text-align: right;
}

.mini-k-chart {
  display: block;
  width: 100%;
  height: 126px;
  margin: 10px 0 12px;
  border: 1px solid rgba(84, 214, 255, 0.2);
  border-radius: 8px;
  background: #07111d;
  box-shadow: inset 0 0 28px rgba(84, 214, 255, 0.08);
}

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

.tile-stat-grid > div {
  min-width: 0;
  padding: 9px;
  border: 1px solid rgba(84, 214, 255, 0.14);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.065);
}

.tile-stat-grid span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 900;
}

.tile-stat-grid strong {
  display: block;
  overflow-wrap: anywhere;
  color: #f7fbff;
  font-size: 15px;
}

.stock-tile p {
  margin: 10px 0 0;
  min-height: 22px;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.tile-actions {
  align-items: center;
  justify-content: flex-end;
  margin-top: 10px;
}

.stock-view-grid.compact .stock-tile {
  min-height: 250px;
  padding: 12px;
}

.stock-view-grid.compact .stock-tile-head strong {
  font-size: 18px;
}

.stock-view-grid.compact .tile-price-row strong {
  font-size: 24px;
}

.stock-view-grid.compact .mini-k-chart {
  height: 92px;
}

.stock-view-grid.compact .tile-stat-grid > div:nth-child(n + 5),
.stock-view-grid.compact .stock-tile p {
  display: none;
}

#view-watch .panel-title,
#view-portfolio .panel-title {
  align-items: center;
}

#view-watch .layout-switch,
#view-portfolio .layout-switch {
  min-width: 190px;
  box-shadow: 0 0 24px rgba(84, 214, 255, 0.08);
}

#view-watch .table-wrap,
#view-portfolio .table-wrap {
  background: rgba(6, 17, 31, 0.94);
  border-color: rgba(84, 214, 255, 0.2);
}

#view-watch table,
#view-portfolio table {
  color: #e7f4ff;
}

#view-watch th,
#view-watch td,
#view-portfolio th,
#view-portfolio td {
  border-bottom-color: rgba(84, 214, 255, 0.12);
}

#view-watch th,
#view-portfolio th {
  color: #c8edff;
  background: rgba(84, 214, 255, 0.08);
}

#view-watch td span,
#view-portfolio td span {
  color: rgba(213, 235, 250, 0.66);
}

#holdingRows td.num-jump {
  display: table-cell;
}

.holding-cell-value {
  display: inline-flex;
  justify-content: flex-end;
  min-width: 72px;
  color: inherit !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-align: right;
}

.holding-cell-value.wide {
  min-width: 128px;
}

.tile-tag-strip,
.table-tag-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tile-tag-strip {
  margin: 8px 0 0;
}

.table-tag-strip {
  justify-content: flex-end;
  min-width: 150px;
}

.tag-chip {
  display: inline-flex !important;
  width: fit-content;
  border: 1px solid rgba(84, 214, 255, 0.24);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(84, 214, 255, 0.09);
  color: #dff7ff !important;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
}

.tag-chip.muted {
  border-color: rgba(163, 184, 201, 0.18);
  background: rgba(163, 184, 201, 0.08);
  color: #9eb6c9 !important;
}

.technical-head,
.advisor-card,
.chart-card,
.company-card,
.position-card,
.chips-card,
.institution-card,
.intraday-card {
  background:
    linear-gradient(180deg, rgba(7, 19, 36, 0.98), rgba(6, 26, 47, 0.9)),
    radial-gradient(circle at top right, rgba(84, 214, 255, 0.12), transparent 38%);
  color: #e7f4ff;
}

.advisor-card p,
.company-intro,
.position-card p,
.technical-summary span,
.technical-detail li,
.institution-card p,
.intraday-card p,
.institution-empty {
  color: #d9e9f6;
}

.institution-empty {
  border: 1px solid rgba(255, 209, 102, 0.28);
  background: rgba(255, 209, 102, 0.08);
}

.institution-grid div {
  background: rgba(84, 214, 255, 0.07);
}

.company-grid div,
.position-list li {
  border-color: rgba(84, 214, 255, 0.16);
  background: rgba(84, 214, 255, 0.07);
}

.company-grid strong,
.position-list strong,
.profile-link,
.concept-pills span,
.company-actions span,
.classification-note strong {
  color: #e7f4ff;
}

.institution-grid span,
.orderbook-table th {
  color: #a8cee6;
}

.orderbook-table {
  overflow: hidden;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background: rgba(2, 7, 17, 0.72);
}

.orderbook-table th {
  background: rgba(84, 214, 255, 0.08);
}

.orderbook-table td {
  background: rgba(7, 17, 29, 0.68);
  color: #e7f4ff;
}

.technical-head {
  align-items: center;
}

.technical-head > div:last-child {
  padding: 8px 12px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.08);
  font-size: 18px;
  font-weight: 950;
}

.chart-toolbar strong {
  color: #f6fbff;
}

.chart-toolbar span {
  color: #a8cee6;
}

.technical-grid div {
  background: rgba(84, 214, 255, 0.07);
}

.technical-grid span {
  color: #a8cee6;
}

.technical-summary {
  background: linear-gradient(135deg, rgba(84, 214, 255, 0.1), rgba(255, 209, 102, 0.08));
}

.pretrade-card {
  grid-column: span 12;
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(7, 19, 36, 0.98), rgba(6, 26, 47, 0.9)),
    radial-gradient(circle at top left, rgba(255, 209, 102, 0.1), transparent 34%);
  box-shadow: inset 0 0 30px rgba(84, 214, 255, 0.06);
}

.pretrade-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.07);
}

.pretrade-summary strong {
  color: #fff;
  font-size: 22px;
}

.pretrade-summary span {
  color: #a8cee6;
  font-size: 12px;
  font-weight: 900;
}

.pretrade-summary.pass {
  border-color: rgba(84, 214, 255, 0.36);
}

.pretrade-summary.warn {
  border-color: rgba(255, 209, 102, 0.42);
}

.pretrade-summary.fail {
  border-color: rgba(255, 95, 109, 0.42);
}

.pretrade-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.pretrade-item {
  min-height: 126px;
  padding: 10px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.055);
}

.pretrade-item span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(84, 214, 255, 0.1);
  color: #54d6ff;
  font-size: 11px;
  font-weight: 950;
}

.pretrade-item.warn span {
  color: #ffd166;
}

.pretrade-item.fail span {
  color: #ff5f6d;
}

.pretrade-item strong {
  display: block;
  color: #f6fbff;
  font-size: 15px;
}

.pretrade-item p {
  margin: 6px 0 0;
  color: #c2d8ea;
  font-size: 12px;
  line-height: 1.45;
}

.source-health {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.source-health:hover {
  border-color: rgba(84, 214, 255, 0.62);
  box-shadow: 0 0 28px rgba(84, 214, 255, 0.12);
  transform: translateY(-1px);
}

body.syncing .source-health,
body.syncing #systemStatus {
  animation: syncBreath 1.1s ease-in-out infinite alternate;
}

@keyframes syncBreath {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.24);
  }
}

.quote-source-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
  margin: -3px 0 8px;
  color: rgba(213, 235, 250, 0.72);
  font-size: 12px;
  font-weight: 850;
}

.freshness-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7d8a9a;
  box-shadow: 0 0 12px currentColor;
}

.freshness-dot.live {
  color: #54d6ff;
  background: #54d6ff;
  animation: livePulse 1.4s ease-out infinite;
}

.freshness-dot.warm {
  color: #ffd166;
  background: #ffd166;
}

.freshness-dot.stale {
  color: #c2d8ea;
  background: #7d8a9a;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(84, 214, 255, 0.38);
  }
  100% {
    box-shadow: 0 0 0 9px rgba(84, 214, 255, 0);
  }
}

.pulse-up,
.pulse-down {
  border-radius: 6px;
  animation: pricePulse 0.55s ease-out;
}

.pulse-up {
  color: #ff5f6d !important;
  background: rgba(255, 95, 109, 0.12);
}

.pulse-down {
  color: #13b981 !important;
  background: rgba(19, 185, 129, 0.12);
}

@keyframes pricePulse {
  from {
    box-shadow: 0 0 0 10px rgba(84, 214, 255, 0.14);
  }
  to {
    box-shadow: 0 0 0 0 rgba(84, 214, 255, 0);
  }
}

.live-tape {
  display: grid;
  grid-template-columns: 124px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 52px;
  margin: 0 0 14px;
  overflow: hidden;
  border: 1px solid rgba(84, 214, 255, 0.24);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(4, 14, 28, 0.96), rgba(7, 29, 51, 0.86));
  box-shadow: inset 0 0 32px rgba(84, 214, 255, 0.06), 0 18px 48px rgba(0, 0, 0, 0.22);
}

.live-tape-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 14px;
  color: #f6fbff;
  font-size: 12px;
  font-weight: 950;
  min-width: 0;
  white-space: nowrap;
}

.live-tape-track {
  display: flex;
  gap: 8px;
  min-width: max-content;
  animation: tapeMove 38s linear infinite;
}

.live-tape:hover .live-tape-track {
  animation-play-state: paused;
}

@keyframes tapeMove {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

.tape-chip {
  display: grid;
  grid-template-columns: auto auto auto;
  align-items: center;
  gap: 8px;
  min-width: 230px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 999px;
  background: rgba(84, 214, 255, 0.07);
  color: #d9e9f6;
  font-size: 12px;
}

.tape-chip strong,
.tape-chip em {
  font-style: normal;
  white-space: nowrap;
}

.tape-chip.hot,
.tape-chip.danger,
.tape-chip.buy,
.tape-chip.near {
  box-shadow: inset 0 0 18px rgba(84, 214, 255, 0.08);
}

.tape-chip.hot {
  border-color: rgba(255, 95, 109, 0.38);
}

.tape-chip.danger {
  border-color: rgba(19, 185, 129, 0.42);
}

.tape-chip.buy,
.tape-chip.near {
  border-color: rgba(255, 209, 102, 0.42);
}

.anomaly-radar {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 35;
  width: min(330px, calc(100vw - 36px));
  border: 1px solid rgba(84, 214, 255, 0.28);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(6, 17, 31, 0.96), rgba(4, 14, 28, 0.94));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.36), inset 0 0 30px rgba(84, 214, 255, 0.06);
  overflow: hidden;
}

.radar-float-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid rgba(84, 214, 255, 0.14);
}

.radar-float-head span {
  display: block;
  color: #a8cee6;
  font-size: 12px;
  font-weight: 950;
}

.radar-float-head strong {
  color: #f6fbff;
  font-size: 24px;
}

.radar-collapse {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(84, 214, 255, 0.24);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.08);
  color: #f6fbff;
  font-weight: 950;
}

.radar-float-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding: 10px;
}

.anomaly-radar.collapsed .radar-float-list {
  display: none;
}

.radar-alert,
.radar-quiet {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(84, 214, 255, 0.14);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.055);
  color: #e7f4ff;
  text-align: left;
}

.radar-alert span {
  color: #54d6ff;
  font-size: 12px;
  font-weight: 950;
}

.radar-alert strong {
  color: #fff;
  font-size: 16px;
}

.radar-alert em,
.radar-alert small,
.radar-quiet {
  color: #a8cee6;
  font-style: normal;
  font-size: 12px;
}

.radar-alert.hot,
.visual-alert.hot {
  border-color: rgba(255, 95, 109, 0.42);
}

.radar-alert.danger,
.visual-alert.danger {
  border-color: rgba(19, 185, 129, 0.48);
}

.radar-alert.buy,
.radar-alert.near,
.visual-alert.buy,
.visual-alert.near {
  border-color: rgba(255, 209, 102, 0.46);
}

.quick-peek {
  position: fixed;
  z-index: 60;
  width: min(340px, calc(100vw - 36px));
  pointer-events: none;
  padding: 12px;
  border: 1px solid rgba(84, 214, 255, 0.34);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(5, 15, 30, 0.98), rgba(6, 26, 47, 0.96));
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.48), inset 0 0 30px rgba(84, 214, 255, 0.08);
  color: #e7f4ff;
}

.quick-peek-head span,
.quick-grid span {
  color: #a8cee6;
  font-size: 12px;
  font-weight: 900;
}

.quick-peek-head strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 20px;
}

.quick-price {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
}

.quick-price strong {
  color: #fff;
  font-size: 32px;
  line-height: 1;
}

.quick-price em {
  font-style: normal;
  font-weight: 950;
}

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

.quick-grid div {
  padding: 8px;
  border: 1px solid rgba(84, 214, 255, 0.14);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.06);
}

.quick-grid strong {
  display: block;
  margin-top: 3px;
  color: #f6fbff;
}

.quick-news {
  margin-top: 9px;
  color: #a8cee6;
  font-size: 12px;
  line-height: 1.45;
}

.quick-news p {
  margin: 5px 0 0;
}

.visual-alert {
  width: fit-content;
  margin: -4px 0 8px;
  padding: 4px 8px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 999px;
  background: rgba(84, 214, 255, 0.08);
  color: #d9e9f6;
  font-size: 12px;
  font-weight: 950;
}

.visual-alert.idle {
  opacity: 0.7;
}

.alert-hot,
.alert-danger,
.alert-buy,
.alert-near {
  animation: alertGlow 2.2s ease-in-out infinite alternate;
}

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

.signal-legend div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px 9px;
  align-items: center;
  min-width: 0;
  padding: 11px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(8, 20, 37, 0.86), rgba(9, 29, 51, 0.62));
}

.signal-legend p {
  grid-column: 1 / -1;
  margin: 0;
  color: #bcd7ea;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.5;
}

.portfolio-news-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(84, 214, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 20, 37, 0.9), rgba(5, 13, 25, 0.82)),
    radial-gradient(circle at 80% 0%, rgba(255, 209, 102, 0.08), transparent 34%);
}

.portfolio-news-list {
  display: grid;
  gap: 10px;
}

.portfolio-news-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.055);
  color: #e7f4ff;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, filter 0.16s ease;
}

.portfolio-news-item:hover {
  transform: translateY(-2px);
  border-color: rgba(84, 214, 255, 0.48);
  filter: brightness(1.12);
}

.portfolio-news-item strong {
  color: #f6fbff;
  line-height: 1.45;
}

.portfolio-news-item span {
  display: block;
  margin-top: 4px;
  color: #a9c5d9;
  font-size: 12px;
  font-weight: 850;
}

.news-match-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.news-match-strip em {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.08);
  color: #ffe2a3;
  font-size: 11px;
  font-style: normal;
  font-weight: 950;
}

.technical-detail-advice {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 209, 102, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.12), rgba(84, 214, 255, 0.07)),
    rgba(8, 20, 37, 0.78);
}

.technical-detail-advice span {
  color: #ffd166;
  font-size: 12px;
  font-weight: 950;
}

.technical-detail-advice strong {
  display: block;
  margin: 5px 0;
  color: #f6fbff;
  font-size: 20px;
}

.technical-detail-advice p,
.technical-detail-advice li {
  color: #d9e9f6;
  line-height: 1.65;
}

.technical-detail-advice ul {
  margin: 0;
  padding-left: 18px;
}

.global-card small {
  line-height: 1.55;
}

@keyframes alertGlow {
  from {
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22), 0 0 0 rgba(84, 214, 255, 0);
  }
  to {
    box-shadow: 0 24px 58px rgba(0, 0, 0, 0.28), 0 0 30px rgba(84, 214, 255, 0.16);
  }
}

body.command-mode .app-shell {
  width: min(1700px, calc(100% - 24px));
}

body.command-mode .command-header {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(560px, 0.86fr);
  position: sticky;
  top: 8px;
  z-index: 30;
  align-items: stretch;
}

body.command-mode .command-header h1 {
  max-width: 780px;
  font-size: clamp(32px, 3.2vw, 48px);
  line-height: 1.08;
  text-wrap: balance;
  overflow-wrap: anywhere;
  word-break: break-word;
}

body.command-mode .header-actions {
  justify-self: end;
  width: min(650px, 100%);
  min-width: 0;
}

body.command-mode .bottom-nav {
  width: 100%;
  min-width: 0;
}

body.command-mode .dashboard-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-flow: row dense;
  align-items: start;
}

body.command-mode .dashboard-grid > .panel {
  min-width: 0;
  overflow: hidden;
}

body.command-mode .market-panel {
  grid-column: span 6;
}

body.command-mode .alerts-panel {
  grid-column: span 3;
}

body.command-mode .global-panel {
  grid-column: span 3;
}

body.command-mode .sector-panel,
body.command-mode .sector-flow-panel,
body.command-mode .outlook-panel {
  grid-column: span 4;
}

body.command-mode .radar-panel {
  grid-column: span 8;
}

body.command-mode .buy-panel {
  grid-column: span 4;
}

body.command-mode .holding-panel {
  grid-column: span 12;
}

body.command-mode .global-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.command-mode .radar-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.command-mode .sector-list,
body.command-mode .sector-flow-grid,
body.command-mode .buy-list,
body.command-mode .alert-list {
  align-content: start;
}

body.command-mode .flow-row {
  grid-template-columns: minmax(86px, 0.8fr) minmax(0, 1.3fr);
}

body.command-mode .flow-row strong,
body.command-mode .flow-row em {
  justify-self: start;
}

body.command-mode .flow-row em {
  grid-column: 1 / -1;
}

body.command-mode .buy-row {
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 10px;
}

body.command-mode .buy-row > div {
  min-width: 0;
}

body.command-mode .buy-row > div:first-child,
body.command-mode .buy-row > div:last-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

body.command-mode .buy-row > div:last-child {
  padding: 10px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.055);
}

body.command-mode .buy-row > div:last-child br {
  display: none;
}

body.command-mode .buy-row > div:last-child strong {
  justify-self: end;
  color: #f6fbff;
}

body.command-mode .buy-row .analysis-cue {
  grid-column: 1 / -1;
  justify-self: start;
}

body.command-mode .zone-line {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

body.command-mode .panel-explain {
  display: block;
  max-height: none;
}

@media (max-width: 1280px) {
  body.command-mode .command-header {
    grid-template-columns: 1fr;
  }

  body.command-mode .header-actions {
    justify-self: stretch;
    width: 100%;
  }

  body.command-mode .market-panel,
  body.command-mode .global-panel,
  body.command-mode .radar-panel,
  body.command-mode .holding-panel,
  body.command-mode .alerts-panel,
  body.command-mode .sector-panel,
  body.command-mode .sector-flow-panel,
  body.command-mode .outlook-panel,
  body.command-mode .buy-panel {
    grid-column: span 6;
  }

  body.command-mode .radar-grid,
  body.command-mode .global-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  body.command-mode .dashboard-grid {
    grid-template-columns: 1fr;
  }

  body.command-mode .market-panel,
  body.command-mode .global-panel,
  body.command-mode .radar-panel,
  body.command-mode .holding-panel,
  body.command-mode .alerts-panel,
  body.command-mode .sector-panel,
  body.command-mode .sector-flow-panel,
  body.command-mode .outlook-panel,
  body.command-mode .buy-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 1340px);
    padding-top: 18px;
  }

  .command-header {
    padding: 18px;
    overflow: hidden;
  }

  body.command-mode .command-header h1,
  .command-header h1 {
    font-size: clamp(26px, 8vw, 36px);
    line-height: 1.12;
  }

  .command-header h1 span {
    display: block;
  }

  .header-buttons {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .stock-brief-grid,
  .financial-grid,
  .company-deep-grid,
  .peer-grid {
    grid-template-columns: 1fr;
  }

  .priority-grid,
  .personality-grid,
  .qa-grid,
  .chart-insight-strip {
    grid-template-columns: 1fr;
  }

  .chart-action-row,
  .priority-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .chart-card.chart-focus {
    inset: 8px;
  }

  .stock-detail-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-detail-tab {
    width: 100%;
  }

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

  .live-tape {
    grid-template-columns: 1fr;
    padding-top: 8px;
  }

  .anomaly-radar {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: auto;
    max-height: 46vh;
  }

  .quick-peek {
    display: none;
  }
}

@media (max-width: 620px) {
  .command-header {
    position: static;
  }

  body.command-mode .command-header {
    position: static;
    top: auto;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-item {
    min-width: 0;
    padding-inline: 8px;
  }

  .system-strip {
    grid-template-columns: 1fr;
  }

  .anomaly-radar {
    pointer-events: auto;
  }

  .anomaly-radar:not(.collapsed) .radar-float-list {
    max-height: 250px;
  }

  .anomaly-radar.collapsed {
    display: none;
  }

  .signal-legend {
    grid-template-columns: 1fr;
  }
}

body.chart-focus-active .chart-card.chart-focus {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  max-height: none;
}

@media (max-width: 720px) {
  body {
    padding-bottom: 92px;
  }

  .app-shell {
    width: 100%;
    padding: 10px 10px 18px;
  }

  .command-header {
    display: block;
    margin-bottom: 10px;
    padding: 16px 16px 18px;
    border-radius: 14px;
  }

  .eyebrow {
    font-size: 10px;
  }

  .command-header h1 {
    max-width: 330px;
    font-size: clamp(27px, 9vw, 38px);
    line-height: 1.04;
  }

  .command-header h1 span {
    display: block;
  }

  .subline {
    font-size: 13px;
  }

  .header-actions {
    display: block;
  }

  .header-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
  }

  .header-buttons .primary-button {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: auto;
    min-width: 0;
    overflow: hidden;
    border: 1px solid rgba(84, 214, 255, 0.32);
    border-radius: 18px;
    background: rgba(4, 14, 28, 0.94);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 0 22px rgba(84, 214, 255, 0.08);
    backdrop-filter: blur(16px);
  }

  .nav-item {
    min-width: 0;
    min-height: 54px;
    padding: 6px 4px;
    border-right: 1px solid rgba(84, 214, 255, 0.12);
    font-size: 12px;
  }

  .nav-item:last-child {
    border-right: 0;
  }

  .system-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .system-strip div,
  .system-strip label {
    min-height: 74px;
    padding: 12px;
    border: 1px solid rgba(84, 214, 255, 0.18);
    border-radius: 12px;
    background: rgba(5, 18, 34, 0.88);
  }

  .system-strip span,
  .system-strip label span {
    font-size: 10px;
  }

  .system-strip strong {
    font-size: 15px;
    line-height: 1.25;
  }

  .system-strip input {
    width: 100%;
    height: 34px;
  }

  .live-tape {
    grid-template-columns: 84px minmax(0, 1fr);
    min-height: 44px;
    margin-bottom: 10px;
    border-radius: 12px;
  }

  .live-tape-head {
    padding-left: 10px;
    font-size: 11px;
  }

  .tape-chip {
    min-width: 185px;
    padding: 7px 9px;
  }

  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .panel {
    border-radius: 14px;
    padding: 14px;
  }

  .panel-title {
    gap: 10px;
  }

  .index-grid,
  .global-grid,
  .radar-grid,
  .portfolio-metrics,
  .health-summary,
  .financial-grid,
  .company-deep-grid,
  .peer-grid,
  .stock-brief-grid {
    grid-template-columns: 1fr;
  }

  .global-card,
  .radar-card,
  .index-card {
    min-height: auto;
  }

  .stock-detail-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0;
    background: rgba(4, 14, 28, 0.96);
  }

  .stock-detail-tab {
    width: 100%;
    min-height: 40px;
    font-size: 12px;
  }

  .chart-live-strip,
  .chart-insight-strip,
  .strategy-row,
  .pretrade-simulator,
  .technical-grid,
  .technical-controls,
  .form-grid,
  .holdings-form,
  .journal-form {
    grid-template-columns: 1fr;
  }

  .chart-card.chart-focus {
    inset: 8px;
  }

  .anomaly-radar.collapsed {
    display: none;
  }

  .anomaly-radar {
    left: 10px;
    right: 10px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 42vh;
  }

  .anomaly-radar:not(.collapsed) .radar-float-list {
    max-height: 240px;
  }
}

body.chart-focus-active .technical-panel {
  position: fixed !important;
  inset: 10px !important;
  z-index: 2000 !important;
  overflow: auto;
  padding: 14px !important;
  border-color: rgba(84, 214, 255, 0.48) !important;
  background:
    linear-gradient(180deg, rgba(5, 13, 25, 0.99), rgba(6, 26, 47, 0.98)),
    radial-gradient(circle at 80% 0%, rgba(84, 214, 255, 0.18), transparent 38%) !important;
  box-shadow: 0 34px 120px rgba(0, 0, 0, 0.62);
}

body.chart-focus-active .technical-panel > .panel-title,
body.chart-focus-active .technical-controls,
body.chart-focus-active .technical-head,
body.chart-focus-active .scan-card,
body.chart-focus-active .advisor-card,
body.chart-focus-active .strategy-score-card,
body.chart-focus-active .stock-detail-shell {
  display: none !important;
}

body.chart-focus-active .technical-box,
body.chart-focus-active .stock-lab {
  display: block !important;
  min-height: 0 !important;
  padding: 0 !important;
}

body.chart-focus-active .chart-card.chart-focus {
  display: block !important;
  width: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(5, 13, 25, 1), rgba(6, 26, 47, 0.98)),
    radial-gradient(circle at 80% 0%, rgba(84, 214, 255, 0.14), transparent 38%) !important;
  color: #e7f4ff !important;
}

body.chart-focus-active .chart-card.chart-focus #kChart {
  height: min(62vh, 720px) !important;
}

body.chart-focus-active .chart-card.chart-focus #indicatorChart {
  height: min(30vh, 360px) !important;
}

body.chart-focus-active {
  overflow: auto;
}

body.chart-focus-active .command-header,
body.chart-focus-active .system-strip,
body.chart-focus-active .live-tape,
body.chart-focus-active #view-signals > .panel:first-child {
  visibility: visible !important;
}

body.chart-focus-active .technical-panel {
  position: relative !important;
  inset: auto !important;
  z-index: auto !important;
  overflow: visible;
  padding: 14px !important;
  box-shadow: var(--shadow);
}

body.chart-focus-active .chart-card.chart-focus {
  position: relative !important;
  inset: auto !important;
  z-index: auto !important;
  grid-column: 1 / -1 !important;
  min-height: 0;
}

body.chart-focus-active .chart-card.chart-focus #kChart {
  height: min(72vh, 760px) !important;
}

body.chart-focus-active .chart-card.chart-focus #indicatorChart {
  height: min(38vh, 390px) !important;
}

.chart-overlay-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
  padding: 10px;
  border: 1px solid rgba(84, 214, 255, 0.16);
  border-radius: 8px;
  background: rgba(84, 214, 255, 0.055);
}

.chart-overlay-controls span {
  color: #a8cee6;
  font-size: 12px;
  font-weight: 950;
}

.chart-overlay-controls button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(84, 214, 255, 0.2);
  border-radius: 8px;
  background: rgba(231, 244, 255, 0.07);
  color: rgba(231, 244, 255, 0.76);
  font-size: 12px;
  font-weight: 950;
}

.chart-overlay-controls button.active {
  border-color: rgba(84, 214, 255, 0.58);
  background: linear-gradient(135deg, rgba(84, 214, 255, 0.28), rgba(255, 209, 102, 0.14));
  color: #fff;
}

.chart-card.chart-focus {
  position: relative !important;
  inset: auto !important;
  z-index: auto !important;
  grid-column: 1 / -1 !important;
  overflow: visible !important;
  max-height: none !important;
}

.chart-card.chart-focus #kChart {
  height: min(72vh, 760px) !important;
}

.chart-card.chart-focus #indicatorChart {
  height: min(38vh, 390px) !important;
}

.panel::after {
  content: none !important;
}

.panel:hover {
  transform: none !important;
  filter: none !important;
}

/* Mobile cockpit reset: keep key data visible without stacked overlays. */
@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    background-size: 28px 28px, 28px 28px, auto;
  }

  .app-shell {
    width: 100%;
    padding: 8px 8px 20px;
  }

  .command-header {
    display: grid;
    gap: 10px;
    margin-bottom: 8px;
    padding: 12px;
    border-radius: 12px;
  }

  .eyebrow {
    margin-bottom: 4px;
    font-size: 9px;
  }

  .command-header h1 {
    max-width: none;
    margin: 0;
    font-size: clamp(22px, 7.1vw, 30px);
    line-height: 1.02;
  }

  .subline {
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.35;
  }

  .header-actions {
    display: grid;
    gap: 8px;
  }

  .bottom-nav {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: 100%;
    min-width: 0;
    margin: 0;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(5, 18, 34, 0.94);
    box-shadow: inset 0 0 22px rgba(84, 214, 255, 0.08);
    backdrop-filter: blur(14px);
  }

  .nav-item {
    height: 38px;
    min-height: 38px;
    padding: 4px 2px;
    border-right: 1px solid rgba(84, 214, 255, 0.12);
    font-size: 11px;
    line-height: 1;
  }

  .nav-item.active {
    border-color: rgba(255, 209, 102, 0.55);
    background: linear-gradient(180deg, rgba(84, 214, 255, 0.25), rgba(255, 209, 102, 0.16));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.5);
  }

  .header-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 0;
  }

  .header-buttons .ghost-button,
  .header-buttons .primary-button {
    grid-column: auto;
    min-height: 38px;
    padding: 0 8px;
    border-radius: 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .system-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(118px, 1fr));
    gap: 8px;
    margin: 0 0 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    border: 0;
    background: transparent;
    box-shadow: none;
    scroll-snap-type: x proximity;
  }

  .system-strip::-webkit-scrollbar {
    display: none;
  }

  .system-strip div,
  .system-strip label {
    min-height: 54px;
    padding: 8px 9px;
    border: 1px solid rgba(84, 214, 255, 0.18);
    border-radius: 10px;
    background: rgba(5, 18, 34, 0.88);
    scroll-snap-align: start;
  }

  .system-strip div:nth-of-type(n + 5),
  .system-strip label {
    display: none;
  }

  .system-strip span,
  .system-strip label span {
    margin-bottom: 4px;
    font-size: 9px;
    line-height: 1;
  }

  .system-strip strong {
    font-size: 13px;
    line-height: 1.22;
  }

  .live-tape {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 38px;
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: 10px;
  }

  .live-tape-head {
    min-width: 0;
    padding-left: 8px;
    font-size: 10px;
  }

  .live-tape-track {
    min-width: 0 !important;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    animation: none;
    scrollbar-width: none;
  }

  .live-tape-track::-webkit-scrollbar {
    display: none;
  }

  .tape-chip {
    flex: 0 0 168px;
    min-width: 0;
    max-width: 168px;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    padding: 6px 8px;
    font-size: 11px;
    border-radius: 18px;
  }

  .tape-chip strong,
  .tape-chip em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

  .panel {
    padding: 12px;
    border-radius: 12px;
  }

  .panel-title {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px;
  }

  .panel-title h2 {
    font-size: 20px;
    line-height: 1.15;
  }

  .kicker {
    font-size: 10px;
  }

  #view-dashboard .market-panel .index-grid,
  .market-panel .index-grid {
    display: flex !important;
    grid-template-columns: none !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  #view-dashboard .market-panel .index-grid::-webkit-scrollbar,
  .market-panel .index-grid::-webkit-scrollbar {
    display: none;
  }

  #view-dashboard .market-panel .index-card,
  .market-panel .index-grid > .index-card {
    box-sizing: border-box;
    flex: 0 0 214px !important;
    width: 214px !important;
    max-width: 214px !important;
    min-width: 0 !important;
    min-height: 96px;
    padding: 10px;
    overflow: hidden;
    scroll-snap-align: start;
  }

  .index-card span {
    font-size: 10px;
  }

  .index-card strong {
    margin-top: 8px;
    font-size: clamp(18px, 5.8vw, 24px);
    line-height: 1.04;
    word-break: break-word;
  }

  .index-card em {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.35;
  }

  .judgement,
  .risk-box,
  .outlook-box {
    padding: 10px;
    font-size: 13px;
    line-height: 1.5;
  }

  .global-grid,
  #view-dashboard .radar-grid,
  .sector-flow-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 78vw);
    grid-template-columns: none !important;
    gap: 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 2px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .global-grid::-webkit-scrollbar,
  #view-dashboard .radar-grid::-webkit-scrollbar,
  .sector-flow-grid::-webkit-scrollbar {
    display: none;
  }

  .global-card,
  .radar-card,
  .flow-row {
    scroll-snap-align: start;
  }

  .global-card,
  .radar-card {
    min-height: 112px;
    padding: 12px;
  }

  .global-card strong,
  .radar-card .price,
  .radar-card .name {
    font-size: 22px;
    line-height: 1.1;
  }

  .alert-list,
  .buy-list,
  .sector-list {
    max-height: 310px;
    overflow: auto;
    padding-right: 2px;
  }

  .alert-item,
  .buy-row,
  .flow-row {
    padding: 10px;
    border-radius: 10px;
  }

  .portfolio-metrics,
  .health-summary,
  .financial-grid,
  .company-deep-grid,
  .peer-grid,
  .stock-brief-grid,
  .technical-grid,
  .strategy-row,
  .pretrade-simulator,
  .chart-live-strip,
  .chart-insight-strip,
  .form-grid,
  .holdings-form,
  .journal-form {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #view-watch > .panel,
  #view-portfolio > .panel {
    display: flex;
    flex-direction: column;
  }

  #view-watch .panel-title,
  #view-portfolio .panel-title {
    order: 0;
    align-items: flex-start;
  }

  #watchPriorityBoard {
    order: 1;
  }

  #watchCards,
  #holdingCards {
    order: 2;
  }

  #watchTableWrap,
  #holdingTableWrap {
    order: 3;
  }

  #view-portfolio .portfolio-news-panel {
    order: 4;
  }

  #view-portfolio .portfolio-history-panel {
    order: 5;
  }

  #watchForm,
  #holdingForm {
    order: 6;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid rgba(84, 214, 255, 0.16);
  }

  .panel-actions {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .layout-switch {
    width: 100%;
    min-width: 0 !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .layout-button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 12px;
  }

  .stock-view-grid,
  .stock-view-grid.compact {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 10px 0;
  }

  .stock-tile,
  .stock-view-grid.compact .stock-tile {
    min-height: 0;
    padding: 12px;
    border-radius: 10px;
  }

  .stock-tile-head {
    margin-bottom: 8px;
  }

  .stock-tile-head strong,
  .stock-view-grid.compact .stock-tile-head strong {
    font-size: 18px;
    line-height: 1.15;
  }

  .tile-price-row {
    align-items: flex-start;
    margin-bottom: 8px;
  }

  .tile-price-row strong,
  .stock-view-grid.compact .tile-price-row strong {
    font-size: 24px;
  }

  .tile-price-row em {
    max-width: 48%;
    font-size: 13px;
    line-height: 1.35;
  }

  .mini-k-chart,
  .stock-view-grid.compact .mini-k-chart {
    height: 82px;
    margin: 8px 0;
  }

  .tile-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .tile-stat-grid > div {
    padding: 7px;
  }

  .tile-stat-grid > div:nth-child(n + 5),
  .stock-view-grid.compact .tile-stat-grid > div:nth-child(n + 5) {
    display: none;
  }

  .stock-tile p {
    min-height: 0;
    font-size: 12px;
  }

  .table-wrap {
    max-width: 100%;
    overflow-x: auto;
    border-radius: 10px;
  }

  table {
    min-width: 760px;
    font-size: 12px;
  }

  th,
  td {
    padding: 8px 9px;
  }

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

  .technical-controls input,
  .technical-controls select,
  .technical-controls button {
    width: 100%;
    min-width: 0;
  }

  .technical-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  .stock-lab {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px;
  }

  .stock-lab > *,
  .advisor-card,
  .chart-card,
  .company-card,
  .position-card,
  .scan-card,
  .anomaly-signal-card,
  .chips-card,
  .institution-card,
  .intraday-card,
  .pretrade-card,
  .strategy-score-card,
  .stock-detail-shell {
    grid-column: 1 / -1 !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .advisor-card {
    padding: 12px;
  }

  .advisor-card strong {
    font-size: 22px;
    line-height: 1.15;
  }

  .chart-card {
    width: 100%;
    overflow: hidden;
    padding: 10px;
    border-radius: 12px;
  }

  .chart-toolbar,
  .chart-action-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .timeframe-switch,
  .indicator-tabs,
  .chart-overlay-controls {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .timeframe-switch::-webkit-scrollbar,
  .indicator-tabs::-webkit-scrollbar,
  .chart-overlay-controls::-webkit-scrollbar {
    display: none;
  }

  .timeframe-button,
  .indicator-tab,
  .chart-overlay-controls button,
  .chart-focus-button {
    flex: 0 0 auto;
    min-height: 32px;
    white-space: nowrap;
  }

  #kChart {
    width: 100% !important;
    height: 340px !important;
  }

  #indicatorChart {
    width: 100% !important;
    height: 180px !important;
  }

  .stock-detail-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    padding: 8px 0;
    background: rgba(4, 14, 28, 0.96);
  }

  .stock-detail-tab {
    width: 100%;
    min-height: 36px;
    padding: 0 6px;
    font-size: 11px;
  }

  .orderbook-table {
    overflow-x: auto;
  }

  .orderbook-table table {
    min-width: 520px;
  }

  .anomaly-radar.collapsed,
  .quick-peek {
    display: none !important;
  }

  .anomaly-radar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 42vh;
  }

  body.chart-focus-active .technical-panel {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2000 !important;
    padding: 8px !important;
    border-radius: 0;
  }

  body.chart-focus-active .chart-card.chart-focus {
    min-height: calc(100vh - 20px);
  }

  body.chart-focus-active .chart-card.chart-focus #kChart {
    height: 58vh !important;
  }

  body.chart-focus-active .chart-card.chart-focus #indicatorChart {
    height: 28vh !important;
  }
}

/* Dedicated phone experience. Desktop/tablet layout remains untouched. */
@media (max-width: 720px) {
  body {
    min-height: 100dvh;
    padding: 0 0 calc(18px + env(safe-area-inset-bottom));
    background:
      linear-gradient(rgba(84, 214, 255, 0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(84, 214, 255, 0.04) 1px, transparent 1px),
      #020711;
    background-size: 24px 24px, 24px 24px, auto;
  }

  .app-shell {
    width: 100%;
    padding: 0 8px 18px;
  }

  .command-header {
    position: sticky;
    top: 0;
    z-index: 120;
    margin: 0 -8px 8px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 10px;
    border-top: 0;
    border-right: 0;
    border-left: 0;
    border-radius: 0 0 14px 14px;
    background:
      linear-gradient(180deg, rgba(4, 14, 28, 0.98), rgba(5, 18, 34, 0.94)),
      radial-gradient(circle at 92% 0%, rgba(84, 214, 255, 0.18), transparent 32%);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.42);
    backdrop-filter: blur(18px);
  }

  .eyebrow {
    margin: 0 0 3px;
    font-size: 8px;
    letter-spacing: 0.08em;
  }

  .command-header h1 {
    max-width: 100%;
    font-size: 21px;
    line-height: 1.02;
  }

  .command-header h1 span {
    display: inline;
  }

  .command-header h1 span + span::before {
    content: " ";
  }

  .subline {
    display: none;
  }

  .header-actions {
    gap: 8px;
    margin-top: 8px;
  }

  .bottom-nav {
    order: 2;
    border-radius: 12px;
  }

  .header-buttons {
    order: 1;
  }

  .header-buttons .ghost-button,
  .header-buttons .primary-button {
    min-height: 34px;
    border-radius: 9px;
    font-size: 12px;
  }

  .nav-item {
    height: 34px;
    min-height: 34px;
    font-size: 11px;
  }

  .system-strip {
    grid-template-columns: repeat(3, minmax(126px, 1fr));
    margin-bottom: 8px;
  }

  .system-strip div,
  .system-strip label {
    min-height: 52px;
  }

  .system-strip div:nth-of-type(n + 4),
  .system-strip label {
    display: none;
  }

  .live-tape {
    grid-template-columns: 68px minmax(0, 1fr);
    min-height: 42px;
    margin-bottom: 8px;
  }

  .live-tape-head {
    padding-left: 8px;
  }

  .tape-chip {
    flex-basis: 154px;
    max-width: 154px;
    min-height: 34px;
  }

  #view-dashboard .dashboard-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 6px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  #view-dashboard .dashboard-grid::-webkit-scrollbar {
    display: none;
  }

  #view-dashboard .dashboard-grid > .panel {
    flex: 0 0 calc(100vw - 16px);
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 198px);
    min-height: calc(100dvh - 230px);
    overflow: auto;
    scroll-snap-align: start;
    overscroll-behavior: contain;
  }

  #view-dashboard .dashboard-grid > .market-panel,
  #view-dashboard .dashboard-grid > .alerts-panel {
    min-height: auto;
  }

  #view-dashboard .panel-title {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -12px -12px 10px;
    padding: 12px;
    border-bottom: 1px solid rgba(84, 214, 255, 0.12);
    background: linear-gradient(180deg, rgba(7, 19, 36, 0.98), rgba(7, 19, 36, 0.92));
  }

  #view-dashboard .panel-title h2 {
    font-size: 21px;
  }

  #view-dashboard .market-panel .index-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px;
    overflow: visible;
  }

  #view-dashboard .market-panel .index-card {
    width: 100% !important;
    max-width: none !important;
    min-height: 104px;
  }

  .index-card strong {
    font-size: 30px;
  }

  .global-grid,
  #view-dashboard .radar-grid,
  .sector-flow-grid {
    grid-auto-columns: minmax(235px, 86vw);
  }

  .alert-list,
  .buy-list,
  .sector-list {
    max-height: none;
    overflow: visible;
  }

  #view-watch .panel,
  #view-portfolio .panel,
  #view-signals .panel,
  #view-intel .panel,
  #view-journal .panel {
    margin-bottom: 8px;
  }

  #view-watch .panel-title,
  #view-portfolio .panel-title {
    display: grid;
    grid-template-columns: 1fr;
  }

  #view-watch .panel-title h2,
  #view-portfolio .panel-title h2,
  #view-signals .panel-title h2,
  #view-intel .panel-title h2,
  #view-journal .panel-title h2 {
    font-size: 22px;
  }

  .stock-view-grid,
  .stock-view-grid.compact {
    gap: 8px;
  }

  .stock-tile {
    border-radius: 14px;
    background:
      linear-gradient(160deg, rgba(8, 26, 46, 0.98), rgba(4, 13, 25, 0.96)),
      radial-gradient(circle at 92% 0%, rgba(84, 214, 255, 0.14), transparent 34%);
  }

  .stock-tile-head strong {
    font-size: 19px;
  }

  .tile-price-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .tile-price-row strong {
    font-size: 27px;
  }

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

  #watchForm,
  #holdingForm,
  .journal-form {
    border-radius: 12px;
    padding: 12px;
    background: rgba(84, 214, 255, 0.04);
  }

  .technical-panel {
    padding: 12px;
  }

  .technical-box {
    padding: 10px;
  }

  .technical-head {
    border-radius: 12px;
  }

  .chart-card {
    border-radius: 14px;
  }

  .chart-live-strip,
  .chart-insight-strip,
  .technical-grid,
  .chips-grid,
  .institution-grid,
  .company-grid,
  .portfolio-history-grid {
    grid-template-columns: 1fr;
  }

  .stock-detail-nav {
    overflow-x: auto;
    grid-template-columns: repeat(6, minmax(92px, 1fr));
    scrollbar-width: none;
  }

  .stock-detail-nav::-webkit-scrollbar {
    display: none;
  }

  .stock-detail-tab {
    white-space: nowrap;
  }

  #kChart {
    height: 360px !important;
  }

  #indicatorChart {
    height: 205px !important;
  }

  .detail-modal {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 34px);
    padding: 14px;
    border-radius: 16px;
  }

  /* Phone cockpit: keep navigation and status compact so data starts above the fold. */
  .command-header {
    gap: 5px;
    padding: calc(5px + env(safe-area-inset-top)) 8px 7px;
    border-radius: 0 0 10px 10px;
  }

  .eyebrow {
    display: none;
  }

  .command-header h1 {
    font-size: 17px;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    gap: 5px;
    margin-top: 4px;
  }

  .header-buttons {
    gap: 5px;
  }

  .header-buttons .ghost-button,
  .header-buttons .primary-button {
    min-height: 30px;
    height: 30px;
    padding: 0 6px;
    border-radius: 8px;
    font-size: 11px;
  }

  .bottom-nav {
    border-radius: 9px;
  }

  .nav-item {
    height: 30px;
    min-height: 30px;
    font-size: 10.5px;
  }

  .system-strip {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
  }

  .system-strip div,
  .system-strip label {
    flex: 0 0 118px;
    min-height: 43px;
    padding: 6px 8px;
  }

  .system-strip span,
  .system-strip label span {
    margin-bottom: 3px;
    font-size: 8.5px;
  }

  .system-strip strong {
    font-size: 12px;
    line-height: 1.15;
  }

  .live-tape {
    height: 48px;
    min-height: 48px;
    padding-top: 0;
    align-items: center;
    margin-bottom: 7px;
  }

  .tape-chip {
    flex-basis: 136px;
    max-width: 136px;
    min-height: 30px;
    padding: 5px 7px;
  }

  #view-dashboard .dashboard-grid > .panel {
    max-height: calc(100dvh - 158px);
    min-height: calc(100dvh - 190px);
  }

  .tile-price-row {
    grid-template-columns: minmax(0, 1fr) minmax(102px, max-content);
  }

  .tile-price-row em {
    max-width: none;
    min-width: 102px;
    justify-self: end;
    white-space: nowrap;
    text-align: right;
  }

  .watch-priority-panel .small-button,
  .chart-action-row .small-button {
    border-color: rgba(84, 214, 255, 0.32);
    background: rgba(7, 28, 49, 0.92);
    color: #e7f4ff;
  }
}

/* Mobile final override: loaded last so the phone layout is not overwritten by older responsive rules. */
@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    padding: 0 0 calc(92px + env(safe-area-inset-bottom));
    background:
      linear-gradient(rgba(84, 214, 255, 0.045) 1px, transparent 1px),
      linear-gradient(90deg, rgba(84, 214, 255, 0.04) 1px, transparent 1px),
      #020711;
    background-size: 26px 26px, 26px 26px, auto;
  }

  .app-shell {
    width: 100%;
    padding: 0 8px 18px;
  }

  .command-header {
    position: sticky;
    top: 0;
    z-index: 170;
    display: grid;
    gap: 7px;
    margin: 0 -8px 8px;
    padding: calc(7px + env(safe-area-inset-top)) 10px 8px;
    border-width: 0 0 1px;
    border-radius: 0 0 12px 12px;
    background:
      linear-gradient(180deg, rgba(3, 12, 24, 0.98), rgba(4, 16, 31, 0.95)),
      radial-gradient(circle at 92% 0%, rgba(84, 214, 255, 0.2), transparent 35%);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.38);
    backdrop-filter: none !important;
  }

  .eyebrow,
  .subline {
    display: none !important;
  }

  .command-header h1 {
    margin: 0;
    color: #e7f4ff;
    font-size: 18px;
    line-height: 1.05;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .command-header h1 span {
    display: inline;
  }

  .command-header h1 span + span::before {
    content: " ";
  }

  .header-actions {
    display: block;
    margin: 0;
    width: 100%;
  }

  .header-buttons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .header-buttons .ghost-button,
  .header-buttons .primary-button {
    min-width: 0;
    height: 32px;
    min-height: 32px;
    padding: 0 7px;
    border-radius: 9px;
    font-size: 11px;
    white-space: nowrap;
  }

  .bottom-nav {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(8px + env(safe-area-inset-bottom)) !important;
    top: auto !important;
    z-index: 260;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    width: auto !important;
    min-width: 0;
    height: 56px;
    margin: 0;
    padding: 5px;
    border: 1px solid rgba(84, 214, 255, 0.32);
    border-radius: 18px;
    overflow: hidden;
    background: rgba(3, 13, 27, 0.96);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.46), inset 0 0 24px rgba(84, 214, 255, 0.1);
    backdrop-filter: blur(18px);
  }

  .nav-item {
    min-width: 0;
    height: 44px;
    min-height: 44px;
    padding: 0 2px;
    border: 0;
    border-radius: 13px;
    font-size: 11px;
    line-height: 1;
  }

  .nav-item.active {
    background: linear-gradient(180deg, rgba(84, 214, 255, 0.32), rgba(255, 209, 102, 0.18));
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.42), 0 8px 18px rgba(84, 214, 255, 0.12);
  }

  .system-strip {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 7px;
    margin: 0 0 7px;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .system-strip::-webkit-scrollbar {
    display: none;
  }

  .system-strip div,
  .system-strip label,
  .system-strip div:nth-of-type(n + 4),
  .system-strip div:nth-of-type(n + 5),
  .system-strip label {
    display: grid !important;
    flex: 0 0 132px;
    min-height: 48px;
    padding: 7px 9px;
    border: 1px solid rgba(84, 214, 255, 0.18);
    border-radius: 12px;
    background: rgba(5, 18, 34, 0.86);
    scroll-snap-align: start;
  }

  .system-strip span,
  .system-strip label span {
    margin-bottom: 3px;
    font-size: 9px;
    line-height: 1;
  }

  .system-strip strong,
  .system-strip input {
    min-width: 0;
    font-size: 12px;
    line-height: 1.2;
  }

  .live-tape {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    min-height: 46px;
    height: 46px;
    margin: 0 0 8px;
    padding: 0;
    overflow: hidden;
    border-radius: 13px;
  }

  .live-tape-head {
    padding-left: 9px;
    font-size: 10px;
  }

  .live-tape-track {
    display: flex !important;
    gap: 8px;
    width: max-content !important;
    min-width: max-content !important;
    overflow: visible !important;
    transform: translate3d(0, 0, 0);
    animation: tapeMove 34s linear infinite !important;
    will-change: transform;
  }

  .live-tape:hover .live-tape-track {
    animation-play-state: running;
  }

  .tape-chip {
    flex: 0 0 206px !important;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 2px 7px;
    max-width: 206px;
    min-height: 32px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
  }

  .tape-chip span,
  .tape-chip strong,
  .tape-chip em {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tape-chip em {
    grid-column: 1 / -1;
    font-size: 10px;
  }

  #view-dashboard .dashboard-grid,
  .dashboard-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px;
    overflow: visible !important;
    padding: 0;
    scroll-snap-type: none;
  }

  #view-dashboard .dashboard-grid > .panel,
  .dashboard-grid > .panel {
    flex: none !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    scroll-snap-align: none;
    content-visibility: auto;
    contain-intrinsic-size: 360px;
  }

  #view-dashboard .panel-title {
    position: static;
    margin: 0 0 10px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
  }

  #view-dashboard .panel-title h2,
  #view-watch .panel-title h2,
  #view-signals .panel-title h2,
  #view-portfolio .panel-title h2,
  #view-intel .panel-title h2,
  #view-journal .panel-title h2 {
    font-size: 20px;
    line-height: 1.18;
  }

  #view-dashboard .market-panel {
    order: 1;
    contain-intrinsic-size: 430px;
  }

  #view-dashboard .radar-panel {
    order: 2;
  }

  #view-dashboard .alerts-panel {
    order: 3;
  }

  #view-dashboard .global-panel {
    order: 4;
  }

  #view-dashboard .sector-panel {
    order: 5;
  }

  #view-dashboard .sector-flow-panel {
    order: 6;
  }

  #view-dashboard .outlook-panel {
    order: 7;
  }

  #view-dashboard .buy-panel {
    order: 8;
  }

  #view-dashboard .holding-panel {
    order: 9;
  }

  #view-dashboard .market-panel .index-grid {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 9px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  #view-dashboard .market-panel .index-grid::-webkit-scrollbar {
    display: none;
  }

  #view-dashboard .market-panel .index-card {
    flex: 0 0 82%;
    width: auto !important;
    max-width: none !important;
    min-height: 124px;
    scroll-snap-align: start;
  }

  .index-card strong {
    font-size: 36px;
    line-height: 1;
  }

  .judgement {
    font-size: 15px;
    line-height: 1.48;
  }

  .alerts-panel,
  .global-panel,
  .sector-panel,
  .sector-flow-panel,
  .outlook-panel,
  .radar-panel,
  .buy-panel,
  .holding-panel {
    max-height: 430px;
  }

  .alert-list,
  .buy-list,
  .sector-list,
  .sector-flow-grid,
  .global-grid,
  .radar-grid,
  .portfolio-metrics {
    max-height: 318px;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .global-grid,
  .radar-grid,
  .sector-flow-grid,
  .portfolio-metrics {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-columns: auto;
  }

  .panel {
    padding: 14px;
    border-radius: 15px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24), inset 0 0 22px rgba(84, 214, 255, 0.045);
  }

  .panel:hover,
  .stock-tile:hover {
    transform: none !important;
    filter: none !important;
  }

  #view-watch > .panel,
  #view-portfolio > .panel {
    display: flex;
    flex-direction: column;
  }

  #watchPriorityBoard {
    order: 1;
  }

  #watchCards,
  #holdingCards {
    order: 2;
  }

  #watchTableWrap,
  #holdingTableWrap {
    order: 3;
  }

  #watchForm,
  #holdingForm {
    order: 4;
  }

  #view-portfolio .portfolio-news-panel {
    order: 5;
  }

  #view-portfolio .portfolio-history-panel {
    order: 6;
  }

  .form-grid,
  .holdings-form,
  .journal-form,
  .technical-controls {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .form-grid input,
  .form-grid select,
  .journal-form input,
  .journal-form select,
  .technical-controls input,
  .technical-controls select {
    min-height: 42px;
  }

  .stock-view-grid,
  .stock-view-grid.compact,
  .stock-view-grid.list {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  .stock-tile,
  .stock-view-grid.compact .stock-tile {
    min-height: 0;
    padding: 12px;
    border-radius: 14px;
  }

  .stock-tile-head,
  .tile-price-row,
  .tile-actions {
    gap: 8px;
  }

  .stock-tile-head strong,
  .stock-view-grid.compact .stock-tile-head strong {
    font-size: 19px;
  }

  .tile-price-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(96px, max-content);
    align-items: end;
  }

  .tile-price-row strong,
  .stock-view-grid.compact .tile-price-row strong {
    font-size: 29px;
    line-height: 1;
  }

  .tile-price-row em {
    max-width: none;
    min-width: 96px;
    justify-self: end;
    white-space: nowrap;
    text-align: right;
    font-size: 13px;
  }

  .mini-k-chart,
  .stock-view-grid.compact .mini-k-chart {
    height: 96px;
    margin: 9px 0;
  }

  .tile-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .tile-stat-grid > div:nth-child(n + 5),
  .stock-view-grid.compact .tile-stat-grid > div:nth-child(n + 5) {
    display: grid;
  }

  .stock-tile p {
    min-height: 0;
    font-size: 12px;
    line-height: 1.45;
  }

  .panel-actions,
  .layout-switch,
  .mode-switch,
  .priority-actions,
  .chart-action-row {
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .panel-actions::-webkit-scrollbar,
  .layout-switch::-webkit-scrollbar,
  .mode-switch::-webkit-scrollbar,
  .priority-actions::-webkit-scrollbar,
  .chart-action-row::-webkit-scrollbar {
    display: none;
  }

  .layout-button,
  .mode-button,
  .small-button {
    flex: 0 0 auto;
  }

  .watch-priority-panel,
  .trader-personality-panel,
  .stock-qa-card,
  .portfolio-news-panel,
  .portfolio-history-panel {
    border-radius: 14px;
  }

  .watch-priority-panel .small-button,
  .chart-action-row .small-button,
  .small-button {
    border-color: rgba(84, 214, 255, 0.32);
    background: rgba(7, 28, 49, 0.92);
    color: #e7f4ff;
  }

  .table-wrap {
    max-width: 100%;
    max-height: 58vh;
    overflow: auto;
    border-radius: 12px;
  }

  table {
    min-width: 720px;
  }

  .technical-panel {
    padding: 14px;
  }

  .technical-box,
  .technical-head,
  .stock-lab,
  .stock-lab > *,
  .advisor-card,
  .chart-card {
    min-width: 0;
  }

  .stock-lab {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .stock-detail-nav {
    display: flex;
    overflow-x: auto;
    gap: 6px;
    scrollbar-width: none;
  }

  .stock-detail-nav::-webkit-scrollbar {
    display: none;
  }

  .stock-detail-tab {
    flex: 0 0 auto;
    min-width: 92px;
    white-space: nowrap;
  }

  #kChart {
    height: 350px !important;
  }

  #indicatorChart {
    height: 200px !important;
  }
}

/* Mobile final polish: keep controls readable and stop old horizontal grids from clipping cards. */
@media (max-width: 720px) {
  .panel-title {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px;
    align-items: start;
  }

  .panel-title > .pill,
  .panel-title > .count-badge {
    justify-self: start;
  }

  .panel-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px;
    width: 100%;
    justify-content: stretch;
    overflow: visible;
  }

  .panel-actions > .pill {
    justify-self: start;
    min-height: 26px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .layout-switch,
  .mode-switch {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    overflow: hidden;
  }

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

  .layout-button,
  .mode-button {
    min-width: 0;
    min-height: 38px;
    padding: 0 8px;
  }

  #view-dashboard .global-grid,
  #view-dashboard .radar-grid,
  #view-dashboard .sector-flow-grid,
  .global-grid,
  .radar-grid,
  .sector-flow-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto;
  }

  .global-card,
  .radar-card,
  .flow-row {
    width: 100%;
    max-width: 100%;
  }

  #view-dashboard .radar-panel .panel-title h2,
  #view-watch .panel-title h2,
  #view-portfolio .panel-title h2 {
    font-size: 19px;
  }
}
/* Mobile v6 actual EOF override: keeps the live served phone layout stable. */
@media (max-width: 720px) {
  body {
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .command-header h1 {
    font-size: 16px !important;
    line-height: 1.1;
  }

  .system-strip div,
  .system-strip label,
  .system-strip div:nth-of-type(n + 4),
  .system-strip div:nth-of-type(n + 5) {
    flex-basis: 122px !important;
    min-height: 44px !important;
    padding: 6px 8px !important;
  }

  .system-strip strong,
  .system-strip input {
    font-size: 11.5px !important;
    line-height: 1.12 !important;
  }

  .live-tape {
    grid-template-columns: 74px minmax(0, 1fr) !important;
    height: 42px !important;
    min-height: 42px !important;
    background: rgba(3, 14, 28, 0.96) !important;
  }

  .live-tape-head {
    position: relative !important;
    z-index: 3 !important;
    min-height: 42px !important;
    padding-left: 8px !important;
    background:
      linear-gradient(90deg, rgba(4, 16, 31, 0.99), rgba(4, 16, 31, 0.98) 78%, rgba(4, 16, 31, 0.76)) !important;
    box-shadow: 14px 0 18px rgba(2, 7, 17, 0.9) !important;
  }

  .live-tape-track {
    position: relative !important;
    z-index: 1 !important;
    align-items: center !important;
  }

  .tape-chip {
    flex: 0 0 178px !important;
    max-width: 178px !important;
    min-height: 30px !important;
    padding: 5px 8px !important;
    border-radius: 14px !important;
  }

  #view-dashboard .market-panel .panel-title {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center !important;
  }

  #view-dashboard .market-panel .panel-title .pill {
    justify-self: end !important;
  }

  #view-dashboard .market-panel .index-grid,
  .market-panel .index-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
    overflow: visible !important;
    padding-bottom: 0 !important;
    scroll-snap-type: none !important;
  }

  #view-dashboard .market-panel .index-card,
  .market-panel .index-grid > .index-card {
    flex: none !important;
    width: auto !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 98px !important;
    padding: 12px !important;
    border-radius: 15px !important;
    scroll-snap-align: none !important;
  }

  #view-dashboard .market-panel .index-card:nth-child(3) {
    grid-column: 1 / -1 !important;
    min-height: 82px !important;
  }

  #view-dashboard .market-panel .index-card strong {
    margin-top: 8px !important;
    font-size: 25px !important;
    line-height: 1 !important;
    font-variant-numeric: tabular-nums;
  }

  #view-dashboard .market-panel .index-card:nth-child(3) strong {
    font-size: 28px !important;
  }

  #view-dashboard .market-panel .index-card em {
    margin-top: 7px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  #view-dashboard .market-panel .judgement {
    margin-top: 10px !important;
    padding: 12px !important;
    border-radius: 14px !important;
    font-size: 14px !important;
    line-height: 1.45 !important;
  }

  #view-dashboard .global-panel {
    max-height: 540px !important;
  }

  #view-dashboard .global-grid,
  .global-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    grid-auto-columns: auto !important;
    gap: 9px !important;
    max-height: 408px !important;
    overflow: auto !important;
    padding-right: 1px !important;
  }

  .global-card {
    display: grid !important;
    align-content: start !important;
    gap: 6px !important;
    width: auto !important;
    max-width: 100% !important;
    min-height: 132px !important;
    padding: 11px !important;
    border-radius: 16px !important;
  }

  .global-card-head {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 5px !important;
    align-items: start !important;
  }

  .global-card span {
    overflow: hidden !important;
    color: #e7f4ff !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .global-symbol {
    max-width: 52px !important;
    border: 1px solid rgba(84, 214, 255, 0.2) !important;
    border-radius: 999px !important;
    padding: 2px 6px !important;
    color: #9edfff !important;
    font-size: 9.5px !important;
    line-height: 1.15 !important;
    text-align: center !important;
  }

  .global-card .sector-tag {
    max-width: 100% !important;
    margin: 0 !important;
    padding: 3px 7px !important;
    overflow: hidden !important;
    color: #ffe6a9 !important;
    font-size: 10px !important;
    line-height: 1.15 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .global-card strong {
    margin: 2px 0 0 !important;
    color: #f6fbff !important;
    font-size: 22px !important;
    line-height: 1 !important;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
  }

  .global-card em {
    width: fit-content !important;
    margin: 0 !important;
    border-radius: 999px !important;
    padding: 3px 7px !important;
    background: rgba(255, 255, 255, 0.04) !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
    white-space: nowrap !important;
  }

  .global-time {
    color: #9fb9ce !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
  }

  .global-card::before,
  .radar-card::before,
  .index-card::before,
  .buy-row::before,
  .signal-row::before {
    display: none !important;
  }

  .global-card:active,
  .radar-card:active,
  .index-card:active,
  .stock-tile:active,
  .sector-chip:active,
  .flow-row:active {
    transform: scale(0.99) !important;
  }

  .view.active {
    animation: mobileViewIn 0.18s ease both;
  }
}

@keyframes mobileViewIn {
  from {
    opacity: 0.78;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Mobile tape shield: keep the moving ticker from painting through the label. */
@media (max-width: 720px) {
  .live-tape {
    position: relative !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
  }

  .live-tape-head {
    width: 92px !important;
    background: #04101f !important;
    box-shadow: 18px 0 22px rgba(2, 7, 17, 0.96) !important;
  }

  .live-tape-head::after {
    content: "";
    position: absolute;
    top: 0;
    right: -50px;
    bottom: 0;
    width: 50px;
    pointer-events: none;
    background: linear-gradient(90deg, #04101f 0 44%, rgba(4, 16, 31, 0));
  }
}
/* Professional data-source clarity: green=live/ok, yellow=fallback/cache, red=error. */
.index-source-note {
  display: block;
  margin-top: 8px;
  color: #9fb9ce;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
}

.health-source-row.ok,
.source-matrix-row.ok {
  border-color: rgba(77, 255, 209, 0.34) !important;
  background: linear-gradient(180deg, rgba(13, 53, 50, 0.28), rgba(8, 28, 43, 0.78)) !important;
}

.health-source-row.fallback,
.source-matrix-row.fallback {
  border-color: rgba(255, 209, 102, 0.42) !important;
  background: linear-gradient(180deg, rgba(74, 54, 16, 0.34), rgba(8, 28, 43, 0.78)) !important;
}

.health-source-row.stale,
.health-source-row.pending,
.source-matrix-row.stale,
.source-matrix-row.pending {
  border-color: rgba(255, 209, 102, 0.34) !important;
}

.health-source-row.error,
.source-matrix-row.error {
  border-color: rgba(255, 95, 109, 0.5) !important;
  background: linear-gradient(180deg, rgba(91, 24, 35, 0.38), rgba(8, 28, 43, 0.78)) !important;
}

@media (max-width: 720px) {
  .index-source-note {
    margin-top: 7px;
    font-size: 10px;
    line-height: 1.25;
  }
}

/* Professional extension panels: breadth, events, impact, reports, risk radar, comparison. */
.market-breadth-panel,
.event-calendar-panel,
.daily-report-panel,
.news-impact-panel,
.portfolio-risk-panel,
.stop-plan-panel,
.compare-panel,
.stock-radar-card {
  overflow: hidden;
}

.market-breadth-grid,
.portfolio-risk-radar,
.stock-radar-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.breadth-gauge,
.risk-radar-core {
  width: 138px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(circle at center, rgba(11, 22, 38, 0.94) 0 55%, transparent 56%),
    conic-gradient(from 220deg, rgba(255, 85, 112, 0.9), rgba(255, 214, 102, 0.95), rgba(71, 255, 199, 0.95) var(--breadth, 50%), rgba(55, 68, 92, 0.74) 0);
  border: 1px solid rgba(147, 197, 253, 0.24);
  box-shadow: inset 0 0 24px rgba(80, 227, 255, 0.08), 0 18px 42px rgba(0, 0, 0, 0.2);
}

.breadth-gauge strong,
.risk-radar-core strong {
  color: #f8fbff;
  font-size: 32px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 0 18px rgba(91, 239, 255, 0.45);
}

.breadth-gauge span,
.risk-radar-core span {
  margin-top: 46px;
  color: #9fb9ce;
  font-size: 11px;
  font-weight: 850;
  position: absolute;
}

.breadth-stats,
.breadth-leaders,
.event-calendar-list,
.daily-report-grid,
.news-impact-grid,
.stop-plan-list,
.compare-arena,
.stock-radar-factors,
.peer-grid {
  display: grid;
  gap: 10px;
  min-width: 0;
}

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

.breadth-stats > div,
.daily-report-grid > article,
.stock-radar-factors > div,
.peer-grid > div {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  padding: 12px;
  background: linear-gradient(145deg, rgba(12, 25, 45, 0.94), rgba(7, 16, 31, 0.9));
  min-width: 0;
}

.breadth-stats span,
.daily-report-grid span,
.stock-radar-factors span,
.peer-grid span {
  display: block;
  color: #9fb9ce;
  font-size: 11px;
  font-weight: 850;
}

.breadth-stats strong,
.daily-report-grid strong,
.peer-grid strong {
  display: block;
  margin-top: 4px;
  color: #eef7ff;
  font-size: 18px;
  font-weight: 950;
}

.breadth-stats em,
.daily-report-grid p,
.peer-grid em {
  display: block;
  margin-top: 5px;
  color: #8fa9bf;
  font-size: 12px;
  line-height: 1.45;
  font-style: normal;
}

.breadth-leaders {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.breadth-leaders button,
.compare-card,
.event-row,
.news-impact-card,
.stop-plan-row {
  border: 1px solid rgba(147, 197, 253, 0.16);
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(10, 22, 40, 0.94), rgba(7, 15, 30, 0.92));
  color: inherit;
  text-align: left;
  text-decoration: none;
  min-width: 0;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.breadth-leaders button {
  padding: 11px 12px;
  cursor: pointer;
}

.breadth-leaders button:hover,
.compare-card:hover,
.event-row:hover,
.news-impact-card:hover,
.stop-plan-row:hover {
  transform: translateY(-2px);
  border-color: rgba(82, 234, 255, 0.38);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24), 0 0 0 1px rgba(82, 234, 255, 0.08);
}

.breadth-leaders span,
.breadth-leaders strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-calendar-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.event-row {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
}

.event-row span,
.news-impact-card span,
.compare-card span,
.stop-plan-row span {
  color: #a6bfd4;
  font-size: 11px;
  font-weight: 850;
}

.event-row strong,
.news-impact-card strong,
.compare-card strong,
.stop-plan-row strong {
  color: #f2f8ff;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.35;
}

.event-row em,
.news-impact-card em,
.compare-card em,
.stop-plan-row em {
  color: #8fa9bf;
  font-size: 12px;
  line-height: 1.4;
  font-style: normal;
}

.event-row.risk,
.news-impact-card.risk,
.stop-plan-row.risk {
  border-color: rgba(255, 95, 109, 0.42);
  background: linear-gradient(145deg, rgba(76, 19, 32, 0.82), rgba(8, 18, 33, 0.92));
}

.event-row.watch,
.news-impact-card.watch,
.news-impact-card.positive {
  border-color: rgba(255, 214, 102, 0.34);
}

.news-impact-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.news-impact-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  min-height: 172px;
}

.impact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.impact-tags i {
  border: 1px solid rgba(82, 234, 255, 0.18);
  border-radius: 999px;
  padding: 4px 8px;
  color: #bfeeff;
  background: rgba(82, 234, 255, 0.08);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}

.daily-report-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.risk-radar-core {
  --breadth: 65%;
  isolation: isolate;
}

.risk-radar-core i {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 2px solid rgba(82, 234, 255, 0.18);
  transform: rotate(calc(var(--i, 0) * 1deg));
  clip-path: polygon(50% 50%, 100% 50%, 100% 64%, 50% 50%);
  opacity: 0.9;
}

.risk-radar-core i:nth-child(1) { --i: 0; border-color: rgba(255, 95, 109, 0.68); }
.risk-radar-core i:nth-child(2) { --i: 72; border-color: rgba(255, 214, 102, 0.66); }
.risk-radar-core i:nth-child(3) { --i: 144; border-color: rgba(82, 234, 255, 0.72); }
.risk-radar-core i:nth-child(4) { --i: 216; border-color: rgba(117, 255, 160, 0.62); }
.risk-radar-core i:nth-child(5) { --i: 288; border-color: rgba(192, 132, 252, 0.62); }

.risk-radar-list > div,
.stock-radar-factors > div {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: center;
}

.risk-radar-list div div,
.stock-radar-factors div div {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.15);
  overflow: hidden;
}

.risk-radar-list div div i,
.stock-radar-factors div div i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #52eaff, #75ffa0);
}

.risk-radar-list em,
.stock-radar-factors em {
  grid-column: 2 / 4;
  color: #8fa9bf;
  font-size: 11px;
  font-style: normal;
}

.stop-plan-list {
  grid-template-columns: 1fr;
}

.stop-plan-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.25fr) repeat(3, minmax(118px, 0.75fr));
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.stop-plan-row > div {
  min-width: 0;
}

.compare-arena {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.compare-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  cursor: pointer;
}

.compare-card > strong {
  color: #f8fbff;
  font-size: 32px;
  line-height: 1;
  text-shadow: 0 0 18px rgba(82, 234, 255, 0.32);
}

.compare-bars {
  display: grid;
  gap: 5px;
}

.compare-bars i {
  position: relative;
  height: 18px;
  border-radius: 999px;
  min-width: 46px;
  background: linear-gradient(90deg, rgba(82, 234, 255, 0.9), rgba(117, 255, 160, 0.78));
  overflow: hidden;
}

.compare-bars b {
  position: absolute;
  inset: 0 7px;
  display: flex;
  align-items: center;
  color: #03101e;
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  white-space: nowrap;
}

.stock-radar-card {
  border: 1px solid rgba(82, 234, 255, 0.18);
  border-radius: 20px;
  padding: 16px;
  margin-top: 14px;
  background: linear-gradient(145deg, rgba(7, 18, 34, 0.96), rgba(12, 28, 50, 0.9));
}

.stock-radar-card h4 {
  margin: 0 0 12px;
  color: #f4fbff;
  font-size: 15px;
}

.stock-radar-card svg {
  width: 100%;
  max-width: 260px;
  height: auto;
  justify-self: center;
  overflow: visible;
}

.stock-radar-card text {
  fill: #b9d5ea;
  font-family: inherit;
  font-size: 10px;
  font-weight: 850;
}

.radar-ring {
  fill: none;
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 1;
}

.radar-shape {
  fill: rgba(82, 234, 255, 0.2);
  stroke: rgba(82, 234, 255, 0.92);
  stroke-width: 2;
  filter: drop-shadow(0 0 10px rgba(82, 234, 255, 0.36));
}

.peer-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-impact-grid,
.detail-compare {
  display: grid;
  gap: 12px;
}

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

body.command-mode .market-breadth-panel,
body.command-mode .event-calendar-panel,
body.command-mode .daily-report-panel,
body.command-mode .news-impact-panel,
body.command-mode .portfolio-risk-panel,
body.command-mode .stop-plan-panel,
body.command-mode .compare-panel {
  max-height: none;
}

@media (max-width: 1120px) {
  .news-impact-grid,
  .compare-arena,
  .daily-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .stop-plan-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .market-breadth-grid,
  .portfolio-risk-radar,
  .stock-radar-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .breadth-gauge,
  .risk-radar-core {
    width: min(46vw, 156px);
    justify-self: center;
  }

  .breadth-stats,
  .breadth-leaders,
  .event-calendar-list,
  .daily-report-grid,
  .news-impact-grid,
  .compare-arena,
  .peer-grid,
  .detail-impact-grid {
    grid-template-columns: 1fr;
  }

  .breadth-stats > div,
  .daily-report-grid > article,
  .news-impact-card,
  .compare-card,
  .event-row {
    border-radius: 14px;
    padding: 12px;
  }

  .news-impact-card {
    min-height: auto;
  }

  .risk-radar-list > div,
  .stock-radar-factors > div {
    grid-template-columns: 68px minmax(0, 1fr) 30px;
    gap: 7px;
  }

  .stop-plan-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .compare-card > strong {
    font-size: 28px;
  }
}

/* Fix high-contrast detail rows and rebuild the stock radar so it does not collapse. */
.detail-table.sector-quote-table {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.detail-table.sector-quote-table button {
  display: grid;
  gap: 5px;
  width: 100%;
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid rgba(82, 234, 255, 0.24);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(8, 20, 38, 0.98), rgba(12, 33, 56, 0.94)) !important;
  color: #e9f7ff !important;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  cursor: pointer;
}

.detail-table.sector-quote-table button:hover {
  border-color: rgba(82, 234, 255, 0.52);
  background: linear-gradient(145deg, rgba(10, 33, 58, 0.98), rgba(8, 23, 42, 0.96)) !important;
}

.detail-table.sector-quote-table button span {
  display: block;
  color: #dff7ff !important;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-table.sector-quote-table button strong {
  display: block;
  color: #7dffbf !important;
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.detail-table.sector-quote-table button strong.danger {
  color: #ff7485 !important;
}

.stock-radar-layout {
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
  align-items: center;
}

.stock-radar-visual {
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(82, 234, 255, 0.13);
  border-radius: 18px;
  background: radial-gradient(circle at center, rgba(82, 234, 255, 0.12), rgba(8, 18, 34, 0.28) 58%, transparent 72%);
}

.stock-radar-card svg {
  width: min(100%, 270px);
  max-width: 270px;
  aspect-ratio: 1;
  overflow: visible;
}

.stock-radar-card text.radar-label {
  fill: #dff7ff;
  font-size: 9.5px;
  font-weight: 950;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5, 12, 24, 0.9);
  stroke-width: 2.5px;
}

.radar-axis {
  stroke: rgba(148, 216, 255, 0.17);
  stroke-width: 1;
}

.radar-ring {
  fill: none;
  stroke: rgba(148, 216, 255, 0.18);
  stroke-width: 1.2;
}

.radar-ring.middle {
  stroke: rgba(148, 216, 255, 0.24);
}

.radar-shape {
  fill: rgba(82, 234, 255, 0.24);
  stroke: #52eaff;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 10px rgba(82, 234, 255, 0.32));
}

.radar-point {
  fill: #dfffff;
  stroke: #52eaff;
  stroke-width: 1.4;
}

.stock-radar-factors > div {
  grid-template-columns: 64px minmax(0, 1fr) 42px;
  padding: 10px 11px;
  border-radius: 14px;
}

.stock-radar-factors > div > span {
  color: #dcefff;
  font-size: 12px;
}

.stock-radar-factors > div > strong {
  color: #f8fcff;
  text-align: right;
}

.stock-radar-factors > div > div {
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.stock-radar-factors > div > div > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #52eaff, #75ffa0);
}

.stock-radar-factors > div > em {
  grid-column: 2 / 4;
  color: #a8c1d8;
  font-size: 11px;
  font-style: normal;
}

.stock-radar-note {
  margin: 12px 0 0;
  color: #c8dded;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 720px) {
  .detail-table.sector-quote-table {
    grid-template-columns: 1fr;
  }

  .stock-radar-layout {
    grid-template-columns: 1fr;
  }

  .stock-radar-card svg {
    width: min(82vw, 270px);
  }

  .stock-lab .chart-card {
    order: -1;
  }
}

/* Final QA repair pass: stable breadth labels, sector detail cards, mobile stock tabs, and radar sizing. */
.breadth-leader-title {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 0;
  padding: 9px 11px;
  border: 1px solid rgba(82, 234, 255, 0.16);
  border-radius: 12px;
  background: rgba(82, 234, 255, 0.055);
}

.breadth-leader-title strong {
  color: #effaff;
  font-size: 13px;
  font-weight: 950;
}

.breadth-leader-title span {
  color: #9eb8cc;
  font-size: 11px;
  font-weight: 850;
}

.detail-table.sector-quote-table {
  align-items: stretch;
}

.detail-table.sector-quote-table button,
.detail-table.sector-quote-table > div {
  min-height: 62px;
}

.stock-view-grid,
.stock-view-grid.compact {
  grid-template-columns: repeat(auto-fit, minmax(244px, 1fr));
}

.stock-view-grid .stock-tile {
  min-width: 0;
}

@media (min-width: 1180px) {
  .stock-view-grid,
  .stock-view-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(244px, 1fr));
  }

  #holdingCards.stock-view-grid,
  #holdingCards.stock-view-grid.compact {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }

  #holdingCards .stock-tile {
    max-width: none;
  }
}

@media (min-width: 1280px) {
  #holdingCards.stock-view-grid,
  #holdingCards.stock-view-grid.compact {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.mini-k-chart {
  aspect-ratio: 16 / 6;
  min-height: 88px;
  max-height: 138px;
}

.stock-radar-card {
  grid-column: span 12;
  min-width: 0;
}

.stock-radar-layout {
  display: grid;
}

.stock-radar-visual {
  overflow: hidden;
}

.stock-radar-card svg {
  display: block;
  width: min(100%, 300px);
  max-width: 300px;
  margin: 0 auto;
}

.stock-radar-card text.radar-label {
  font-size: 8.8px;
  dominant-baseline: middle;
}

.mobile-chart-control-card {
  border: 1px solid rgba(82, 234, 255, 0.18);
  border-radius: 16px;
  padding: 14px;
  background:
    radial-gradient(circle at top right, rgba(82, 234, 255, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(7, 18, 34, 0.96), rgba(9, 26, 46, 0.9));
}

.mobile-chart-snapshot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin: 12px 0;
}

.mobile-chart-snapshot div {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(82, 234, 255, 0.15);
  border-radius: 12px;
  background: rgba(82, 234, 255, 0.06);
}

.mobile-chart-snapshot span,
.mobile-chart-snapshot em {
  display: block;
  color: #9eb8cc;
  font-size: 11px;
  font-style: normal;
  font-weight: 850;
}

.mobile-chart-snapshot strong {
  display: block;
  margin: 4px 0;
  color: #effaff;
  font-size: 18px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.mobile-chart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-chart-actions button {
  min-height: 34px;
  border: 1px solid rgba(82, 234, 255, 0.24);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(82, 234, 255, 0.08);
  color: #dff7ff;
  font-size: 12px;
  font-weight: 950;
}

@media (max-width: 720px) {
  .stock-detail-shell {
    padding: 10px;
    border-radius: 16px;
  }

  .stock-detail-nav {
    position: sticky;
    top: 8px;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    padding: 7px;
    overflow: visible;
    background: rgba(3, 12, 25, 0.94);
    backdrop-filter: blur(14px);
  }

  .stock-detail-tab {
    min-width: 0;
    min-height: 32px;
    padding: 6px 4px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .stock-tab-panel {
    min-height: 180px;
  }

  .stock-brief-grid,
  .technical-grid,
  .strategy-bars,
  .chips-grid,
  .financial-grid,
  .company-deep-grid,
  .qa-grid,
  .mobile-chart-snapshot {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-live-strip,
  .chart-insight-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advisor-card,
  .strategy-score-card,
  .stock-radar-card,
  .stock-detail-shell,
  .chart-card,
  .company-card,
  .financial-card,
  .chips-card,
  .institution-card,
  .intraday-card,
  .pretrade-card {
    border-radius: 16px;
  }

  .stock-radar-layout {
    grid-template-columns: 1fr;
  }

  .stock-radar-card svg {
    width: min(78vw, 280px);
  }

  .stock-radar-factors > div {
    grid-template-columns: 52px minmax(0, 1fr) 34px;
  }

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

  .detail-table.sector-quote-table button {
    min-height: 74px;
    padding: 10px;
  }

  .detail-table.sector-quote-table button span,
  .detail-table.sector-quote-table button strong {
    font-size: 12px;
  }

  #holdingCards.stock-view-grid,
  #holdingCards.stock-view-grid.compact,
  #watchCards.stock-view-grid,
  #watchCards.stock-view-grid.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stock-tile {
    padding: 11px;
  }

  .stock-tile-head strong {
    font-size: 16px;
  }

  .tile-price-row strong {
    font-size: 21px;
  }

  .tile-price-row em {
    font-size: 12px;
  }

  .mini-k-chart,
  .stock-view-grid.compact .mini-k-chart {
    height: auto;
    min-height: 82px;
  }
}

@media (max-width: 430px) {
  .stock-detail-nav {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
  }

  .stock-detail-tab {
    font-size: 10px;
    padding-inline: 2px;
  }

  .stock-brief-grid,
  .technical-grid,
  .strategy-bars,
  .chips-grid,
  .financial-grid,
  .company-deep-grid,
  .qa-grid,
  .mobile-chart-snapshot,
  .detail-table.sector-quote-table,
  #holdingCards.stock-view-grid,
  #holdingCards.stock-view-grid.compact,
  #watchCards.stock-view-grid,
  #watchCards.stock-view-grid.compact {
    grid-template-columns: 1fr;
  }
}
