:root {
  --ink: #13263d;
  --muted: #637083;
  --surface: #ffffff;
  --canvas: #f5f6f7;
  --line: #d9dfe5;
  --accent: #0b6e69;
  --accent-dark: #075651;
  --signal: #e6a52f;
  --danger: #b7413e;
}

html { font-size: 15px; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--accent-dark); text-underline-offset: 0.15em; }
a:hover { color: var(--ink); }

.site-content { min-height: calc(100vh - 13rem); }
.site-nav { border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.94); }
.wordmark { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); font-weight: 750; letter-spacing: -0.04em; }
.wordmark:hover { color: var(--ink); }
.wordmark-mark { display: inline-grid; width: 1.85rem; height: 1.85rem; place-items: center; border-radius: 0.45rem; background: var(--ink); color: var(--signal); font-size: 1.05rem; }
.site-nav .nav-link { color: var(--muted); font-size: 0.92rem; }

.card { border: 1px solid var(--line); border-radius: 0.6rem; box-shadow: none; }
.company-section { background: var(--surface); }
.company-section-subheading { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.bond-metric { min-height: 4.1rem; padding: 0.55rem 0.65rem; border-left: 2px solid #c9dddb; background: #f7faf9; font-size: 1.05rem; font-weight: 650; }
.bond-metric--secondary { border-left-color: #d6c49e; background: #fcfaf5; }
.bond-source { margin-top: 1rem; color: var(--muted); font-size: 0.78rem; }
.bond-issuer-score { display: flex; align-items: center; gap: 0.75rem; }
.bond-issuer-score .company-score { min-width: 2.4rem; padding: 0.25rem 0.4rem; font-size: 1.4rem; }
.bond-price-chart { margin: 0 0 1rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.45rem; color: var(--accent); background: #f7faf9; }
.bond-price-chart svg { height: 10rem; }
.bond-price-chart figcaption { margin-top: 0.45rem; color: var(--muted); font-size: 0.78rem; }
.bond-history-details summary { color: var(--accent-dark); cursor: pointer; font-size: 0.84rem; text-decoration: underline; text-underline-offset: 0.16em; }
.bond-history-details[open] summary { margin-bottom: 0.1rem; }
.bond-card-table--prices th:not(:first-child), .bond-card-table--prices td:not(:first-child), .bond-card-table--payments th:nth-child(n+3), .bond-card-table--payments td:nth-child(n+3) { text-align: center; }
.bond-disclaimer { margin-bottom: 1rem; padding: 0.75rem 1rem; border: 1px solid var(--line); border-radius: 0.5rem; color: var(--muted); background: #eef2f4; font-size: 0.82rem; }
.filter-card { background: #edf1f3; }
.filter-card .form-label { font-size: 0.78rem; }
.filter-card .form-control, .filter-card .form-select { padding-top: 0.3rem; padding-bottom: 0.3rem; font-size: 0.88rem; }
.filter-label { display: flex; align-items: center; gap: 0.3rem; margin-bottom: 0.5rem; }
.filter-label .form-label { margin-bottom: 0; }
.filter-popover { display: grid; width: 1.1rem; height: 1.1rem; padding: 0; place-items: center; flex: 0 0 auto; border: 1px solid #8e9ba7; border-radius: 50%; color: var(--muted); background: var(--surface); font-size: 0.7rem; font-weight: 700; line-height: 1; }
.filter-popover:hover { border-color: var(--accent); color: var(--accent-dark); }
.filter-popover:focus-visible { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 0.2rem rgba(11, 110, 105, 0.15); }
.filter-card:not(.filter-card--advanced-open) .filter-field--advanced { display: none; }
.filter-section { min-width: 0; padding: 0.55rem 0.7rem 0.7rem; border: 1px solid var(--line); border-left-width: 3px; border-radius: 0.5rem; background: var(--surface); }
.filter-section--issuer { border-left-color: var(--accent); }
.filter-section--issue { border-left-color: #d6c49e; }
.filter-section__title { width: auto; margin: 0 0 0.35rem; padding: 0; color: var(--ink); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.filter-section__hint { color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; }
.filter-card .form-select {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23075651' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7' d='m3 6 5 5 5-5'/%3E%3C/svg%3E");
  background-position: right 0.65rem center;
  background-repeat: no-repeat;
  background-size: 0.85rem;
  appearance: none;
}
.filter-toggle { padding: 0; border: 0; color: var(--accent-dark); background: transparent; font-size: 0.84rem; text-decoration: underline; text-underline-offset: 0.16em; }
.filter-toggle::after { content: " +"; }
.filter-card--advanced-open .filter-toggle::after { content: " −"; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.active-filters::before { color: var(--muted); content: "Активные фильтры:"; font-size: 0.78rem; }
.active-filter { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.22rem 0.45rem; border: 1px solid #b7cfcd; border-radius: 999px; color: var(--accent-dark); background: #e8f2f1; font-size: 0.78rem; }
.active-filter:hover { border-color: var(--accent); background: #d9ebe8; }
.btn-primary { border-color: var(--accent); background: var(--accent); }
.btn-primary:hover, .btn-primary:focus { border-color: var(--accent-dark); background: var(--accent-dark); }
.btn-outline-secondary { color: var(--muted); border-color: #aeb8c3; }
.form-control, .form-select { border-color: #b8c3cd; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 0.2rem rgba(11, 110, 105, 0.15); }

.table { --bs-table-bg: transparent; --bs-table-striped-bg: #f7f9fa; --bs-table-hover-bg: #edf3f2; border-color: var(--line); font-size: 0.92rem; }
.table thead th { color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }

.screener-table { font-size: 0.84rem; }
.screener-table thead th { font-size: 0.68rem; text-align: center; }
.screener-table tbody td { text-align: center; }
.screener-table th:first-child, .screener-table td:first-child { text-align: left; }

.pagination { gap: 0.3rem; }
.pagination .page-item { margin: 0; }
.pagination .page-link {
  min-width: 2.15rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem !important;
  color: var(--accent-dark);
  background: var(--surface);
  text-align: center;
}
.pagination .page-link:hover { border-color: var(--accent); color: var(--accent-dark); background: #e8f2f1; }
.pagination .page-item.active .page-link { border-color: var(--accent); background: var(--accent); color: #fff; }
.pagination .page-item.disabled .page-link { border-color: transparent; background: transparent; color: #a3adb8; }
.pagination .page-link:focus { box-shadow: 0 0 0 0.2rem rgba(11, 110, 105, 0.15); }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.screener-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #f7f9fa;
}

.screener-table thead th a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.score-badge {
  min-width: 2rem;
  font-size: 0.85rem;
}

.score-high { background-color: var(--accent); }

.score-mid {
  background-color: #ffc107;
  color: #212529;
}

.score-low { background-color: var(--danger); }

.company-score { min-width: 3.25rem; padding: 0.25rem 0.55rem; border-radius: 0.45rem; color: #fff; font-size: 2rem; font-weight: 750; line-height: 1; text-align: center; }
.company-score--high { background: var(--accent); }
.company-score--mid { color: #342600; background: var(--signal); }
.company-score--low { background: var(--danger); }
.company-score-disclaimer { font-size: 0.8rem; }

.risk-panel { padding: 1rem; border: 1px solid #e3b5ae; border-radius: 0.5rem; color: #873a34; background: #fff4f2; }
.risk-panel .text-muted { color: #765b58 !important; }

.company-card-table--group th:not(:first-child), .company-card-table--group td:not(:first-child), .company-card-table--ratings th:not(:first-child), .company-card-table--ratings td:not(:first-child) { text-align: center; }
.company-card-table--peer th:nth-child(n+3), .company-card-table--peer td:nth-child(n+3), .company-card-table--issues th:nth-child(n+3), .company-card-table--issues td:nth-child(n+3), .company-card-table--ratios th:nth-child(n+3), .company-card-table--ratios td:nth-child(n+3) { text-align: center; }

.points-badge {
  min-width: 1.75rem;
}

.points-0 { background-color: var(--danger); }

.points-1 {
  background-color: #ffc107;
  color: #212529;
}

.points-2 { background-color: var(--accent); }

.site-footer { margin-top: 3rem; padding: 1.5rem 0; border-top: 1px solid var(--line); background: #fff; color: var(--muted); }
.footer-brand { margin-bottom: 1rem; color: var(--ink); font-size: 0.9rem; font-weight: 650; }
.footer-groups { display: flex; flex-wrap: wrap; gap: 1.25rem 3rem; }
.footer-heading { margin-bottom: 0.5rem; color: var(--ink); font-size: inherit; font-weight: 650; }
.footer-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.25rem; line-height: 1.7; }
.footer-links > * { max-width: 100%; }
.footer-button { padding: 0; border: 0; color: var(--accent-dark); background: transparent; font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 0.15em; }
.footer-legal .footer-heading, .footer-legal a, .footer-legal .footer-button { color: var(--muted); }

.cookie-banner { position: fixed; right: 1rem; bottom: 1rem; z-index: 1050; width: min(35rem, calc(100vw - 2rem)); padding: 1rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--surface); box-shadow: 0 1rem 3rem rgba(19, 38, 61, 0.18); }
.cookie-banner-content { display: grid; gap: 1rem; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.cookie-settings { position: fixed; inset: 0; z-index: 1060; display: grid; place-items: center; padding: 1rem; background: rgba(19, 38, 61, 0.48); }
.cookie-settings-card { width: min(32rem, 100%); padding: 1.5rem; border-radius: 0.7rem; background: var(--surface); box-shadow: 0 1rem 3rem rgba(19, 38, 61, 0.3); }

@media (max-width: 767.98px) {
  html { font-size: 14px; }
  .site-nav { margin-bottom: 1.25rem !important; }
  .site-content { padding-right: 0.85rem; padding-left: 0.85rem; }
  .table-responsive { margin-right: -0.25rem; margin-left: -0.25rem; padding-right: 0.25rem; padding-left: 0.25rem; border: 1px solid var(--line); border-radius: 0.45rem; background: #fff; }
  .pagination { margin-top: 1rem; }
  .bond-metric { min-height: 3.7rem; padding: 0.45rem 0.5rem; font-size: 0.95rem; }
  .bond-price-chart svg { height: 8rem; }
  .footer-groups { flex-direction: column; }
  .cookie-banner { right: 0.75rem; bottom: 0.75rem; width: calc(100vw - 1.5rem); }
}
