/* ═══════════════════════════════════════════════════════
   DIVERGENT IA — WIDGET v1.0.0
   Design: Intercom-level polish
═══════════════════════════════════════════════════════ */

/* ── Brand font ──────────────────────────────────────── */
@font-face {
  font-family: 'Rosnoc';
  src: url('../fonts/Rosnoc.otf') format('opentype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ──────────────────────────────────────────── */
#mptia-root {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  --c1: #00cacc;
  --c2: #0077b6;

  /* RGB components so alpha variants track --c1/--c2 changes */
  --c1-r: 0;   --c1-g: 202; --c1-b: 204;
  --c2-r: 0;   --c2-g: 119; --c2-b: 182;
  --c1-10: rgba(var(--c1-r), var(--c1-g), var(--c1-b), 0.10);
  --c1-12: rgba(var(--c1-r), var(--c1-g), var(--c1-b), 0.12);
  --c1-14: rgba(var(--c1-r), var(--c1-g), var(--c1-b), 0.14);
  --c1-18: rgba(var(--c1-r), var(--c1-g), var(--c1-b), 0.18);
  --c1-30: rgba(var(--c1-r), var(--c1-g), var(--c1-b), 0.30);
  --c1-50: rgba(var(--c1-r), var(--c1-g), var(--c1-b), 0.50);
  --c2-30: rgba(var(--c2-r), var(--c2-g), var(--c2-b), 0.30);
  --c2-35: rgba(var(--c2-r), var(--c2-g), var(--c2-b), 0.35);
  --c2-40: rgba(var(--c2-r), var(--c2-g), var(--c2-b), 0.40);
  --c2-50: rgba(var(--c2-r), var(--c2-g), var(--c2-b), 0.50);

  --surf0: #ffffff;
  --surf1: #f5f7fa;
  --bd: #e8edf5;
  --txt1: #0b1320;
  --txt2: #5a6a82;
  --ghost: #a8b5c8;
  --head: #0b1829;
  --head2: #0d2040;
  --bot-sh: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.05);
  --usr-sh: 0 2px 14px var(--c2-30, rgba(0,119,182,.3));
  --win-sh: 0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.1), 0 0 0 1px rgba(0,0,0,.06);
  --r: 20px;
  --rb: 18px;
  --spring: cubic-bezier(.34,1.52,.64,1);
  --out: cubic-bezier(.16,1,.3,1);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --gap-diff: 12px;
}

/* Override with color-mix only where supported */
@supports (color: color-mix(in srgb, red, blue)) {
  #mptia-root {
    --c1-10: color-mix(in srgb, var(--c1) 10%, transparent);
    --c1-12: color-mix(in srgb, var(--c1) 12%, transparent);
    --c1-14: color-mix(in srgb, var(--c1) 14%, transparent);
    --c1-18: color-mix(in srgb, var(--c1) 18%, transparent);
    --c1-30: color-mix(in srgb, var(--c1) 30%, transparent);
    --c1-50: color-mix(in srgb, var(--c1) 50%, transparent);
    --c2-30: color-mix(in srgb, var(--c2) 30%, transparent);
    --c2-35: color-mix(in srgb, var(--c2) 35%, transparent);
    --c2-40: color-mix(in srgb, var(--c2) 40%, transparent);
    --c2-50: color-mix(in srgb, var(--c2) 50%, transparent);
  }
}

#mptia-root, #mptia-root * {
  box-sizing: border-box; margin: 0; padding: 0;
}

#mptia-root {
  font-family: var(--font);
  position: fixed !important;
  bottom: 24px; right: 24px;
  z-index: 2147483646;
}
#mptia-root.mptia-left { right: auto; left: 24px; }

