/* ═══════════════════════════════════════════════════════
   Stock Control — Jade Terminal
   Chinese jade palette × modern fintech density
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,700;0,900;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=JetBrains+Mono:wght@400;500;600&family=Noto+Sans+SC:wght@300;400;500;600;700&display=swap');

:root {
  /* ── Jade Palette ── */
  --jade:        #00d4aa;
  --jade-dim:    #00b894;
  --jade-glow:   rgba(0, 212, 170, 0.25);
  --jade-ghost:  rgba(0, 212, 170, 0.08);
  --jade-border: rgba(0, 212, 170, 0.2);

  /* ── Gold Accent ── */
  --gold:        #fbbf24;
  --gold-dim:    rgba(251, 191, 36, 0.15);

  /* ── Surfaces ── */
  --ink:         #06060a;
  --bg:          #0a0a10;
  --surface-1:   #0f1018;
  --surface-2:   #14151e;
  --surface-3:   #191a25;
  --surface-4:   #1e202e;
  --surface-5:   #252738;

  /* ── Borders ── */
  --line-faint:  rgba(255, 255, 255, 0.04);
  --line-subtle: rgba(255, 255, 255, 0.06);
  --line:        rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.15);

  /* ── Text ── */
  --text:        #e8eaf0;
  --text-2:      #a8aab8;
  --text-3:      #6b6d80;
  --text-4:      #3d3f50;

  /* ── Semantic (A-share: red=up, green=down) ── */
  --up:          #ff4757;
  --up-soft:     rgba(255, 71, 87, 0.12);
  --up-ghost:    rgba(255, 71, 87, 0.06);
  --down:        #2ed573;
  --down-soft:   rgba(46, 213, 115, 0.12);
  --down-ghost:  rgba(46, 213, 115, 0.06);
  --warn:        #ffa502;
  --warn-soft:    rgba(255, 165, 2, 0.12);

  /* ── Type ── */
  --font-display: 'Playfair Display', 'Noto Sans SC', Georgia, serif;
  --font-body:    'DM Sans', 'Noto Sans SC', -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* ── Spacing (4px) ── */
  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem;
  --s4: 1rem;    --s5: 1.25rem; --s6: 1.5rem;
  --s8: 2rem;    --s10: 2.5rem; --s12: 3rem;

  /* ── Radius ── */
  --r-sm: 6px;  --r: 10px;  --r-lg: 14px;
  --r-xl: 20px; --r-full: 9999px;

  /* ── Motion ── */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 180ms;
  --dur-slow: 300ms;

  /* ── Layout ── */
  --topbar-h: 56px;
  --max-w: 1480px;
}

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

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

/* ── Utilities ── */
.mono { font-family: var(--font-mono); font-size: 0.9em; }
.muted { color: var(--text-3); font-size: 0.78rem; margin-top: 0.15rem; }
.up { color: var(--up); }
.down { color: var(--down); }
.tabular { font-variant-numeric: tabular-nums; }


/* ═══════════════════════════════════════
   Topbar — Jade gradient underline
   ═══════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--s5);
  height: var(--topbar-h);
  padding: 0 var(--s6);
  background: var(--surface-1);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line-subtle);
}
.topbar::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--jade) 0%, var(--jade-dim) 40%, transparent 100%);
  opacity: 0.6;
}

.brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  color: var(--gold);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.brand::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--jade);
  box-shadow: 0 0 10px var(--jade-glow);
  flex-shrink: 0;
}

.topbar nav {
  display: flex;
  gap: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.topbar nav::-webkit-scrollbar { display: none; }

.topbar nav a {
  padding: var(--s3) var(--s4);
  font-family: var(--font-display);
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-3);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.topbar nav a:hover { color: var(--text-2); }
.topbar nav a.active-nav {
  color: var(--jade);
  border-bottom-color: var(--jade);
}

.topbar form { margin-left: auto; }


/* ═══════════════════════════════════════
   Buttons
   ═══════════════════════════════════════ */
