/* ══════════════════════════════════════════════════════════
   INTEGRATION PAGE — integration.css  (v5)
   Extends existing wed-* classes, adds pv-* preview shell
   ══════════════════════════════════════════════════════════ */

/* ── Tabs ── (existing .integ-* kept for backward compat) */
.integ-tabs-wrap { margin-bottom: 24px; }

.integ-tabs {
    display: flex;
    gap: 4px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
    width: fit-content;
}

.integ-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink2);
    cursor: pointer;
    background: none;
    border: none;
    transition: all .15s;
}

.integ-tab:hover { background: var(--bg); color: var(--ink); }

.integ-tab.active {
    background: var(--accent-light);
    color: #1a6e3a;
    font-weight: 600;
}

.integ-tab-icon { font-size: 15px; }

.integ-panel { display: none; }
.integ-panel.active { display: block; }

/* ══════════════════════════════════════════════════════════
   EDITOR LAYOUT
   ══════════════════════════════════════════════════════════ */
.widget-editor-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

/* ── Controls ── */
.wed-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wed-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
}

.wed-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.wed-add-btn {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-light);
    border: none;
    padding: 3px 10px;
    border-radius: 20px;
    cursor: pointer;
    transition: opacity .15s;
    text-transform: none;
    letter-spacing: 0;
}

.wed-add-btn:hover { opacity: .8; }

/* Fields */
.wed-field { margin-bottom: 12px; }
.wed-field:last-child { margin-bottom: 0; }

.wed-label {
    display: block;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--ink3);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
}

.wed-input,
.wed-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    color: var(--ink);
    background: var(--bg);
    font-family: inherit;
    transition: border-color .15s;
    resize: none;
}

.wed-input:focus,
.wed-textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--white);
}

.wed-textarea--mono {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 10px;
    height: 60px;
}

.wed-hint {
    font-size: 11.5px;
    color: var(--ink3);
    margin-top: 4px;
    line-height: 1.5;
}

.wed-hint b { color: var(--ink2); }

/* 2-column grid */
.wed-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Color presets */
.wed-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.wed-preset {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 2px solid transparent;
    padding: 3px;
    cursor: pointer;
    transition: all .12s;
    background: none;
}

.wed-preset span {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 7px;
}

.wed-preset.active,
.wed-preset:hover {
    border-color: var(--ink);
    transform: scale(1.08);
}

/* Color pickers */
.wed-color-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
}

.wed-color {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.wed-color-val {
    font-size: 12px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    color: var(--ink2);
}

/* Quick buttons / stats editor rows */
.wed-quickbtns {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.wed-qbtn-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 8px 10px;
}

.wed-qbtn-emoji {
    font-size: 18px;
    cursor: pointer;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.wed-qbtn-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--ink);
    font-family: inherit;
}

.wed-qbtn-input:focus { outline: none; }

.wed-qbtn-input--val {
    width: 60px;
    flex: none;
    font-weight: 700;
}

.wed-qbtn-input--small {
    font-size: 10px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    height: 36px;
    resize: none;
    padding: 4px 6px;
}

.wed-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    flex-shrink: 0;
}

.wed-qbtn-delete {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--red-light);
    color: var(--red);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .15s;
}

.wed-qbtn-delete:hover { opacity: .7; }

/* Chips editor */
.wed-chips-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.wed-chip-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wed-chip-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12.5px;
    color: var(--ink);
    background: var(--bg);
    font-family: inherit;
    transition: border-color .15s;
}

.wed-chip-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Answers editor */
.wed-answers-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.wed-answer-row {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
}

.wed-answer-q,
.wed-answer-a {
    width: 100%;
    border: none;
    background: none;
    font-family: inherit;
    color: var(--ink);
    resize: none;
}

.wed-answer-q {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.wed-answer-a {
    font-size: 12.5px;
    color: var(--ink2);
    line-height: 1.5;
}

.wed-answer-q:focus,
.wed-answer-a:focus { outline: none; }

.wed-answer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 6px;
}

.wed-answer-num { font-size: 11px; color: var(--ink4); }

.wed-answer-del {
    font-size: 11px;
    color: var(--red);
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
}

/* Toggles */
.wed-toggles-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wed-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.wed-toggle-lbl {
    font-size: 13px;
    color: var(--ink2);
}

.wed-toggle-wrap {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}