/* ── Toggle Button ───────────────────────────────────── */
#mptia-btn {
  position: relative;
  width: 60px; height: 60px;
  border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: 0 4px 20px var(--c2-35, rgba(0,119,182,.35)), 0 1px 4px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.22);
  display: flex; align-items: center; justify-content: center;
  outline: none; -webkit-tap-highlight-color: transparent;
  transition: transform .28s var(--spring, cubic-bezier(.34,1.52,.64,1)), box-shadow .22s ease;
}
#mptia-btn:hover { transform: scale(1.09); box-shadow: 0 8px 28px var(--c2-40, rgba(0,119,182,.4)), 0 2px 8px rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.22); }
#mptia-btn:active { transform: scale(.9); transition-duration: .08s; }
#mptia-btn .ico { position: absolute; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;   transition: opacity .22s ease, transform .28s var(--spring, cubic-bezier(.34,1.52,.64,1)); }
#mptia-btn .ico svg { width: 100%; height: 100%; fill: #fff; }
#mptia-btn .ico-open  { opacity: 1; transform: scale(1) rotate(0deg); }
#mptia-btn .ico-close { opacity: 0; transform: scale(.3) rotate(-90deg); }
#mptia-root.open #mptia-btn .ico-open  { opacity: 0; transform: scale(.3) rotate(90deg); }
#mptia-root.open #mptia-btn .ico-close { opacity: 1; transform: scale(1) rotate(0deg); }

#mptia-dot {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px;
  background: #ff3b5c; border-radius: 11px; border: 2.5px solid #fff;
  display: none; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #fff;
  padding: 0 6px; line-height: 1;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(255,59,92,.35);
}
#mptia-dot.on {
  display: flex;
  animation: mptia-badge-pop .4s cubic-bezier(.34,1.52,.64,1) forwards,
             mptia-badge-attention 2.6s ease 1s infinite;
}
#mptia-dot::after {
  content: ''; position: absolute; inset: -4px;
  border-radius: 50%; background: rgba(255,59,92,.2);
  animation: mptia-badge-pulse 2.4s ease infinite 1.2s;
  z-index: -1;
}
#mptia-dot:empty::after { display: none; }
@keyframes mptia-badge-pop {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  60% { transform: scale(1.25) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes mptia-badge-attention {
  0%, 100% { transform: scale(1); }
  5% { transform: scale(1.15); }
  10% { transform: scale(1); }
  15% { transform: scale(1.1); }
  20% { transform: scale(1); }
}
@keyframes mptia-badge-pulse { 0%,100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.8); opacity: 0; } }

/* ── Window ──────────────────────────────────────────── */
#mptia-win {
  position: absolute; bottom: 76px; right: 0;
  width: 375px; height: 590px;
  display: flex; flex-direction: column;
  background: var(--surf1);
  border-radius: var(--r); overflow: hidden;
  box-shadow: var(--win-sh);
  opacity: 0; transform: translateY(18px) scale(.95);
  transform-origin: bottom right; pointer-events: none;
  transition: opacity .22s ease, transform .28s var(--out, cubic-bezier(.16,1,.3,1));
  will-change: opacity, transform;
}
#mptia-root.mptia-left #mptia-win { right: auto; left: 0; transform-origin: bottom left; }
#mptia-root.open #mptia-win { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* ── Header ──────────────────────────────────────────── */
#mptia-head {
  flex-shrink: 0;
  background: linear-gradient(150deg, var(--head) 0%, var(--head2) 55%, #091520 100%);
  padding: 18px 16px 16px;
  display: flex; align-items: center; gap: 12px;
  position: relative; overflow: hidden;
}
#mptia-head::before {
  content: ''; position: absolute;
  top: -40px; right: -20px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, var(--c1-14, rgba(0,202,204,.14)) 0%, transparent 70%);
  pointer-events: none;
}
#mptia-head::after {
  content: ''; position: absolute;
  bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--c1-50, rgba(0,202,204,.5)) 40%, var(--c2-50, rgba(0,119,182,.5)) 60%, transparent);
}

#mptia-hav {
  flex-shrink: 0;
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.18);
  position: relative;
}
#mptia-hav::after { content: ''; position: absolute; inset: 0; border-radius: 14px; border: 1px solid rgba(255,255,255,.14); }
#mptia-hav svg { width: 22px; height: 22px; fill: #fff; }
#mptia-hav img { width: 46px; height: 46px; object-fit: cover; }

#mptia-hinfo { flex: 1; min-width: 0; }
#mptia-hname {
  color: #fff; font-size: 15px; font-weight: 600;
  letter-spacing: -.025em; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#mptia-hstatus { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
