/*
 * Кабинет клиента: элементы страниц кабинета (реквизиты, шаги заказа,
 * группы корзины, проверки товара, фото) — в общей дизайн-системе
 * (rk-ui.css подключается раньше этого файла).
 */

.rk-cabinet .badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600; line-height: 1.3; padding: 4px 9px;
    border-radius: 7px; background: var(--rk-gray-soft); color: var(--rk-gray-text);
    white-space: nowrap;
}
.rk-cabinet .badge.ok { background: var(--rk-green-soft); color: var(--rk-green-text); }
.rk-cabinet .badge.warn { background: var(--rk-orange-soft); color: var(--rk-orange-text); }
.rk-cabinet .badge.accent { background: var(--rk-red-soft); color: #c4182e; }
.rk-cabinet .badge.info { background: var(--rk-blue-soft); color: var(--rk-blue-text); }

.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
/* Сумма справа не разрывается на строки — переносится подпись слева */
.row-between > b:last-child, .row-between > strong:last-child { white-space: nowrap; flex: none; text-align: right; }

.req-row {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: var(--rk-surface-2); border: 1px solid var(--rk-border);
    border-radius: var(--rk-r); margin-bottom: 6px;
}
.req-row .req-text { flex: 1; min-width: 0; }
.req-row .req-label { font-size: 12px; color: var(--rk-muted); }
.req-row .req-value { font-weight: 600; word-break: break-all; }
.copy-btn {
    flex: none; padding: 7px 12px; font-size: 13px; border-radius: 8px; margin: 0;
    background: #fff; color: var(--rk-text); border: 1px solid var(--rk-border-strong); box-shadow: none;
}
.copy-btn:hover { background: var(--rk-surface-2); color: var(--rk-text); }
.copy-btn.copied, .copy-btn.copied:hover { background: var(--rk-green-soft); color: var(--rk-green-text); border-color: #c9ead7; }
.req-photo { max-width: 260px; width: 100%; border-radius: 12px; border: 1px solid var(--rk-border); display: block; margin-top: 8px; }

.terms-box {
    background: var(--rk-orange-soft); border: 1px solid #f6dcc0; border-radius: 12px; padding: 14px; margin: 14px 0;
    font-size: 14px; white-space: pre-line;
}
.terms-box b { display: block; margin-bottom: 6px; }
.check-line { display: flex; gap: 10px; align-items: flex-start; font-weight: 600; margin-top: 10px; cursor: pointer; color: var(--rk-text); font-size: var(--rk-fs-md); }
.check-line input { width: 20px; height: 20px; flex: none; margin: 1px 0 0; }

.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 14px; color: var(--rk-muted); position: relative; }
.steps li .dot {
    width: 24px; height: 24px; border-radius: 50%; flex: none; display: flex; align-items: center;
    justify-content: center; font-size: 12px; font-weight: 700; background: var(--rk-surface-3); color: var(--rk-muted);
}
.steps li.done { color: var(--rk-text); }
.steps li.done .dot { background: var(--rk-green); color: #fff; }
.steps li.current { color: var(--rk-text); font-weight: 700; }
.steps li.current .dot { background: var(--rk-red); color: #fff; box-shadow: 0 0 0 4px var(--rk-red-soft); }

.next-action {
    display: flex; align-items: flex-start; gap: 8px;
    background: var(--rk-red-soft); color: #b8172b; border: 1px solid var(--rk-red-line);
    border-radius: var(--rk-r); padding: 10px 12px; font-weight: 600; margin-top: 8px; font-size: var(--rk-fs-md);
}
.next-action > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.next-action > span { min-width: 0; }
.group-head { border-left: 4px solid var(--rk-red); padding-left: 12px; margin-bottom: 10px; }
.group-head.new { border-left-color: var(--rk-nav-bg); }
.item-line { display: flex; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--rk-border); }
.item-line:last-child { border-bottom: none; }
.item-line img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; flex: none; background: var(--rk-surface-3); border: 1px solid var(--rk-border); }
.btn-link { display: inline-block; }
.btn-link button { width: 100%; }
.balance-hint { border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; font-size: 14px; }
.balance-hint.ok { background: var(--rk-green-soft); border: 1px solid #c9ead7; }
.balance-hint.warn { background: var(--rk-orange-soft); border: 1px solid #f6dcc0; }
.fl-item { padding: 12px 0; border-bottom: 1px solid var(--rk-border); }
.fl-item:last-child { border-bottom: none; }
.fl-state { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 7px; background: var(--rk-gray-soft); color: var(--rk-gray-text); margin-top: 4px; }
.fl-state.done { background: var(--rk-green-soft); color: var(--rk-green-text); }
.fl-state.attention { background: var(--rk-red-soft); color: #c4182e; }
.chat-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-bottom: 6px; }
.chat-files img, .chat-files video { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; display: block; background: #000; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.media-grid a, .media-grid video { display: block; width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; overflow: hidden; background: #000; }
.media-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-grid video { object-fit: cover; }
.inspection-box { background: var(--rk-surface-2); border: 1px solid var(--rk-border); border-radius: 12px; padding: 12px; margin-top: 10px; }
.summary-headline { font-size: 18px; font-weight: 800; margin: 0 0 6px; }
.summary-list { margin: 0; padding-left: 18px; color: var(--rk-muted); font-size: 14px; }

/* Карточки заказов в старой разметке страниц (списки, уведомления) */
.order-card { border-radius: var(--rk-r-lg); }

@media (max-width: 640px) {
    .card { padding: 16px; }
}

/* ============================================================ переписка (поддержка и чаты заказов) */
.rk-chat-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: var(--rk-gap); align-items: start; }
.rk-dialogs { margin: 0; overflow: hidden; position: sticky; top: calc(var(--rk-topbar-h) + 16px); max-height: calc(100vh - var(--rk-topbar-h) - 40px); display: flex; flex-direction: column; }
.rk-dialogs-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--rk-border); }
.rk-dialogs-list { overflow-y: auto; padding: 6px; }
.rk-dialogs-sep { padding: 12px 12px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--rk-faint); }
.rk-dialog { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--rk-r); color: var(--rk-text); text-decoration: none; }
.rk-dialog:hover { background: var(--rk-surface-2); text-decoration: none; }
.rk-dialog.is-active { background: var(--rk-red-soft); }
.rk-dialog-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rk-dialog-top { display: flex; justify-content: space-between; gap: 8px; }
.rk-dialog-top b { font-size: var(--rk-fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-dialog-top time { color: var(--rk-faint); font-size: 11.5px; white-space: nowrap; flex: none; }
.rk-dialog-text { color: var(--rk-muted); font-size: var(--rk-fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rk-chat { margin: 0; padding: 0; display: flex; flex-direction: column; min-height: min(640px, calc(100vh - var(--rk-topbar-h) - 120px)); }
.rk-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rk-border); }
.rk-chat-head h1 { font-size: var(--rk-fs-xl); margin: 0; }
.rk-chat-log { flex: 1; overflow-y: auto; padding: 18px 20px; background: var(--rk-surface-2); max-height: calc(100vh - var(--rk-topbar-h) - 320px); min-height: 260px; }
.rk-chat-foot { padding: 14px 20px 18px; border-top: 1px solid var(--rk-border); background: #fff; border-radius: 0 0 var(--rk-r-lg) var(--rk-r-lg); }
.rk-chat-foot textarea { min-height: 64px; }
.rk-chat-tools { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.rk-chat-tools input[type=file] { flex: 1 1 200px; min-width: 0; }
.rk-chat .error { margin: 12px 20px 0; }
.rk-chat-empty { color: var(--rk-muted); font-size: var(--rk-fs-md); text-align: center; padding: 28px 10px; }

.rk-msg { display: flex; margin-bottom: 10px; }
.rk-msg.is-mine { justify-content: flex-end; }
.rk-msg-bubble { max-width: min(78%, 560px); padding: 10px 13px; border-radius: 14px; background: #fff; border: 1px solid var(--rk-border); box-shadow: var(--rk-shadow-xs); font-size: var(--rk-fs-md); line-height: 1.45; overflow-wrap: anywhere; }
.rk-msg:not(.is-mine) .rk-msg-bubble { border-bottom-left-radius: 4px; }
.rk-msg.is-mine .rk-msg-bubble { background: var(--rk-nav-bg); color: #fff; border-color: var(--rk-nav-bg); border-bottom-right-radius: 4px; }
.rk-msg.is-mine .rk-msg-bubble a { color: #fff; text-decoration: underline; }
.rk-msg-meta { font-size: 11px; color: var(--rk-muted); margin-top: 4px; }
.rk-msg.is-mine .rk-msg-meta { color: rgba(255, 255, 255, 0.65); }
.rk-msg-bubble img { max-width: 100%; border-radius: 10px; display: block; }
.rk-msg-bubble video { max-width: 100%; border-radius: 10px; }

@media (max-width: 1023px) {
    .rk-chat-layout { grid-template-columns: minmax(0, 1fr); }
    .rk-dialogs { position: static; max-height: none; order: 2; }
    .rk-dialogs-list { max-height: 260px; }
}
@media (max-width: 767px) {
    .rk-chat-head, .rk-chat-log, .rk-chat-foot { padding-left: 14px; padding-right: 14px; }
    .rk-chat-log { max-height: 60vh; }
    .rk-msg-bubble { max-width: 88%; }
}

/* Рейтинг товара по 5-балльной шкале (30.10.2026): звёзды с дробной заливкой + число «из 5». */
.rk-rating { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; line-height: 1.2; color: var(--rk-muted, #6b7280); white-space: nowrap; }
.rk-rating b { color: var(--rk-text, #1c1d1f); font-weight: 700; }
.rk-stars { position: relative; display: inline-block; color: #d9dce1; font-size: 13px; letter-spacing: 1px; line-height: 1; }
.rk-stars-on { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: #f59e0b; }
.rk-rating.is-big { gap: 7px; font-size: 13.5px; }
.rk-rating.is-big .rk-stars { font-size: 18px; }
.rk-rating.is-big b { font-size: 17px; }
a.rk-rating-link { color: inherit; text-decoration: none; display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
a.rk-rating-link:hover { text-decoration: none; }
a.rk-rating-link:hover b { color: var(--accent); }
