/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #0f172a;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --bt-bg: #dbeafe;
  --bt-color: #1e40af;
  --mc-bg: #dcfce7;
  --mc-color: #166534;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --radius: 12px;
}

body {
  font-family: var(--font, 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: var(--text-md, 15px);
  line-height: var(--lh-normal, 1.6);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
}

/* ===== HEADER ===== */
header {
  background: var(--primary);
  color: #fff;
  padding: 1.1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.header-content {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── Left: logo + divider + title (all horizontal) ── */
.header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
}

.header-logo-wrap {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
  padding-right: 1.25rem;
  border-right: 1.5px solid rgba(255,255,255,0.15);
}

.header-logo-img {
  width: 150px;
  height: 48px;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.header-title-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
  padding-left: 1.25rem;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  line-height: 1.2;
}

.subtitle {
  font-size: 0.75rem;
  color: #94a3b8;
  white-space: nowrap;
}

/* ── Right: preview + auto-refresh ── */
.header-right {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-shrink: 0;
}

.header-divider {
  color: rgba(255,255,255,0.25);
  font-size: 1rem;
  user-select: none;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.2s;
}
.back-btn:hover {
  opacity: 0.75;
}

.auto-refresh-label {
  font-size: 0.78rem;
  color: #94a3b8;
  white-space: nowrap;
  text-align: right;
}

#countdown {
  font-weight: 700;
  color: #e2e8f0;
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1.1rem;
  background: #fff;
  color: var(--primary);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, transform 0.1s;
}
.refresh-btn:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}

.send-email-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 1rem;
  background: #16a34a;
  color: #fff;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s, transform 0.1s;
}
.send-email-btn:hover { background: #15803d; transform: translateY(-1px); }

.preview-email-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 1rem;
  background: rgba(255,255,255,0.12);
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s, transform 0.1s;
}
.preview-email-btn:hover { background: rgba(255,255,255,0.22); transform: translateY(-1px); }

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-success { background: #16a34a; }
.toast-warn    { background: #d97706; }
.toast-error   { background: #dc2626; }

/* ===== MAIN CONTAINER ===== */
main {
  will-change: opacity;
}

.container {
  flex: 1;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 2rem 2rem 290px;
}

/* ===== SECTION HEADER ===== */
.section { margin-bottom: 3rem; }

.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border);
}

.section-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: #e0f2fe;
  color: #0369a1;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== SOURCE BADGES ===== */
.source-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.18rem 0.6rem;
  border-radius: 4px;
  white-space: nowrap;
}

.source-badge.business-today {
  background: var(--bt-bg);
  color: var(--bt-color);
}

.source-badge.moneycontrol {
  background: var(--mc-bg);
  color: var(--mc-color);
}

/* ===== TOP 5 GRID ===== */
.top-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.top-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  transition: box-shadow 0.2s, transform 0.2s;
}
.top-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rank {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.card-title {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  flex: 1;
}

.card-summary {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.source-link {
  display: inline-block;
  margin-top: auto;
  padding-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 6px;
  align-self: flex-start;
  transition: background 0.15s, transform 0.1s;
}
.source-link:hover {
  background: #334155;
  transform: translateY(-1px);
}

/* ===== LATEST NEWS LIST ===== */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.list-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  transition: box-shadow 0.2s, transform 0.15s;
}
.list-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(3px);
}

.list-card-left {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.25rem;
}

.list-summary {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
}

.read-btn {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  text-decoration: none;
  padding: 0.38rem 0.9rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  align-self: center;
}
.read-btn:hover {
  background: #334155;
  transform: translateY(-1px);
}
.btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.pdf-btn {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  background: #dc2626;
  text-decoration: none;
  padding: 0.38rem 0.9rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  align-self: center;
}
.pdf-btn:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

/* ===== TWO COLUMN LAYOUT ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.col {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.col-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.25rem;
  font-weight: 700;
  font-size: 1rem;
}

.col-header h3 { flex: 1; font-size: 1rem; }

.col-icon { font-size: 1.1rem; }

.col-count {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.6rem;
  border-radius: 20px;
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.bse-corp-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  color: #fff;
  border-bottom: none;
}

.bse-notice-header {
  background: linear-gradient(135deg, #065f46 0%, #059669 100%);
  color: #fff;
  border-bottom: none;
}

.col-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.col-card {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: background 0.15s, border-left-color 0.15s;
}
.col-card:last-child { border-bottom: none; }
.col:has(.bse-corp-header)   .col-card:hover { background: #eff6ff; border-left-color: #3b82f6; }
.col:has(.bse-notice-header) .col-card:hover { background: #f0fdf4; border-left-color: #10b981; }

.col-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.col-summary {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

.col-empty {
  padding: 1.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* top-5 card inside column (with rank number) */
