/* Unero — окно чата виджета сайта. Цвет компании — --c. */
:root {
  --c: #2F6FED;
  --bg: #ffffff;
  --bg2: #F4F5F7;
  --line: #E4E6EB;
  --ink: #1C1E21;
  --ink2: #65676B;
  --in: var(--c);
  --out: #F0F2F5;
  --err: #E5484D;
  --ok: #30A46C;
  --r: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
body.mode-page { background: var(--bg2); }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }

.app {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.mode-page .app {
  max-width: 720px;
  margin: 0 auto;
  height: 100%;
  box-shadow: 0 0 0 1px var(--line);
}
@media (min-width: 760px) {
  .mode-page .app { height: calc(100% - 48px); margin-top: 24px; border-radius: var(--r); }
}

/* Шапка */
.hd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px 16px 20px;
  background: var(--c);
  color: #fff;
  flex: none;
}
.hd-main { flex: 1; min-width: 0; }
.hd-title { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hd-sub { font-size: 12.5px; opacity: .88; display: flex; align-items: center; gap: 6px; margin-top: 2px; min-width: 0; }
.hd-sub span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.55); flex: none; }
.dot.on { background: #4ADE80; box-shadow: 0 0 0 2px rgba(74,222,128,.3); }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
  color: var(--ink2);
}
.icon-btn svg { width: 22px; height: 22px; fill: currentColor; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
.hd .icon-btn { color: #fff; }
.hd .icon-btn:hover { background: rgba(255,255,255,.16); }
.icon-btn:focus-visible, .send-btn:focus-visible, .btn:focus-visible, .msgr-btn:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }

/* Мессенджеры */
.msgr {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex: none;
}
.msgr-label { font-size: 12.5px; color: var(--ink2); margin-right: 2px; }
.msgr-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px 5px 8px; border-radius: 999px; border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 500; text-decoration: none; background: var(--bg);
}
.msgr-btn:hover { background: var(--bg2); }
.msgr-btn svg { width: 16px; height: 16px; }
.msgr-telegram svg { fill: #229ED9; }
.msgr-whatsapp svg { fill: #25D366; }
.msgr-max svg { fill: #7B5CFF; }

.banner {
  display: none;
  padding: 8px 16px;
  font-size: 13px;
  background: #FFF4E5;
  color: #8A4B00;
  border-bottom: 1px solid #FFE1B3;
  flex: none;
}
.banner.ok { background: #E9F9EF; color: #1B6B3F; border-color: #C8EED6; }

/* Лента */
.list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.day {
  align-self: center;
  font-size: 12px;
  color: var(--ink2);
  background: var(--bg2);
  border-radius: 999px;
  padding: 3px 10px;
  margin: 10px 0 6px;
}
.row { display: flex; flex-direction: column; max-width: 82%; }
.row.in { align-self: flex-end; align-items: flex-end; }
.row.out { align-self: flex-start; align-items: flex-start; }
.sender { font-size: 12px; color: var(--ink2); margin: 6px 0 2px 12px; }
.bubble {
  padding: 8px 12px 6px;
  border-radius: 18px;
  background: var(--out);
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  max-width: 100%;
}
.row.in .bubble { background: var(--in); color: #fff; border-bottom-right-radius: 6px; }
.row.out .bubble { border-bottom-left-radius: 6px; }
.row.in .bubble a { color: #fff; }
.row.out .bubble a { color: var(--c); }
.bubble.err { background: #FDECEC; color: var(--err); cursor: pointer; }
.meta { font-size: 11px; opacity: .7; text-align: right; margin-top: 2px; white-space: nowrap; }
.err-hint, .read-hint { font-size: 11.5px; color: var(--ink2); margin: 2px 4px 0; }
.err-hint { color: var(--err); }

.att-img { display: block; margin: 0 -8px 6px; border-radius: 12px; overflow: hidden; max-width: 260px; }
.att-img img { display: block; width: 100%; height: auto; max-height: 320px; object-fit: cover; background: rgba(0,0,0,.06); }
.att-file {
  display: flex; align-items: center; gap: 8px; text-decoration: none;
  padding: 6px 4px; margin-bottom: 2px; min-width: 180px;
}
.att-file svg { width: 28px; height: 28px; fill: currentColor; opacity: .85; flex: none; }
.att-meta { display: flex; flex-direction: column; min-width: 0; }
.att-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.att-size { font-size: 11.5px; opacity: .75; }

/* Анкета */
.card {
  align-self: stretch;
  margin: 8px 0;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card-title { font-weight: 600; font-size: 15px; }
.card-hint { color: var(--ink2); font-size: 12.5px; margin-top: -4px; white-space: pre-wrap; }
.fld { display: flex; flex-direction: column; gap: 4px; }
.fld-label { font-size: 12.5px; color: var(--ink2); }
.fld input, .fld textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px;
  background: var(--bg); outline: none; resize: vertical;
}
.fld textarea { min-height: 64px; }
.fld input:focus, .fld textarea:focus { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.fld.bad input, .fld.bad textarea { border-color: var(--err); }
.fld-err { font-size: 12px; color: var(--err); min-height: 0; }
.fld-err:empty { display: none; }
.consent { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink2); cursor: pointer; }
.consent input { margin: 2px 0 0; accent-color: var(--c); }
.consent a { color: var(--c); }
.card-err { color: var(--err); font-size: 12.5px; }
.card-err:empty { display: none; }
.card-actions { display: flex; align-items: center; gap: 12px; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 16px; background: var(--c); color: #fff;
  font-weight: 600; cursor: pointer;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-link { border: 0; background: none; color: var(--ink2); cursor: pointer; padding: 6px; }
.btn-link:hover { color: var(--ink); }

/* Поле ввода */
.cmp {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 8px 8px 10px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  flex: none;
}
.input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px 14px;
  min-height: 38px;
  max-height: 120px;
  resize: none;
  outline: none;
  background: var(--bg2);
  line-height: 1.4;
}
.input:focus { border-color: var(--c); background: var(--bg); }
.send-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--c);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none;
}
.send-btn svg { width: 18px; height: 18px; fill: #fff; margin-left: 2px; }
.brand {
  display: none;
  text-align: center;
  font-size: 11px;
  color: var(--ink2);
  padding: 0 0 8px;
  text-decoration: none;
  background: var(--bg);
}
.brand:hover { color: var(--ink); }
.mode-frame .app { padding-bottom: env(safe-area-inset-bottom); }
/* iPhone увеличивает страницу при фокусе на поле с шрифтом меньше 16px. */
@media (max-width: 480px) {
  .input, .fld input, .fld textarea { font-size: 16px; }
}
