/* Информационный текст под вопросом */
.question-info {
    margin-bottom: 10px;
}

/* ===== BASE TITLES / TEXT ===== */

.rlv-h1 {
    margin: 0 0 12px;
    font-size: 1.6rem;
    font-weight: 600;
}

.rlv-sub {
    font-size: 0.95rem;
    color: var(--rlv-text-soft);
}

/* в тёмной теме делаем мягкий, но читаемый серый */
:root[data-theme="dark"] .rlv-sub {
    color: rgba(255, 255, 255, 0.78);
}

/* ===== PROFILE PAGE ===== */

.rlv-profile-page {
    max-width: 980px;
    margin: 0 auto;
}

.rlv-profile-card {
    margin-top: 8px;
}

.rlv-profile-layout {
    display: grid;
    grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
    gap: 20px;
    align-items: flex-start;
}

@media (max-width: 768px) {
    .rlv-profile-layout {
        grid-template-columns: 1fr;
    }
}

.rlv-profile-avatar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.rlv-profile-avatar-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.16);
}

.rlv-profile-avatar-img--edit {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.rlv-profile-avatar-img--edit:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 0 10px rgba(15, 23, 42, 0.25);
}

.rlv-profile-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rlv-form-two-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px 18px;
}

.rlv-form-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rlv-form-field label,
.rlv-form-field .rz-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--rlv-text-soft);
}

.rlv-profile-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.rlv-profile-meta b {
    font-weight: 500;
}

/* читаемость текста в профиле */
.rlv-profile-line {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
}

.rlv-profile-meta .rz-text,
.rlv-profile-meta .rlv-profile-line {
    color: var(--rlv-text-main, #111827);
}

:root[data-theme="dark"] .rlv-profile-meta .rz-text,
:root[data-theme="dark"] .rlv-profile-meta .rlv-profile-line {
    color: rgba(255, 255, 255, 0.92);
}

.rlv-profile-name {
    text-align: center;
}

.rlv-profile-email {
    font-size: 0.95rem;
    color: var(--rlv-text-soft);
}

:root[data-theme="dark"] .rlv-profile-email {
    color: rgba(255, 255, 255, 0.8);
}

.rlv-profile-hint {
    font-size: 0.85rem;
    color: var(--rlv-text-soft);
}

:root[data-theme="dark"] .rlv-profile-hint {
    color: rgba(255, 255, 255, 0.8);
}

/* блок пригласительной ссылки в профиле */

.rlv-invite-block {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.rlv-invite-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.rlv-invite-input .rz-inputtext {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rlv-invite-hint {
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .rlv-invite-row {
        flex-direction: row;
    }
}

/* ===== AUTO-EXPANDING TEXTAREAS (протоколы + в целом) ===== */

textarea.auto-expanding {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    overflow: hidden;
}

.auto-expanding {
    width: 100%;
    min-height: 150px;
    resize: vertical;
    overflow: hidden;
}

.wrap-pre {
    white-space: pre-wrap;
    word-break: break-word;
}

/* ===== TOP-SCROLL ДЛЯ ТАБЛИЦ ПРОТОКОЛОВ ===== */

.grid-top-scroll {
    height: 14px;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 1px solid var(--rz-base-200, #e5e7eb);
    margin-bottom: 6px;
}

.grid-top-scroll::-webkit-scrollbar {
    height: 12px;
}

.grid-top-scroll .spacer {
    height: 1px;
}

/* ===== ПРОТОКОЛ: КНОПКА ЛОСОСЕВАЯ ===== */

.salmon-btn {
    background-color: #FA8072 !important;
    border-color: #FA8072 !important;
    color: #fff !important;
}

/* ===== MATERIALS TILES ===== */

.materials-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* читаемость подписей в карточках материалов в тёмной теме */

:root[data-theme="dark"] .rlv-card .rlv-sub,
:root[data-theme="dark"] .rlv-card-glass .rlv-sub {
    color: rgba(255, 255, 255, 0.78);
}

/* немного поднимаем контраст всего текста в карточках в тёмной теме */

:root[data-theme="dark"] .rlv-card .rz-text,
:root[data-theme="dark"] .rlv-card .rz-label,
:root[data-theme="dark"] .rlv-card-glass .rz-text,
:root[data-theme="dark"] .rlv-card-glass .rz-label {
    color: rgba(255, 255, 255, 0.95);
}

/* ===== FORM FIELDS COMMON WIDTH ===== */

.rlv-form-field .rz-textbox,
.rlv-form-field .rz-password,
.rlv-form-field .rz-textarea,
.rlv-form-field .rz-numeric,
.rlv-form-field .rz-dropdown,
.rlv-form-field .rz-datepicker {
    width: 100%;
}

/* ===== CLIENTS: TILES ON /clients ===== */

.client-tile {
    display: flex;
    flex-direction: column;
}

.client-tile-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.client-tile-icon {
    font-size: 32px;
    color: var(--rlv-primary);
}

.client-tile-sub {
    display: block;
    margin-top: 4px;
}

/* читаемость текста в плитках в тёмной теме */
:root[data-theme="dark"] .client-tile .rlv-sub,
:root[data-theme="dark"] .client-tile .rz-text {
    color: rgba(255, 255, 255, 0.96) !important;
}

/* ===== CLIENT LIST (ACTIVE + ARCHIVED) ===== */

.client-list {
    margin-top: 12px;
}

/* только здесь убираем отступы у li */
.client-list .rz-datalist-data > li {
    padding: 0;
}

.client-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden; /* не даём тексту вылезать наружу */
}

.client-card-body {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap; /* на мобилках не вылезает */
}

.client-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.18);
}

.client-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* чтобы wrap работал корректно */
}