.top-col-card {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: background 0.15s, border-left-color 0.15s;
}
.top-col-card:last-child { border-bottom: none; }
.col:has(.bse-corp-header)   .top-col-card:hover { background: #eff6ff; border-left-color: #3b82f6; }
.col:has(.bse-notice-header) .top-col-card:hover { background: #f0fdf4; border-left-color: #10b981; }

.rank-inline {
  font-size: 1rem;
  font-weight: 800;
  color: #cbd5e1;
  min-width: 1.8rem;
  padding-top: 0.1rem;
  flex-shrink: 0;
}

/* Rank accent per column type */
.col:has(.bse-corp-header) .rank-inline   { color: #93c5fd; }
.col:has(.bse-notice-header) .rank-inline { color: #6ee7b7; }

.top-col-body {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

/* ===== VIEW MORE ===== */
.viewmore-wrap {
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.viewmore-btn {
  background: none;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.45rem 1.4rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  width: 100%;
}
.viewmore-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ===== LOADING PAGE ===== */
.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
  gap: 1rem;
}

.loading-box h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.loading-box p {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 400px;
}

.loading-sub {
  font-size: 0.8rem !important;
  color: #94a3b8 !important;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 5px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== EMPTY STATE ===== */
.llm-banner {
  background: #fefce8;
  border: 1px solid #fde047;
  color: #713f12;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.llm-banner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #eab308;
  animation: pulse 1.2s infinite;
  flex-shrink: 0;
}

/* ===== BSE FETCH SKELETON ===== */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.bse-skeleton {
  padding: 1.2rem 0 0.5rem;
}

.bse-skeleton-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1rem;
}

.bse-skeleton-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 1.2s infinite;
  flex-shrink: 0;
}

.sk-card {
  height: 68px;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
}

.sk-card--short { height: 48px; }

.mkt-placeholder {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 0.6rem 0;
  animation: pulse 1.5s infinite;
}

.empty-state {
  text-align: center;
  padding: 5rem 2rem;
  color: var(--muted);
  font-size: 1rem;
}
.empty-state a { color: var(--accent); }

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--card-bg);
  border-top: 1px solid var(--border);
}

/* ===== MARKET DATA ===== */
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.market-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1.1rem 1.25rem;
}

/* live pulse dot next to Market Data header */
.market-live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22,163,74,0.5);
  animation: pulse-dot 2s infinite;
  margin-left: 4px;
  flex-shrink: 0;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  70%  { box-shadow: 0 0 0 6px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}
