:root {
  --bg: #f4f7fb;
  --bg-rail: #edf2f7;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef3f9;
  --line: #d9e0ea;
  --line-strong: #b7c2d2;
  --text: #111827;
  --text-soft: #475467;
  --text-faint: #8994a7;
  --accent: #1d4ed8;
  --accent-2: #0f766e;
  --accent-soft: #eaf1ff;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #12a675;
  --green-dark: #047857;
  --green-soft: #e9f8f2;
  --red: #dc2626;
  --red-soft: #fff0f0;
  --amber: #b7791f;
  --amber-soft: #fff8e6;
  --gray: #667085;
  --radius: 8px;
  --radius-sm: 6px;
  --max-width: none;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, .08);
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 13px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .78), rgba(255, 255, 255, 0) 220px),
    var(--bg);
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
}

#header,
.app-shell {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
}

.progress-wrap,
.market-overview,
.presets,
.filters,
.table-wrap,
.stock-page,
.premium-page,
#plans-page,
#admin-page,
#stock-page-content,
#premium-content,
#plans-content,
#admin-content {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

#stock-page-content,
#premium-content,
#plans-content,
#admin-content {
  min-width: 0;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-faint);
  font-size: .72rem;
  line-height: 1.45;
}

#header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem .8rem;
  background: rgba(244, 247, 251, .92);
  border-bottom: 1px solid rgba(217, 224, 234, .82);
  backdrop-filter: blur(14px);
}

.header-left,
.header-right,
.logo {
  display: flex;
  align-items: center;
}

.logo {
  gap: .75rem;
  min-width: 0;
}

.logo svg {
  flex: 0 0 auto;
  filter: drop-shadow(0 6px 14px rgba(29, 78, 216, .18));
}

.logo h1 {
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
}

.accent {
  color: var(--accent);
}

.subtitle {
  margin-top: .12rem;
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 500;
}

.header-right {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .45rem;
}

.meta-text {
  min-width: 8.5rem;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: .68rem;
  text-align: right;
}

.market-clock {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: .38rem .62rem;
  color: var(--gray);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 750;
  white-space: nowrap;
}

.market-clock::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: .42rem;
  background: currentColor;
  border-radius: 999px;
}

.market-clock.market-open {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: rgba(18, 166, 117, .26);
}

.market-clock.market-warn {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: rgba(183, 121, 31, .26);
}

.market-clock.market-closed {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(220, 38, 38, .2);
}

.btn-pill {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: .38rem;
  padding: .45rem .78rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.btn-pill:hover {
  transform: translateY(-1px);
}

.btn-pill:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border-color: transparent;
  box-shadow: 0 7px 18px rgba(29, 78, 216, .18);
}

.btn-primary:hover {
  box-shadow: 0 10px 22px rgba(29, 78, 216, .23);
}

.btn-ghost {
  color: var(--text-soft);
  background: var(--surface);
}

.btn-ghost:hover {
  color: var(--accent);
  border-color: #b7c8ec;
  background: var(--accent-soft);
}

.btn-pill.spinning svg {
  animation: spin .8s linear infinite;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(230px, 270px) minmax(0, 1fr);
  gap: 1rem;
  padding: .85rem 1rem 0;
}

.workspace {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 76px;
  align-self: start;
  max-height: calc(100vh - 92px);
  overflow: auto;
  padding-right: .15rem;
}

