.tdb-chat {
  --tdb-chat-ink:#242b34;
  --tdb-chat-muted:#596573;
  --tdb-chat-border:#dfe5eb;
  --tdb-chat-accent:#a2320a;
  --tdb-chat-offset:20px;
  font-family:inherit;
}
.tdb-chat [hidden] { display:none !important; }
.tdb-chat button,.tdb-chat input,.tdb-chat textarea { font:inherit; }
.tdb-chat button:focus-visible,.tdb-chat a:focus-visible,.tdb-chat label:has(+ input:focus-visible) {
  outline:3px solid #2256bf; outline-offset:3px;
}
.tdb-chat-launch {
  position:fixed; z-index:9990; left:max(16px,env(safe-area-inset-left)); right:auto;
  bottom:calc(var(--tdb-chat-offset) + env(safe-area-inset-bottom)); width:56px; height:56px;
  display:grid; place-items:center; padding:0; border:1px solid #83300e; border-radius:17px; cursor:pointer;
  background:#a2320a; color:#fff; box-shadow:0 5px 16px #59220a36;
}
.tdb-chat-icon { position:relative; width:23px; height:17px; border:2px solid currentColor; border-radius:5px; }
.tdb-chat-icon::before {
  content:""; position:absolute; bottom:-5px; right:3px; width:6px; height:6px;
  border:solid currentColor; border-width:0 2px 2px 0; background:var(--tdb-chat-accent); transform:skewY(35deg);
}
.tdb-chat-icon::after { content:"···"; position:absolute; inset:0; line-height:10px; font:bold 13px/10px Arial; }
@media (prefers-reduced-motion:no-preference) {
  .tdb-chat-launch:not(.tdb-chat-launch-used)::before {
    content:""; position:absolute; inset:0; border:2px solid #a2320a; border-radius:inherit;
    pointer-events:none; opacity:0;
    animation:tdb-chat-attention-ring 4.8s ease-out 1.2s 2;
  }
  .tdb-chat-launch:not(.tdb-chat-launch-used) .tdb-chat-icon {
    animation:tdb-chat-attention-icon 4.8s ease-out 1.2s 2;
  }
}
@keyframes tdb-chat-attention-ring {
  0% { opacity:0; transform:scale(1); }
  4% { opacity:.55; }
  19%,100% { opacity:0; transform:scale(1.28); }
}
@keyframes tdb-chat-attention-icon {
  0%,15%,100% { transform:translateY(0); }
  5% { transform:translateY(-3px); }
}
.tdb-chat-launch i {
  position:absolute; inset:5px 5px auto auto; width:12px; height:12px; border:2px solid #a2320a;
  border-radius:50%; background:#fff;
}
.tdb-chat dialog {
  position:fixed; inset:auto auto calc(18px + var(--tdb-keyboard,0px) + env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left));
  margin:0; box-sizing:border-box; width:min(408px,calc(100vw - 32px)); max-width:none;
  height:min(640px,calc(var(--tdb-view-height,100dvh) - 36px)); max-height:none;
  padding:0; overflow:hidden; border:1px solid #d8e0e7; border-radius:18px;
  background:#fff; color:var(--tdb-chat-ink); box-shadow:0 16px 50px #171e2b37;
}
.tdb-chat dialog[open] { display:flex; flex-direction:column; }
.tdb-chat dialog::backdrop { background:#11182736; }
.tdb-chat a { color:#91320f; text-decoration:underline; }
.tdb-chat-header { padding:14px 18px; background:#242b34; color:#fff; display:flex; flex-direction:row-reverse; align-items:center; justify-content:space-between; gap:8px; }
.tdb-chat-header h2 { margin:0; color:#fff; font-family:inherit; font-size:17px; font-weight:700; line-height:1.6; }
.tdb-chat-header p { margin:2px 0 0; color:#e5e9ed; font-size:12px; }
.tdb-chat-close { flex:none; width:44px; height:44px; border:1px solid #647180; border-radius:10px; padding:0; background:transparent; color:#fff; cursor:pointer; font-size:25px !important; }
.tdb-chat-header-actions { display:flex; flex:none; flex-direction:row-reverse; align-items:center; gap:6px; }
.tdb-chat-history-toggle {
  min-height:44px; padding:5px 9px; border:1px solid transparent; border-radius:8px;
  color:#fff; background:transparent; cursor:pointer; font-size:13px !important;
}
.tdb-chat-header-actions button:hover,.tdb-chat-history-toggle[aria-expanded="true"] { background:#38424e; }
.tdb-chat-header-actions button:focus-visible { outline-color:#afcbff; }
.tdb-chat-file button,.tdb-chat-back,.tdb-chat-record,.tdb-chat-attach,.tdb-chat-new {
  min-height:40px; padding:6px 9px; border:1px solid transparent; border-radius:8px;
  color:var(--tdb-chat-ink); background:#fff; cursor:pointer; font-size:13px; line-height:1.6;
}
.tdb-chat-history { flex:1; min-height:0; overflow:auto; overflow-wrap:anywhere; padding:12px 16px; }
.tdb-chat-help {
  flex:0 0 auto; box-sizing:border-box; max-height:47%; overflow:auto; overflow-wrap:anywhere;
  padding:9px 12px; border-bottom:1px solid var(--tdb-chat-border);
}
.tdb-chat-topics { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:6px; }
.tdb-chat-topics .tdb-chat-topic { min-height:44px; margin:0; padding:5px 8px; font-size:13px; line-height:1.65; }
.tdb-chat-help h3 { margin:10px 0 6px; font-size:16px; }
.tdb-chat-help p { margin:4px 0 7px; line-height:1.8; }
.tdb-chat-help > a { display:block; margin-bottom:12px; }
.tdb-chat-help details { margin-top:3px; }
.tdb-chat-help summary { min-height:40px; padding:7px 8px; cursor:pointer; color:var(--tdb-chat-muted); font-size:13px; }
.tdb-chat-topic {
  display:block; box-sizing:border-box; width:100%; min-height:43px; margin-bottom:6px; padding:7px 12px; text-align:right;
  border:1px solid var(--tdb-chat-border); border-radius:9px; background:#f7f8fa; color:var(--tdb-chat-ink); cursor:pointer;
}
.tdb-chat-topic:hover { background:#eef1f5; }
.tdb-chat-product { padding:9px; border-right:3px solid var(--tdb-chat-accent); background:#fff4ed; }
.tdb-chat-talk { flex:1; min-height:0; display:flex; flex-direction:column; overflow:auto; }
.tdb-chat-log { flex:1; min-height:28px; overflow:auto; background:#f4f6f8; padding:12px; }
.tdb-chat-message { width:fit-content; max-width:90%; padding:8px 10px; margin:0 0 8px auto; background:white; border:1px solid var(--tdb-chat-border); border-radius:12px 12px 4px 12px; overflow-wrap:anywhere; }
.tdb-chat-message.tdb-chat-own { margin-inline-start:auto; margin-inline-end:0; background:#fff1e6; border-color:#f1d5c4; border-radius:12px 12px 12px 4px; }
.tdb-chat-message p { margin:0; white-space:pre-wrap; }
.tdb-chat-message small { display:inline-block; color:var(--tdb-chat-muted); font-size:10px; margin-inline-end:6px; }
.tdb-chat-message audio { display:block; width:min(230px,100%); margin:4px 0; }
.tdb-chat-message a { display:block; }
.tdb-chat-form { flex:none; padding:8px 12px 5px; border-top:1px solid var(--tdb-chat-border); }
.tdb-chat-form fieldset { border:1px solid var(--tdb-chat-border); border-radius:8px; margin:0 0 8px; padding:4px 9px 7px; }
.tdb-chat-form fieldset label { display:block; font-size:12px; margin-bottom:3px; }
.tdb-chat-form legend { font-size:12px; font-weight:700; }
.tdb-chat-form input:not([type=file]),.tdb-chat-form textarea {
  display:block; box-sizing:border-box; width:100%; border:1px solid #a6b1bc;
  border-radius:8px; padding:6px 9px; color:var(--tdb-chat-ink); background:#fff; font-size:16px;
}
.tdb-chat-form textarea { resize:vertical; min-height:52px; max-height:105px; }
.tdb-chat-actions { display:flex; align-items:center; gap:6px; }
.tdb-chat-attach { display:flex; align-items:center; }
.tdb-chat-send,.tdb-chat-primary { min-height:42px; padding:6px 12px; border:1px solid #83300e; border-radius:8px; color:#fff; background:var(--tdb-chat-accent); cursor:pointer; }
.tdb-chat-send { margin-inline-start:auto; }
.tdb-chat-send:disabled { opacity:.7; cursor:wait; }
.tdb-chat-file { display:flex; align-items:center; justify-content:space-between; gap:4px; overflow-wrap:anywhere; font-size:12px; }
.tdb-chat-feedback { flex:none; min-height:13px; padding:0 12px 7px; margin:0; color:var(--tdb-chat-muted); font-size:12px; line-height:1.5; }
.tdb-chat-rating { padding:6px 12px; }
.tdb-chat-rating p { margin:0; }
.tdb-chat-rating button { padding:2px 6px; min-width:37px; min-height:40px; color:#9a4b00; background:white; border:1px solid var(--tdb-chat-border); border-radius:6px; cursor:pointer; }
.tdb-chat-sr { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; clip-path:inset(50%); overflow:hidden; white-space:nowrap; }
@media (max-width:767px) {
  .tdb-chat { --tdb-chat-offset:72px; }
  .tdb-chat-launch { width:50px; height:50px; left:max(12px,env(safe-area-inset-left)); border-radius:15px; }
  .tdb-chat dialog { inset:auto max(8px,env(safe-area-inset-right)) calc(8px + var(--tdb-keyboard,0px) + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left)); width:auto; height:min(630px,calc(var(--tdb-view-height,100dvh) - 16px)); border-radius:14px; }
}
@media (max-height:420px) {
  .tdb-chat-header { padding:6px 11px; }
  .tdb-chat-form fieldset { display:grid; grid-template-columns:1fr 1fr; gap:6px; }
}
.tdb-chat:has(.tdb-chat-form textarea:focus, .tdb-chat-form fieldset :focus) .tdb-chat-help {
  max-height:min(47%, calc(var(--tdb-view-height,100dvh) * .34));
}
