/* toomotions AI assistant widget */
.tmai-root {
  --tm-brand: #04abf2;
  --tm-brand-dark: #0390cc;
  --tm-bg: #ffffff;
  --tm-bg2: #f3f5f8;
  --tm-line: #e3e7ee;
  --tm-text: #1b1f24;
  --tm-muted: #6b7380;
  --tm-user: #04abf2;
  --tm-user-text: #ffffff;
  --tm-red: #e53935;
  --tm-green: #2e9d50;
  --tm-shadow: 0 12px 40px rgba(16, 24, 40, .18);
  font-family: Lato, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--tm-text);
}
.tmai-root.tmai-dark {
  --tm-bg: #1c1f24;
  --tm-bg2: #262a31;
  --tm-line: #333943;
  --tm-text: #eceff3;
  --tm-muted: #9aa3ae;
  --tm-shadow: 0 12px 40px rgba(0, 0, 0, .5);
}
.tmai-root *, .tmai-root *::before, .tmai-root *::after { box-sizing: border-box; }
.tmai-hidden { display: none !important; }

/* launcher */
.tmai-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 99998;
  display: flex; align-items: center; gap: 8px;
  height: 52px; padding: 0 18px 0 14px; border: 0; border-radius: 26px;
  background: var(--tm-brand); color: #fff; font: inherit; font-weight: 700; font-size: 15px;
  box-shadow: 0 6px 20px rgba(4, 171, 242, .45); cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.tmai-launcher:hover { background: var(--tm-brand-dark); transform: translateY(-1px); }
.tmai-launcher:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.tmai-launcher-icon {
  width: 24px; height: 24px; flex: none;
  background: no-repeat center/24px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2l1.9 4.6L18.5 8.5 13.9 10.4 12 15l-1.9-4.6L5.5 8.5l4.6-1.9L12 2zm6.5 10l1 2.5 2.5 1-2.5 1-1 2.5-1-2.5-2.5-1 2.5-1 1-2.5zM6 15l.8 1.9 1.9.8-1.9.8L6 20.5l-.8-1.9-1.9-.8 1.9-.8L6 15z'/%3E%3C/svg%3E");
}
.tmai-open .tmai-launcher { display: none; }

