.rstv-overlay{position:fixed;inset:0;background:rgba(15,35,58,.5);z-index:999999;display:flex;align-items:center;justify-content:center;padding:18px;backdrop-filter:blur(4px)}
.rstv-overlay[hidden]{display:none!important}
.rstv-window{background:#fff;color:#15263d;width:min(100%,650px);max-height:min(92vh,760px);border-radius:20px;display:flex;flex-direction:column;box-shadow:0 20px 70px rgba(0,18,37,.23);overflow:hidden;font-family:system-ui,-apple-system,'Segoe UI',Arial,sans-serif;font-size:16px}
.rstv-header{background:#f1f7fd;padding:18px 22px;display:flex;gap:12px;align-items:center;border-bottom:1px solid #dbe7f3}
.rstv-logo{width:40px;height:40px;flex:0 0 40px;border-radius:12px;background:#e0efff;display:grid;place-items:center;color:#1571cc;font-size:27px;font-weight:900}
.rstv-heading{flex:1;min-width:0}
.rstv-title{font-weight:800;font-size:17px;line-height:1.35}
.rstv-subtitle{color:#516780;font-size:12px;margin-top:3px}
.rstv-x{background:transparent;border:none;color:#566f87;cursor:pointer;font-size:27px;line-height:1;padding:4px 8px}
.rstv-warning{padding:11px 22px;background:#fff8e9;border-bottom:1px solid #f0e2bc;color:#775719;font-size:12px;line-height:1.5}
.rstv-log{padding:18px 22px;overflow-y:auto;min-height:165px;flex:1;display:flex;flex-direction:column;gap:12px}
.rstv-msg{border-radius:16px;padding:11px 14px;max-width:87%;font-size:15px;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.rstv-msg--assistant{background:#eef5fc;align-self:flex-start;border-bottom-left-radius:4px}
.rstv-msg--user{background:#0e71c9;color:#fff;align-self:flex-end;border-bottom-right-radius:4px}
.rstv-label{font-size:13px;color:#45617b;font-weight:700;padding:0 22px 7px}
.rstv-controls{padding:0 22px 14px;display:flex;gap:8px}
.rstv-input{flex:1;min-width:0;border:1px solid #bfd1e3;border-radius:11px;padding:12px;font:inherit;color:#15263d;background:#fff}
.rstv-input:focus{outline:2px solid #4d9aec;outline-offset:1px}
.rstv-btn{border:0;border-radius:11px;padding:11px 14px;font:inherit;font-size:14px;font-weight:700;cursor:pointer;background:#0c6fc6;color:#fff}
.rstv-btn:hover{filter:brightness(.96)}
.rstv-btn--mic{background:#e8f2fc;color:#0b5599;border:1px solid #b4d1ea;min-width:44px}
.rstv-btn--mic[aria-pressed=true]{background:#e9f1ff;box-shadow:inset 0 0 0 2px #0c6fc6}
.rstv-foot{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px;padding:11px 22px 14px;border-top:1px solid #e2eaf1;font-size:12px;color:#526a83}
.rstv-foot label{display:flex;align-items:center;gap:6px;cursor:pointer}
.rstv-status{padding:0 22px 8px;color:#4b6684;font-size:12px;min-height:15px}
.rstv-result{margin:0 22px 16px;padding:14px;background:#f4f8fc;border:1px solid #d7e4f1;border-radius:13px;display:none}
.rstv-result[hidden]{display:none!important}
.rstv-result h3{margin:0 0 8px;font-size:15px}.rstv-result p{white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.5;margin:0 0 12px}
.rstv-result .rstv-btn{font-size:12px;padding:8px 11px}
body.rstv-open{overflow:hidden}
@media(max-width:570px){.rstv-overlay{padding:0;align-items:flex-end}.rstv-window{border-radius:20px 20px 0 0;max-height:93vh}.rstv-header{padding:14px}.rstv-warning{padding:9px 14px}.rstv-log{padding:14px}.rstv-controls{padding:0 14px 12px}.rstv-label,.rstv-status{padding-left:14px;padding-right:14px}.rstv-foot{padding:10px 14px}.rstv-result{margin:0 14px 12px}}

/* v0.2.0: видимый процесс диктовки, реальная звуковая активность микрофона */
.rstv-listening-panel{display:flex;align-items:center;gap:12px;margin:0 22px 12px;border:1px solid #a7d1ee;border-radius:14px;background:#eef8ff;padding:10px 14px;color:#123a61}
.rstv-listening-panel[hidden]{display:none!important}
.rstv-live-indicator{display:inline-flex;align-items:center;gap:7px;flex-shrink:0;font-size:12px;font-weight:800;white-space:nowrap}
.rstv-live-indicator::before{content:'';width:8px;height:8px;border-radius:50%;background:#e14246;box-shadow:0 0 0 4px #e1424622;animation:rstv-pulse 1.4s infinite}
.rstv-waveform{display:flex;flex:1;gap:3px;align-items:center;justify-content:center;height:40px;min-width:0}
.rstv-waveform>i{display:block;flex:1 1 0;max-width:7px;min-width:2px;background:#1477cf;border-radius:99px;height:3px;transition:height .08s linear}
.rstv-timer{font-size:12px;font-variant-numeric:tabular-nums;font-weight:700;color:#476c8b;flex-shrink:0}
.rstv-interim{font-size:13px;line-height:1.4;color:#496783;margin:0 22px 9px;min-height:0;overflow-wrap:anywhere}
.rstv-interim[hidden]{display:none!important}
.rstv-btn--mic[aria-pressed=true]{background:#d9edff;border-color:#1477cf;color:#0a4d93}
@keyframes rstv-pulse{50%{box-shadow:0 0 0 7px #e1424608}}
@media(max-width:570px){.rstv-listening-panel{margin:0 14px 10px;padding:8px;gap:7px}.rstv-waveform{gap:2px}.rstv-interim{margin-left:14px;margin-right:14px}.rstv-live-indicator{font-size:11px}}
@media(prefers-reduced-motion:reduce){.rstv-live-indicator::before{animation:none}.rstv-waveform>i{transition:none}}

/* v0.3.0 — выбор канала связи, компактный итог */
.rstv-channels{padding:11px 22px 13px;border-bottom:1px solid #e1eaf4;background:#fff}
.rstv-channels-title{font-size:13px;color:#43617f;font-weight:750;margin-bottom:8px}
.rstv-channel-buttons{display:flex;gap:8px;flex-wrap:wrap}
.rstv-channel{display:inline-flex;align-items:center;justify-content:center;appearance:none;text-decoration:none!important;background:#f0f6fc;color:#114d85!important;border:1px solid #c5d9eb;border-radius:11px;font-size:13px;line-height:1.25;font-weight:750;padding:10px 13px;cursor:pointer;min-height:41px;white-space:normal;font-family:inherit}
.rstv-channel:focus-visible,.rstv-copy-number:focus-visible{outline:2px solid #1678d1;outline-offset:2px}
.rstv-channel:hover{background:#e2f0fc}
.rstv-channel--active{background:#1473c7;color:white!important;border-color:#1473c7}
.rstv-channel--active:hover{background:#0861ae}
.rstv-max-help{margin-top:9px;border:1px solid #c9dcef;border-radius:11px;background:#f2f8ff;padding:10px;display:flex;gap:12px;align-items:center;flex-wrap:wrap;font-size:12px;line-height:1.5;color:#234c72}
.rstv-max-help[hidden]{display:none!important}
.rstv-copy-number{background:#fff;border:1px solid #b7d1ea;border-radius:9px;font:inherit;font-weight:700;color:#1160a7;padding:7px 10px;cursor:pointer}
.rstv-summary-details>summary{font-size:13px;font-weight:800;cursor:pointer;color:#164e81}
.rstv-summary-details>p{margin-top:10px}
.rstv-result{padding:11px 14px}
.rstv-log{flex:0 1 auto;max-height:240px;min-height:102px}
@media(max-width:570px){.rstv-channels{padding:10px 14px}.rstv-channel-buttons{display:grid;grid-template-columns:1fr 1fr}.rstv-channel:first-child{grid-column:1/3}.rstv-channel{font-size:12px;padding:9px}.rstv-max-help{display:block}.rstv-copy-number{margin-top:7px}}


/* v0.4.0: compact callback CTA + private phone form. */
.rstv-window{position:relative}
.rstv-callback-trigger{font-size:12px;padding:9px 12px;white-space:normal}
.rstv-callback-panel{position:absolute;inset:0;z-index:5;overflow-y:auto;background:#fff;padding:25px 26px 30px;display:flex;flex-direction:column;gap:12px;box-sizing:border-box}
.rstv-callback-panel[hidden]{display:none!important}
.rstv-callback-header{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid #e2eaf2;padding-bottom:10px}
.rstv-callback-header h3{margin:0;color:#142b47;font-size:22px;line-height:1.3}
.rstv-callback-intro{margin:0;color:#4c6580;line-height:1.6;font-size:14px}
.rstv-callback-label{font-weight:750;color:#314b69;font-size:14px}
.rstv-callback-phone{width:100%;flex:none;font-size:18px;padding:13px 15px;box-sizing:border-box}
.rstv-consent-label{display:flex;align-items:flex-start;gap:10px;cursor:pointer;color:#243f5c;font-size:14px;line-height:1.5}
.rstv-consent-label input{flex:none;width:18px;height:18px;margin-top:2px;accent-color:#1373ca}
.rstv-legal-links{display:flex;flex-wrap:wrap;gap:8px 15px;font-size:13px}
.rstv-legal-links a{color:#1468b4;text-decoration:underline}
.rstv-callback-note{margin:0;color:#647d95;font-size:12px;line-height:1.5}
.rstv-callback-status{min-height:20px;font-size:13px;color:#8e4217;line-height:1.5}
.rstv-callback-success{color:#0b7144;font-weight:700}
.rstv-callback-send{align-self:flex-start;min-width:180px}
.rstv-callback-send[hidden]{display:none!important}
.rstv-callback-send:disabled{opacity:.6;cursor:not-allowed}
@media(max-width:570px){.rstv-callback-panel{padding:18px 17px 24px}.rstv-callback-header h3{font-size:19px}.rstv-callback-trigger{width:100%}.rstv-foot{justify-content:center}.rstv-foot label{margin-right:auto}}

.rstv-honeypot{position:absolute!important;left:-99999px!important;opacity:0!important;pointer-events:none!important;width:1px;height:1px}

/* v0.5.1: mobile voice usability and geolocation */
.rstv-btn--mic{min-width:62px;min-height:60px;font-size:28px;line-height:1;display:inline-flex;justify-content:center;align-items:center;flex-shrink:0}
.rstv-btn--mic[aria-pressed=true]{background:#cfe8ff;border:2px solid #0c6fc6;color:#0757a6}
.rstv-controls .rstv-btn:not(.rstv-btn--mic){min-height:55px}
.rstv-location-button{margin:0 22px 13px;align-self:flex-start;background:#e9f4ff;color:#0d5caa;border:1px solid #bad4eb;padding:12px 16px;font-size:14px}
.rstv-location-button[hidden]{display:none!important}
.rstv-listening-panel{flex-shrink:0}
.rstv-listening-panel:not([hidden]) .rstv-waveform>i{animation:rstv-voice-wave .9s ease-in-out infinite alternate}
.rstv-listening-panel .rstv-waveform>i:nth-child(3n){animation-delay:.23s}
.rstv-listening-panel .rstv-waveform>i:nth-child(4n){animation-delay:.49s}
@keyframes rstv-voice-wave{from{height:5px}to{height:25px}}
@media(max-width:570px){
  .rstv-btn--mic{min-width:64px;min-height:62px;font-size:30px}
  .rstv-controls .rstv-btn:not(.rstv-btn--mic){font-size:13px;padding:10px}
  .rstv-location-button{margin:0 14px 12px;width:calc(100% - 28px)}
}
@media(prefers-reduced-motion:reduce){.rstv-listening-panel .rstv-waveform>i{animation:none}}

/* v0.5.3: approved truck logo, visibly larger mic and balanced reset button */
.rstv-logo{width:56px;height:56px;flex:0 0 56px;background:transparent;border-radius:14px;overflow:hidden}
.rstv-logo-image{display:block;width:100%;height:100%;object-fit:contain}
.rstv-btn--mic{min-width:76px;min-height:70px;padding:9px;display:inline-flex;align-items:center;justify-content:center}
.rstv-btn--mic svg{display:block;width:46px;height:46px}
.rstv-btn--restart{font-size:14px!important;font-weight:500!important;line-height:1.35;min-width:0;padding:10px 14px;min-height:42px;background:#e8f2fc;color:#0b5599;border:1px solid #b4d1ea}
.rstv-btn--restart:hover{background:#dceefc}
.rstv-btn--restart:focus-visible,.rstv-btn--mic:focus-visible{outline:3px solid #1477cf;outline-offset:2px}
@media(max-width:570px){
  .rstv-logo{width:48px;height:48px;flex-basis:48px}
  .rstv-btn--mic{min-width:72px;min-height:68px}
  .rstv-btn--mic svg{width:44px;height:44px}
  .rstv-btn--restart{font-size:13px!important;min-height:40px;padding:8px 11px}
}

/* 0.5.4: mandatory city selection before sending to team dispatcher. */
.rstv-callback-city{width:100%;flex:none;min-height:48px;padding:11px 14px;font-size:15px;color:#163b5b}


/* 0.5.5: visible city selection before conversation and routed request. */
.rstv-city-panel{background:#f4f9ff;border-bottom:1px solid #d7e6f5;padding:12px 22px;color:#163b5e}
.rstv-city-panel--chosen{background:#ecf6ff}
.rstv-city-row{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}
.rstv-city-texts{min-width:0;flex:1}
.rstv-city-summary{display:block;font-size:15px;font-weight:800;color:#0c4f91;line-height:1.4}
.rstv-city-description{font-size:12px;line-height:1.5;color:#476984;margin-top:3px}
.rstv-city-change{appearance:none;background:#fff;border:1px solid #a7ccee;border-radius:10px;color:#0959a4;cursor:pointer;font:inherit;font-size:12px;font-weight:700;padding:8px 10px;white-space:nowrap}
.rstv-city-change[hidden],.rstv-city-choices[hidden]{display:none!important}
.rstv-city-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;margin-top:12px}
.rstv-city-choice{appearance:none;border:1px solid #c1d8f0;background:#fff;border-radius:9px;color:#104e83;cursor:pointer;min-height:39px;padding:8px;font:inherit;font-size:12px;font-weight:750;line-height:1.2}
.rstv-city-choice:hover{background:#e5f3ff}
.rstv-city-choice:focus-visible,.rstv-city-change:focus-visible{outline:3px solid #1477cf;outline-offset:2px}
.rstv-channel[aria-disabled="true"]{opacity:.56;cursor:not-allowed}
@media(max-width:570px){.rstv-city-panel{padding:10px 14px}.rstv-city-row{gap:6px}.rstv-city-summary{font-size:14px}.rstv-city-description{font-size:11px}.rstv-city-choices{grid-template-columns:repeat(2,minmax(0,1fr))}.rstv-city-change{font-size:11px;padding:8px}}

/* Keep city selection and the phone CTA reachable on mobile and small laptop windows. */
.rstv-window{max-height:min(96vh,880px);overflow-y:auto;overscroll-behavior:contain}
.rstv-log{min-height:70px}
@media(max-width:570px){.rstv-window{max-height:96vh;overflow-y:auto}.rstv-city-choices{max-height:28vh;overflow-y:auto}}

/* v0.6.0 — emphasize direct connection with the specialist, both in contact choice and callback form. */
.rstv-direct-note{margin:0;padding:11px 22px;background:#eef6ff;color:#244766;font-size:13px;line-height:1.55;border-bottom:1px solid #c7dff5;overflow-wrap:anywhere}
.rstv-direct-note strong{font-weight:850;color:#0c5799}
.rstv-direct-note--callback{padding:12px 14px;border:1px solid #c7dff5;border-left:3px solid #167bc9;border-radius:0 10px 10px 0}
@media(max-width:570px){.rstv-direct-note{padding:10px 14px;font-size:12px}.rstv-direct-note--callback{padding:10px 12px}}

/* v0.6.6: a single microphone next to the reply field; no separate audio recorder */
.rstv-answer-area{resize:vertical;min-height:58px;max-height:145px;line-height:1.45;box-sizing:border-box}
@media(max-width:570px){.rstv-answer-area{min-height:60px}}

/* 0.7.7 — first select a city, then show the routed conversation. */
.rstv-window.rstv-stage--city{max-height:min(94vh,790px)}
.rstv-window.rstv-stage--city > :not(.rstv-header):not(.rstv-city-panel){display:none!important}
.rstv-window.rstv-stage--city .rstv-city-panel{background:#f4f9ff;border-bottom:0;padding:22px 24px 27px;overflow-y:auto;max-height:70vh}
.rstv-window.rstv-stage--city .rstv-city-summary{font-size:19px;line-height:1.35}
.rstv-window.rstv-stage--city .rstv-city-description{font-size:14px;margin-top:6px}
.rstv-window.rstv-stage--city .rstv-city-choices{gap:10px;margin-top:18px;max-height:none;overflow:visible}
.rstv-window.rstv-stage--city .rstv-city-choice{min-height:51px;font-size:14px;border-radius:12px}
.rstv-channel-buttons{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px}
.rstv-channel-buttons .rstv-channel{display:flex;gap:7px;white-space:nowrap;min-width:0;min-height:42px}
.rstv-channel-icon{display:block;width:19px;height:19px;flex:0 0 19px}
.rstv-channel--phone{background:#0e70c9!important;border-color:#0e70c9!important;color:#fff!important}
.rstv-callback-chosen-city{background:#eef6ff;border:1px solid #c5d9eb;border-radius:10px;padding:10px 12px;color:#284b6a;font-size:14px}
.rstv-callback-chosen-city strong{color:#0c4f91}
@media(max-width:570px){
  .rstv-window.rstv-stage--city .rstv-city-panel{padding:18px 15px 24px;max-height:72vh}
  .rstv-window.rstv-stage--city .rstv-city-summary{font-size:17px}
  .rstv-window.rstv-stage--city .rstv-city-description{font-size:13px}
  .rstv-window.rstv-stage--city .rstv-city-choice{font-size:13px}
  .rstv-channel-buttons{grid-template-columns:repeat(2,minmax(0,1fr))}
  .rstv-channel-buttons .rstv-channel:first-child{grid-column:auto}
  .rstv-channel-buttons .rstv-channel{font-size:12px;padding:10px 7px}
}
@media(max-width:365px){.rstv-channel-buttons{grid-template-columns:repeat(2,minmax(0,1fr))}.rstv-channel-buttons .rstv-channel{gap:5px;font-size:11px;padding:9px 5px}.rstv-channel-icon{width:17px;height:17px;flex-basis:17px}}

/* 0.7.7: callback joins direct contact buttons; no duplicate in the footer. */
.rstv-channel--callback{background:#0e70c9!important;border-color:#0e70c9!important;color:#fff!important;font-size:13px;white-space:normal!important}
.rstv-channels .rstv-channel--callback:hover,.rstv-channels .rstv-channel--phone:hover{background:#095aa6!important}
.rstv-window .rstv-warning{padding:8px 17px;font-size:11px}
@media(max-width:570px){.rstv-channel-buttons--odd > .rstv-channel:last-child{grid-column:1/-1}.rstv-window .rstv-warning{padding:8px 14px}.rstv-callback-trigger{width:auto}}


/* 0.7.8 — balanced direct-contact grid at every width. */
/* The assistant modal is intentionally only ~650 CSS px wide on desktop.
   Choose 3+2 for five actions and 3+3 for six, not a cramped 5/6-col row. */
@media(min-width:650px){
  .rstv-channel-buttons{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:8px}
  .rstv-channel-buttons>.rstv-channel{grid-column:span 2;min-width:0}
  .rstv-channel-buttons[data-count="5"]>.rstv-channel:nth-child(n+4){grid-column:span 3}
  .rstv-channel-buttons[data-count="4"]>.rstv-channel{grid-column:span 3}
  .rstv-channel-buttons[data-count="2"]>.rstv-channel{grid-column:span 3}
  .rstv-channel-buttons[data-count="1"]>.rstv-channel{grid-column:1/-1}
}
/* Mobile: exact two-column grid and an odd last action spanning both. */
@media(max-width:649px){
  .rstv-channel-buttons{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .rstv-channel-buttons>.rstv-channel{grid-column:auto;min-width:0}
  .rstv-channel-buttons[data-count="1"]>.rstv-channel,
  .rstv-channel-buttons[data-count="3"]>.rstv-channel:last-child,
  .rstv-channel-buttons[data-count="5"]>.rstv-channel:last-child{grid-column:1/-1}
}
/* Avoid long labels pushing the grid beyond its container. */
.rstv-channel-buttons>.rstv-channel{box-sizing:border-box;max-width:100%;overflow-wrap:anywhere;text-align:center}

/* 0.8.2: явная отправка заявки и редактирование черновика без потери диалога */
.rstv-draft-actions{display:flex;gap:9px;flex-wrap:wrap;margin:12px 0 0}
.rstv-draft-send{flex:1 1 210px}
.rstv-draft-edit{background:#eaf3fd;color:#16558e;border:1px solid #b6d4ed;flex:1 1 140px}
.rstv-draft-edit-panel{margin-top:12px;border-top:1px solid #c4d9eb;padding-top:12px}
.rstv-draft-edit-panel[hidden]{display:none!important}
.rstv-draft-edit-label{display:flex;flex-direction:column;gap:6px;font-weight:700;color:#244968;font-size:13px}
.rstv-draft-select{width:100%;padding:10px;border:1px solid #bed4ea;border-radius:9px;font:inherit;background:white;color:#15263d}
.rstv-draft-edit-textarea{width:100%;box-sizing:border-box;margin-top:10px;min-height:84px;resize:vertical}
@media(max-width:570px){.rstv-draft-actions{flex-direction:column}.rstv-draft-actions .rstv-btn{width:100%;flex:0 0 auto;min-height:44px}}

/* 0.8.6: show validation under draft-edit field, not only at bottom of modal. */
.rstv-draft-edit-feedback{margin:8px 0 0;padding:9px 11px;border:1px solid #e6b4a1;border-radius:9px;background:#fff4ee;color:#913818;font-size:14px;line-height:1.4}
.rstv-draft-edit-feedback[hidden]{display:none!important}