.user-panel,
.sidebar-section,
.side-nav {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.user-panel {
  padding: .9rem;
}

.user-panel h2 {
  margin-top: .2rem;
  color: var(--text);
  font-size: .98rem;
  font-weight: 800;
  letter-spacing: 0;
}

.user-panel p {
  margin-top: .18rem;
  color: var(--text-soft);
  font-size: .72rem;
  line-height: 1.45;
}

.user-panel .plan-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-top: .45rem;
  padding: .18rem .42rem;
  color: var(--gray);
  background: var(--surface-muted);
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.user-panel .plan-badge.premium {
  color: var(--green-dark);
  background: var(--green-soft);
}

.user-panel .plan-badge.ultimate,
.user-panel .plan-badge.admin {
  color: var(--accent);
  background: var(--accent-soft);
}

.side-label {
  color: var(--text-faint);
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.side-actions {
  display: flex;
  gap: .4rem;
  margin-top: .7rem;
}

.side-btn {
  min-height: 30px;
  flex: 1;
  padding: .4rem .55rem;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .7rem;
  font-weight: 800;
}

.side-btn:hover {
  color: var(--accent);
  border-color: #b7c8ec;
  background: var(--accent-soft);
}

.side-btn.primary {
  color: #fff;
  background: var(--text);
  border-color: var(--text);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-top: .75rem;
  padding: .35rem;
}

.side-nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  width: 100%;
  min-height: 38px;
  padding: .55rem .65rem;
  color: var(--text-soft);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .75rem;
  font-weight: 800;
  text-align: left;
}

.side-nav-btn strong {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: .66rem;
}

.side-nav-btn:hover,
.side-nav-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.side-nav-btn.active strong {
  color: var(--accent);
}

.sidebar-section {
  margin-top: .75rem;
  padding: .75rem;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .55rem;
}

.mini-link {
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: .66rem;
  font-weight: 800;
}

.sector-list {
  display: flex;
  flex-direction: column;
  gap: .32rem;
}

.sector-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .5rem .55rem;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.sector-row:hover {
  border-color: #c8d5e8;
  background: #fff;
  transform: translateY(-1px);
}

.sector-row.active {
  border-color: #b7c8ec;
  background: var(--accent-soft);
}

.sector-name {
  min-width: 0;
  overflow: hidden;
  font-size: .72rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sector-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .05rem;
  font-family: var(--mono);
  line-height: 1.15;
}

.sector-meta strong {
  font-size: .7rem;
}

.sector-meta em {
  color: var(--text-faint);
  font-size: .58rem;
  font-style: normal;
}

.watchlist-preview {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.watch-item {
  display: flex;
  flex-direction: column;
  gap: .08rem;
  width: 100%;
  padding: .46rem .55rem;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.watch-item:hover {
  border-color: #c8d5e8;
  background: #fff;
}

.watch-item strong {
  color: var(--accent);
  font-family: var(--mono);
  font-size: .7rem;
}

.watch-item span {
  overflow: hidden;
  color: var(--text-soft);
  font-size: .66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 0 .2rem;
}

.progress-wrap.hidden {
  display: none;
}

.progress-bar {
  flex: 1;
  height: 6px;
  overflow: hidden;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  border-radius: inherit;
  transition: width .28s ease;
}

.progress-text {
  min-width: 9rem;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: .68rem;
  text-align: right;
  white-space: nowrap;
}

.market-overview {
  display: grid;
  grid-template-columns: minmax(230px, 1.25fr) minmax(150px, .85fr) repeat(5, minmax(92px, .65fr));
  gap: .55rem;
  padding: .75rem 0 .55rem;
}

.mo-card {
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: .45rem;
  padding: .75rem .85rem;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.mo-label {
  color: var(--text-faint);
  font-size: .61rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.mo-big {
  font-family: var(--mono);
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
}

.mo-breadth,
.mo-sentiment {
  display: flex;
  align-items: center;
}

.mo-breadth {
  gap: .55rem;
}

.mo-sentiment {
  gap: .5rem;
  flex-wrap: wrap;
}

.mo-g,
.mo-r {
  min-width: 3.8rem;
  font-family: var(--mono);
  font-size: .82rem;
  font-weight: 700;
}

.mo-g { color: var(--green-dark); }
.mo-r { color: var(--red); text-align: right; }

.mo-bar-wrap {
  flex: 1;
  height: 8px;
  overflow: hidden;
  background: var(--red-soft);
  border-radius: 999px;
}

.mo-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--green-dark), var(--green));
  border-radius: inherit;
  transition: width .45s ease;
}

.mo-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: .2rem .46rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mo-tag.bull { color: var(--green-dark); background: var(--green-soft); }
.mo-tag.bear { color: var(--red); background: var(--red-soft); }
.mo-tag.neutral { color: var(--gray); background: var(--surface-muted); }

.sc-buy .mo-big { color: var(--green-dark); }
.sc-buy-l .mo-big { color: var(--green); }
.sc-hold .mo-big { color: var(--gray); }
.sc-sell .mo-big { color: var(--red); }
.sc-total .mo-big { color: var(--accent); }

.sector-wrap {
  padding: 0 1.5rem .55rem;
}

.sector-heatmap {
  min-height: 35px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sh-block {
  min-width: 78px;
  display: flex;
  flex-direction: column;
  gap: .04rem;
  padding: .38rem .55rem;
  color: #fff;
  border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  cursor: default;
  transition: filter .16s ease, transform .16s ease;
}

.sh-block:hover {
  filter: saturate(1.08) brightness(.97);
  transform: translateY(-1px);
}

.sh-name {
  overflow: hidden;
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.sh-val {
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 700;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  padding: .28rem 0 .5rem;
}

.preset {
  min-height: 30px;
  padding: .38rem .66rem;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .69rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
}

.preset:hover {
  color: var(--accent);
  border-color: #b7c8ec;
  background: var(--accent-soft);
}

.preset.active {
  color: #fff;
  background: var(--text);
  border-color: var(--text);
  box-shadow: 0 8px 18px rgba(17, 24, 39, .16);
}

.filters {
  display: grid;
  grid-template-columns: minmax(230px, 1.4fr) repeat(3, minmax(150px, .55fr)) auto;
  align-items: center;
  gap: .45rem;
  padding: .55rem 0 .7rem;
}

.search-box,
.fsel {
  width: 100%;
  min-height: 36px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .75rem;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.search-box {
  padding: .48rem .72rem;
}

.search-box::placeholder {
  color: var(--text-faint);
}

.fsel {
  padding: .48rem 2rem .48rem .62rem;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-soft) 50%),
    linear-gradient(135deg, var(--text-soft) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 52%,
    calc(100% - 10px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.search-box:focus,
.fsel:focus {
  outline: 0;
  background-color: #fff;
  border-color: rgba(29, 78, 216, .62);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .11);
}

.filter-count {
  justify-self: end;
  min-width: 11rem;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}

.table-wrap {
  flex: 1;
  padding: 0 0 1.5rem;
  overflow-x: auto;
}

#stock-table {
  width: 100%;
  min-width: 1080px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

#stock-table thead {
  background: #f2f5f9;
}

#stock-table th,
#stock-table td {
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

#stock-table th {
  padding: .55rem .5rem;
  color: #687386;
  background: #f2f5f9;
  font-size: .61rem;
  font-weight: 800;
  letter-spacing: .065em;
  text-align: left;
  text-transform: uppercase;
}

#stock-table td {
  padding: .48rem .5rem;
  font-size: .74rem;
}

#stock-table tr:last-child td {
  border-bottom: 0;
}

#stock-table tbody tr {
  cursor: pointer;
  transition: background .14s ease;
}