/* panel */
.tmai-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 99999;
  width: 400px; height: min(680px, calc(100vh - 90px));
  display: none; flex-direction: column; overflow: hidden;
  background: var(--tm-bg); border: 1px solid var(--tm-line); border-radius: 16px; box-shadow: var(--tm-shadow);
}
.tmai-open .tmai-panel { display: flex; animation: tmai-in .18s ease-out; }
@keyframes tmai-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.tmai-head {
  display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 6px;
  border-bottom: 1px solid var(--tm-line); background: var(--tm-bg);
}
.tmai-title { flex: 1; display: flex; flex-direction: column; padding-left: 4px; min-width: 0; }
.tmai-title strong { font-size: 15px; }
.tmai-sub { font-size: 12px; color: var(--tm-muted); }
.tmai-icon-btn {
  width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px; cursor: pointer;
  background: transparent no-repeat center/20px; opacity: .75;
}
.tmai-icon-btn:hover { background-color: var(--tm-bg2); opacity: 1; }
.tmai-ic-menu  { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7380' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E"); }
.tmai-ic-new   { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7380' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.tmai-ic-close { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7380' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E"); }
.tmai-ic-trash { width: 30px; height: 30px; background-size: 16px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7380' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 7h16M9 7V4h6v3M6 7l1 13h10l1-13'/%3E%3C/svg%3E"); }

/* history drawer */
.tmai-history { position: absolute; top: 57px; left: 0; right: 0; bottom: 0; z-index: 2; overflow-y: auto; padding: 8px; background: var(--tm-bg); }
.tmai-hist-title { font-weight: 700; padding: 6px 8px 10px; }
.tmai-hist-item { display: flex; align-items: center; border-radius: 10px; }
.tmai-hist-item:hover, .tmai-hist-item.active { background: var(--tm-bg2); }
.tmai-hist-open { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 10px; font: inherit; color: var(--tm-text); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* messages */
.tmai-list { flex: 1; overflow-y: auto; padding: 14px 12px 6px; display: flex; flex-direction: column; gap: 8px; background: var(--tm-bg); overscroll-behavior: contain; }
.tmai-msg { max-width: 86%; padding: 9px 13px; border-radius: 16px; word-wrap: break-word; overflow-wrap: anywhere; }
.tmai-assistant { align-self: flex-start; background: var(--tm-bg2); border-bottom-left-radius: 5px; }
.tmai-user { align-self: flex-end; background: var(--tm-user); color: var(--tm-user-text); border-bottom-right-radius: 5px; }
.tmai-msg a { color: var(--tm-brand); }
.tmai-user a { color: #fff; text-decoration: underline; }
.tmai-li { display: block; padding-left: 12px; position: relative; }
.tmai-li::before { content: '•'; position: absolute; left: 0; }
.tmai-error { background: #fdecec; color: #a12622; }
.tmai-dark .tmai-error { background: #3a2223; color: #ffb4b1; }
.tmai-typing { display: flex; gap: 4px; padding: 13px 14px; }
.tmai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--tm-muted); animation: tmai-dot 1s infinite ease-in-out; }
.tmai-typing i:nth-child(2) { animation-delay: .15s; }
.tmai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tmai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.tmai-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.tmai-chip { border: 1px solid var(--tm-line); background: var(--tm-bg); color: var(--tm-text); border-radius: 18px; padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.tmai-chip:hover { border-color: var(--tm-brand); color: var(--tm-brand); }

/* cards */
.tmai-card { align-self: stretch; border: 1px solid var(--tm-line); border-radius: 14px; padding: 10px; background: var(--tm-bg); }
.tmai-card-title { font-weight: 700; font-size: 13px; color: var(--tm-muted); margin: 0 2px 8px; }
.tmai-videos { padding: 10px 0 8px; }
.tmai-videos .tmai-card-title { margin-left: 12px; }
.tmai-scroller { display: flex; gap: 10px; overflow-x: auto; padding: 0 10px 4px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.tmai-video { flex: none; width: 200px; color: var(--tm-text) !important; text-decoration: none !important; scroll-snap-align: start; }
.tmai-video.is-reel { width: 128px; }
.tmai-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: var(--tm-bg2); }
.is-reel .tmai-thumb { aspect-ratio: 9 / 16; }
.tmai-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.tmai-video:hover .tmai-thumb img { transform: scale(1.04); }
.tmai-dur { position: absolute; right: 5px; bottom: 5px; padding: 1px 5px; border-radius: 4px; font-size: 11px; font-weight: 700; color: #fff; background: rgba(0, 0, 0, .75); }
.tmai-badge { position: absolute; left: 5px; top: 5px; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; color: #fff; background: var(--tm-brand); }
.tmai-badge.tmai-paid { left: auto; right: 5px; background: #f59e0b; }
.tmai-badge.tmai-priv { top: auto; bottom: 5px; background: rgba(0, 0, 0, .7); }
.tmai-vt { font-weight: 700; font-size: 13px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tmai-vm { font-size: 12px; color: var(--tm-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmai-muted { color: var(--tm-muted); font-size: 12px; }

.tmai-channel { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; color: var(--tm-text) !important; text-decoration: none !important; }
.tmai-channel:hover { background: var(--tm-bg2); }
.tmai-channel img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.tmai-channel div { display: flex; flex-direction: column; min-width: 0; }

.tmai-row { display: flex; gap: 8px; flex-wrap: wrap; }
.tmai-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 0 16px;
  border: 1px solid var(--tm-line); border-radius: 10px; background: var(--tm-bg); color: var(--tm-text) !important;
  font: inherit; font-weight: 700; text-decoration: none !important; cursor: pointer;
}
.tmai-btn:hover { background: var(--tm-bg2); }
.tmai-btn:disabled { opacity: .6; cursor: default; }
.tmai-primary { background: var(--tm-brand); border-color: var(--tm-brand); color: #fff !important; }
.tmai-primary:hover { background: var(--tm-brand-dark); }
.tmai-red { background: var(--tm-red); border-color: var(--tm-red); color: #fff !important; }

/* upload */
.tmai-drop { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 12px; text-align: center; border: 2px dashed var(--tm-line); }
.tmai-drop.hover { border-color: var(--tm-brand); background: rgba(4, 171, 242, .06); }
.tmai-drop-icon { width: 40px; height: 40px; background: no-repeat center/36px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304abf2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4m0 0l-4 4m4-4l4 4M4 15v3a2 2 0 002 2h12a2 2 0 002-2v-3'/%3E%3C/svg%3E"); }
.tmai-drop .tmai-btn { margin-top: 6px; }
.tmai-uploading { display: flex; flex-direction: column; gap: 6px; }
.tmai-uploading strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmai-progress-bar { height: 6px; border-radius: 3px; background: var(--tm-bg2); overflow: hidden; }
.tmai-progress-bar i { display: block; height: 100%; width: 0; background: var(--tm-brand); transition: width .2s; }
.tmai-indeterminate i { width: 35% !important; animation: tmai-slide 1.1s infinite ease-in-out; }
@keyframes tmai-slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* confirm */
.tmai-confirm { display: flex; flex-direction: column; gap: 10px; }
.tmai-danger { border-color: rgba(229, 57, 53, .45); }
.tmai-preview { display: flex; gap: 10px; align-items: center; }
.tmai-preview img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: var(--tm-bg2); }
.tmai-preview.is-reel img { width: 64px; aspect-ratio: 9 / 16; }
.tmai-src { display: block; font-size: 12px; color: var(--tm-brand); }
.tmai-warn { font-size: 12px; padding: 8px 10px; border-radius: 8px; background: #fff6e0; color: #7a5200; }
.tmai-dark .tmai-warn { background: #3a3120; color: #ffd98a; }
.tmai-form { display: flex; flex-direction: column; gap: 8px; }
.tmai-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 700; color: var(--tm-muted); }
.tmai-field { width: 100%; padding: 8px 10px; border: 1px solid var(--tm-line); border-radius: 8px; background: var(--tm-bg); color: var(--tm-text); font: inherit; font-size: 14px; font-weight: 400; }
.tmai-field:focus { outline: none; border-color: var(--tm-brand); box-shadow: 0 0 0 3px rgba(4, 171, 242, .18); }
textarea.tmai-field { resize: vertical; min-height: 64px; }
.tmai-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tmai-check { flex-direction: row !important; align-items: center; gap: 6px !important; color: var(--tm-text) !important; font-weight: 400 !important; font-size: 14px !important; }
.tmai-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tmai-tpick { flex: none; width: 74px; background: var(--tm-bg2) !important; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: none; cursor: pointer; }
.tmai-tpick img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.tmai-thumbs.is-reel .tmai-tpick { align-self: flex-start; }
.tmai-tpick.on { border-color: var(--tm-brand); }
.tmai-thumbs.is-reel .tmai-tpick { width: 48px; }
.tmai-thumbs.is-reel .tmai-tpick img { aspect-ratio: 9 / 16; }
.tmai-changes { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.tmai-changes del { color: var(--tm-muted); }
.tmai-status { font-size: 13px; font-weight: 700; }
.tmai-status:empty { display: none; }
.tmai-ok { color: var(--tm-green); }
.tmai-err { color: var(--tm-red); }
.tmai-confirm .tmai-videos { border: 0; padding: 0; }
.tmai-confirm .tmai-scroller { padding: 0; }

/* composer */
.tmai-foot { display: flex; align-items: flex-end; gap: 6px; padding: 10px; border-top: 1px solid var(--tm-line); background: var(--tm-bg); }
.tmai-input {
  flex: 1; min-height: 40px; max-height: 120px; resize: none; padding: 9px 12px;
  border: 1px solid var(--tm-line); border-radius: 20px; background: var(--tm-bg2); color: var(--tm-text);
  font: inherit; font-size: 14px; line-height: 1.4;
}
.tmai-input:focus { outline: none; border-color: var(--tm-brand); }
.tmai-send, .tmai-attach { width: 40px; height: 40px; flex: none; border: 0; border-radius: 50%; cursor: pointer; background: no-repeat center/20px; }
.tmai-send { background-color: var(--tm-brand); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M3.4 20.4l17.45-7.48a1 1 0 000-1.84L3.4 3.6a.99.99 0 00-1.39.91L2 9.12c0 .5.37.93.87.99L17 12 2.87 13.88c-.5.07-.87.5-.87 1l.01 4.61c0 .71.73 1.2 1.39.91z'/%3E%3C/svg%3E"); }
.tmai-send:disabled { opacity: .5; }
.tmai-attach { background-color: transparent; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7380' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='14' height='14' rx='2'/%3E%3Cpath d='M17 10l4-2v8l-4-2'/%3E%3C/svg%3E"); }
.tmai-attach:hover { background-color: var(--tm-bg2); }

/* phones: full screen */
@media (max-width: 560px) {
  .tmai-panel { right: 0; bottom: 0; width: 100vw; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .tmai-launcher { right: 14px; bottom: 76px; height: 48px; padding: 0 14px 0 12px; }
  .tmai-launcher-label { display: none; }
  .tmai-grid { grid-template-columns: 1fr 1fr; }
  .tmai-input { font-size: 16px; }   /* stops iOS zooming into the field */
}
@media (prefers-reduced-motion: reduce) {
  .tmai-root * { animation: none !important; transition: none !important; }
}
