/* ===== ТАБЛИЦА ОБЛИГАЦИЙ (компактная, раскрывающиеся строки) ===== */

.table-master-container {
  height: 800px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin: 16px 0;
  position: relative;
}

.bonds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  table-layout: auto;
  font-family: var(--font-primary);
}

.bonds-table th,
.bonds-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}

.bonds-table th.num,
.bonds-table td.num {
  text-align: right;
  font-family: var(--font-mono), var(--font-mono-fallback);
  font-variant-numeric: tabular-nums;
}

.bonds-table th.expand-col,
.bonds-table td.expand-col {
  width: 28px;
  padding-right: 0;
}

.bonds-table th {
  cursor: pointer;
  user-select: none;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  background: var(--surface-2);
  white-space: nowrap;
}

.bonds-table th:hover {
  color: var(--text);
}

.bonds-table thead {
  position: sticky;
  top: 0;
  z-index: 101;
}

.bonds-table tbody tr.row {
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.bonds-table tbody tr.row:hover {
  background: var(--surface-2);
}

.bonds-table tbody tr.row.expanded {
  background: var(--accent-soft);
}

.group-headers th {
  background: var(--text);
  color: var(--bg);
  font-weight: bold;
  font-size: 12px;
  text-align: center;
  padding: 8px 12px;
  border-bottom: none;
}


/* ===== ЯЧЕЙКА "БУМАГА" ===== */

.bond-name-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 170px;
}

.bond-name-cell .nm {
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
}

.bond-name-cell .nm:hover {
  color: var(--accent);
  text-decoration: underline;
}

.bond-name-cell .meta {
  font-family: var(--font-mono), var(--font-mono-fallback);
  font-size: 10.5px;
  color: var(--text-faint);
  display: flex;
  gap: 6px;
  align-items: center;
}

.type-tag {
  font-family: var(--font-primary);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--neutral-pill);
  color: var(--text-muted);
  text-transform: uppercase;
}

.type-tag.floater { background: var(--ok-soft); color: var(--ok); }
.type-tag.fx { background: var(--accent-soft); color: var(--accent); }
.type-tag.sub { background: var(--poor-soft); color: var(--poor); }
.type-tag.default-tag { background: var(--poor); color: var(--accent-contrast); font-weight: 800; }


/* ===== ЭКСПАНД-ТОГГЛ ===== */

.expand-toggle {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  transition: transform 0.15s ease;
}

tr.expanded .expand-toggle {
  transform: rotate(90deg);
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: transparent;
}


/* ===== РЕЙТИНГ ===== */

.rating-pill {
  font-family: var(--font-mono), var(--font-mono-fallback);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  display: inline-block;
  white-space: nowrap;
}

.rating-pill.good { background: var(--good-soft); color: var(--good); }
.rating-pill.ok { background: var(--ok-soft); color: var(--ok); }
.rating-pill.poor { background: var(--poor-soft); color: var(--poor); }
.rating-pill.withdrawn { background: var(--neutral-pill); color: var(--text-faint); font-weight: 600; font-size: 10px; }
.rating-pill.none { color: var(--text-faint); background: none; padding: 2px 0; font-weight: 400; }

.rating-agency-hint {
  display: block;
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 2px;
  white-space: nowrap;
}


/* ===== НКД (прогресс текущего купонного периода) ===== */

.nkd-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}

.nkd-bar {
  width: 46px;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  flex-shrink: 0;
}

.nkd-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.nkd-pct {
  font-family: var(--font-mono), var(--font-mono-fallback);
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  width: 30px;
  text-align: right;
}

.yield-num {
  font-weight: 700;
  color: var(--text);
}

.yield-num.hi {
  color: var(--good);
}


/* ===== ВСПЛЫВАЮЩАЯ ПАНЕЛЬ С ПОЛНОЙ ИНФОРМАЦИЕЙ ===== */