#stock-table tbody tr:hover td {
  background: #f7fafc;
}

#stock-table tbody tr.active-row td {
  background: var(--accent-soft);
  border-bottom-color: #b7c8ec;
}

.th-fav { width: 42px; text-align: center !important; }
.th-code { width: 86px; }
.th-num { text-align: right !important; }
.th-spark { width: 116px; text-align: center !important; }

.td-fav {
  text-align: center;
}

.fav-btn {
  width: 26px;
  min-width: 26px;
  min-height: 24px;
  padding: .1rem;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .95rem;
  font-weight: 800;
  line-height: 1;
}

.fav-btn:hover {
  color: var(--accent);
  border-color: #b7c8ec;
  background: var(--accent-soft);
}

.fav-btn.active {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: rgba(18, 166, 117, .3);
}

.td-code {
  color: var(--accent);
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 700;
}

.td-name {
  max-width: 185px;
  overflow: hidden;
  color: var(--text);
  font-weight: 650;
  text-overflow: ellipsis;
}

.td-sector {
  max-width: 130px;
  overflow: hidden;
  color: var(--text-soft);
  font-size: .7rem;
  text-overflow: ellipsis;
}

.td-num {
  font-family: var(--mono);
  font-weight: 600;
  text-align: right;
}

.pos { color: var(--green-dark); }
.neg { color: var(--red); }

.badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: .18rem .48rem;
  border-radius: 999px;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .035em;
  text-transform: uppercase;
}

.badge-strong-buy {
  color: #fff;
  background: var(--green-dark);
}

.badge-buy {
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid rgba(18, 166, 117, .22);
}

.badge-hold {
  color: var(--gray);
  background: var(--surface-muted);
  border: 1px solid var(--line);
}

.badge-watch {
  color: var(--amber);
  background: var(--amber-soft);
  border: 1px solid rgba(183, 121, 31, .2);
}

.badge-sell {
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid rgba(220, 38, 38, .16);
}

.badge-strong-sell {
  color: #fff;
  background: var(--red);
}

.conv-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .36rem;
}

.conv-fill {
  display: flex;
  gap: 2px;
}

.conv-dot {
  width: 5px;
  height: 13px;
  background: #dfe6ef;
  border-radius: 2px;
}

.conv-dot.on-g { background: var(--green); }
.conv-dot.on-r { background: var(--red); }
.conv-dot.on-o { background: var(--amber); }

.conv-num {
  min-width: 1.35em;
  color: var(--text);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 800;
  text-align: right;
}

.spark-cell {
  width: 102px;
  height: 30px;
}

.spark-cell canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.empty-msg {
  margin-top: .75rem;
  padding: 1.3rem;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}

.empty-msg.hidden {
  display: none;
}

.detail-row td {
  padding: 0 !important;
  background: #f8fafc !important;
  border-bottom: 2px solid #b7c8ec !important;
}

.stock-page {
  padding: .35rem 0 1.5rem;
}

.premium-page {
  padding: .35rem 0 1.5rem;
}

#premium-content {
  display: grid;
  gap: .75rem;
}

#plans-content,
#admin-content {
  display: grid;
  gap: .75rem;
}