button {
  border: none;
  background: linear-gradient(135deg, var(--jade), var(--jade-dim));
  color: var(--ink);
  border-radius: var(--r-sm);
  padding: var(--s2) var(--s4);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
  white-space: nowrap;
  min-height: 34px;
  letter-spacing: -0.01em;
}
button:hover {
  box-shadow: 0 0 20px var(--jade-glow), 0 2px 8px rgba(0,0,0,0.3);
  transform: translateY(-1px);
}
button:active { transform: translateY(0) scale(0.97); }

button.secondary {
  background: var(--surface-3);
  color: var(--text-2);
  border: 1px solid var(--line);
}
button.secondary:hover {
  background: var(--surface-4);
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: none;
  transform: none;
}
button.ghost {
  background: transparent;
  color: var(--text-3);
  border: none;
  min-height: auto;
  padding: var(--s1) var(--s3);
}
button.ghost:hover {
  color: var(--text-2);
  background: var(--surface-3);
  box-shadow: none;
  transform: none;
}
button.mini {
  padding: var(--s1) var(--s3);
  font-size: 0.72rem;
  min-height: 26px;
}


/* ═══════════════════════════════════════
   Main Content
   ═══════════════════════════════════════ */
main {
  padding: var(--s8) var(--s6) 5rem;
  max-width: var(--max-w);
  margin: 0 auto;
}


/* ═══════════════════════════════════════
   Security Warning
   ═══════════════════════════════════════ */
.security-warn {
  background: var(--warn-soft);
  border-bottom: 1px solid rgba(255, 165, 2, 0.2);
  color: var(--warn);
  padding: var(--s3) var(--s6);
  font-size: 0.78rem;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 500;
}


/* ═══════════════════════════════════════
   Page Header
   ═══════════════════════════════════════ */
.page-head {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--s3);
  margin-bottom: var(--s8);
  position: relative;
  text-align: center;
}
.page-head::after {
  content: '';
  position: absolute;
  bottom: calc(var(--s8) * -1 + 6px);
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--jade-border), transparent 70%);
}
.page-head h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--gold);
  line-height: 1.1;
}
.page-head p {
  margin: var(--s2) 0 0;
  color: var(--text-3);
  font-size: 0.82rem;
}
.actions, .review-form {
  display: flex;
  gap: var(--s1);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.page-head .actions a {
  padding: var(--s2) var(--s3);
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-3);
  border: 1px solid transparent;
  transition: all var(--dur) var(--ease);
}
.page-head .actions a:hover {
  color: var(--text-2);
  background: var(--surface-3);
  border-color: var(--line-subtle);
}
.page-head .actions a.active {
  color: var(--jade);
  border-color: var(--jade-border);
  background: var(--jade-ghost);
}


/* ═══════════════════════════════════════
   Summary Grid — Jade-bordered cards
   ═══════════════════════════════════════ */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--s3);
  margin-bottom: var(--s8);
}
.summary-grid div {
  background: var(--surface-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-lg);
  padding: var(--s6) var(--s5);
  transition: all var(--dur) var(--ease);
  position: relative;
  overflow: hidden;
  text-align: center;
}
.summary-grid div::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--jade), transparent);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.summary-grid div:hover {
  border-color: var(--jade-border);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), 0 0 1px var(--jade-border);
}
.summary-grid div:hover::before { opacity: 1; }

