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

:root {
  --bg:         #0B0F1A;
  --bg2:        #111827;
  --bg3:        #1C2333;
  --border:     #1F2A3C;
  --text:       #E2E8F0;
  --text-muted: #64748B;
  --text-dim:   #94A3B8;
  --accent:     #6366F1;
  --green:      #10B981;
  --amber:      #F59E0B;
  --red:        #EF4444;
  --radius:     12px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Header ─────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 14px; }

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  font-size: 24px;
  width: 42px; height: 42px;
  background: linear-gradient(135deg, #6366F1, #818CF8);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #fff;
}
.logo h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; }
.logo-sub { font-size: 11px; color: var(--text-muted); font-weight: 400; }

.last-updated {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg3);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.tlref-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
}
.tlref-badge-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.tlref-badge-rate {
  font-size: 14px;
  font-weight: 700;
  color: var(--green);
}
.tlref-badge-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.refresh-btn {
  display: flex; align-items: center; gap: 7px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
.refresh-btn:hover { opacity: 0.85; transform: translateY(-1px); }
.refresh-btn:active { transform: translateY(0); }
.refresh-btn.loading svg { animation: spin 0.7s linear infinite; }

/* ── Main layout ─────────────────────────────────── */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Status bar ──────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: #1C1A2E;
  border: 1px solid #3730A3;
  font-size: 13px;
  color: #A5B4FC;
}
.status-bar.error { background: #1C0A0A; border-color: #7F1D1D; color: #FCA5A5; }
.status-bar.hidden { display: none; }

/* ── Cards ───────────────────────────────────────── */
.cards-section {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  flex: 1;
  min-width: 160px;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
  overflow: hidden;
}
.card:hover { border-color: #2D3F5C; transform: translateY(-2px); }

.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--card-accent, var(--accent));
  border-radius: var(--radius) var(--radius) 0 0;
}
.card-anchor { --card-accent: #94A3B8; }

.card-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.card-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 500;
}
.card-rate {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 6px;
}
.card-sub {
  font-size: 11px;
  color: var(--text-muted);
}
.card-price {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.bond-cards {
  display: contents;
}

/* ── Skeleton ──────────────────────────────────────*/
.skeleton .card-rate,
.skeleton .card-label {
  background: var(--bg3);
  border-radius: 4px;
  color: transparent;
  animation: pulse 1.4s ease-in-out infinite;
}

/* ── Chart ───────────────────────────────────────── */
.chart-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.chart-header h2 { font-size: 16px; font-weight: 600; }
.chart-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.legend-line {
  width: 20px; height: 2px;
  border-radius: 1px;
}

.chart-wrapper {
  position: relative;
  height: 360px;
}

canvas { width: 100% !important; }

.chart-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(17, 24, 39, 0.75);
  border-radius: 8px;
  backdrop-filter: blur(4px);
  font-size: 13px;
  color: var(--text-muted);
}
.chart-overlay.hidden { display: none; }

/* ── Table ───────────────────────────────────────── */
.table-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.table-section h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover { color: var(--text); }
.sort-icon { opacity: 0.3; font-size: 10px; margin-left: 3px; }
.sort-icon.active { opacity: 1; color: var(--accent); }
td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

.loading-row {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
}

.series-cell { font-family: 'Courier New', monospace; font-size: 11px; color: var(--text-muted); }
.k-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(245,158,11,0.18);
  color: var(--amber);
  border: 1px solid rgba(245,158,11,0.35);
}
.katilim-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(16,185,129,0.15);
  color: var(--green);
  border: 1px solid rgba(16,185,129,0.35);
}
.value-cell { font-weight: 600; font-variant-numeric: tabular-nums; }
.yield-cell { color: var(--amber); font-weight: 600; }
.zero-cell  { color: var(--green); font-weight: 600; }
.spread-cell { font-weight: 600; }
.spread-pos { color: #F87171; }
.spread-neg { color: var(--green); }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

/* ── Footer ──────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 20px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

/* ── Spinner ─────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── Animations ──────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 640px) {
  .header { padding: 14px 16px; }
  .main { padding: 16px 12px 40px; }
  .card-rate { font-size: 26px; }
  .chart-wrapper { height: 260px; }
}