.wed-toggle-wrap input { opacity: 0; width: 0; height: 0; }

.wed-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--ink4);
    border-radius: 11px;
    transition: .2s;
    cursor: pointer;
}

.wed-toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: .2s;
}

.wed-toggle-wrap input:checked + .wed-toggle-slider { background: var(--accent); }
.wed-toggle-wrap input:checked + .wed-toggle-slider::before { transform: translateX(16px); }

/* Position grid */
.wed-position-grid { display: flex; gap: 8px; }

.wed-pos-btn {
    flex: 1;
    padding: 8px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--ink2);
    cursor: pointer;
    background: var(--bg);
    transition: all .15s;
    font-family: inherit;
}

.wed-pos-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: #1a6e3a;
    font-weight: 600;
}

/* Range */
.wed-range-wrap { display: flex; align-items: center; gap: 8px; }
.wed-range { flex: 1; accent-color: var(--accent); cursor: pointer; }
.wed-range-val { font-size: 12px; color: var(--ink3); min-width: 32px; text-align: right; }

/* Actions */
.wed-actions { display: flex; gap: 10px; }

/* ══════════════════════════════════════════════════════════
   PREVIEW WRAP
   ══════════════════════════════════════════════════════════ */
.wed-preview-wrap {
    position: sticky;
    top: 80px;
}

.wed-preview-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ink3);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
}

.wed-pv-mode-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.wed-pv-mode-hint {
    font-size: 11px;
    color: var(--ink3);
    font-weight: 600;
}

.wed-pv-mode-bar .wed-pos-btn {
    flex: none;
    padding: 5px 14px;
    font-size: 11.5px;
}

/* ══════════════════════════════════════════════════════════
   WIDGET PREVIEW SHELL  (pv-*)
   Все токены берём из variables.css через var()
   Новые специфические токены виджета объявлены inline-перегрузкой
   ══════════════════════════════════════════════════════════ */
.pv-shell {
    /* Widget-specific overrides (не конфликтуют с project vars) */
    --pv-c1:       #03635D;
    --pv-c2:       #013a36;
    --pv-gold:     #D7AB6B;
    --pv-grad:     linear-gradient(145deg, var(--pv-c1) 0%, var(--pv-c2) 100%);
    --pv-glass:    rgba(250,247,242,.82);
    --pv-bdr:      rgba(3,99,93,.12);
    --pv-bdr2:     rgba(3,99,93,.26);
    --pv-soft:     rgba(3,99,93,.08);
    --pv-text1:    #19302d;
    --pv-text2:    rgba(25,48,45,.72);
    --pv-text3:    rgba(25,48,45,.46);
    --pv-bg-soft:  #faf7f2;

    background: var(--pv-bg-soft);
    border-radius: 28px;
    border: 1px solid var(--pv-bdr);
    box-shadow: 0 32px 64px rgba(3,99,93,.14), 0 8px 24px rgba(0,0,0,.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 620px;
    font-family: 'Golos Text', 'Onest', sans-serif;
    font-size: 13px;
    width: 410px;
    margin-left: auto;
    margin-right: auto;
}

.pv-shell--launcher {
    height: auto;
    min-height: 200px;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Header */
.pv-header {
    padding: 16px;
    background: var(--pv-grad);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

.pv-header::before {
    content: '';
    position: absolute;
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: rgba(215,171,107,.1);
    top: -40px;
    right: -30px;
    pointer-events: none;
    filter: blur(40px);
}

.pv-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(215,171,107,.12);
    border: 1.5px solid rgba(215,171,107,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.pv-header-text { flex: 1; min-width: 0; position: relative; z-index: 1; }

.pv-brand-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pv-brand-sub {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: rgba(255,255,255,.75);
    margin-top: 2px;
}

.pv-online-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(74,222,128,.6);
    animation: pvPulse 2s infinite;
}

@keyframes pvPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.2); opacity: .7; }
}

.pv-actions { display: flex; gap: 6px; position: relative; z-index: 1; }