.row-detail-popover {
  position: fixed;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px 18px;
  min-width: 320px;
  max-width: 720px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px 22px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.detail-field .lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.detail-field .val {
  font-family: var(--font-mono), var(--font-mono-fallback);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: normal;
}

.detail-field .val.wide {
  font-family: var(--font-primary);
  font-weight: 500;
}


/* ===== КЛИКАЕМЫЕ ЭЛЕМЕНТЫ (используются и на других страницах) ===== */

.secid-clickable {
  cursor: pointer;
  color: var(--accent);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-primary);
}

.secid-clickable:hover {
  background-color: var(--accent-soft);
  text-decoration: underline;
}

.price-clickable {
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
  font-weight: bold;
  font-family: var(--font-primary);
}

.price-clickable:hover {
  color: var(--accent);
  background-color: var(--accent-soft);
}

.clickable-price {
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-block;
  padding: 2px 4px;
  border-radius: 4px;
}

.clickable-price:hover {
  background-color: var(--accent-soft);
  color: var(--accent);
}

.clickable-price::after {
  content: " 📈";
  opacity: 0;
  font-size: 11px;
  transition: opacity 0.2s ease;
}

.clickable-price:hover::after {
  opacity: 0.8;
}


/* ===== ЦВЕТОВЫЕ КЛАССИФИКАЦИИ (используются на других страницах) ===== */

.price, .yield, .volume, .currency,
.price-high, .price-medium, .price-low,
.yield-high, .yield-medium, .yield-low,
.change-positive, .change-negative,
.numeric {
  font-family: var(--font-mono), var(--font-mono-fallback);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
}

.price-high { color: var(--poor); font-weight: bold; }
.price-medium { color: var(--ok); }
.price-low { color: var(--good); }

.yield-high { color: var(--good); font-weight: bold; }
.yield-medium { color: var(--ok); }
.yield-low { color: var(--poor); }

.change-positive { color: var(--good); background-color: var(--good-soft); }
.change-negative { color: var(--poor); background-color: var(--poor-soft); }

.coupon-high { color: var(--good); font-weight: bold; }
.coupon-medium { color: var(--ok); }
.coupon-low { color: var(--poor); }

.amortization-high { color: var(--poor); }
.amortization-medium { color: var(--ok); }
.amortization-low { color: var(--good); }

.yield-spread {
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 3px;
  font-weight: 600;
}
.yield-spread.positive { background: var(--good-soft); color: var(--good); }
.yield-spread.negative { background: var(--poor-soft); color: var(--poor); }

.days-to-offer {
  padding: 2px 6px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}
.days-soon { background: var(--poor-soft); color: var(--poor); }
.days-near { background: var(--ok-soft); color: var(--ok); }
.days-far { background: var(--good-soft); color: var(--good); }


/* ===== АМОРТИЗАЦИЯ (используется на других страницах) ===== */

.amortization-cell {
  text-align: center;
  padding: 4px 8px;
}

.amortization-signs {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2px;
  font-size: 16px;
  color: var(--text-muted);
  cursor: help;
  user-select: none;
}

.effective-yield {
  font-weight: 600;
  color: var(--accent);
}


/* ===== РАЗНОЕ ===== */

.bond-type-icon {
  text-align: center;
  font-size: 16px;
}

.qualified-badge {
  background: var(--poor);
  color: var(--accent-contrast);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 5px;
}

.sort-asc::after { content: " ↑"; color: var(--accent); }
.sort-desc::after { content: " ↓"; color: var(--accent); }

.coupon-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 15px 0;
}

.coupon-table th,
.coupon-table td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
}

.coupon-table th {
  background: var(--surface-2);
  font-weight: 600;
  text-align: left;
}

.coupon-table tr:hover {
  background: var(--surface-2);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top: 2px solid var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.virtualization-info {
  padding: 10px;
  background: var(--surface-2);
  border-radius: 4px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.no-data {
  color: var(--text-faint);
}