#mptia-hdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #20e070; flex-shrink: 0;
  box-shadow: 0 0 0 0 rgba(32,224,112,.6);
  animation: mptia-pulse 2.8s ease-out infinite;
}
@keyframes mptia-pulse { 0% { box-shadow: 0 0 0 0 rgba(32,224,112,.6); } 70% { box-shadow: 0 0 0 7px rgba(32,224,112,0); } 100% { box-shadow: 0 0 0 0 rgba(32,224,112,0); } }
@keyframes mpt-spin-dot { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }
#mptia-hstatus span { color: rgba(255,255,255,.5); font-size: 11.5px; }

#mptia-hx {
  flex-shrink: 0;
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.08); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .18s; outline: none;
  -webkit-tap-highlight-color: transparent;
}
#mptia-hx:hover { background: rgba(255,255,255,.18); transform: rotate(90deg); }
#mptia-hx svg { width: 14px; height: 14px; stroke: rgba(255,255,255,.75); fill: none; stroke-width: 2.5; stroke-linecap: round; }

/* ── Messages ────────────────────────────────────────── */
#mptia-msgs {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 20px 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surf1);
  scroll-behavior: smooth; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.1) transparent;
}
#mptia-msgs::-webkit-scrollbar { width: 3px; }
#mptia-msgs::-webkit-scrollbar-thumb { background: rgba(0,0,0,.1); border-radius: 3px; }
#mptia-msgs::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.18); }

@keyframes mptia-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

/* Quick reply chips */
#mptia-root .mptia-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 4px 14px 8px 50px;
}
#mptia-root .mptia-chip {
  background: var(--surf0); border: 1px solid var(--c1-30);
  color: var(--c1); border-radius: 16px;
  padding: 5px 12px; font-size: 12.5px; cursor: pointer;
  transition: background .15s, border-color .15s;
  font-family: var(--font);
}
#mptia-root .mptia-chip:hover { background: var(--c1-10); border-color: var(--c1); }

/* Copy-to-clipboard button on bot messages */
#mptia-root .mb-wrap { position: relative; flex: 1; min-width: 0; }
#mptia-root .mb-copy {
  position: absolute; top: 6px; right: 6px;
  background: var(--surf1); border: 1px solid var(--bd);
  border-radius: 6px; padding: 3px 6px;
  font-size: 11px; color: var(--txt2); cursor: pointer;
  opacity: 0; transition: opacity .15s;
  display: flex; align-items: center; gap: 3px;
  font-family: var(--font); z-index: 2;
}
#mptia-root .mb:hover .mb-copy { opacity: 1; }

/* Character counter */
#mptia-char-count {
  font-size: 10px; color: var(--ghost);
  text-align: right; padding: 0 16px 4px;
  display: none;
}
#mptia-char-count.warn { color: #e07020; display: block; }
#mptia-char-count.danger { color: #d03030; display: block; }

/* GDPR consent bar */
#mptia-consent {
  flex-shrink: 0;
  display: none;
  padding: 8px 14px 4px;
  background: var(--surf0);
  border-top: 1px solid var(--bd);
  font-size: 11px; color: var(--txt2); line-height: 1.4;
}
#mptia-consent label { display: flex; align-items: flex-start; gap: 6px; cursor: pointer; }
#mptia-consent input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }

/* Bot row */
#mptia-root .mb {
  display: flex; align-items: flex-end; gap: 8px;
  align-self: stretch; width: 100%;
  animation: mptia-in .22s var(--out, cubic-bezier(.16,1,.3,1)) both;
}
#mptia-root .mb + .mb                       { margin-top: 3px; }
#mptia-root .mu + .mb,
#mptia-root .mwa-wrap + .mb,
#mptia-root .merr + .mb                     { margin-top: 12px; }

#mptia-root .mb-av {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; margin-bottom: 1px;
  box-shadow: 0 1px 5px rgba(0,0,0,.12);
}
#mptia-root .mb-av svg { width: 14px; height: 14px; fill: #fff; }
#mptia-root .mb-av img { width: 28px; height: 28px; object-fit: cover; }
#mptia-root .mb.grp .mb-av { visibility: hidden; }