.pv-icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,.14);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.pv-icon-btn svg {
    width: 14px;
    height: 14px;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pv-icon-btn--light {
    background: var(--pv-soft);
    border: 1px solid var(--pv-bdr);
    color: var(--pv-text2);
}

/* Scrollable area */
.pv-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pv-scroll::-webkit-scrollbar { width: 4px; }
.pv-scroll::-webkit-scrollbar-track { background: transparent; }
.pv-scroll::-webkit-scrollbar-thumb { background: var(--pv-bdr2); border-radius: 2px; }

/* Hero card */
.pv-hero {
    background: var(--pv-grad);
    border-radius: 22px;
    padding: 20px 18px 18px;
    color: #fff;
    position: relative;
    /* overflow: hidden; */
}

.pv-hero::before {
    content: '';
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: rgba(215,171,107,.1);
    top: -60px;
    right: -40px;
    pointer-events: none;
    filter: blur(40px);
}

.pv-hero-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(215,171,107,.18);
    border: 1px solid rgba(215,171,107,.3);
    color: rgba(215,171,107,.9);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    position: relative;
    z-index: 1;
}

.pv-hero-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.pv-hero h2 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}

.pv-hero h2 em {
    color: var(--pv-gold);
    font-style: normal;
}

.pv-hero-side {
    background: rgba(215,171,107,.14);
    border: 1px solid rgba(215,171,107,.28);
    border-radius: 12px;
    padding: 10px 12px;
    text-align: center;
    flex-shrink: 0;
    min-width: 80px;
}

.pv-hero-side-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--pv-gold);
    line-height: 1;
}

.pv-hero-side-lbl {
    font-size: 9px;
    color: rgba(255,255,255,.65);
    line-height: 1.3;
    margin-top: 3px;
}

.pv-hero p {
    font-size: 12px;
    color: rgba(255,255,255,.75);
    line-height: 1.5;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.pv-hero-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.pv-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 7px 10px;
    flex: 1;
}

.pv-stat strong { font-size: 13px; font-weight: 800; color: #fff; }
.pv-stat span   { font-size: 9.5px; color: rgba(255,255,255,.6); }

.pv-hero-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.pv-main-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--pv-gold);
    color: #18302d;
    font-size: 12px;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.pv-ghost-btn {
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.85);
    border: 1px solid rgba(255,255,255,.22);
    font-size: 12px;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
}

/* Sections */
.pv-section { display: flex; flex-direction: column; gap: 10px; }

.pv-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.pv-section-kicker {
    font-size: 10px;
    font-weight: 700;
    color: var(--pv-c1);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.pv-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--pv-text1);
    line-height: 1.2;
}

.pv-section-note { font-size: 10.5px; color: var(--pv-text3); }

/* Feat grid */
.pv-feat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.pv-feat-card {
    background: var(--pv-grad);
    color: #fff;
    border-radius: 18px;
    padding: 14px;
}

.pv-feat-badge {
    display: inline-block;
    background: rgba(215,171,107,.2);
    border: 1px solid rgba(215,171,107,.3);
    color: rgba(215,171,107,.9);
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 8px;
}

.pv-feat-card h4 {
    font-size: 12.5px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 6px;
}

.pv-feat-card h4 em { color: var(--pv-gold); font-style: normal; }
.pv-feat-card p { font-size: 10.5px; color: rgba(255,255,255,.65); line-height: 1.4; }

.pv-mini-stack { display: flex; flex-direction: column; gap: 8px; }

.pv-mini-panel {
    background: var(--pv-glass);
    border: 1px solid var(--pv-bdr);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.pv-mini-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--pv-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    color: var(--pv-c1);
}

.pv-mini-icon svg {
    width: 15px;
    height: 15px;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pv-mini-panel strong { font-size: 11px; font-weight: 700; color: var(--pv-text1); }
.pv-mini-panel span   { font-size: 10px; color: var(--pv-text3); line-height: 1.35; }

/* Quick nav grid */
.pv-quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }

.pv-quick-card {
    background: var(--pv-glass);
    border: 1px solid var(--pv-bdr);
    border-radius: 12px;
    padding: 10px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: border-color .15s;
}

.pv-quick-card:hover { border-color: var(--pv-bdr2); }

.pv-quick-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--pv-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pv-c1);
}

.pv-quick-name {
    font-size: 9.5px;
    font-weight: 600;
    color: var(--pv-text2);
    text-align: center;
    line-height: 1.3;
}

/* Promo strip */
.pv-promo {
    background: linear-gradient(135deg, rgba(3,99,93,.06), rgba(215,171,107,.08));
    border: 1px solid rgba(215,171,107,.38);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.pv-promo-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: rgba(215,171,107,.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pv-gold);
    flex-shrink: 0;
}

