/**
 * Hotchkis CRM Connector — стили личного кабинета (My Account → Бонусы / Подарочные карты).
 * Карточка лояльности повторяет визуал CRM-платформы (бежевый паспорт-стиль).
 */

/* ---------- LOYALTY CARD (как в CRM) ---------- */
.hotchkis-loyalty-card {
    --hl-bg: #efe6d2;
    --hl-bg-darker: #e8ddc4;
    --hl-text: #1f1d18;
    --hl-muted: #8b8470;
    --hl-accent: #c79a3a;
    background: var(--hl-bg);
    color: var(--hl-text);
    border-radius: 16px;
    padding: 20px 24px 18px;
    margin: 0 0 24px;
    font-family: inherit;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .03);
}
.hotchkis-loyalty-card__head {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}
.hotchkis-loyalty-card__chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--hl-muted);
}
.hotchkis-loyalty-card__chip-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hl-accent);
}

.hotchkis-loyalty-card__name {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 2px;
    color: var(--hl-text);
}
.hotchkis-loyalty-card__sub {
    font-size: 13px;
    color: var(--hl-muted);
    margin-bottom: 18px;
}

.hotchkis-loyalty-card__metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}
/* Если есть «Сгорят» — переключаемся на 5 колонок. */
.hotchkis-loyalty-card__metrics.has-expiring {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}
.hotchkis-loyalty-card__metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.hotchkis-loyalty-card__label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--hl-muted);
}
.hotchkis-loyalty-card__value {
    font-size: 22px;
    font-weight: 700;
    color: var(--hl-text);
    line-height: 1.1;
    word-break: break-word;
}
.hotchkis-loyalty-card__sublabel {
    margin-top: 2px;
    font-size: 11px;
    font-weight: 500;
    color: var(--hl-muted);
    font-variant-numeric: tabular-nums;
}
/* «Сгорят» — акцент на ближайшее сгорание. */
.hotchkis-loyalty-card__metric--expiring .hotchkis-loyalty-card__value {
    color: #b45309;
}
.hotchkis-loyalty-card__metric--expiring .hotchkis-loyalty-card__label {
    color: #b45309;
}

.hotchkis-loyalty-card__phone-wrap {
    margin-bottom: 16px;
}
.hotchkis-loyalty-card__phone {
    margin-top: 4px;
    background: var(--hl-bg-darker);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    font-size: 16px;
    color: var(--hl-text);
}
.hotchkis-loyalty-card__phone-text {
    letter-spacing: 0.04em;
}
.hotchkis-loyalty-card__phone-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--hl-muted);
    opacity: .55;
}
.hotchkis-loyalty-card__phone-lock svg { display: block; }

.hotchkis-loyalty-card__footer {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid rgba(0, 0, 0, .06);
    padding-top: 12px;
}
.hotchkis-loyalty-card__more {
    font-size: 12px;
    color: var(--hl-muted);
}
.hotchkis-loyalty-card__id {
    text-align: right;
}
.hotchkis-loyalty-card__id-label {
    display: block;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--hl-muted);
    margin-bottom: 2px;
}
.hotchkis-loyalty-card__id-value {
    font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace;
    font-size: 16px;
    font-weight: 700;
    color: var(--hl-text);
    letter-spacing: 0.06em;
}