.client-name {
    font-weight: 600;
    color: var(--rlv-text-main, #111827);
    word-break: break-word;
    overflow-wrap: anywhere;
}

:root[data-theme="dark"] .client-name {
    color: rgba(255, 255, 255, 0.96);
}

.client-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.9rem;
    max-width: 100%;
}

.client-meta-label {
    font-weight: 500;
    color: var(--rlv-text-soft);
}

.client-meta-value {
    color: var(--rlv-text-main, #111827);
    word-break: break-word;
    overflow-wrap: anywhere;
}

:root[data-theme="dark"] .client-meta-value {
    color: rgba(255, 255, 255, 0.9);
}

.client-card-footer {
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
}

/* заголовок и кнопка "Добавить клиента" сверху списка */

.client-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

@media (max-width: 768px) {
    .client-card-body {
        align-items: flex-start;
    }

    .client-list-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ===== CLIENT CREATE PAGE ===== */

.client-create-card {
    max-width: 720px;
    margin: 0 auto;
}

.client-create-title {
    margin-bottom: 4px;
}

.client-create-hint {
    margin-bottom: 12px;
}

.form-error {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #b91c1c;
}

:root[data-theme="dark"] .form-error {
    color: #fecaca;
}

/* ===== CLIENT DETAIL PAGE ===== */

.client-detail-card {
    max-width: 980px;
    margin: 0 auto;
}

.client-detail-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 12px;
}

.client-avatar-lg {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.22);
}

.client-detail-main {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.client-detail-name {
    font-weight: 600;
}

.client-detail-email {
    font-size: 0.95rem;
}

.client-status-row {
    margin-top: 4px;
}

.client-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 500;
}

.client-status--active {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.client-status--other {
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
}

:root[data-theme="dark"] .client-status--active {
    background: rgba(22, 163, 74, 0.25);
    color: #bbf7d0;
}

:root[data-theme="dark"] .client-status--other {
    background: rgba(59, 130, 246, 0.25);
    color: #bfdbfe;
}

.client-edit-btn {
    align-self: flex-start;
    margin-top: 8px;
}

.client-detail-body {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 20px;
    margin-top: 16px;
}

.client-detail-column {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.client-section-title {
    font-weight: 600;
    font-size: 0.95rem;
}

.client-detail-text {
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: break-word;
    font-size: 0.95rem;
}

.client-meta-block {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

.client-archive-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

/* кнопки действий внизу карточки клиента */

.client-actions-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
}

.client-actions-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.client-button {
    border-radius: 10px !important;
    padding: 8px 16px !important;
    white-space: nowrap;
}

.client-button-primary {
    background-color: var(--rlv-primary) !important;
    border-color: var(--rlv-primary) !important;
    color: #fff !important;
}

.client-button-primary:hover {
    filter: brightness(0.95);
}

.client-button-secondary {
    background-color: var(--rlv-surface-2, #e5e7eb) !important;
    border-color: var(--rlv-surface-2, #e5e7eb) !important;
    color: var(--rlv-text-main, #111827) !important;
}

:root[data-theme="dark"] .client-button-secondary {
    background-color: rgba(148, 163, 184, 0.3) !important;
    border-color: rgba(148, 163, 184, 0.3) !important;
    color: rgba(255, 255, 255, 0.92) !important;
}

@media (max-width: 768px) {
    .client-detail-header {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .client-detail-main {
        align-items: center;
    }

    .client-detail-body {
        grid-template-columns: 1fr;
    }

    .client-actions-row {
        flex-direction: column;
        align-items: stretch;
    }

    .client-actions-group {
        justify-content: center;
    }

    .client-actions-group .client-button {
        width: 100%;
        justify-content: center;
    }
}

/* edit mode: небольшие подсказки */

.client-edit-card {
    max-width: 780px;
    margin: 0 auto;
}

.client-edit-avatar-wrap {
    margin-bottom: 10px;
}

.client-edit-avatar-hint {
    text-align: center;
    font-size: 0.85rem;
}

/* switch row */

.client-switch-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Имя в профиле (rlv-profile-name) */
:root[data-theme="dark"] .rlv-profile-name {
    color: rgba(255, 255, 255, 0.96);
}

/* Имя в карточке клиента */
:root[data-theme="dark"] .client-detail-name {
    color: rgba(255, 255, 255, 0.96);
}

/* Заголовки секций "О клиенте", "Данные", "О себе" */
:root[data-theme="dark"] .client-section-title {
    color: rgba(255, 255, 255, 0.92);
}

/* Текст анамнеза и "О себе" в карточке клиента */
:root[data-theme="dark"] .client-detail-text {
    color: rgba(255, 255, 255, 0.9);
}

:root[data-theme="dark"] .rlv-card-title {
    color: rgba(255, 255, 255, 0.92);
}