.summary-grid span {
  color: var(--text-3);
  display: block;
  margin-bottom: var(--s2);
  font-size: 0.7rem;
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.summary-grid strong {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.summary-grid strong.up { color: var(--up); }
.summary-grid strong.down { color: var(--down); }


/* ═══════════════════════════════════════
   Sub-tabs
   ═══════════════════════════════════════ */
.sub-tabs {
  display: flex;
  gap: var(--s1);
  flex-wrap: wrap;
  margin-bottom: var(--s5);
  padding-bottom: var(--s5);
  border-bottom: 1px solid var(--line-faint);
}
.sub-tabs a {
  padding: var(--s2) var(--s3);
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-3);
  border: 1px solid transparent;
  transition: all var(--dur) var(--ease);
}
.sub-tabs a:hover {
  color: var(--text-2);
  background: var(--surface-3);
  border-color: var(--line-subtle);
}
.sub-tabs a.active {
  color: var(--jade);
  border-color: var(--jade-border);
  background: var(--jade-ghost);
}


/* ═══════════════════════════════════════
   Sort Link
   ═══════════════════════════════════════ */
.sort-link {
  color: var(--text-3);
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.sort-link:hover { color: var(--jade); }


/* ═══════════════════════════════════════
   Data Table — Dense fintech grid
   ═══════════════════════════════════════ */
.table-wrap {
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-lg);
  overflow: auto;
  background: var(--surface-1);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-4) transparent;
}
.table-wrap::-webkit-scrollbar { height: 5px; }
.table-wrap::-webkit-scrollbar-track { background: transparent; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--surface-4); border-radius: 3px; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}
th, td {
  border-bottom: 1px solid var(--line-faint);
  padding: var(--s3) var(--s3);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
td.note-cell {
  white-space: normal;
  word-break: break-all;
  max-width: 200px;
}
th {
  color: var(--text-3);
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 1;
  white-space: nowrap;
}
tbody tr {
  transition: background var(--dur) var(--ease);
  border-left: 3px solid transparent;
}
tbody tr:hover {
  background: var(--surface-3);
  border-left-color: var(--jade);
}

/* ── Group Tags ── */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.68rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
}
.tag:hover { filter: brightness(1.2); transform: translateY(-1px); }

/* holdings — warm amber */
.tag-holdings {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.25);
}
/* watchlist — sky blue */
.tag-watchlist {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.2);
}
/* tech — jade green */
.tag-tech {
  background: rgba(0, 212, 170, 0.12);
  color: #00d4aa;
  border: 1px solid rgba(0, 212, 170, 0.2);
}
/* tradable — rose */
.tag-tradable {
  background: rgba(251, 113, 133, 0.12);
  color: #fb7185;
  border: 1px solid rgba(251, 113, 133, 0.2);
}

.pill {
  display: inline-block;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: var(--surface-3);
  border-radius: var(--r-full);
  padding: 0.1rem var(--s2);
  color: var(--text-3);
  font-size: 0.68rem;
  font-family: var(--font-display);
  font-weight: 500;
}


/* ═══════════════════════════════════════
   Position Form
   ═══════════════════════════════════════ */
.position-form {
  display: grid;
  grid-template-columns: 58px 66px 58px auto;
  gap: var(--s2);
  align-items: center;
}
.position-form input[type="number"]::-webkit-inner-spin-button,
.position-form input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.position-form input[type="number"] {
  -moz-appearance: textfield;
}
.position-pnl {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 500;
  margin-top: 2px;
  opacity: 0.8;
}
input, select {
  min-width: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: var(--s2) var(--s2);
  font-size: 0.8rem;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input:focus, select:focus {
  outline: none;
  border-color: var(--jade);
  box-shadow: 0 0 0 3px var(--jade-ghost), 0 0 12px var(--jade-ghost);
}
input::placeholder { color: var(--text-4); }


/* ═══════════════════════════════════════
   Login — Centered jade card
   ═══════════════════════════════════════ */
.login-panel {
  max-width: 400px;
  margin: 15vh auto;
  background: var(--surface-2);
  border: 1px solid var(--line-subtle);
  border-radius: var(--r-xl);
  padding: var(--s10) var(--s8);
  position: relative;
  overflow: hidden;
}
.login-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--jade), var(--jade-dim), var(--gold));
}
.login-panel::after {
  content: '';
  position: absolute;
  top: -100%;
  left: -50%;
  width: 200%;
  height: 300%;
  background: radial-gradient(ellipse at center, var(--jade-ghost) 0%, transparent 50%);
  pointer-events: none;
}
.login-panel h1 {
  font-family: var(--font-display);
  margin: 0 0 var(--s8);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  position: relative;
}
.login-form {
  display: grid;
  gap: var(--s5);
  position: relative;
}
.login-form label {
  display: grid;
  gap: var(--s2);
  color: var(--text-3);
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.login-form input {
  padding: var(--s3) var(--s4);
  font-size: 0.92rem;
  border-radius: var(--r);
}


/* ═══════════════════════════════════════
   Reviews
   ═══════════════════════════════════════ */
.review-list {
  display: grid;
  gap: var(--s4);
}
.review-card {
  background: var(--surface-2);
  border: 1px solid var(--line-subtle);
  border-left: 3px solid var(--jade);
  border-radius: var(--r);
  padding: var(--s6);
  transition: all var(--dur) var(--ease);
}
.review-card:hover {
  border-color: var(--line);
  border-left-color: var(--jade);
  background: var(--surface-3);
}
.review-card header {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  color: var(--text-3);
  margin-bottom: var(--s4);
  font-size: 0.78rem;
  font-family: var(--font-display);
}
.review-card pre {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.7;
  font-family: var(--font-body);
  font-size: 0.86rem;
  color: var(--text-2);
}

.inline {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text-3);
  font-size: 0.82rem;
}