@media (max-width: 880px) {
    .hotchkis-loyalty-card__metrics.has-expiring { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .hotchkis-loyalty-card__metrics,
    .hotchkis-loyalty-card__metrics.has-expiring { grid-template-columns: repeat(2, 1fr); }
    .hotchkis-loyalty-card__name    { font-size: 22px; }
    .hotchkis-loyalty-card__value   { font-size: 20px; }
}

/* ---------- HISTORY (компактная лента) ---------- */
.hotchkis-loyalty-history {
    margin: 24px 0 8px;
}
.hotchkis-loyalty-history__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.hotchkis-loyalty-history__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #111;
}
.hotchkis-loyalty-history__count {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: #6b7280;
}
.hotchkis-loyalty-history__empty {
    margin: 8px 0 0;
    color: #6b7280;
    font-size: 13px;
}
.hotchkis-loyalty-history__list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid #ececec;
}
/* Превью: показываем только первые 10 операций до клика «Показать ещё». */
.hotchkis-loyalty-history__list.is-collapsed .hotchkis-loyalty-history__row:nth-child(n+11) {
    display: none;
}
.hotchkis-loyalty-history__row {
    display: grid;
    grid-template-columns: 130px 1fr 110px 90px;
    gap: 12px;
    align-items: center;
    padding: 10px 4px;
    border-bottom: 1px solid #f1f1f1;
}
.hotchkis-loyalty-history__cell { min-width: 0; }
.hotchkis-loyalty-history__cell--date {
    font-size: 12px;
    color: #6b7280;
    font-variant-numeric: tabular-nums;
}
.hotchkis-loyalty-history__type {
    font-size: 13px;
    font-weight: 600;
    color: #111;
}
.hotchkis-loyalty-history__order {
    margin-left: 6px;
    font-size: 11px;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
}
.hotchkis-loyalty-history__status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #f3f4f6;
    color: #6b7280;
}
.hotchkis-loyalty-history__status--available { background: #ecfdf5; color: #047857; }
.hotchkis-loyalty-history__status--pending   { background: #fef3c7; color: #92400e; }
.hotchkis-loyalty-history__status--reserved  { background: #eef2ff; color: #4338ca; }
.hotchkis-loyalty-history__status--expired,
.hotchkis-loyalty-history__status--cancelled { background: #fef2f2; color: #b91c1c; }
.hotchkis-loyalty-history__points {
    display: block;
    text-align: right;
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.hotchkis-loyalty-history__row.is-positive .hotchkis-loyalty-history__points { color: #047857; }
.hotchkis-loyalty-history__row.is-negative .hotchkis-loyalty-history__points { color: #b91c1c; }
.hotchkis-loyalty-history__row.is-neutral  .hotchkis-loyalty-history__points { color: #6b7280; }

@media (max-width: 640px) {
    .hotchkis-loyalty-history__row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        row-gap: 4px;
    }
    .hotchkis-loyalty-history__cell--date {
        grid-column: 1 / 2;
    }
    .hotchkis-loyalty-history__cell--points {
        grid-row: 1 / 3;
        grid-column: 2 / 3;
        align-self: center;
    }
    .hotchkis-loyalty-history__cell--type,
    .hotchkis-loyalty-history__cell--status {
        grid-column: 1 / 2;
    }
}

/* Кнопка «Показать ещё» — компактная серая, без рамки. */
.hotchkis-loyalty-history__more {
    display: block;
    width: 100%;
    margin: 8px 0 0;
    padding: 10px 14px;
    background: transparent;
    color: #6b7280;
    border: 0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color .12s, color .12s;
}
.hotchkis-loyalty-history__more:hover,
.hotchkis-loyalty-history__more:focus {
    background: #f3f4f6;
    color: #111;
    outline: none;
}

.hotchkis-loyalty-readonly {
    margin: 12px 0 0;
    color: #9ca3af;
    font-size: 11px;
    font-style: italic;
}

/* ---------- GIFT CARDS (старые селекторы остаются, но обновим стиль) ---------- */
.hotchkis-crm-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin: 16px 0 24px;
}
.hotchkis-crm-summary__cell {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
}
.hotchkis-crm-summary__label {
    display: block;
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.hotchkis-crm-summary__value {
    display: block;
    margin-top: 4px;
    font-size: 22px;
    font-weight: 600;
    color: #0f172a;
}
.hotchkis-crm-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
}
.hotchkis-crm-table th,
.hotchkis-crm-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    font-size: 14px;
}
.hotchkis-crm-table th {
    background: #f1f5f9;
    font-weight: 600;
}
.hotchkis-crm-empty,
.hotchkis-crm-readonly-note,
.hotchkis-crm-unlinked {
    color: #64748b;
    font-style: italic;
    margin-top: 16px;
}