.dot-flash { background: #2563eb !important; }

.market-card-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.market-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.market-row:last-child { border-bottom: none; }

.market-name { flex: 1; font-weight: 600; color: var(--text); text-align: left; }
.market-val  { color: var(--muted); font-size: 0.82rem; text-align: right; min-width: 5rem; }
.market-pct  { font-weight: 700; font-size: 0.82rem; min-width: 4rem; text-align: right; }
.pct-up   { color: #16a34a; }
.pct-down { color: #dc2626; }

/* ===== SECTOR INTELLIGENCE ===== */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.sector-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: box-shadow 0.2s, transform 0.2s;
}
.sector-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.bias-positive { border-left-color: #16a34a; }
.bias-negative { border-left-color: #dc2626; }
.bias-neutral  { border-left-color: #94a3b8; }

/* ── Header: two-line layout ── */
.sector-card-header {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Line 1: sector name + bias pill */
.sector-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sector-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.2px;
}

/* Line 2: index label + pct change */
.sector-meta-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sector-index-name {
  font-size: 0.7rem;
  color: var(--muted);
  font-style: italic;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sector-pct {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Bias pill ── */
.bias-tag-positive {
  display: inline-flex; align-items: center; gap: 0.2rem;
  background: #16a34a; color: #fff;
  padding: 0.18rem 0.55rem; border-radius: 20px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; white-space: nowrap; flex-shrink: 0;
}
.bias-tag-negative {
  display: inline-flex; align-items: center; gap: 0.2rem;
  background: #dc2626; color: #fff;
  padding: 0.18rem 0.55rem; border-radius: 20px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; white-space: nowrap; flex-shrink: 0;
}
.bias-tag-neutral {
  display: inline-flex; align-items: center; gap: 0.2rem;
  background: #64748b; color: #fff;
  padding: 0.18rem 0.55rem; border-radius: 20px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; white-space: nowrap; flex-shrink: 0;
}

/* ── Index sub-label (old, kept for fallback) ── */
.sector-index-label {
  font-size: 0.68rem;
  color: var(--muted);
  font-style: italic;
  margin-top: -0.2rem;
}

/* ── Confidence ── */
.sector-confidence {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}

/* ── Insight text ── */
.asset-description {
  font-size: 0.75rem;
  color: #475569;
  line-height: 1.4;
  margin: 0.25rem 0 0.4rem;
  font-style: italic;
}
.sector-description {
  font-size: 0.75rem;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.4;
  margin-top: 0.3rem;
}
.sector-insight {
  font-size: 0.76rem;
  color: #475569;
  line-height: 1.55;
  border-top: 1px solid var(--border);
  padding-top: 0.4rem;
  margin-top: 0.3rem;
}

/* ── Company tags ── */
.sector-companies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.company-tag {
  font-size: 0.68rem;
  font-weight: 600;
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}

/* ===== AFFECTED ASSETS — 2×2 grid ===== */
.assets-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.asset-row {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  border-top: 3px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: box-shadow 0.2s, transform 0.15s;
}
.asset-row:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.signal-row-buy   { border-top-color: #16a34a; }
.signal-row-sell  { border-top-color: #dc2626; }
.signal-row-hold  { border-top-color: #d97706; }
.signal-row-watch { border-top-color: #3b82f6; }

/* ── Card header: symbol + signal badge ── */
.asset-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.asset-sym-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.asset-sym {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
}

.asset-fullname {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.3;
}

.asset-meta-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-top: 0.2rem;
}

.asset-exchange-tag {
  font-size: 0.6rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 0.08rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.asset-type-tag {
  font-size: 0.6rem;
  font-weight: 700;
  background: #eff6ff;
  color: #3b82f6;
  border: 1px solid #bfdbfe;
  padding: 0.08rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Analysis pillars ── */
.asset-pillars {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.asset-pillar {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
}

.pillar-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  min-width: 5.5rem;
  flex-shrink: 0;
}

.pillar-text {
  font-size: 0.77rem;
  color: #334155;
  line-height: 1.45;
}

/* ── Signal block ── */
.asset-signal-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}

.signal-badge-buy {
  display: inline-block;
  background: #16a34a; color: #fff;
  font-size: 0.7rem; font-weight: 800;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.signal-badge-sell {
  display: inline-block;
  background: #dc2626; color: #fff;
  font-size: 0.7rem; font-weight: 800;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.signal-badge-hold {
  display: inline-block;
  background: #d97706; color: #fff;
  font-size: 0.7rem; font-weight: 800;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.signal-badge-watch {
  display: inline-block;
  background: #3b82f6; color: #fff;
  font-size: 0.7rem; font-weight: 800;
  padding: 0.28rem 0.75rem;
  border-radius: 6px;
  text-transform: uppercase; letter-spacing: 0.08em;
}

.asset-conf {
  font-size: 0.6rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .assets-list { grid-template-columns: 1fr; }
}

/* ===== PAGE LAYOUT (single column) ===== */
.page-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto 1fr;
  gap: 1.5rem;
  align-items: start;
}

/* column 1 rows */
.market-section {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}
.content-main {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

/* ── News Modal open buttons ── */
.ntp-open-btn {
  padding: 0.3rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ntp-open-btn:hover { background: #2563eb; color: #fff; }

/* ── News Modal overlay ── */
.ntp-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.ntp-modal-overlay.active { display: flex; }
.ntp-modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 48px rgba(0,0,0,0.2);
  width: min(860px, 92vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ntp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  background: #f8faff;
  padding-right: 0.75rem;
  flex-shrink: 0;
}
.ntp-modal-tabs { display: flex; }
.ntp-tab {
  padding: 0.7rem 1.2rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #64748b;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ntp-tab:hover { color: #1e293b; }
.ntp-tab.active { color: #2563eb; border-bottom-color: #2563eb; background: #fff; }
.ntp-modal-close {
  font-size: 1rem;
  color: #94a3b8;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
.ntp-modal-close:hover { background: #f1f5f9; color: #1e293b; }
.ntp-modal-body { overflow-y: auto; padding: 1rem; flex: 1; }
.ntp-pane { display: none; }
.ntp-pane.active { display: block; }

/* Global news sidebar — column 2, starts at row 1, spans all rows */
.global-news-sidebar {
  grid-column: 2;
  grid-row: 1 / 3;
  position: sticky;
  top: 80px;
  margin-left: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.08);
  overflow: hidden;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

/* ── Global News Header ── */
.gn-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f8faff 0%, #f0f4ff 100%);
  flex-shrink: 0;
}
.gn-updated {
  font-size: 0.68rem;
  color: #94a3b8;
  padding: 2px 10px 4px;
  font-style: italic;
}
.gn-title {
  font-size: 0.83rem;
  font-weight: 700;
  color: #1e293b;
}
.gn-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  animation: pulse 2s infinite;
}

/* ── Source Tabs ── */
.gn-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  flex-shrink: 0;
}
.gn-tab {
  padding: 0.2rem 0.55rem;
  font-size: 0.62rem;
  font-weight: 600;
  border-radius: 5px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.gn-tab:hover { border-color: #94a3b8; background: #f1f5f9; }
.gn-tab.active { background: #334155; border-color: #334155; color: #fff; }

/* ── News List ── */
.gn-list {
  overflow-y: auto;
  flex: 1;
  padding: 0.4rem 0;
  will-change: opacity;
}
.gn-list::-webkit-scrollbar { width: 3px; }
.gn-list::-webkit-scrollbar-track { background: transparent; }
.gn-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.gn-item {
  display: block;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid #f8fafc;
  text-decoration: none;
  transition: background 0.12s;
}
.gn-item:hover { background: #f8fafc; }
.gn-item:last-child { border-bottom: none; }

.gn-item-source {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.2rem;
}
.gn-item-title {
  font-size: 0.73rem;
  color: #1e293b;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  line-clamp: 3;
  overflow: hidden;
}
.gn-item-summary {
  font-size: 0.68rem;
  color: #475569;
  line-height: 1.4;
  margin-top: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
}
.gn-item-date {
  font-size: 0.58rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.gn-loading, .gn-empty {
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
  padding: 2rem 1rem;
}

@media (max-width: 1100px) {
  .container { padding: 2rem 1.5rem; }
  .page-layout {
    grid-template-columns: 1fr;
  }
  .global-news-sidebar {
    grid-column: 1;
    grid-row: auto;
    position: static;
    max-height: 400px;
  }
}

/* ── Live Market Data Section ── */
/* ── Live Market Data Section ── */
.market-section {
  background: transparent;
  padding: 0;
}

.market-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.market-section-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}

.market-section-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* 3-column horizontal card grid */
.market-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* Each card */
.mkt-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* Indices — navy header */
.mkt-card:not(.mkt-gainers):not(.mkt-losers) .mkt-card-header {
  background: #1e3a5f;
}

/* Gainers — green header */
.mkt-gainers .mkt-card-header {
  background: #14532d;
}

/* Losers — red header */
.mkt-losers .mkt-card-header {
  background: #7f1d1d;
}

.mkt-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
}

.mkt-card-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
}

.mkt-badge-up {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4ade80;
  background: rgba(74,222,128,0.2);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(74,222,128,0.3);
}

.mkt-badge-down {
  font-size: 0.7rem;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(252,165,165,0.2);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  border: 1px solid rgba(252,165,165,0.3);
}

.mkt-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
  transition: background 0.15s;
}

.mkt-row:hover { background: var(--bg); }
.mkt-row:last-child { border-bottom: none; }

.mkt-name {
  flex: 1;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

.mkt-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mkt-link:hover { color: var(--accent); text-decoration: underline; }

.mkt-subname {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mkt-val {
  color: var(--muted);
  font-size: 0.78rem;
  min-width: 4.5rem;
  text-align: right;
}

.mkt-pct {
  font-weight: 700;
  font-size: 0.8rem;
  min-width: 4.5rem;
  text-align: right;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .top-grid { grid-template-columns: repeat(2, 1fr); }
  .market-3col { grid-template-columns: 1fr 1fr; }
}

/* ===== EMAIL RECIPIENTS PANEL ===== */
/* ══════════════════════════════════════════
   Email Recipients — Fixed Left Panel
══════════════════════════════════════════ */
.email-panel {
  position: fixed;
  left: 16px;
  top: 80px;
  width: 240px;
  z-index: 200;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  overflow: hidden;
}

/* Header */
.ep-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem 0.75rem;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f8faff 0%, #f0f6ff 100%);
}
.ep-header-left { display: flex; align-items: center; gap: 0.6rem; }
.ep-icon { font-size: 1.2rem; line-height: 1; }
.ep-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.ep-subtitle {
  font-size: 0.6rem;
  color: #3b82f6;
  font-weight: 500;
  margin-top: 0.1rem;
}

/* Body */
.ep-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

/* Add form */
.ep-add-form {
  display: flex;
  gap: 0.4rem;
}
.ep-input {
  flex: 1;
  min-width: 0;
  padding: 0.42rem 0.6rem;
  font-size: 0.73rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.ep-input:focus { border-color: #3b82f6; background: #fff; }
.ep-add-btn {
  padding: 0.42rem 0.75rem;
  font-size: 0.73rem;
  font-weight: 700;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.ep-add-btn:hover { background: #2563eb; }

/* Status message */
.ep-msg {
  font-size: 0.68rem;
  min-height: 0.9rem;
  border-radius: 5px;
  padding: 0;
}
.ep-msg-ok   { color: #16a34a; }
.ep-msg-warn { color: #d97706; }
.ep-msg-err  { color: #ef4444; }
.ep-msg-info { color: #64748b; }

/* Search */
.ep-search {
  width: 100%;
  box-sizing: border-box;
  padding: 0.38rem 0.6rem;
  font-size: 0.71rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 7px;
  background: #f8fafc;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s;
}
.ep-search:focus { border-color: #3b82f6; background: #fff; }

/* Recipient list */
.ep-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 180px;
  overflow-y: auto;
}
.ep-list::-webkit-scrollbar { width: 3px; }
.ep-list::-webkit-scrollbar-track { background: transparent; }
.ep-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 2px; }

.ep-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  padding: 0.32rem 0.4rem 0.32rem 0.6rem;
  transition: background 0.1s;
}
.ep-chip:hover { background: #f1f5f9; }
.ep-chip-match { border-color: #fde68a; background: #fffbeb; }
.ep-chip-email {
  flex: 1;
  font-size: 0.68rem;
  color: #334155;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ep-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 0.65rem;
  line-height: 1;
  padding: 0.1rem;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.ep-remove:hover { color: #ef4444; background: #fee2e2; }

.ep-empty {
  font-size: 0.7rem;
  color: #94a3b8;
  text-align: center;
  padding: 0.5rem 0;
}

/* Highlight */
.email-highlight {
  background: #fef08a;
  color: #713f12;
  border-radius: 2px;
  padding: 0 1px;
  font-weight: 700;
}

/* Upload */
.ep-upload {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  margin-top: 0.2rem;
}
.ep-upload:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }
.ep-upload-icon { font-size: 0.9rem; }

.ep-upload-hint {
  font-size: 0.58rem;
  color: #94a3b8;
  text-align: center;
  margin: 0;
  letter-spacing: 0.02em;
}

@media (max-width: 960px) {
  .email-panel { display: none; }
}

@media (max-width: 640px) {
  .header-content { flex-wrap: wrap; padding: 0 1rem; gap: 0.75rem; }
  .header-left { flex-shrink: 1; }
  .header-logo-img { width: 110px; height: 36px; }
  .header-title-block { padding-left: 0.75rem; }
  header h1 { font-size: 1rem; }
  .subtitle { display: none; }
  .header-right { align-items: flex-start; }
  .container { padding: 1.25rem 1rem; }
  .top-grid { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .list-card { flex-direction: column; gap: 0.75rem; }
  .read-btn { align-self: flex-start; }
  .market-3col { grid-template-columns: 1fr; }
  .header-divider { display: none; }
}
