.tc-app{--tc-bg:#ffffff;--tc-soft:#f2f3f1;--tc-line:#d5d8d6;--tc-text:#1e2124;--tc-muted:#555a5f;--tc-head:#3b3f42;--tc-accent:#c8a456;--tc-accent-text:#15171a;--tc-me:#3b3f42;--tc-me-text:#ffffff;--tc-them:#ece7d8;--tc-err:#b3261e;font-family:inherit;font-size:16px;line-height:1.45;color:var(--tc-text);box-sizing:border-box}
.tc-app *,.tc-app *::before,.tc-app *::after{box-sizing:border-box}
.tc-app [hidden]{display:none!important}

/* Кнопка виджета */
.tc-widget{position:fixed;right:20px;bottom:20px;z-index:99990}
.tc-launcher{display:inline-flex;align-items:center;gap:10px;min-height:52px;padding:0 20px;border:0;border-radius:26px;background:var(--tc-accent);color:var(--tc-accent-text);font:inherit;font-weight:600;cursor:pointer;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.tc-launcher:focus-visible{outline:3px solid #1e2124;outline-offset:3px}
.tc-badge{min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:var(--tc-err);color:#fff;font-size:13px;line-height:22px;text-align:center}
.tc-widget.is-open .tc-launcher{display:none}

/* Панель */
.tc-panel{display:flex;flex-direction:column;background:var(--tc-bg);border-radius:8px;overflow:hidden}
.tc-widget .tc-panel{position:fixed;right:20px;bottom:20px;width:400px;max-width:calc(100vw - 32px);height:min(640px,calc(100vh - 40px));box-shadow:0 18px 48px rgba(0,0,0,.35)}
.tc-inline .tc-panel{border:1px solid var(--tc-line);min-height:520px}
.tc-head{display:flex;align-items:center;gap:10px;padding:12px 14px;background:var(--tc-head);color:#fff}
.tc-dot{width:9px;height:9px;border-radius:50%;background:#7bd88f;flex:none}
.tc-title{font-weight:600;white-space:nowrap}
.tc-sub{font-size:13px;color:#d4d5d1;margin-left:auto;text-align:right;line-height:1.25}
.tc-close{display:flex;align-items:center;justify-content:center;width:40px;height:40px;margin-right:-6px;border:0;border-radius:50%;background:transparent;color:#fff;cursor:pointer}
.tc-close:hover{background:rgba(255,255,255,.12)}

/* Стартовая форма */
.tc-start{flex:1;overflow-y:auto;padding:14px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;align-content:start}
.tc-widget .tc-start{grid-template-columns:minmax(0,1fr)}
.tc-tabs{grid-column:1/-1;display:flex;gap:4px;padding:4px;background:var(--tc-soft);border-radius:6px}
.tc-tab{flex:1;min-height:40px;border:0;border-radius:4px;background:transparent;color:var(--tc-muted);font:inherit;font-size:14px;cursor:pointer}
.tc-tab.is-active{background:#fff;color:var(--tc-text);font-weight:600;box-shadow:0 1px 2px rgba(0,0,0,.12)}
.tc-formfields,.tc-row{grid-column:1/-1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.tc-widget .tc-formfields{grid-template-columns:minmax(0,1fr)}
.tc-field{display:flex;flex-direction:column;gap:5px;font-size:14px;color:var(--tc-muted)}
.tc-wide{grid-column:1/-1}
.tc-field input,.tc-field select,.tc-field textarea,.tc-msg input{width:100%;min-height:44px;padding:8px 12px;border:1px solid var(--tc-line);border-radius:4px;background:#fff;color:var(--tc-text);font:inherit;font-size:16px}
.tc-field textarea{resize:vertical;min-height:84px}
.tc-field :focus,.tc-msg input:focus{outline:2px solid var(--tc-accent);outline-offset:0;border-color:var(--tc-accent)}
.tc-drop{position:relative;display:flex;align-items:center;justify-content:center;min-height:72px;padding:10px;border:1px dashed #8a8f92;border-radius:4px;background:var(--tc-soft);color:var(--tc-text);text-align:center;font-size:15px}
.tc-drop input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.tc-consent{grid-column:1/-1;display:flex;gap:10px;align-items:flex-start;font-size:14px;color:var(--tc-muted)}
.tc-consent input{width:20px;height:20px;margin:1px 0 0;flex:none;accent-color:var(--tc-head)}
.tc-consent a,.tc-policy a{color:inherit;text-decoration:underline}
.tc-policy{grid-column:1/-1;margin:-4px 0 0;font-size:13px;color:var(--tc-muted)}
.tc-trust{margin:0 0 8px;color:var(--tc-text)}
.tc-hp{position:absolute!important;left:-9999px!important;width:1px;height:1px;opacity:0}
.tc-submit{grid-column:1/-1;min-height:52px;border:0;border-radius:4px;background:var(--tc-accent);color:var(--tc-accent-text);font:inherit;font-weight:600;font-size:17px;cursor:pointer}
.tc-submit:disabled,.tc-send:disabled{opacity:.6;cursor:wait}
.tc-error{grid-column:1/-1;margin:0;padding:8px 12px;border-radius:4px;background:#fbe9e7;color:var(--tc-err);font-size:14px}

/* Переписка */
.tc-chat{flex:1;display:flex;flex-direction:column;min-height:0}
.tc-log{flex:1;overflow-y:auto;padding:14px;display:flex;flex-direction:column;gap:10px;background:var(--tc-soft)}
.tc-note{align-self:center;max-width:92%;padding:8px 12px;border-radius:6px;background:#fff;color:var(--tc-muted);font-size:14px;text-align:center}
.tc-bubble{max-width:85%;padding:9px 13px;border-radius:14px;word-wrap:break-word;white-space:pre-wrap}
.tc-me{align-self:flex-end;background:var(--tc-me);color:var(--tc-me-text);border-top-right-radius:4px}
.tc-them{align-self:flex-start;background:var(--tc-them);color:var(--tc-text);border-top-left-radius:4px}
.tc-who{font-size:12px;font-weight:600;color:var(--tc-muted);margin-bottom:2px}
.tc-photo{display:block;margin-top:6px}
.tc-photo img{display:block;max-width:220px;max-height:180px;border-radius:8px;object-fit:cover}
.tc-time{font-size:11px;opacity:.7;text-align:right;margin-top:3px}
.tc-compose{display:flex;gap:8px;padding:10px;border-top:1px solid var(--tc-line);background:#fff}
.tc-msg{flex:1;display:flex}
.tc-msg input{border-radius:22px;padding:0 16px}
.tc-attach,.tc-send{position:relative;flex:none;display:flex;align-items:center;justify-content:center;width:44px;height:44px;border-radius:50%;cursor:pointer}
.tc-attach{border:1px solid var(--tc-line);color:var(--tc-head);background:#fff}
.tc-attach input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.tc-send{border:0;background:var(--tc-head);color:#fff}
.tc-chat .tc-error{margin:0 10px 10px}
.tc-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Телефон: виджет на весь экран */
@media (max-width:560px){
  .tc-widget{right:12px;bottom:12px}
  .tc-widget .tc-panel{inset:0;right:0;bottom:0;width:100%;max-width:none;height:100%;border-radius:0}
  .tc-inline .tc-start,.tc-inline .tc-formfields,.tc-row{grid-template-columns:minmax(0,1fr)}
}