.pv-promo > div { flex: 1; }
.pv-promo strong { font-size: 11px; font-weight: 700; color: var(--pv-text1); display: block; margin-bottom: 2px; }
.pv-promo span   { font-size: 10.5px; color: var(--pv-text2); line-height: 1.4; }

/* Chips */
.pv-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.pv-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--pv-glass);
    border: 1px solid var(--pv-bdr);
    border-radius: 20px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: var(--pv-text2);
    transition: all .15s;
}

.pv-chip:hover { border-color: var(--pv-c1); color: var(--pv-c1); }

/* Input row */
.pv-input-row {
    padding: 10px 12px;
    background: rgba(255,255,255,.9);
    border-top: 1px solid var(--pv-bdr);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}

.pv-chat-input {
    flex: 1;
    background: var(--pv-bg-soft);
    border: 1px solid var(--pv-bdr);
    border-radius: 22px;
    padding: 9px 14px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--pv-text1);
    transition: border-color .15s;
}

.pv-chat-input:focus { outline: none; border-color: var(--pv-c1); }

.pv-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pv-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .15s;
}

.pv-send:hover { transform: scale(1.08); }

/* ── Chat view ── */
.pv-chat-header {
    padding: 12px 14px;
    background: rgba(255,255,255,.95);
    border-bottom: 1px solid var(--pv-bdr);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}

.pv-back {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--pv-c1);
    cursor: pointer;
    font-weight: 600;
}

.pv-chat-mini-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--pv-soft);
    border: 1px solid var(--pv-bdr);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pv-c1);
    flex-shrink: 0;
}

.pv-chat-name { font-size: 13px; font-weight: 700; color: var(--pv-text1); }

.pv-disclaimer {
    padding: 7px 12px;
    background: rgba(215,171,107,.08);
    border-bottom: 1px solid rgba(215,171,107,.3);
    font-size: 10.5px;
    color: var(--pv-text2);
    text-align: center;
    flex-shrink: 0;
}

.pv-msgs {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pv-msg-row { display: flex; gap: 8px; align-items: flex-end; }

.pv-msg-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--pv-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pv-c1);
    flex-shrink: 0;
}

.pv-msg-bot {
    background: #fff;
    border: 1px solid var(--pv-bdr);
    border-radius: 14px 14px 14px 4px;
    padding: 9px 12px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--pv-text1);
    max-width: 85%;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.pv-msg-user {
    background: var(--pv-grad);
    color: #fff;
    border-radius: 14px 14px 4px 14px;
    padding: 9px 12px;
    font-size: 12px;
    line-height: 1.45;
    max-width: 85%;
    margin-left: auto;
}

.pv-typing { display: flex; gap: 8px; align-items: flex-end; }

.pv-typing-bubble {
    background: #fff;
    border: 1px solid var(--pv-bdr);
    border-radius: 14px 14px 14px 4px;
    padding: 12px 14px;
    display: flex;
    gap: 5px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

.pv-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pv-c1);
    animation: pvTyping 1.4s infinite;
}

.pv-typing-dot:nth-child(2) { animation-delay: .2s; }
.pv-typing-dot:nth-child(3) { animation-delay: .4s; }

@keyframes pvTyping {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-6px); }
}

/* ── Launcher view ── */
.pv-launcher-wrap {
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.pv-lcard {
    background: var(--pv-glass);
    border: 1px solid var(--pv-bdr2);
    border-radius: 22px;
    padding: 16px;
    width: 280px;
    box-shadow: 0 20px 50px rgba(3,99,93,.14), 0 4px 16px rgba(0,0,0,.06);
    backdrop-filter: blur(12px);
}

.pv-lcard-status {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 8px;
}

.pv-llbl { font-size: 12.5px; font-weight: 700; color: var(--pv-text1); }

.pv-ltext {
    font-size: 12px;
    color: var(--pv-text2);
    line-height: 1.5;
    margin-bottom: 12px;
}

.pv-lcaps { display: flex; flex-direction: column; gap: 8px; }

.pv-lcap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--pv-bdr);
    border-radius: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: border-color .15s;
}

.pv-lcap:hover { border-color: var(--pv-c1); }

.pv-lcap--featured {
    background: linear-gradient(135deg, rgba(3,99,93,.06), rgba(3,99,93,.02));
    border-color: rgba(3,99,93,.2);
}