/* ═══════════════════════════════════════
   Animations
   ═══════════════════════════════════════ */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 8px var(--jade-glow); }
  50% { box-shadow: 0 0 20px var(--jade-glow); }
}

main > section,
main > nav {
  animation: slideUp 0.4s var(--ease) both;
}
main > section:nth-child(2) { animation-delay: 0.06s; }
main > section:nth-child(3) { animation-delay: 0.12s; }
main > section:nth-child(4) { animation-delay: 0.18s; }


/* ═══════════════════════════════════════
   Bottom Tab Bar
   ═══════════════════════════════════════ */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface-1);
  border-top: 1px solid var(--line-subtle);
  z-index: 100;
  padding: var(--s1) 0 env(safe-area-inset-bottom, 0);
}
.bottom-nav::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--jade-border), transparent);
}
.bottom-nav-inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: var(--s2) var(--s2);
  color: var(--text-4);
  font-family: var(--font-display);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: color var(--dur) var(--ease);
  min-width: 48px;
  text-transform: uppercase;
  position: relative;
}
.bottom-nav a svg {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}
.bottom-nav a.active-nav {
  color: var(--jade);
}
.bottom-nav a.active-nav svg {
  filter: drop-shadow(0 0 4px var(--jade-glow));
}
.bottom-nav a.active-nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--jade);
  box-shadow: 0 0 8px var(--jade-glow);
}


/* ═══════════════════════════════════════
   Responsive — Tablet
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
  .sub-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: var(--s2);
  }
  .sub-tabs::-webkit-scrollbar { display: none; }
  .sub-tabs a {
    flex-shrink: 0;
    font-size: 0.72rem;
    padding: var(--s1) var(--s3);
  }
}
@media (max-width: 1024px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
}


/* ═══════════════════════════════════════
   Responsive — Phone
   ═══════════════════════════════════════ */