.stock-page-loading {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: var(--text-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stock-page-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .9rem;
  padding: .85rem .95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.back-btn {
  min-height: 34px;
  padding: .45rem .7rem;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .7rem;
  font-weight: 800;
}

.back-btn:hover {
  color: var(--accent);
  border-color: #b7c8ec;
  background: var(--accent-soft);
}

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

.stock-code-pill {
  display: inline-flex;
  margin-bottom: .18rem;
  padding: .16rem .42rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 800;
}

.stock-title-wrap h2 {
  overflow: hidden;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 850;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock-title-wrap p {
  color: var(--text-soft);
  font-size: .72rem;
}

.stock-head-actions {
  display: flex;
  align-items: center;
}

.stock-hero-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: .55rem;
  margin-top: .65rem;
}

.stock-hero-stat {
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: .45rem;
  padding: .72rem .8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.stock-hero-stat span {
  color: var(--text-faint);
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.stock-hero-stat strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
}

.premium-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: .9rem .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.premium-head h2 {
  margin: .08rem 0 .16rem;
  color: var(--text);
  font-size: 1.12rem;
  line-height: 1.15;
}

.premium-head p {
  margin: 0;
  color: var(--text-soft);
  font-size: .76rem;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.plan-card {
  display: grid;
  gap: .75rem;
  padding: .95rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.plan-card.active {
  border-color: rgba(18, 166, 117, .35);
  box-shadow: inset 0 0 0 1px rgba(18, 166, 117, .16), var(--shadow-sm);
}

.plan-card h3 {
  color: var(--text);
  font-size: 1rem;
  line-height: 1.1;
}

.plan-price {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 800;
}

.plan-list {
  display: grid;
  gap: .35rem;
  color: var(--text-soft);
  font-size: .73rem;
  line-height: 1.35;
  list-style: none;
}

.plan-list li::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: .42rem;
  background: var(--green);
  border-radius: 999px;
  vertical-align: .08rem;
}

.plan-message {
  min-height: 1rem;
  color: var(--green-dark);
  font-size: .73rem;
  font-weight: 750;
}

.plan-message.error {
  color: var(--red);
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .65rem;
}

.admin-stat {
  padding: .75rem .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.admin-stat span {
  display: block;
  color: var(--text-faint);
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.admin-stat strong {
  display: block;
  margin-top: .16rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.2rem;
}

.admin-table-wrap {
  width: 100%;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.admin-table th,
.admin-table td {
  padding: .62rem .75rem;
  border-bottom: 1px solid var(--line);
  font-size: .73rem;
  text-align: left;
  vertical-align: middle;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: .61rem;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-user-main {
  display: grid;
  gap: .1rem;
}

.admin-user-main strong {
  color: var(--text);
  font-size: .75rem;
}

.admin-user-main span {
  color: var(--text-faint);
  font-size: .66rem;
}

.plan-select {
  min-width: 8rem;
  min-height: 30px;
  padding: .35rem .5rem;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 750;
}

.plan-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: .18rem .46rem;
  color: var(--gray);
  background: var(--surface-muted);
  border-radius: 999px;
  font-size: .61rem;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.plan-pill.premium {
  color: var(--green-dark);
  background: var(--green-soft);
}

.plan-pill.ultimate,
.plan-pill.admin {
  color: var(--accent);
  background: var(--accent-soft);
}

.plan-pill.pending {
  color: var(--amber);
  background: var(--amber-soft);
}

.exec-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  width: 100%;
}

.exec-stat {
  padding: .78rem .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gray);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.exec-stat.ready { border-left-color: var(--green); }
.exec-stat.trigger { border-left-color: var(--blue); }
.exec-stat.watch { border-left-color: var(--amber); }
.exec-stat.avoid { border-left-color: var(--red); }

.exec-stat span {
  display: block;
  color: var(--text-soft);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.exec-stat strong {
  display: block;
  margin-top: .18rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.45rem;
  line-height: 1;
}

.execution-table-wrap {
  width: 100%;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.execution-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.execution-table col.exec-col-rank { width: 46px; }
.execution-table col.exec-col-counter { width: 168px; }
.execution-table col.exec-col-status { width: 128px; }
.execution-table col.exec-col-close { width: 96px; }
.execution-table col.exec-col-trigger { width: 106px; }
.execution-table col.exec-col-zone { width: 154px; }
.execution-table col.exec-col-stop { width: 96px; }
.execution-table col.exec-col-t1 { width: 96px; }
.execution-table col.exec-col-rr { width: 72px; }
.execution-table col.exec-col-score { width: 82px; }
.execution-table col.exec-col-reason { width: 260px; }

.execution-table th:first-child,
.execution-table td:first-child {
  text-align: right;
}

.execution-table th,
.execution-table td {
  padding: .62rem .85rem;
  border-bottom: 1px solid var(--line);
  font-size: .73rem;
  text-align: left;
  vertical-align: top;
}

.execution-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}

.execution-table td {
  overflow-wrap: anywhere;
}

.execution-table .td-num {
  text-align: right;
  white-space: nowrap;
}

.execution-table tbody tr {
  cursor: pointer;
}

.execution-table tbody tr:hover {
  background: #f8fbff;
}

.exec-rank {
  color: var(--text-faint);
  font-family: var(--mono);
  font-weight: 800;
}

.exec-code {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 850;
  cursor: pointer;
}

.execution-table td span:not(.exec-status) {
  display: block;
  max-width: 220px;
  margin-top: .1rem;
  color: var(--text-faint);
  font-size: .65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exec-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: .18rem .42rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.exec-status.ready {
  color: var(--green-dark);
  background: var(--green-soft);
}

.exec-status.trigger {
  color: var(--blue);
  background: var(--accent-soft);
}

.exec-status.watch {
  color: var(--amber);
  background: var(--amber-soft);
}

.exec-status.avoid {
  color: var(--red);
  background: var(--red-soft);
}

.exec-status.neutral {
  color: var(--gray);
  background: var(--surface-muted);
}

.premium-lock-actions {
  display: flex;
  justify-content: flex-end;
  gap: .45rem;
  flex-wrap: wrap;
}

.locked-preview-summary,
.locked-preview-row {
  user-select: none;
}

.locked-preview-row {
  cursor: default !important;
}

.locked-preview-row:hover {
  background: transparent !important;
}

.premium-lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .68rem .85rem;
  background: linear-gradient(180deg, var(--surface-soft), #fff);
  border-bottom: 1px solid var(--line);
}

.premium-lock-banner strong {
  color: var(--text);
  font-size: .74rem;
}

.premium-lock-banner span {
  color: var(--text-soft);
  font-size: .7rem;
  text-align: right;
}

.scanner-lock-row td {
  padding: 0 !important;
  background: var(--surface) !important;
}

.scanner-lock-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
  padding: .9rem .85rem;
  background: linear-gradient(180deg, var(--surface-soft), #fff);
  border-bottom: 1px solid var(--line);
}

.scanner-lock-banner strong {
  display: block;
  margin-top: .1rem;
  color: var(--text);
  font-size: .95rem;
}

.scanner-lock-banner p {
  margin-top: .12rem;
  color: var(--text-soft);
  font-size: .72rem;
}

.preview-mask {
  display: inline-block;
  max-width: 100%;
  min-height: .78rem;
  color: transparent !important;
  background: linear-gradient(90deg, #d7dfeb, #eef3f9 48%, #d7dfeb);
  border-radius: 4px;
  filter: blur(1.8px);
}

.preview-code {
  width: 3rem;
}

.preview-name {
  width: 10rem;
}

.preview-num {
  width: 4.2rem;
}

.preview-zone {
  width: 7.6rem;
}

.preview-small {
  width: 2.6rem;
}

.preview-reason {
  width: min(18rem, 100%);
}

.preview-count {
  width: 3.2rem;
  min-height: 1.45rem;
}

.preview-status {
  opacity: .72;
  filter: blur(.65px);
}

.presets button:disabled,
.filters input:disabled,
.filters select:disabled,
#btn-rescan:disabled,
#btn-export:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.exec-empty {
  padding: 1.1rem !important;
  color: var(--text-soft);
  text-align: center !important;
}

.exec-disclaimer {
  width: 100%;
  padding-inline: .1rem;
  color: var(--text-faint);
  font-size: .7rem;
}

.stock-profile-grid {
  padding: .7rem 0 0;
}

.detail-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: .7rem;
  padding: .85rem;
}

.dp-section {
  min-width: 0;
  padding: .78rem .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
}

.dp-section.dp-wide { grid-column: 1 / -1; }
.dp-section.dp-span2 { grid-column: span 2; }

.strategy-section {
  background: linear-gradient(180deg, rgba(18, 166, 117, .045), var(--surface));
  border-color: rgba(18, 166, 117, .18);
}

.strategy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .72rem;
}

.strategy-head .dp-title {
  margin-bottom: .16rem;
}

.strategy-sub {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 700;
}

.strategy-verdict {
  min-width: 150px;
  text-align: right;
}

.strategy-verdict span {
  display: block;
  color: var(--text-faint);
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.strategy-verdict strong {
  display: block;
  margin-top: .1rem;
  font-family: var(--mono);
  font-size: 1.28rem;
  line-height: 1;
  color: var(--text);
}

.strategy-verdict.pos strong { color: var(--green-dark); }
.strategy-verdict.neg strong { color: var(--red); }

.strategy-grid {
  display: grid;
  grid-template-columns: minmax(180px, .9fr) minmax(260px, 1.25fr) minmax(180px, .8fr);
  gap: .72rem;
  align-items: stretch;
}

.strategy-score-card,
.strategy-plan,
.strategy-risk {
  min-width: 0;
  padding: .62rem .7rem;
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.strategy-score-card > span {
  color: var(--text-soft);
  font-size: .66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.strategy-score-card > strong {
  display: block;
  margin: .12rem 0 .42rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.45rem;
  line-height: 1;
}

.strategy-meter {
  height: 8px;
  overflow: hidden;
  background: #dfe6ef;
  border-radius: 999px;
}

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

.strategy-scores {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .45rem;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: .64rem;
}

.strategy-plan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .22rem .7rem;
}

.strategy-plan-row {
  display: flex;
  flex-direction: column;
  gap: .08rem;
}

.strategy-plan-row span,
.strategy-risk > span:first-child {
  color: var(--text-soft);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.strategy-plan-row strong {
  color: var(--text);
  font-family: var(--mono);
  font-size: .78rem;
}

.strategy-risk {
  display: flex;
  flex-direction: column;
  gap: .32rem;
}

.strategy-risk span:not(:first-child) {
  padding: .28rem .38rem;
  color: var(--amber);
  background: rgba(245, 158, 11, .12);
  border: 1px solid rgba(245, 158, 11, .18);
  border-radius: 5px;
  font-size: .68rem;
  font-weight: 700;
}

.strategy-rules {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .45rem;
  margin-top: .72rem;
}

.strategy-rule {
  min-width: 0;
  padding: .48rem .55rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gray);
  border-radius: var(--radius-sm);
}

.strategy-rule.buy { border-left-color: var(--green); }
.strategy-rule.sell { border-left-color: var(--red); }

.strategy-rule span,
.strategy-rule strong,
.strategy-rule em {
  display: block;
}

.strategy-rule span {
  color: var(--text);
  font-size: .7rem;
  font-weight: 800;
}

.strategy-rule strong {
  margin: .18rem 0;
  font-family: var(--mono);
  font-size: .68rem;
}

.strategy-rule.buy strong { color: var(--green-dark); }
.strategy-rule.sell strong { color: var(--red); }

.strategy-rule em {
  color: var(--text-faint);
  font-size: .65rem;
  font-style: normal;
  line-height: 1.35;
}

.strategy-note {
  margin-top: .62rem;
  padding-top: .55rem;
  border-top: 1px dashed var(--line);
  color: var(--text-soft);
  font-size: .72rem;
  font-weight: 650;
}

.chart-section {
  padding: .7rem .75rem .75rem;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
}

.chart-head .dp-title {
  margin-bottom: 0;
}

.chart-meta {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: .64rem;
  text-align: right;
  white-space: nowrap;
}

.chart-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .6rem;
  margin-bottom: .6rem;
}

.chart-toolbar-secondary {
  margin-top: -.28rem;
}

.chart-control-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .28rem;
  min-width: 0;
}

.chart-tools {
  justify-content: flex-end;
}

.chart-control-group span {
  margin-right: .12rem;
  color: var(--text-faint);
  font-size: .58rem;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.chart-pill {
  min-width: 34px;
  min-height: 28px;
  padding: .24rem .48rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text-soft);
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.chart-pill:hover {
  border-color: #b9c5d4;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .08);
}

.chart-pill.active {
  border-color: var(--text);
  background: var(--text);
  color: #fff;
}

.chart-tool-btn.active {
  border-color: var(--blue);
  background: var(--blue);
}

.tv-chart {
  position: relative;
  width: 100%;
  height: 300px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #edf1f6;
  border-radius: var(--radius-sm);
}

.tv-chart.tool-active {
  cursor: crosshair;
}

.chart-fallback {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 1rem;
  color: var(--text-faint);
  font-size: .78rem;
  text-align: center;
}

.dp-title {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-bottom: .48rem;
  color: var(--text-soft);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.dp-title svg {
  width: 14px;
  height: 14px;
}

.level-list {
  display: flex;
  flex-direction: column;
  gap: .22rem;
}

.level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding: .22rem .42rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .72rem;
}

.lv-r { color: var(--red); background: var(--red-soft); }
.lv-s { color: var(--green-dark); background: var(--green-soft); }
.lv-c { color: var(--accent); background: var(--accent-soft); font-weight: 800; }
.lv-fib { color: var(--amber); background: var(--amber-soft); }

.level-label {
  font-size: .66rem;
  font-weight: 700;
}

.level-val {
  font-weight: 700;
}

.ind-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .3rem;
}

.ind-item,
.fund-item,
.risk-row {
  display: flex;
  justify-content: space-between;
  gap: .65rem;
}

.ind-item {
  padding: .28rem .42rem;
  background: var(--surface-soft);
  border: 1px solid #edf1f6;
  border-radius: 4px;
  font-size: .72rem;
}

.ind-name,
.fund-label,
.risk-label {
  color: var(--text-soft);
  font-weight: 600;
}

.ind-val,
.fund-val,
.risk-val {
  font-family: var(--mono);
  font-weight: 700;
  text-align: right;
}

.pattern-tag {
  display: inline-flex;
  align-items: center;
  margin: .1rem .12rem .1rem 0;
  padding: .16rem .42rem;
  border-radius: 999px;
  font-size: .62rem;
  font-weight: 700;
}

.pt-bull { color: var(--green-dark); background: var(--green-soft); }
.pt-bear { color: var(--red); background: var(--red-soft); }
.pt-neut { color: var(--gray); background: var(--surface-muted); }

.risk-grid,
.fund-grid {
  display: grid;
  gap: .18rem .8rem;
}

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

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

.risk-row,
.fund-item {
  padding: .2rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: .72rem;
}

.rv-g { color: var(--green-dark); }
.rv-r { color: var(--red); }

.safe-zone {
  margin-top: .48rem;
  padding: .42rem .55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: .72rem;
  font-weight: 750;
  text-align: center;
}

.safe-zone.sz-buy {
  color: var(--green-dark);
  background: var(--green-soft);
  border-color: rgba(18, 166, 117, .22);
}

.safe-zone.sz-sell {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(220, 38, 38, .16);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: .42rem;
}

.news-item {
  font-size: .72rem;
  line-height: 1.4;
}

.news-item a {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.news-item a:hover {
  text-decoration: underline;
}

.news-meta {
  margin-top: .08rem;
  color: var(--text-faint);
  font-size: .62rem;
}

.conv-detail {
  display: flex;
  flex-direction: column;
  gap: .24rem;
}

.conv-row {
  display: flex;
  align-items: flex-start;
  gap: .34rem;
  color: var(--text-soft);
  font-size: .72rem;
}

.conv-icon {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  margin-top: .42rem;
  background: var(--green-dark);
  border-radius: 999px;
}

.conv-big-bar {
  height: 9px;
  overflow: hidden;
  background: #dfe6ef;
  border-radius: 999px;
}

.conv-big-fill {
  height: 100%;
  border-radius: inherit;
  transition: width .25s ease;
}

.dp-chart {
  width: 100%;
  height: 200px;
}

.dp-chart canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.dp-loading {
  padding: 2rem;
  color: var(--text-soft);
  font-size: .82rem;
  text-align: center;
}

.dp-structure {
  background: linear-gradient(180deg, rgba(29, 78, 216, .035), var(--surface));
  border-color: #b7c8ec;
}

.ms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .42rem;
}

.ms-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: .12rem;
  padding: .42rem .52rem;
  background: var(--surface-soft);
  border: 1px solid #edf1f6;
  border-radius: var(--radius-sm);
}

.ms-label {
  color: var(--text-faint);
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.ms-val {
  color: var(--text);
  font-size: .75rem;
  font-weight: 750;
}

.ms-detail {
  color: var(--text-soft);
  font-size: .65rem;
  line-height: 1.35;
}

.ms-item.ms-alert {
  grid-column: span 2;
  border-left: 3px solid var(--line-strong);
}

.ms-alert.ms-success {
  background: var(--green-soft);
  border-left-color: var(--green);
}

.ms-alert.ms-warn {
  background: var(--red-soft);
  border-left-color: var(--red);
}

.ms-alert.ms-info {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.ms-setup {
  margin-top: .6rem;
  padding: .58rem .66rem;
  background: var(--surface-soft);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}

.ms-setup.pos {
  background: var(--green-soft);
  border-color: rgba(18, 166, 117, .45);
}

.ms-setup.neg {
  background: var(--red-soft);
  border-color: rgba(220, 38, 38, .32);
}

.ms-setup-header {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

.ms-setup-type {
  color: var(--text);
  font-size: .78rem;
  font-weight: 800;
}

.ms-setup-risk {
  margin-left: auto;
  color: var(--text-soft);
  font-size: .62rem;
  font-weight: 750;
}

.ms-setup-action {
  margin-top: .28rem;
  color: var(--text-soft);
  font-size: .72rem;
  line-height: 1.42;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(8px);
}

.auth-card {
  position: relative;
  width: min(420px, 100%);
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(15, 23, 42, .24);
}

.auth-close {
  position: absolute;
  top: .7rem;
  right: .7rem;
  width: 28px;
  height: 28px;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 800;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.auth-form h2 {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 800;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: .28rem;
  color: var(--text-soft);
  font-size: .68rem;
  font-weight: 800;
}

.auth-form input,
.auth-form textarea {
  width: 100%;
  min-height: 38px;
  padding: .52rem .62rem;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: .76rem;
}

.auth-form textarea {
  resize: vertical;
  font-family: var(--mono);
  font-size: .68rem;
}

.auth-form input:focus,
.auth-form textarea:focus {
  outline: 0;
  background: #fff;
  border-color: rgba(29, 78, 216, .62);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .11);
}

.auth-submit {
  width: 100%;
  margin-top: .15rem;
}

.auth-msg {
  min-height: 1rem;
  color: var(--green-dark);
  font-size: .72rem;
  font-weight: 700;
}

.auth-msg.error {
  color: var(--red);
}

.auth-switch {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
}

.auth-switch button {
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: .7rem;
  font-weight: 800;
}

footer {
  padding: 1rem 1.5rem 1.25rem;
  color: var(--text-faint);
  border-top: 1px solid var(--line);
  font-size: .62rem;
  text-align: center;
}

footer strong {
  color: var(--text-soft);
  font-weight: 700;
}

footer em {
  color: var(--text-faint);
  font-style: normal;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #c5cfdd;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #98a6bb;
  border: 2px solid transparent;
  background-clip: padding-box;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 238px minmax(0, 1fr);
    gap: .75rem;
  }

  .market-overview {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }

  .mo-card-wide {
    grid-column: span 2;
  }

  .filters {
    grid-template-columns: minmax(230px, 1fr) repeat(2, minmax(150px, .7fr));
  }

  #stock-table {
    min-width: 960px;
  }

  #stock-table th:nth-child(4),
  #stock-table td:nth-child(4),
  #stock-table th:nth-child(8),
  #stock-table td:nth-child(8) {
    display: none;
  }

  .filter-count {
    grid-column: 1 / -1;
    justify-self: start;
    min-width: 0;
    text-align: left;
  }

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

  .strategy-risk {
    grid-column: 1 / -1;
  }

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

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

  .admin-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #header {
    position: static;
    align-items: flex-start;
    padding-inline: 1rem;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding-inline: 1rem;
  }

  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .market-overview,
  .presets,
  .filters,
  .table-wrap,
  .progress-wrap,
  .stock-page,
  .premium-page {
    padding-left: 0;
    padding-right: 0;
  }

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

  .dp-section.dp-span2,
  .dp-section.dp-wide {
    grid-column: span 1;
  }

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

  .stock-page-head .back-btn {
    grid-column: 1 / -1;
    justify-self: start;
  }

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

  #stock-table {
    min-width: 820px;
  }

  #stock-table th:nth-child(6),
  #stock-table td:nth-child(6),
  #stock-table th:nth-child(9),
  #stock-table td:nth-child(9),
  #stock-table th:nth-child(13),
  #stock-table td:nth-child(13) {
    display: none;
  }

  .tv-chart {
    height: 280px;
  }

  .chart-head {
    align-items: flex-start;
    flex-direction: column;
    gap: .25rem;
  }

  .chart-meta {
    text-align: left;
    white-space: normal;
  }

  .chart-toolbar {
    flex-direction: column;
  }

  .chart-tools {
    justify-content: flex-start;
  }

  .strategy-head {
    flex-direction: column;
  }

  .strategy-verdict {
    min-width: 0;
    text-align: left;
  }

  .strategy-grid,
  .strategy-rules {
    grid-template-columns: 1fr;
  }

  .premium-head {
    flex-direction: column;
  }

  .premium-lock-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .premium-lock-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .scanner-lock-banner {
    align-items: flex-start;
    flex-direction: column;
  }

  .premium-lock-banner span {
    text-align: left;
  }
}

@media (max-width: 720px) {
  html {
    font-size: 12.5px;
  }

  #header {
    flex-direction: column;
  }

  .header-right {
    width: 100%;
    justify-content: flex-start;
  }

  .meta-text {
    min-width: 0;
    text-align: left;
  }

  .market-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .45rem;
  }

  .mo-card-wide {
    grid-column: 1 / -1;
  }

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

  .table-wrap {
    overflow-x: visible;
  }

  #stock-table {
    min-width: 0;
    border-spacing: 0 .55rem;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  #stock-table thead {
    display: none;
  }

  #stock-table tbody,
  #stock-table tr,
  #stock-table td {
    display: block;
    width: 100%;
  }

  #stock-table tbody tr {
    position: relative;
    padding: .75rem .78rem .65rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }

  #stock-table tbody tr:hover td {
    background: transparent;
  }

  #stock-table tbody tr.active-row td {
    background: transparent;
    border-bottom-color: transparent;
  }

  #stock-table td {
    padding: 0;
    border: 0;
    white-space: normal;
  }

  #stock-table td:nth-child(4),
  #stock-table td:nth-child(6),
  #stock-table td:nth-child(8),
  #stock-table td:nth-child(9),
  #stock-table td:nth-child(13) {
    display: none;
  }

  .td-fav {
    position: absolute;
    top: .65rem;
    right: .65rem;
    width: auto !important;
  }

  .td-code {
    margin-bottom: .15rem;
    padding-right: 2.4rem !important;
    font-size: .78rem;
  }

  .td-name {
    max-width: none;
    margin-bottom: .5rem;
    padding-right: 2.4rem !important;
    font-size: .9rem;
    white-space: normal;
  }

  #stock-table td:nth-child(5),
  #stock-table td:nth-child(7),
  #stock-table td:nth-child(10),
  #stock-table td:nth-child(11),
  #stock-table td:nth-child(12) {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: calc(50% - .25rem);
    min-height: 30px;
    margin: .15rem .1rem;
    padding: .32rem .42rem;
    background: var(--surface-soft);
    border: 1px solid #edf1f6;
    border-radius: var(--radius-sm);
    font-size: .7rem;
  }

  #stock-table td:nth-child(5)::before { content: "Close"; color: var(--text-faint); font-family: var(--font); font-weight: 800; }
  #stock-table td:nth-child(7)::before { content: "RSI"; color: var(--text-faint); font-family: var(--font); font-weight: 800; }
  #stock-table td:nth-child(10)::before { content: "Chg"; color: var(--text-faint); font-family: var(--font); font-weight: 800; }
  #stock-table td:nth-child(11)::before { content: "Signal"; color: var(--text-faint); font-family: var(--font); font-weight: 800; }
  #stock-table td:nth-child(12)::before { content: "Conv."; color: var(--text-faint); font-family: var(--font); font-weight: 800; }

  .conv-bar {
    gap: .25rem;
  }

  .conv-dot {
    width: 4px;
    height: 11px;
  }

  .detail-row {
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .detail-row td {
    border: 0 !important;
  }

  .detail-panel {
    padding: .6rem 0 0;
  }

  .stock-page-head {
    gap: .65rem;
    padding: .75rem;
  }

  .stock-title-wrap h2 {
    white-space: normal;
    font-size: 1rem;
  }

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

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

  .plan-grid,
  .admin-summary {
    grid-template-columns: 1fr;
  }

  .tv-chart {
    height: 250px;
  }

  .chart-control-group {
    width: 100%;
  }

  .chart-pill {
    min-width: 32px;
    padding-left: .42rem;
    padding-right: .42rem;
  }

  .side-actions,
  .auth-switch {
    flex-direction: column;
  }

  .risk-grid,
  .fund-grid,
  .ind-grid,
  .strategy-plan,
  .ms-grid {
    grid-template-columns: 1fr;
  }

  .ms-item.ms-alert {
    grid-column: span 1;
  }

  footer {
    text-align: left;
  }
}
