/* ── чат: общие стили (визитка и кабинет) */
.oz-chat { display: flex; flex-direction: column; min-height: 0; height: 100%; background: var(--bg-2); color: var(--text); }
.oz-chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.oz-chat-who { display: grid; line-height: 1.25; flex: 1; min-width: 0; }
.oz-chat-who b { font-size: 16px; }
.oz-chat-who small { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oz-icon-btn {
    flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.oz-icon-btn svg { width: 21px; height: 21px; }
.oz-icon-btn:hover { border-color: #3A4554; }
.oz-call-btn { color: var(--accent); }
.oz-send-btn { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.oz-close-btn { font-size: 18px; color: var(--muted); }
.oz-chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.oz-day { align-self: center; color: var(--muted); font-size: 12.5px; padding: 4px 10px; margin: 8px 0 4px; background: var(--surface); border-radius: 999px; }
.oz-empty { margin: auto; text-align: center; color: var(--muted); max-width: 300px; font-size: 15px; }
.oz-msg { max-width: 82%; padding: 9px 12px 6px; border-radius: 16px; position: relative; font-size: 15.5px; line-height: 1.45; word-wrap: break-word; overflow-wrap: anywhere; }
.oz-msg.is-mine { align-self: flex-end; background: #1E3A31; border-bottom-right-radius: 5px; }
.oz-msg.is-theirs { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 5px; }
.oz-msg-text { white-space: pre-wrap; }
.oz-msg-time { display: block; text-align: right; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.oz-msg.kind-call { background: transparent; border: 1px dashed var(--line); }
.oz-call-note { display: flex; align-items: center; gap: 8px; color: var(--text-soft); }
.oz-call-note svg { width: 16px; height: 16px; color: var(--accent); }
.oz-voice { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.oz-voice-btn { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; flex: none; }
.oz-voice-btn svg { width: 18px; height: 18px; }
.oz-voice-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .14); cursor: pointer; position: relative; overflow: hidden; }
.oz-voice-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); }
.oz-voice-time { font-size: 13px; color: var(--text-soft); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.oz-chat-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.oz-chat-compose textarea {
    flex: 1; resize: none; min-height: 44px; max-height: 140px; padding: 11px 14px; border-radius: 22px;
    border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: 400 16px/1.4 "Onest", sans-serif; outline: none;
}
.oz-chat-compose textarea:focus { border-color: var(--accent); }
.oz-rec { display: flex; align-items: center; gap: 12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.oz-rec[hidden], .oz-chat-compose[hidden] { display: none; }
.oz-rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #FF5A4E; animation: ozPulse 1s infinite; }
.oz-rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.oz-rec-hint { flex: 1; color: var(--muted); font-size: 14px; }
@keyframes ozPulse { 50% { opacity: .3; } }
.oz-text-btn { background: none; border: 0; color: var(--accent); font: 600 15px "Onest", sans-serif; cursor: pointer; padding: 10px 8px; }
.oz-text-btn.is-muted { color: var(--muted); }
.oz-push-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 16px; background: var(--accent-soft); font-size: 14px; color: var(--text-soft); }
.oz-push-offer span { flex: 1 1 180px; }
.oz-toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 1000; background: #232A35; color: var(--text); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; font-size: 15px; box-shadow: 0 20px 40px -20px #000; max-width: calc(100% - 32px); }

/* окно звонка */
.oz-call-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(8, 10, 14, .86); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: grid; place-items: center; padding: 24px; }
.oz-call-overlay[hidden] { display: none; }
.oz-call-card { width: min(360px, 100%); text-align: center; display: grid; gap: 10px; justify-items: center; }
.oz-call-avatar { width: 96px; height: 96px; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--accent); color: var(--accent); display: grid; place-items: center; font: 700 40px "Onest", sans-serif; margin-bottom: 8px; }
.oz-call-name { font-size: 22px; }
.oz-call-status { color: var(--text-soft); font-variant-numeric: tabular-nums; }
.oz-call-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 22px; }
.oz-call-act { min-height: 52px; padding: 0 22px; border-radius: 999px; border: 0; font: 600 16px "Onest", sans-serif; cursor: pointer; color: #fff; }
.oz-call-act.is-green { background: #23B26D; }
.oz-call-act.is-red { background: #E5484D; }
.oz-call-act.is-ghost { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }

/* ── визитка: кнопка и окно чата */
.oz-chat-fab {
    position: fixed; right: 20px; bottom: 20px; z-index: 60; display: inline-flex; align-items: center; gap: 10px;
    min-height: 56px; padding: 0 22px 0 18px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--accent); color: var(--accent-ink); font: 700 16px "Onest", sans-serif;
    box-shadow: 0 16px 36px -12px rgba(127, 227, 190, .55);
}
.oz-chat-fab svg { width: 22px; height: 22px; }
.oz-chat-fab[hidden] { display: none; }
.oz-chat-panel {
    position: fixed; right: 20px; bottom: 20px; z-index: 70; width: min(400px, calc(100vw - 40px)); height: min(640px, calc(100vh - 40px));
    border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); background: var(--bg-2);
    display: flex; flex-direction: column;
}
.oz-chat-panel[hidden] { display: none; }
.oz-chat-panel > div { flex: 1; min-height: 0; }
.oz-start { padding: 18px 18px 22px; display: grid; gap: 14px; overflow-y: auto; }
.oz-start p { margin: 0; color: var(--text-soft); font-size: 15px; }
.oz-start .field input, .oz-start .field textarea { padding: 12px 14px; }
.oz-start .field textarea { min-height: 84px; }
@media (max-width: 640px) {
    .oz-chat-fab { right: 16px; bottom: 16px; }
    .oz-chat-panel { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
    html.oz-chat-open, html.oz-chat-open body { overflow: hidden; }
}

/* ── кабинет: чат в карточке заявки */
.admin-chat { height: min(640px, 75vh); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }

/* вложения */
.oz-attach-btn { color: var(--text-soft); }
.oz-photo { display: block; margin: -3px -6px 0; border-radius: 12px; overflow: hidden; max-width: 260px; }
.oz-photo img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; }
.oz-msg.kind-image { padding: 6px 6px 4px; }
.oz-msg.kind-image .oz-msg-time { padding-right: 6px; }
.oz-file { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 220px; max-width: 280px; }
.oz-file-ext { flex: none; width: 44px; height: 52px; border-radius: 8px; background: rgba(127, 227, 190, .16); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; letter-spacing: .04em; }
.oz-file-info { display: grid; min-width: 0; }
.oz-file-info b { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oz-file-info small { color: var(--muted); font-size: 12.5px; }
a.oz-file:hover b { text-decoration: underline; text-underline-offset: 3px; }
.oz-progress { height: 4px; background: rgba(255, 255, 255, .12); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.oz-progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.oz-chat.is-drop { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* ── приложение «OZ чат» */
.chat-app-body { background: var(--bg); }
.app-shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.app-top { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.app-top .brand { text-decoration: none; }
.app-chat { flex: 1; min-height: 0; display: flex; }
.app-chat[hidden] { display: none; }
.app-chat .oz-chat { flex: 1; height: auto; }
.chat-app-body .app-shell:has(.app-chat:not([hidden])) { height: 100vh; height: 100dvh; }
@media (min-width: 760px) {
    .app-chat { width: min(760px, 100%); margin: 20px auto; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; max-height: calc(100dvh - 110px); }
}
.gate { flex: 1; padding: 20px 16px calc(32px + env(safe-area-inset-bottom)); }
.gate[hidden] { display: none; }
.gate-loading { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: ozSpin 0.8s linear infinite; }
@keyframes ozSpin { to { transform: rotate(360deg); } }
.gate-steps { list-style: none; margin: 4px auto 22px; padding: 0; display: flex; justify-content: center; gap: 6px; max-width: 460px; }
.gate-steps li { flex: 1; display: grid; justify-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); text-align: center; position: relative; }
.gate-steps li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px; }
.gate-steps li.is-current { color: var(--text); }
.gate-steps li.is-current span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.gate-steps li.is-done span { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-size: 0; }
.gate-steps li.is-done span::after { content: "✓"; font-size: 15px; }
.gate-card { max-width: 460px; margin: 0 auto; display: grid; gap: 16px; }
.gate-card h1 { margin: 6px 0 0; font-size: clamp(28px, 7vw, 36px); line-height: 1.12; letter-spacing: -.02em; }
.gate-lead { margin: 0; color: var(--text-soft); font-size: 16.5px; }
.gate-note { margin: 0; color: var(--text-soft); font-size: 15px; }
.gate-icon .brand-mark { width: 72px; height: 72px; }
.gate-app { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px; }
.gate-app img { border-radius: 18px; box-shadow: 0 12px 30px -12px rgba(127, 227, 190, .45); }
.gate-app b { display: block; font-size: 18px; }
.gate-app small { color: var(--muted); }
.gate-perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gate-perks li { position: relative; padding-left: 28px; color: var(--text-soft); font-size: 15px; }
.gate-perks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.btn-lg { min-height: 56px; font-size: 17px; }
.gate-howto { display: grid; gap: 10px; }
.gate-howto[hidden] { display: none; }
.howto-step { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; font-size: 15.5px; color: var(--text-soft); }
.howto-step > b { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-size: 14px; }
.howto-step[hidden] { display: none; }
.kbd { display: inline-block; padding: 1px 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); color: var(--text); font-weight: 600; white-space: nowrap; }
.ios-share { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #2B6EF6; color: #fff; vertical-align: middle; }
.ios-share svg { width: 18px; height: 18px; }
.gate-done { display: flex; gap: 14px; align-items: flex-start; background: var(--accent-soft); border: 1px solid rgba(127, 227, 190, .35); border-radius: 16px; padding: 16px; }
.gate-done[hidden] { display: none; }
.gate-done p { margin: 0; color: var(--text-soft); }
.gate-check { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; }
.notif-mock { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: start; background: rgba(36, 42, 52, .9); border: 1px solid var(--line); border-radius: 18px; padding: 14px; box-shadow: 0 24px 50px -24px #000; animation: ozDrop .6s ease both; }
.notif-mock img { border-radius: 10px; }
.notif-mock b { display: block; font-size: 15px; }
.notif-mock span { color: var(--text-soft); font-size: 14.5px; }
.notif-mock small { color: var(--muted); font-size: 12px; }
@keyframes ozDrop { from { opacity: 0; transform: translateY(-14px); } }
.gate-denied { display: grid; gap: 12px; }
.gate-denied[hidden] { display: none; }
.muted-inline { color: var(--muted); font-weight: 400; }

.gate .oz-start { padding: 0; overflow: visible; }
.notif-mock { animation-duration: .45s; }

/* «Представьтесь» и полоска про уведомления */
.oz-profile { margin: 10px 12px 0; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid rgba(127, 227, 190, .35); display: grid; gap: 10px; }
.oz-profile-head b { display: block; font-size: 15.5px; }
.oz-profile-head span { color: var(--text-soft); font-size: 13.5px; }
.oz-profile-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; }
.oz-profile input[name=name], .oz-profile input[name=phone] { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: 400 16px "Onest", sans-serif; outline: none; }
.oz-profile input:focus { border-color: var(--accent); }
.oz-profile-consent { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-soft); }
.oz-profile-consent input { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 1px; flex: none; }
.oz-profile-err { color: var(--danger); font-size: 13.5px; }
.oz-profile-err:empty { display: none; }
.oz-profile-actions { display: flex; align-items: center; gap: 8px; }
.oz-profile-save { min-height: 42px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font: 700 15px "Onest", sans-serif; cursor: pointer; }
@media (max-width: 380px) { .oz-profile-fields { grid-template-columns: minmax(0, 1fr); } }
.oz-notif-bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(216, 183, 122, .12); border-bottom: 1px solid rgba(216, 183, 122, .3); color: var(--text-soft); font-size: 14px; }
.oz-notif-bar span { flex: 1; }
.oz-notif-bar button { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 0; background: var(--gold); color: #2A1F0B; font: 700 14px "Onest", sans-serif; cursor: pointer; }
.gate-welcome { text-align: center; justify-items: center; padding-top: 6vh; }
.gate-welcome .gate-app { justify-content: center; }
.oz-call-quality { font-size: 13px; color: var(--text-soft); display: inline-flex; align-items: center; gap: 6px; }
.oz-call-quality::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #3ecf8e; }
.oz-call-quality[data-level="нормальная"]::before { background: #f5b942; }
.oz-call-quality[data-level="слабая"]::before { background: #ef5b5b; }
.oz-call-quality[hidden] { display: none; }