#mptia-root .mb-txt {
  background: var(--surf0); color: #1a2535;
  padding: 9px 14px;
  border-radius: var(--rb) var(--rb) var(--rb) 5px;
  font-size: 13.5px; font-weight: 400; line-height: 1.6;
  word-break: break-word; overflow-wrap: anywhere; white-space: pre-line;
  box-shadow: var(--bot-sh); border: 1px solid rgba(0,0,0,.04);
  min-width: 0; flex: 1 1 auto; max-width: 100%;
}
/* Grouped bot bubbles — middle of sequence: no tail */
#mptia-root .mb.grp .mb-txt {
  border-radius: 5px var(--rb) var(--rb) 5px;
}
/* Last bot bubble in a group gets the tail back */
#mptia-root .mb.grp-last .mb-txt {
  border-radius: 5px var(--rb) var(--rb) 5px;
}
/* First bot bubble — tail only at bottom-left */
#mptia-root .mb.grp-first .mb-txt {
  border-radius: var(--rb) var(--rb) var(--rb) 5px;
}
#mptia-root .mb-txt a { color: var(--c2); text-decoration: underline; }
#mptia-root .mb-ts {
  color: var(--ghost); font-size: 9.5px; letter-spacing: .02em;
  margin-top: 3px; padding-left: 36px; user-select: none;
}
#mptia-root .mb.grp .mb-ts { padding-left: 0; }

/* User row */
#mptia-root .mu {
  display: flex; justify-content: flex-end;
  align-self: flex-end; max-width: min(80%, 285px);
  animation: mptia-in .22s var(--out) both;
}
#mptia-root .mu + .mu                       { margin-top: 3px; }
#mptia-root .mb + .mu,
#mptia-root .mwa-wrap + .mu,
#mptia-root .merr + .mu                     { margin-top: 12px; }

#mptia-root .mu-txt {
  background: linear-gradient(145deg, var(--c1), var(--c2)); color: #fff;
  padding: 9px 14px;
  border-radius: var(--rb) var(--rb) 5px var(--rb);
  font-size: 13.5px; line-height: 1.55;
  word-break: break-word; overflow-wrap: anywhere; white-space: pre-line;
  box-shadow: var(--usr-sh); min-width: 0;
}
/* Grouped user bubbles — middle: no tail */
#mptia-root .mu.grp .mu-txt {
  border-radius: var(--rb) 5px 5px var(--rb);
}
/* First user bubble */
#mptia-root .mu.grp-first .mu-txt {
  border-radius: var(--rb) var(--rb) 5px var(--rb);
}
/* Last user bubble in group */
#mptia-root .mu.grp-last .mu-txt {
  border-radius: var(--rb) 5px 5px var(--rb);
}
#mptia-root .mu-txt a { color: rgba(255,255,255,.85); text-decoration: underline; }
#mptia-root .mu-ts {
  color: var(--ghost); font-size: 9.5px; letter-spacing: .02em;
  margin-top: 3px; text-align: right; user-select: none;
}

/* Typing indicator */
#mptia-root .mptyp {
  display: flex; align-items: flex-end; gap: 8px;
  align-self: flex-start; margin-top: 10px;
  animation: mptia-in .2s ease both;
}
#mptia-root .mptyp-bub {
  background: var(--surf0);
  border-radius: var(--rb) var(--rb) var(--rb) 5px;
  padding: 12px 15px; display: flex; gap: 5px; align-items: center;
  box-shadow: var(--bot-sh); border: 1px solid rgba(0,0,0,.04);
}
#mptia-root .mptyp-bub {
  display: flex; gap: 4px; padding: 11px 14px;
}
#mptia-root .mptyp-bub span {
  display: block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--ghost);
  animation: mptia-dot-bounce .9s ease infinite;
}
#mptia-root .mptyp-bub span:nth-child(2) { animation-delay: .15s; }
#mptia-root .mptyp-bub span:nth-child(3) { animation-delay: .30s; }
@keyframes mptia-dot-bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