@media (max-width: 640px) {
  html { font-size: 13px; }

  .topbar nav { display: none; }
  .bottom-nav { display: block; }
  main { padding: var(--s5) var(--s4) 5rem; }

  .topbar { gap: var(--s3); padding: 0 var(--s4); height: 50px; }
  .brand { font-size: 0.92rem; }

  .page-head {
    flex-direction: column;
    align-items: center;
    gap: var(--s3);
    margin-bottom: var(--s6);
  }
  .page-head::after { bottom: calc(var(--s6) * -1 + 6px); }
  .actions {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: var(--s1);
  }
  .actions::-webkit-scrollbar { display: none; }
  .actions button { flex-shrink: 0; }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--s2);
  }
  .summary-grid div { padding: var(--s4) var(--s3); }
  .summary-grid div::before { display: none; }
  .summary-grid strong { font-size: 1.2rem; }

  /* Table → Card */
  .table-wrap {
    border: none;
    background: transparent;
    overflow: visible;
  }
  table, thead, tbody, tr, th, td { display: block; }
  table { min-width: 0; }
  thead { display: none; }

  tbody tr {
    background: var(--surface-2);
    border: 1px solid var(--line-subtle);
    border-left: 3px solid var(--jade);
    border-radius: var(--r);
    padding: var(--s4);
    margin-bottom: var(--s3);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s2) var(--s4);
    animation: slideUp 0.3s var(--ease) both;
  }
  tbody tr:nth-child(1) { animation-delay: 0s; }
  tbody tr:nth-child(2) { animation-delay: 0.04s; }
  tbody tr:nth-child(3) { animation-delay: 0.08s; }
  tbody tr:nth-child(4) { animation-delay: 0.12s; }
  tbody tr:nth-child(5) { animation-delay: 0.16s; }
  tbody tr:hover {
    background: var(--surface-3);
    border-left-color: var(--jade);
  }

  tbody td {
    border: none;
    padding: var(--s1) 0;
  }
  tbody td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-display);
    font-size: 0.6rem;
    color: var(--text-4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    margin-bottom: 0.1rem;
  }

  tbody td:nth-child(1),
  tbody td:nth-child(2) { grid-column: 1 / -1; }
  tbody td:nth-child(2) strong { font-size: 0.95rem; }

  .position-form { grid-template-columns: 1fr 1fr 1fr; }
  .position-form button { grid-column: 1 / -1; }

  .login-panel {
    margin: 8vh auto;
    padding: var(--s8) var(--s6);
    max-width: 92vw;
    border-radius: var(--r-lg);
  }
}

@media (max-width: 380px) {
  html { font-size: 12px; }
  .summary-grid { gap: var(--s1); }
  .summary-grid div { padding: var(--s3); }
}

/* ── Indicator tooltip cells ── */
.indicator-cell {
  cursor: pointer;
  user-select: none;
  position: relative;
}
.indicator-tip {
  display: none;
  position: fixed;
  z-index: 9999;
  background: var(--surface-2, #1e2a35);
  border: 1px solid var(--border, #2d3f50);
  border-radius: 8px;
  padding: 8px 12px;
  white-space: nowrap;
  font-size: 0.8em;
  line-height: 1.6;
  color: var(--text, #e0e8f0);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: none;
}
.indicator-cell.active .indicator-tip {
  display: block;
}
.tip-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.tip-label {
  color: var(--text-muted, #7a8fa0);
}
.tip-val {
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.tip-divider {
  border-top: 1px solid var(--border, #2d3f50);
  margin: 3px 0;
}

/* ── Fund table ── */
.fund-table th a.sort-link {
  color: inherit;
  text-decoration: none;
}
.fund-table td strong {
  font-size: 0.85rem;
}
.fund-table .note-cell {
  font-size: 0.75rem;
  color: var(--text-2);
}

/* ── Review table ── */
.review-table th a.sort-link { color: inherit; text-decoration: none; }
.review-table .analysis-cell {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--text-2);
  min-width: 220px;
  white-space: normal;
}
.review-table .analysis-cell br + br { display: none; }

/* ── Signal page ── */
.signal-section {
  margin-bottom: var(--s8);
}
.signal-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--s3);
  padding-bottom: var(--s2);
  border-bottom: 1px solid var(--line);
}
.signal-title.buy {
  color: var(--up);
  border-bottom-color: var(--up-soft);
}
.signal-title.sell {
  color: var(--down);
  border-bottom-color: var(--down-soft);
}
.signal-table .score-cell {
  text-align: center;
}
.score-buy {
  display: inline-block;
  background: var(--up-soft);
  color: var(--up);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.score-sell {
  display: inline-block;
  background: var(--down-soft);
  color: var(--down);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.signal-note {
  font-size: 0.7rem;
  line-height: 1.4;
  margin: 1px 0;
}
.signal-note.buy-note {
  color: var(--up);
}
.signal-note.sell-note {
  color: var(--down);
}
.signal-table .note-cell {
  font-size: 0.78rem;
}
.signal-table .highlight {
  background: var(--jade-ghost);
  font-weight: 600;
}
.period-tabs {
  margin-top: calc(-1 * var(--s4));
  margin-bottom: var(--s6);
}
.period-tabs a {
  font-size: 0.8rem;
  padding: var(--s1) var(--s3);
}

}
