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

:root {
  --navy:      #0f172a;
  --navy-mid:  #1e3a5f;
  --navy-lt:   #243b55;
  --blue:      #3b82f6;
  --up:        #16a34a;
  --up-bg:     #dcfce7;
  --down:      #dc2626;
  --down-bg:   #fee2e2;
  --neutral:   #6b7280;
  --bg:        #f0f4f8;
  --card:      #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --text-sm:   #475569;
  --radius:    8px;
  --shadow:    0 1px 4px rgba(0,0,0,.08);
}

html { font-size: 15px; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ── Site header ─────────────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.brand { display: flex; flex-direction: column; }
.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: #f8fafc;
}
.brand-tag {
  font-size: 11px;
  color: #94a3b8;
  letter-spacing: .3px;
}

/* instrument nav tabs */
.instrument-nav { display: flex; gap: 4px; }
.nav-tab {
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-tab.active {
  background: rgba(255,255,255,.15);
  color: #fff;
}
.nav-tab.disabled {
  opacity: .45;
  cursor: default;
}
.nav-tab em {
  font-style: normal;
  font-size: 10px;
  background: #334155;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 4px;
}

/* ── Date bar ────────────────────────────────────────────────────────────── */
.date-bar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.date-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 50px;
  gap: 16px;
}
.date-selector-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-sm);
}
.date-selector-wrap select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  background: var(--bg);
  cursor: pointer;
}
.download-buttons { display: flex; gap: 8px; }
.btn-dl {
  padding: 6px 14px;
  border: 1px solid var(--navy-mid);
  border-radius: 6px;
  background: transparent;
  color: var(--navy-mid);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-dl:hover { background: var(--navy-mid); color: #fff; }

/* ── Summary cards ───────────────────────────────────────────────────────── */
.summary-section { padding: 20px 0 8px; }
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.summary-card .card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-sm);
  margin-bottom: 6px;
}
.summary-card .card-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.1;
}
.summary-card .card-sub {
  font-size: 12px;
  color: var(--text-sm);
  margin-top: 4px;
}
.summary-card .card-sub .up   { color: var(--up); font-weight: 600; }
.summary-card .card-sub .down { color: var(--down); font-weight: 600; }

/* ── Ad zone ─────────────────────────────────────────────────────────────── */
.ad-zone {
  min-height: 50px;
  background: #f8fafc;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 12px;
  margin: 16px 0;
}

/* ── Filter section ──────────────────────────────────────────────────────── */
.filter-section {
  padding: 12px 0;
  background: var(--card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 90;
  box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 5px 0;
}
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sm);
  white-space: nowrap;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 4px 13px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.chip:hover  { border-color: var(--navy-mid); color: var(--navy-mid); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

.filter-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-inline select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg);
  cursor: pointer;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-sm);
  cursor: pointer;
}