/* Date divider */
#mptia-root .mptia-date-div {
  display: flex; align-items: center; gap: 10px;
  align-self: stretch; margin: 8px 0;
}
#mptia-root .mptia-date-div::before,
#mptia-root .mptia-date-div::after { content: ''; flex: 1; height: 1px; background: var(--bd); }
#mptia-root .mptia-date-div span { color: var(--ghost); font-size: 11px; white-space: nowrap; }

/* Error card */
#mptia-root .merr {
  align-self: flex-start; display: flex; align-items: center; gap: 10px;
  background: var(--surf0); border: 1px solid #ffd6d6;
  border-radius: 14px; padding: 11px 14px;
  max-width: min(84%, 300px); animation: mptia-in .2s ease both;
  box-shadow: var(--bot-sh); margin-top: 10px;
}
#mptia-root .merr-ico { flex-shrink: 0; width: 15px; height: 15px; }
#mptia-root .merr-ico svg { width: 15px; height: 15px; fill: #e53e3e; }
#mptia-root .merr-txt { color: var(--txt2); font-size: 13px; flex: 1; }
#mptia-root .merr-btn {
  flex-shrink: 0; background: linear-gradient(145deg, var(--c1), var(--c2));
  color: #fff; border: none; border-radius: 20px;
  padding: 5px 13px; font-size: 12px; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  transition: opacity .15s, transform .18s var(--spring, cubic-bezier(.34,1.52,.64,1));
}
#mptia-root .merr-btn:hover { opacity: .88; transform: scale(1.05); }

/* WhatsApp CTA */
#mptia-root .mwa-wrap {
  align-self: flex-start; max-width: min(84%, 300px);
  animation: mptia-in .24s var(--out, cubic-bezier(.16,1,.3,1)) both; margin-top: 10px;
}
#mptia-root .mwa-card {
  background: var(--surf0); border: 1px solid var(--bd);
  border-radius: 16px; padding: 13px 14px;
  box-shadow: var(--bot-sh); display: flex; flex-direction: column; gap: 9px;
}
#mptia-root .mwa-label { color: var(--txt2); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
#mptia-root .mwa-link {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(145deg, #25d366, #1aad4d);
  color: #fff; text-decoration: none; border-radius: 10px;
  padding: 9px 14px; font-size: 13.5px; font-weight: 600;
  font-family: var(--font); box-shadow: 0 3px 12px rgba(37,211,102,.3);
  transition: transform .2s var(--spring, cubic-bezier(.34,1.52,.64,1)), box-shadow .2s ease;
  -webkit-tap-highlight-color: transparent;
}
#mptia-root .mwa-link:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(37,211,102,.4); }
#mptia-root .mwa-link:active { transform: scale(.96); }
#mptia-root .mwa-link svg { width: 17px; height: 17px; fill: #fff; flex-shrink: 0; }

/* ── Input area ──────────────────────────────────────── */
#mptia-input-wrap {
  flex-shrink: 0; background: var(--surf0);
  border-top: 1px solid var(--bd); padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom, 10px));
  overflow: hidden;
}
#mptia-form { display: flex; align-items: flex-end; gap: 8px; width: 100%; }

#mptia-inp {
  flex: 1; background: var(--surf1);
  border: 1.5px solid var(--bd); border-radius: 22px;
  padding: 9px 16px; font-size: 13.5px;
  font-family: var(--font); color: var(--txt1);
  resize: none; outline: none; line-height: 1.5;
  min-height: 40px; max-height: 110px;
  overflow-y: hidden; display: block; width: 100%;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
#mptia-inp:focus { border-color: var(--c1); background: var(--surf0);   box-shadow: 0 0 0 3px var(--c1-12, rgba(0,202,204,.12)); }
#mptia-inp::placeholder { color: var(--ghost); }
#mptia-inp:disabled { opacity: .5; cursor: not-allowed; }