.pv-lcap-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--pv-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pv-c1);
    flex-shrink: 0;
}

.pv-lcap-text { flex: 1; font-size: 12px; font-weight: 600; color: var(--pv-text1); }
.pv-lcap-arrow { font-size: 13px; color: var(--pv-text3); }

.pv-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--pv-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(3,99,93,.35);
    transition: transform .2s;
}

.pv-fab:hover { transform: scale(1.06); }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
    .widget-editor-layout { grid-template-columns: 360px 1fr; }
}

@media (max-width: 1100px) {
    .widget-editor-layout { grid-template-columns: 1fr; }
    .wed-preview-wrap { position: relative; top: 0; }
}

@media (max-width: 640px) {
    .wed-row-2     { grid-template-columns: 1fr; }
    .pv-feat-grid  { grid-template-columns: 1fr; }
    .pv-quick-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════
   DIALOGS TAB
   ══════════════════════════════════════════════════════════ */

/* ── Toolbar ── */
.dlg-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.dlg-filters {
    display: flex;
    gap: 4px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px;
}

.dlg-filter {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink2);
    cursor: pointer;
    background: none;
    border: none;
    transition: all .15s;
    white-space: nowrap;
}

.dlg-filter:hover  { background: var(--bg); color: var(--ink); }
.dlg-filter.active { background: var(--accent-light); color: #1a6e3a; font-weight: 600; }

.dlg-filter-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.dlg-filter-dot.hot  { background: #ef4444; }
.dlg-filter-dot.warm { background: #f97316; }
.dlg-filter-dot.cold { background: #94a3b8; }

.dlg-refresh-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

/* ── Loading / Empty states ── */
.dlg-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    padding: 40px 20px;
    font-size: 13px;
    color: var(--ink3);
}

.dlg-loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: dlgSpin .7s linear infinite;
    flex-shrink: 0;
}

@keyframes dlgSpin { to { transform: rotate(360deg); } }

.dlg-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink2);
    text-align: center;
}

/* ── Table extras ── */
.dlg-row { cursor: pointer; }

.dlg-last-msg {
    font-size: 12.5px;
    color: var(--ink2);
    max-width: 280px;
}

.dlg-msg-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--ink2);
}

/* ── Wide modal variant ── */
.crm-modal--wide {
    width: 620px;
    max-width: 96vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

/* ── Lead info strip inside modal ── */
.dlg-modal-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--ink3);
    margin-top: 4px;
}

.dlg-lead-strip {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding: 10px 22px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.dlg-lead-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ink2);
}

.dlg-lead-item svg { flex-shrink: 0; color: var(--ink3); }

/* ── Message list ── */
.dlg-modal-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f7f8fa;
    min-height: 200px;
    max-height: 420px;
}

/* ── Chat bubbles (HTML + inline CSS from DB colors) ── */
.dlg-bubble-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.dlg-bubble-row--visitor {
    flex-direction: row-reverse;
}

.dlg-bubble-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dlg-bubble {
    max-width: 72%;
    padding: 9px 13px;
    border-radius: 16px;
    font-size: 13px;
    line-height: 1.55;
    word-break: break-word;
}

.dlg-bubble--ai {
    background: var(--white);
    color: var(--ink);
    border-radius: 4px 16px 16px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.dlg-bubble--visitor {
    border-radius: 16px 16px 4px 16px;
}

.dlg-bubble-time {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    color: var(--ink3);
    margin-top: 3px;
    padding-left: 2px;
}

.dlg-bubble-row--visitor .dlg-bubble-time {
    justify-content: flex-end;
    padding-left: 0;
    padding-right: 2px;
}

.dlg-model-tag {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 600;
    color: var(--ink3);
    text-transform: uppercase;
    letter-spacing: .3px;
}

/* ── Тариф истёк — виджет не показывается на сайте клиента ─────────── */
.integ-tariff-warn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 14px;
    background: #fff6e8;
    color: #92400e;
}
.integ-tariff-warn svg { flex-shrink: 0; margin-top: 1px; }
.integ-tariff-warn > div { flex: 1; }
.integ-tariff-warn span { font-size: 12.5px; line-height: 1.5; font-weight: 600; display: block; }
.integ-tariff-warn button {
    margin-top: 8px;
    background: #92400e;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}
.integ-tariff-warn button:hover { opacity: .88; }