:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --bg-body: #f8fafc;
  --surface: #ffffff;
  --text-main: #111827;
  --text-secondary: #64748b;
  --border: #e2e8f0;
}

body {
  background: var(--bg-body);
  color: var(--text-main);
  /* Основной шрифт — Inter (чистый гротеск) */
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  margin: 0;
  padding: 0;
}

.page-wrapper {
  max-width: 1025px;
  margin: 32px auto;
  padding: 0 16px;
}

.title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 24px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.search-container {
    position: relative;
    margin-bottom: 36px;
}

.form-group {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.label {
  flex: 0 0 auto;
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding-top: 6px;
  letter-spacing: 0.025em;
}

.input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.button {
  padding: 11px 20px;
  border: none;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.button:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.button:active:not(:disabled) {
  transform: scale(0.98);
}

.button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.calc-btn.pulse-on-hover:hover:not(:disabled) {
  animation: pulse-primary 1.2s infinite;
}

@keyframes pulse-primary {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(37, 99, 235, 0); }
  100% { box-shadow: none; }
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.05);
  z-index: 1000;
  margin-top: 8px;
}

.autocomplete-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.autocomplete-item {
  padding: 10px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}

.autocomplete-item:hover {
  background: #f1f5f9;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-dropdown.hidden {
  display: none;
}

.autocomplete-item.active {
    background-color: #f1f5f9;
    cursor: pointer;
}