#mptia-sbtn {
  flex-shrink: 0; width: 40px; height: 40px;
  border-radius: 50%; border: none; cursor: pointer;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 10px var(--c2-30, rgba(0,119,182,.3)), inset 0 1px 0 rgba(255,255,255,.2);
  outline: none; -webkit-tap-highlight-color: transparent;
  transition: transform .22s var(--spring, cubic-bezier(.34,1.52,.64,1)), box-shadow .18s ease, opacity .15s;
  position: relative; overflow: hidden;
}
#mptia-sbtn:hover { transform: scale(1.1); box-shadow: 0 4px 18px var(--c2-40, rgba(0,119,182,.4)); }
#mptia-sbtn:active { transform: scale(.88); transition-duration: .07s; }
#mptia-sbtn:disabled { opacity: .3; cursor: not-allowed; transform: none !important; box-shadow: none; pointer-events: none; }
#mptia-sbtn[data-loading] { opacity: 1; cursor: wait; pointer-events: none; transform: none !important; }
#mptia-sbtn svg { width: 17px; height: 17px; fill: #fff; transform: translateX(1px); position: relative; }

/* ── Square shape (Intercom style) ───────────────────── */
#mptia-root.mptia-shape-square #mptia-btn {
  width: 56px; height: 56px;
  border-radius: 16px;
}
#mptia-root.mptia-shape-square #mptia-win {
  border-radius: 14px;
}
#mptia-root.mptia-shape-square #mptia-hav {
  border-radius: 12px;
}
#mptia-root.mptia-shape-square #mptia-hav::after {
  border-radius: 12px;
}
#mptia-root.mptia-shape-square .mb-av {
  border-radius: 10px;
}
@media (max-width: 500px) {
  #mptia-root.mptia-shape-square #mptia-btn {
    width: 52px; height: 52px;
    border-radius: 14px;
  }
  #mptia-root.mptia-shape-square #mptia-win {
    border-radius: 20px 20px 0 0;
  }
}

/* ── Pill shape (rounded-rectangle hybrid) ───────────── */
#mptia-root.mptia-shape-pill #mptia-btn {
  width: 60px; height: 60px;
  border-radius: 18px;
}
#mptia-root.mptia-shape-pill #mptia-win {
  border-radius: 18px;
}
#mptia-root.mptia-shape-pill #mptia-hav {
  border-radius: 14px;
}
#mptia-root.mptia-shape-pill #mptia-hav::after {
  border-radius: 14px;
}
#mptia-root.mptia-shape-pill .mb-av {
  border-radius: 12px;
}
@media (max-width: 500px) {
  #mptia-root.mptia-shape-pill #mptia-btn {
    width: 54px; height: 54px;
    border-radius: 16px;
  }
  #mptia-root.mptia-shape-pill #mptia-win {
    border-radius: 22px 22px 0 0;
  }
}

/* ── Brand footer ────────────────────────────────────── */
#mptia-brand {
  flex-shrink: 0; text-align: center;
  padding: 5px 0 7px; font-size: 10.5px; color: var(--ghost);
  background: var(--surf0); border-top: 1px solid var(--bd); letter-spacing: .01em;
}
#mptia-brand a { color: var(--txt2); text-decoration: none; font-weight: 500; font-family: 'Rosnoc', var(--font); letter-spacing: .01em; transition: color .15s; }
#mptia-brand a:hover { color: var(--c1); }

/* ── Mobile ≤ 500px ──────────────────────────────────── */
@media (max-width: 500px) {
  #mptia-root { bottom: 14px; right: 14px; }
  #mptia-root.mptia-left { right: auto; left: 14px; }
  #mptia-btn { width: 56px; height: 56px; }
  #mptia-win { position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: 70vh; max-height: calc(100vh - 8px); border-radius: 24px 24px 0 0; transform-origin: bottom center; transform: translateY(30px) scale(1); }
  #mptia-root.open #mptia-win { transform: translateY(0) scale(1); }
  #mptia-msgs { min-height: 0; max-height: none; overflow-y: auto; padding: 14px 12px 8px; }
  #mptia-input-wrap { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom, 10px)); }
  #mptia-root .mu { max-width: 80%; }
  #mptia-root .merr, #mptia-root .mwa-wrap { max-width: 88%; }
  #mptia-root .mb-txt, #mptia-root .mu-txt { font-size: 14.5px; }
  #mptia-inp { font-size: 16px; }
  #mptia-head { padding: 14px 14px 14px; }
  #mptia-hav { width: 40px; height: 40px; border-radius: 12px; }
  #mptia-hav::after { border-radius: 12px; }
  #mptia-hname { font-size: 14px; }
}