/* ── Main table section ──────────────────────────────────────────────────── */
.table-section { padding: 20px 0; }
.table-meta {
  font-size: 12px;
  color: var(--text-sm);
  margin-bottom: 10px;
}
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.data-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: var(--card);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table thead th {
  background: var(--navy);
  color: #e2e8f0;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 11px 14px;
  text-align: left;
  white-space: nowrap;
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td {
  padding: 10px 14px;
  font-size: 13px;
  vertical-align: middle;
}

/* column widths */
.col-name  { min-width: 180px; }
.col-cat   { min-width: 120px; }
.col-price { min-width: 80px; text-align: right; }
.col-chg   { min-width: 100px; text-align: right; }
.col-52w   { min-width: 150px; }
.col-tv    { min-width: 110px; text-align: right; }
.col-tr    { min-width: 80px; text-align: right; }
.col-liq   { min-width: 80px; }
.col-range { min-width: 120px; }

/* name cell */
.cell-symbol { font-weight: 700; font-size: 13px; color: var(--navy); }
.cell-name   { font-size: 11px; color: var(--text-sm); margin-top: 2px; max-width: 200px;
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-under  { font-size: 10px; color: #94a3b8; margin-top: 1px; max-width: 200px;
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* change colours */
.up   { color: var(--up);      font-weight: 600; }
.down { color: var(--down);    font-weight: 600; }
.zero { color: var(--neutral); }

/* category pill */
.cat-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.cat-eq   { background: #dbeafe; color: #1d4ed8; }
.cat-sec  { background: #ede9fe; color: #5b21b6; }
.cat-com  { background: #fef9c3; color: #854d0e; }
.cat-dbt  { background: #dcfce7; color: #166534; }
.cat-int  { background: #fce7f3; color: #9d174d; }
.cat-oth  { background: #f1f5f9; color: #475569; }

/* liquidity badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.badge-High   { background: var(--up-bg);   color: #166534; }
.badge-Medium { background: #fef9c3; color: #854d0e; }
.badge-Low    { background: var(--down-bg); color: #991b1b; }

/* 52-week position bar */
.bar-wrap { display: flex; flex-direction: column; gap: 3px; }
.bar-52w {
  position: relative;
  width: 100px;
  height: 8px;
  background: linear-gradient(90deg, #dc2626 0%, #f59e0b 50%, #16a34a 100%);
  border-radius: 4px;
  flex-shrink: 0;
}
.bar-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid #1e293b;
  border-radius: 50%;
}
.bar-text { font-size: 10px; color: var(--text-sm); white-space: nowrap; }
.bar-flag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 8px;
  background: #fef9c3;
  color: #854d0e;
}
.bar-flag.hi52 { background: var(--up-bg); color: #166534; }
.bar-flag.lo52 { background: var(--down-bg); color: #991b1b; }

/* intraday range cell */
.range-abs { font-size: 13px; color: var(--text); }
.range-pct { font-size: 11px; color: var(--text-sm); }

/* ── Quick views ─────────────────────────────────────────────────────────── */
.views-section { padding: 0 0 32px; }
.section-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;
}
.views-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.view-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.view-card h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.view-card.wide { grid-column: 1 / -1; }
.threshold-note { font-weight: 400; font-size: 11px; color: var(--text-sm); }

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.mini-table th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-sm);
  padding: 5px 8px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.mini-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.mini-table tr:last-child td { border-bottom: none; }
.mini-table tr:hover td { background: #f8fafc; }
.mini-table .sym { font-weight: 700; color: var(--navy); }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--navy);
  color: #94a3b8;
  padding: 24px 0;
  margin-top: 32px;
}
.footer-inner { display: flex; flex-direction: column; gap: 4px; }
.site-footer p { font-size: 12px; }

/* ── Back to top ─────────────────────────────────────────────────────────── */
.back-to-top-bar {
  background: var(--card);
  border-top: 1px solid var(--border);
  padding: 10px 0;
  text-align: right;
}
.back-to-top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--navy);
  color: #fff;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.back-to-top:hover { background: var(--navy-mid); color: #fff; text-decoration: none; }

/* ── Home page ───────────────────────────────────────────────────────────── */
.home-hero {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 32px 0;
}
.home-hero p {
  font-size: 14px;
  color: var(--text-sm);
  line-height: 1.8;
  max-width: 780px;
}

.home-instrument-row {
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}
.home-row-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.home-row-header h2 {
  font-size: 16px;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
}
.home-row-date {
  font-size: 12px;
  color: var(--text-sm);
}
.home-row-link {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
}
.home-row-link:hover { text-decoration: underline; }

.home-coming-soon {
  font-size: 13px;
  color: var(--text-sm);
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

/* ── About page ──────────────────────────────────────────────────────────── */
.about-section {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 0;
}
.about-section h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 16px;
}
.about-section p {
  font-size: 14px;
  color: var(--text-sm);
  line-height: 1.8;
  margin-bottom: 20px;
}
.about-badge {
  display: inline-block;
  padding: 4px 12px;
  background: var(--navy);
  color: #fff;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .4px;
}

/* ── Corporate bond liquidity badges ────────────────────────────────────── */
.badge-Active   { background: var(--up-bg);   color: #166534; }
.badge-Moderate { background: #fef9c3; color: #854d0e; }
.badge-VeryThin { background: #f1f5f9; color: #64748b; }

/* corp action badge */
.badge-corp {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: #ede9fe;
  color: #5b21b6;
  white-space: nowrap;
}

/* col-corp width */
.col-corp { min-width: 110px; }

/* ── Row detail drawer ───────────────────────────────────────────────────── */
.bond-drawer { position: fixed; inset: 0; z-index: 200; }
.bond-drawer.hidden { display: none; }

.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.45);
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 400px;
  background: #fff;
  overflow-y: auto;
  padding: 28px 24px;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
}
.drawer-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #64748b;
  line-height: 1;
}
.drawer-close:hover { color: #ef4444; }
.drawer-title { font-size: 15px; font-weight: 800; color: var(--navy); margin-bottom: 2px; }
.drawer-subtitle { font-size: 12px; color: var(--text-sm); margin-bottom: 20px; }
.drawer-section { margin-bottom: 20px; }
.drawer-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-sm);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.drawer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.drawer-stat .stat-label { font-size: 11px; color: var(--text-sm); }
.drawer-stat .stat-value { font-size: 15px; font-weight: 700; color: var(--navy); }
.drawer-note {
  font-size: 12px;
  color: var(--text-sm);
  line-height: 1.6;
  background: #f8fafc;
  border-left: 3px solid var(--blue);
  padding: 10px 12px;
  border-radius: 0 6px 6px 0;
  margin-top: 10px;
}
.drawer-corp-note {
  font-size: 12px;
  background: #ede9fe;
  color: #5b21b6;
  padding: 10px 12px;
  border-radius: 6px;
  margin-top: 8px;
}

@media (max-width: 480px) {
  .drawer-panel { width: 100%; }
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 9999;
  color: #fff;
  font-size: 14px;
}
.loading-overlay.hidden { display: none; }
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-sm);
}
.empty-state h3 { font-size: 18px; margin-bottom: 8px; }
.empty-state p  { font-size: 14px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .header-inner { height: auto; padding: 12px 0; flex-wrap: wrap; gap: 10px; }
  .instrument-nav { width: 100%; }
  .date-bar-inner { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .filter-section { position: static; }
  .views-grid { grid-template-columns: 1fr; }
  .view-card.wide { grid-column: auto; }
}
@media (max-width: 480px) {
  .summary-grid { grid-template-columns: 1fr; }
  .brand-tag { display: none; }
}