.bank-card-block {
  margin-top: 0;
  padding: 20px 0;
  border-top: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.card-header h3 {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

.status-tag {
  padding: 6px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.75rem;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.status-tag.SZKO {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #17365d, #254f78);
    border: 1px solid #c9a85c;
    color: #f4df9b;
    line-height: 1.4;
    white-space: nowrap;
}

.status-tag.OTZ { background: #d9534f; }
.status-tag.LIK { background: #d9534f; }
.status-tag.ANN { background: #d9534f; }
/* .status-tag.ANN { background: #5bc0de; }
.status-tag.LIK { background: #f0ad4e; } */



/* Класс для «технических» полей (ОГРН, Рег. №, даты) — моноширинный шрифт для точности */
.data-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.calc-form {
  display: flex;
  justify-content: flex-end; /* прижимает кнопку вправо */
  align-items: center;       /* центрирует по вертикали */
  margin-top: 0;
}

.alert-error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 12px;
  border-radius: 8px;
  border-left: 4px solid #dc2626;
  margin: 20px 0;
}

.card-row {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 24px;
}

.card-logo {
  flex: 0 0 80px; /* фиксированная ширина под логотипы */
  display: flex;
  align-items: center;
  justify-content: center;
}

.bank-logo-img {
  max-width: 100%;
  height: 164px;
  max-height: 64px; /* ограничиваем высоту логотипа */
  object-fit: contain;
  display: block;
}

.bank-logo-placeholder {
  width: 64px;
  height: 64px;
  background: #e5e7eb;
  color: #6b7280;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
}

.card-info {
  flex: 1;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.info-label {
  font-size: 0.925rem;
  color: var(--text-secondary);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.info-value {
  font-size: 0.975rem;
  color: var(--text-main);
  text-align: right; /* чтобы значения были правее */
  min-width: 140px;  /* чтобы колонки не «прыгали» */
}

/* Моноширинный шрифт только для идентификаторов и дат */
.data-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.card-logo {
  position: relative;
  flex: 0 0 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bank-logo-color {
  max-width: 100%;
  height: auto;
  max-height: 64px;
  object-fit: contain;
  display: block;
  z-index: 3;
  transition: filter 0.3s ease;
}

.bank-logo-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-color: #e5e7eb;
  opacity: 0;
  z-index: 1;
  pointer-events: none;
}

.progress-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%; /* Начинаем с 0, JS поднимет до 100 */
  background: var(--primary, #3b82f6); /* Цвет полоски */
  z-index: 2;
  will-change: height;
}


/* =========================================================
   RATING SIGNAL
   ========================================================= */

.rating-signal {
    position: relative;

    display: inline-block;

    width: 12px;
    height: 12px;

    margin-left: 7px;

    border-radius: 50%;

    vertical-align: middle;

    flex-shrink: 0;

    cursor: help;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease;
}


/* ---------------------------------------------------------
   Signal colors
   --------------------------------------------------------- */

.rating-signal-rating_up {
    background-color: #22c55e;
}

.rating-signal-rating_down {
    background-color: #ef4444;
}

.rating-signal-forecast_changed {
    background-color: #facc15;
}

.rating-signal-rating_confirmed {
    background-color: #8be9fd;
}

.rating-signal-rating_new {
    background-color: #94a3b8;
}


/* ---------------------------------------------------------
   Signal hover
   --------------------------------------------------------- */

.rating-signal:hover {
    transform: scale(1.2);

    box-shadow:
        0 0 0 4px rgba(139, 233, 253, 0.18);
}

/* =========================================================
   DATE CELL TOOLTIP
   ========================================================= */

.date-cell {
    position: relative;

    cursor: pointer;
}


/* ---------------------------------------------------------
   Tooltip
   --------------------------------------------------------- */

.date-tooltip {
    display: block;
    position: absolute;

    left: 50%;
    bottom: calc(100% + 10px);

    transform: translateX(-50%);

    width: max-content;
    max-width: 260px;

    padding: 9px 12px;

    box-sizing: border-box;

    background: #1e293b;
    color: #ffffff;

    border-radius: 8px;

    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.18);

    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;

    white-space: nowrap;

    text-align: center;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.15s ease,
        visibility 0.15s ease;

    z-index: 100;

}


/* ---------------------------------------------------------
   Show tooltip
   --------------------------------------------------------- */

.date-cell:hover .date-tooltip {
    opacity: 1;
    visibility: visible;
}


/* ---------------------------------------------------------
   Tooltip arrow
   --------------------------------------------------------- */

.date-tooltip::after {
    content: "";

    position: absolute;

    left: 50%;
    top: 100%;

    transform: translateX(-50%);

    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1e293b;
}

/* =========================================================
   RATING TOOLTIP
   ========================================================= */

.rating-tooltip {
    position: absolute;

    left: 50%;
    bottom: calc(100% + 10px);

    transform: translateX(-50%);

    width: 260px;
    max-width: 260px;

    padding: 12px 14px;

    box-sizing: border-box;

    background: #1e293b;
    color: #ffffff;

    border-radius: 8px;

    box-shadow:
        0 8px 24px rgba(15, 23, 42, 0.18);

    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;

    text-align: left;

    white-space: normal;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transition:
        opacity 0.15s ease,
        visibility 0.15s ease;

    z-index: 100;
}


/* ---------------------------------------------------------
   Tooltip visibility
   --------------------------------------------------------- */

.rating-signal:hover .rating-tooltip {
    opacity: 1;
    visibility: visible;
}


/* ---------------------------------------------------------
   Tooltip arrow
   --------------------------------------------------------- */

.rating-tooltip::after {
    content: "";

    position: absolute;

    left: 50%;
    top: 100%;

    transform: translateX(-50%);

    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #1e293b;
}


/* ---------------------------------------------------------
   Tooltip title
   --------------------------------------------------------- */

.rating-tooltip strong {
    display: block;

    margin-bottom: 7px;

    font-size: 11px;
    font-weight: 700;

    letter-spacing: 0.04em;

    text-transform: uppercase;
}


/* ---------------------------------------------------------
   Tooltip change
   --------------------------------------------------------- */

.rating-tooltip-change {
    display: block;

    font-size: 13px;
    font-weight: 600;

    line-height: 1.45;
}


/* ---------------------------------------------------------
   Arrow between old / new value
   --------------------------------------------------------- */

.rating-tooltip-arrow {
    display: inline-block;

    margin: 0 5px;

    opacity: 0.7;
}



/* ---------------------------------------------------------
   Tooltip date
   --------------------------------------------------------- */

.rating-tooltip-date {
    display: block;

    margin-top: 8px;

    font-size: 10px;

    color: #94a3b8;
}

/* =========================================================
   Адаптация карточки банка
   При недостатке ширины рейтинги переходят вниз
   ========================================================= */

@media (max-width: 1200px) {

    .card-main-area {
        flex-direction: column;
        width: 100%;
    }

    .card-info {
        width: 100%;
        flex: none;
    }

    .card-ratings {
        width: 100%;
        flex: none;

        margin-left: 0;
        margin-top: 24px;

        padding-left: 0;
        padding-top: 20px;

        border-left: none;
        border-top: 1px solid #e5eaf7;
    }
}
/* =========================================================
   MARS ANALYTICS — заголовок и поиск
   Вариант без отдельной белой карточки
   ========================================================= */

.analysis-heading {
    position: relative;
    padding-left: 16px;
    margin-bottom: 24px;
}

.analysis-heading::before {
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, #2563eb, #93b8f8);
}

.analysis-eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: #4775b8;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
}

.analysis-eyebrow-dot {
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.analysis-heading .title {
    margin: 0 0 9px;
    font-size: clamp(1.3rem, 1.8vw, 1.65rem);
    line-height: 1.35;
    font-weight: 700;
    letter-spacing: -0.035em;
    color: #172b45;
}

.analysis-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Поиск остаётся на общем фоне страницы */

.search-container {
    position: relative;
    margin-bottom: 36px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.search-container .form-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.search-container .label {
    padding-top: 0;
    white-space: nowrap;
}

.search-container .input {
    min-width: 0;
    height: 44px;
    box-sizing: border-box;
}

.search-container .button {
    min-width: 100px;
    height: 44px;
    box-sizing: border-box;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.14);
}

.search-container .button:hover:not(:disabled) {
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.20);
}

@media (max-width: 640px) {
    .analysis-heading {
        padding-left: 13px;
    }

    .analysis-heading .title {
        font-size: 1.25rem;
    }

    .search-container .form-group {
        flex-wrap: wrap;
    }

    .search-container .label {
        width: 100%;
    }

    .search-container .input {
        flex: 1 1 180px;
    }

    .search-container .button {
        flex: 0 0 auto;
    }
}