/* ── Tablet ──────────────────────────────────────────── */
@media (min-width: 501px) and (max-width: 768px) {
  #mptia-win { width: 345px; height: 545px; }
}

/* ── Desktop ≥ 769px ─────────────────────────────────── */
@media (min-width: 769px) {
  #mptia-win { width: 380px; height: min(620px, 75vh); }
  #mptia-root .mu { max-width: min(80%, 285px); }
  #mptia-root .mb-txt, #mptia-root .mu-txt { font-size: 14px; }
  #mptia-root .merr, #mptia-root .mwa-wrap { max-width: min(75%, 330px); }
  #mptia-msgs { padding: 20px 14px 12px; gap: 8px; }
  #mptia-inp { font-size: 14px; }
  #mptia-head { padding: 18px 16px 16px; }
  #mptia-hav { width: 46px; height: 46px; }
  #mptia-hname { font-size: 15px; }
}

/* ── Large Desktop ≥ 1200px ───────────────────────────── */
@media (min-width: 1200px) {
  #mptia-win { width: 400px; height: min(660px, 78vh); }
  #mptia-root .mu { max-width: min(80%, 300px); }
  #mptia-root .mb-txt, #mptia-root .mu-txt { font-size: 14.5px; }
  #mptia-root .merr, #mptia-root .mwa-wrap { max-width: min(80%, 360px); }
  #mptia-msgs { padding: 22px 16px 14px; gap: 9px; }
  #mptia-inp { font-size: 14px; padding: 10px 18px; }
  #mptia-head { padding: 20px 18px 16px; }
  #mptia-hav { width: 48px; height: 48px; }
  #mptia-hname { font-size: 16px; }
  #mptia-hstatus span { font-size: 12px; }
  #mptia-brand { padding: 6px 0 8px; font-size: 11px; }
}

/* ── Dark mode ──────────────────────────────────────────── */
#mptia-root.mptia-dark,
@media (prefers-color-scheme: dark) {
  #mptia-root:not(.mptia-light) {
  --surf0: #1e2330;
  --surf1: #171c28;
  --bd:    #2a3347;
  --txt1:  #e8edf5;
  --txt2:  #8a9bb8;
  --ghost: #4a5a72;
  --head:  #0d1520;
  --head2: #091018;
}
}
#mptia-root.mptia-dark .mb-txt,
@media (prefers-color-scheme: dark) {
  #mptia-root:not(.mptia-light) .mb-txt {
  background: #222b3a;
  color: #dde4f0;
  border-color: rgba(255,255,255,.05);
}
}
#mptia-root.mptia-dark #mptia-msgs,
@media (prefers-color-scheme: dark) {
  #mptia-root:not(.mptia-light) #mptia-msgs {
  background: var(--surf1);
}
}
#mptia-root.mptia-dark #mptia-input-wrap,
@media (prefers-color-scheme: dark) {
  #mptia-root:not(.mptia-light) #mptia-input-wrap {
  background: var(--surf0);
  border-top-color: var(--bd);
}
}
#mptia-root.mptia-dark #mptia-inp,
@media (prefers-color-scheme: dark) {
  #mptia-root:not(.mptia-light) #mptia-inp {
  background: #1a2236;
  color: var(--txt1);
  border-color: var(--bd);
}
}
#mptia-root.mptia-dark #mptia-inp::placeholder,
@media (prefers-color-scheme: dark) {
  #mptia-root:not(.mptia-light) #mptia-inp::placeholder {
  color: var(--ghost);
}
}
#mptia-root.mptia-dark #mptia-brand,
@media (prefers-color-scheme: dark) {
  #mptia-root:not(.mptia-light) #mptia-brand {
  background: var(--surf0);
  border-top-color: var(--bd);
}
}

/* ── Reduced motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #mptia-root *, #mptia-root *::before, #mptia-root *::after {
    animation-duration: .01ms !important; transition-duration: .01ms !important;
  }
}
