/* Botarnia live demo: a Telegram-like chat (dark), branded with the template accent. */
.tgd {
  --tgd-bg: #0c0c0e;
  --tgd-panel: #151518;
  --tgd-in: #1d1d21;
  --tgd-fg: #f4f4f5;
  --tgd-muted: #8b8b93;
  --tgd-line: #26262b;
  --tgd-accent: #2aabee;
  --tgd-radius: 28px;
  --tgd-h: min(640px, 78svh);
  color: var(--tgd-fg);
  font: 400 15px/1.42 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: calc(var(--tgd-h) + 52px);
}
.tgd *, .tgd *::before, .tgd *::after { box-sizing: border-box; }

.tgd-tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.tgd-tab, .tgd-reset {
  appearance: none; border: 1px solid var(--tgd-line); background: transparent; color: var(--tgd-muted);
  border-radius: 999px; padding: 9px 14px; font: 700 13px/1 inherit; font-family: inherit; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: color .2s, border-color .2s, background .2s;
}
.tgd-tab[aria-selected="true"] { color: #000; background: var(--tgd-accent); border-color: var(--tgd-accent); }
.tgd-reset { margin-left: auto; width: 38px; justify-content: center; padding: 9px 0; font-size: 16px; }
.tgd-reset:hover, .tgd-tab:hover { color: var(--tgd-fg); border-color: var(--tgd-muted); }
.tgd-tab[aria-selected="true"]:hover { color: #000; }
.tgd-badge { min-width: 18px; height: 18px; border-radius: 9px; padding: 0 5px; background: #ff3b30;
  color: #fff; font-size: 11px; display: inline-grid; place-items: center; animation: tgd-pop .3s ease; }

.tgd-panes { display: grid; }
.tgd-phone {
  grid-area: 1 / 1; position: relative; display: flex; flex-direction: column; height: var(--tgd-h);
  background: var(--tgd-bg); border: 1px solid var(--tgd-line); border-radius: var(--tgd-radius);
  overflow: hidden; isolation: isolate;
}
.tgd-phone::before { /* quiet dot pattern, like Telegram's wallpaper */
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
  background: radial-gradient(circle at 1px 1px, #ffffff10 1px, transparent 1.4px) 0 0 / 18px 18px;
}
.tgd .tgd-phone { visibility: hidden; }
.tgd[data-active="client"] .tgd-phone[data-side="client"],
.tgd[data-active="owner"] .tgd-phone[data-side="owner"] { visibility: visible; }
@media (min-width: 980px) {
  .tgd.tgd-split .tgd-panes { grid-template-columns: 1fr 1fr; gap: 14px; }
  .tgd.tgd-split .tgd-phone { grid-area: auto; visibility: visible; }
  .tgd.tgd-split .tgd-phone[data-side="owner"] { --tgd-bg: #101012; }
  .tgd.tgd-split .tgd-tab { pointer-events: none; }
  .tgd.tgd-split .tgd-tab[aria-selected] { color: var(--tgd-fg); background: transparent; border-color: var(--tgd-line); }
  .tgd.tgd-split .tgd-tabs { display: grid; grid-template-columns: 1fr 1fr auto; }
  .tgd.tgd-split .tgd-tab { justify-content: center; }
  .tgd.tgd-split .tgd-badge { display: none; }
}

.tgd-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--tgd-panel);
  border-bottom: 1px solid var(--tgd-line); }
.tgd-ava { width: 38px; height: 38px; border-radius: 50%; background: var(--tgd-accent); flex: none;
  display: grid; place-items: center; overflow: hidden; }
.tgd-ava svg { width: 30px; height: 30px; }
.tgd-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.tgd-who b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tgd-status { color: var(--tgd-muted); font-size: 12.5px; }
.tgd-role { margin-left: auto; font-size: 18px; }

.tgd-log { flex: 1; overflow-y: auto; padding: 14px 10px 8px; display: flex; flex-direction: column; gap: 6px;
  scrollbar-width: thin; scrollbar-color: #ffffff22 transparent; overscroll-behavior: contain; }
.tgd-msg { display: flex; flex-direction: column; max-width: 86%; animation: tgd-in .28s ease both; }
.tgd-in { align-self: flex-start; }
.tgd-out { align-self: flex-end; }
.tgd-bubble { position: relative; padding: 8px 12px 18px; border-radius: 16px; background: var(--tgd-in);
  overflow-wrap: anywhere; min-width: 64px; }
.tgd-in .tgd-bubble { border-bottom-left-radius: 6px; }
.tgd-out .tgd-bubble { background: var(--tgd-accent); color: #000; border-bottom-right-radius: 6px; }
.tgd-text b { font-weight: 800; }
.tgd-text a { color: var(--tgd-accent); }
.tgd-time { position: absolute; right: 10px; bottom: 4px; font-size: 10.5px; color: var(--tgd-muted); }
.tgd-out .tgd-time { color: #0009; }
.tgd-edit .tgd-bubble { animation: tgd-flash .35s ease; }
.tgd-photo { height: 120px; border-radius: 10px; margin: -2px -6px 8px; }

.tgd-kb { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.tgd-row { display: flex; gap: 4px; }
.tgd-btn { flex: 1 1 0; min-width: 0; appearance: none; border: 0; cursor: pointer; color: var(--tgd-fg);
  background: #ffffff14; backdrop-filter: blur(6px); border-radius: 10px; padding: 9px 8px;
  font: 600 13.5px/1.2 inherit; font-family: inherit; transition: background .15s, transform .1s; }
.tgd-btn:hover { background: #ffffff24; }
.tgd-btn:active { transform: scale(.97); }
.tgd-ext { opacity: .6; font-size: 11px; }
.dead .tgd-kb, .dead .tgd-pay { opacity: .45; pointer-events: none; }

.tgd-invoice { margin-top: 8px; padding: 12px; border-radius: 12px; background: #0000004d; }
.tgd-inv-title { font-weight: 800; }
.tgd-inv-desc { color: var(--tgd-muted); font-size: 13px; margin: 2px 0 8px; }
.tgd-inv-sum { font: 800 22px/1 "Unbounded", inherit; margin-bottom: 10px; }
.tgd-pay { width: 100%; appearance: none; border: 0; border-radius: 10px; padding: 11px; cursor: pointer;
  background: var(--tgd-accent); color: #000; font: 800 14px/1 inherit; font-family: inherit; }
.tgd-pay:disabled { opacity: .7; cursor: progress; }

.tgd-sys { align-self: center; margin: 6px 0; animation: tgd-in .3s ease both; text-align: center; }
.tgd-sys span { display: inline-block; background: #ffffff12; color: var(--tgd-muted); border-radius: 999px;
  padding: 4px 12px; font-size: 12.5px; font-weight: 600; }
.tgd-contact { display: inline-block; line-height: 1.3; }

.tgd-typing .tgd-bubble { padding: 12px 14px; display: flex; gap: 4px; min-width: 0; }
.tgd-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--tgd-muted);
  animation: tgd-dot 1s infinite ease-in-out; }
.tgd-typing i:nth-child(2) { animation-delay: .15s; }
.tgd-typing i:nth-child(3) { animation-delay: .3s; }

.tgd-reply { display: none; flex-direction: column; gap: 5px; padding: 8px 8px 0; background: var(--tgd-panel); }
.has-reply .tgd-reply { display: flex; }
.tgd-rbtn { flex: 1 1 0; min-width: 0; appearance: none; border: 0; cursor: pointer; border-radius: 10px;
  padding: 11px 8px; background: #ffffff12; color: var(--tgd-fg); font: 600 13.5px/1.2 inherit; font-family: inherit; }
.tgd-rbtn:hover { background: #ffffff22; }

.tgd-input { display: flex; gap: 8px; padding: 8px; background: var(--tgd-panel); border-top: 1px solid var(--tgd-line); }
.has-reply .tgd-input { border-top: 0; }
.tgd-input input { flex: 1; min-width: 0; border: 0; outline: 0; border-radius: 999px; padding: 11px 16px;
  background: var(--tgd-in); color: var(--tgd-fg); font: 400 15px/1.2 inherit; font-family: inherit; }
.tgd-input input:focus-visible { box-shadow: 0 0 0 2px var(--tgd-accent); }
.tgd-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; cursor: pointer;
  background: var(--tgd-accent); color: #000; display: grid; place-items: center; }
.tgd-send svg { width: 20px; height: 20px; }

.tgd-toast { position: absolute; left: 50%; top: 64px; transform: translate(-50%, -8px); opacity: 0; z-index: 5;
  pointer-events: none; max-width: 86%; background: #000000e6; color: #fff; border: 1px solid var(--tgd-line);
  border-radius: 12px; padding: 10px 14px; font-size: 13.5px; text-align: center;
  transition: opacity .2s, transform .2s; }
.tgd-toast.on { opacity: 1; transform: translate(-50%, 0); }

.tgd-note { margin: 10px 4px 0; color: var(--tgd-muted); font-size: 13px; }
.tgd-note a { color: inherit; }

.tgd-badge[hidden] { display: none; }
@keyframes tgd-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes tgd-flash { 50% { filter: brightness(1.35); } }
@keyframes tgd-dot { 0%, 80%, 100% { transform: scale(.6); opacity: .5; } 40% { transform: scale(1); opacity: 1; } }
@keyframes tgd-pop { from { transform: scale(.4); } }
@media (prefers-reduced-motion: reduce) {
  .tgd-msg, .tgd-sys, .tgd-edit .tgd-bubble, .tgd-typing i, .tgd-badge { animation: none; }
}
