#tma-ai-root{font-family:Arial,sans-serif;position:fixed;right:22px;bottom:22px;z-index:999999;font-size:14px}#tma-ai-launch{border:0;border-radius:30px;background:#1266d6;color:white;box-shadow:0 5px 22px #0003;padding:14px 20px;font-weight:700;cursor:pointer}#tma-ai-panel{position:absolute;bottom:65px;right:0;width:min(380px,calc(100vw - 24px));height:510px;max-height:calc(100vh - 110px);background:#fff;color:#152a45;box-shadow:0 8px 38px #0003;border-radius:16px;overflow:hidden;display:flex;flex-direction:column;border:1px solid #dce5f2}#tma-ai-panel[hidden]{display:none!important}#tma-ai-panel .tma-ai-panel-head{background:#1266d6;color:white;padding:16px;display:flex;justify-content:space-between;align-items:center}#tma-ai-panel .tma-ai-panel-head strong{font-size:16px}#tma-ai-panel .tma-ai-panel-head small{display:block;font-size:12px;margin-top:4px;opacity:.85}#tma-ai-close{background:transparent;color:white;border:0;font-size:26px;cursor:pointer;padding:0 6px}#tma-ai-messages{flex:1;overflow-y:auto;padding:16px;background:#f7faff;display:flex;flex-direction:column;gap:12px}#tma-ai-panel .tma-ai-bubble{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.55;max-width:90%;padding:11px 13px;border-radius:14px;background:#e7edf7;align-self:flex-start}#tma-ai-panel .tma-ai-bubble.user{background:#1266d6;color:white;align-self:flex-end}#tma-ai-form{display:flex;gap:8px;padding:10px;border-top:1px solid #e2e8f0;margin:0}#tma-ai-input{flex:1;min-width:0;padding:10px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#172a42;font-size:14px}#tma-ai-form button{border:0;border-radius:9px;background:#1266d6;color:#fff;padding:0 14px;cursor:pointer}#tma-ai-form button:disabled{opacity:.5}@media(max-width:480px){#tma-ai-root{right:12px;bottom:12px}#tma-ai-panel{height: min(510px,calc(100vh - 100px))}}
/* V1.2: rich, safe comparison output */
#tma-ai-panel .tma-ai-bubble.model{white-space:normal;max-width:96%;width:fit-content}
#tma-ai-panel .tma-ai-bubble p{margin:0 0 9px;line-height:1.6}
#tma-ai-panel .tma-ai-bubble p:last-child{margin-bottom:0}
#tma-ai-panel .tma-ai-bubble ul{padding-left:18px;margin:6px 0 10px}
#tma-ai-panel .tma-ai-bubble li{margin:4px 0}
#tma-ai-panel .tma-ai-heading{display:block;margin:12px 0 6px;font-size:14px}
#tma-ai-panel .tma-ai-table-wrap{max-width:100%;overflow-x:auto;margin:10px 0;background:white;border-radius:8px}
#tma-ai-panel .tma-ai-table-wrap table{border-collapse:collapse;width:100%;min-width:290px;font-size:12px}
#tma-ai-panel .tma-ai-table-wrap th,#tma-ai-panel .tma-ai-table-wrap td{padding:8px;border:1px solid #dce5f2;text-align:left;vertical-align:top;min-width:90px}
#tma-ai-panel .tma-ai-table-wrap th{background:#d9e9ff;color:#163b73;font-weight:700}
#tma-ai-panel .tma-ai-bubble code{background:#d6e1f0;padding:1px 3px;border-radius:3px}

/* V1.3: wider desktop layout, expandable chat, accessible mobile tables */
#tma-ai-panel{width:min(640px,calc(100vw - 36px));height:min(660px,calc(100dvh - 105px));transition:width .16s ease,height .16s ease}
#tma-ai-panel .tma-ai-header-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}
#tma-ai-panel .tma-ai-header-actions button{background:transparent;color:#fff;border:1px solid #ffffff55;border-radius:8px;min-width:36px;min-height:36px;cursor:pointer;font-size:24px;line-height:1}
#tma-ai-panel .tma-ai-header-actions button:hover,#tma-ai-panel .tma-ai-header-actions button:focus-visible{background:#ffffff25}
#tma-ai-panel.tma-ai-expanded{position:fixed;inset:16px;width:auto;height:auto;max-height:none;bottom:16px;right:16px;z-index:1000001}
#tma-ai-panel .tma-ai-bubble.model{max-width:100%;width:auto;min-width:0}
#tma-ai-panel .tma-ai-table-wrap{max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;border:1px solid #dce5f2}
#tma-ai-panel .tma-ai-table-wrap table{min-width:480px;width:max-content;max-width:none;table-layout:auto}
#tma-ai-panel .tma-ai-table-wrap th,#tma-ai-panel .tma-ai-table-wrap td{min-width:130px;max-width:260px;overflow-wrap:anywhere}
#tma-ai-panel .tma-ai-table-wrap th:first-child,#tma-ai-panel .tma-ai-table-wrap td:first-child{min-width:105px}
#tma-ai-panel .tma-ai-bubble{min-width:0}
@media(max-width:600px){#tma-ai-root{right:10px;bottom:10px}#tma-ai-panel{right:0;bottom:64px;width:calc(100vw - 20px);height:min(560px,calc(100dvh - 92px));max-height:calc(100dvh - 92px)}#tma-ai-panel.tma-ai-expanded{inset:0;width:100vw;height:100dvh;max-height:none;border-radius:0}#tma-ai-messages{padding:12px}#tma-ai-panel .tma-ai-bubble{max-width:98%}#tma-ai-panel .tma-ai-table-wrap table{min-width:480px}}

/* v1.3.2: Readable compact text button, no Gemini/sparkle emblem. */
#tma-ai-root #tma-ai-launch {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 84px;
  height: 40px;
  min-height: 40px;
  padding: 0 13px;
  margin: 0;
  border: 1px solid #ffffff;
  border-radius: 10px;
  background: #08469f;
  color: #ffffff;
  box-shadow: 0 3px 11px rgba(5, 30, 76, .28);
  font: 700 14px/1.15 Arial, sans-serif;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
  text-decoration: none;
  text-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#tma-ai-root #tma-ai-launch span {
  display: inline;
  color: #ffffff;
  font: inherit;
  letter-spacing: inherit;
  white-space: nowrap;
}
#tma-ai-root #tma-ai-launch:hover {
  background: #063676;
  color: #ffffff;
}
#tma-ai-root #tma-ai-launch:focus-visible {
  outline: 3px solid #ff993e;
  outline-offset: 2px;
}
@media (max-width: 600px) {
  #tma-ai-root {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: max(14px, env(safe-area-inset-bottom, 0px));
  }
  #tma-ai-root #tma-ai-launch {
    min-width: 78px;
    height: 40px;
    min-height: 40px;
    padding: 0 11px;
    border-radius: 10px;
    font-size: 13px;
  }
  #tma-ai-root #tma-ai-panel:not(.tma-ai-expanded) {
    bottom: 52px;
  }
}

/* v1.3.3: keep the existing label size and make the mobile launcher hug its text. */
@media (max-width: 600px) {
  #tma-ai-root::before,
  #tma-ai-root::after,
  #tma-ai-root #tma-ai-launch::before,
  #tma-ai-root #tma-ai-launch::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: none !important;
  }
  #tma-ai-root #tma-ai-launch {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 7px 10px !important;
    margin: 0 !important;
    font-size: 14px !important;
    line-height: 1.15;
    border-radius: 9px;
  }
  #tma-ai-root #tma-ai-launch span {
    font-size: inherit !important;
  }
}

/* Thiện Mộc An: mobile-only button tightened; keep the original 14px text.
   Desktop button dimensions remain identical to source v1.3.3. */
@media (max-width: 600px) {
  #tma-ai-root #tma-ai-launch {
    width: max-content !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 5px 7px !important;
    font-size: 14px !important;
    line-height: 1.15 !important;
    border-radius: 7px !important;
  }
  #tma-ai-root #tma-ai-launch span { font-size: inherit !important; }
}
/* Product snippets are shown separately from model text, using site URLs only. */
#tma-ai-panel .tma-ai-products{display:grid;gap:8px;margin:10px 0 3px;width:100%}
#tma-ai-panel .tma-ai-product{display:flex;gap:10px;align-items:center;border:1px solid #dce5f2;background:#fff;border-radius:10px;padding:8px;text-decoration:none;color:#163b73}
#tma-ai-panel .tma-ai-product img{width:54px;height:54px;object-fit:cover;border-radius:6px;flex-shrink:0}
#tma-ai-panel .tma-ai-product-info{min-width:0;display:flex;flex-direction:column;gap:3px}
#tma-ai-panel .tma-ai-product-title{font-size:13px;line-height:1.3;font-weight:700}
#tma-ai-panel .tma-ai-product-price{font-size:13px;font-weight:700;color:#a13d15}
#tma-ai-panel .tma-ai-product:hover{background:#f0f6ff}


/* v1.0.1 fix: keep the chat panel compact on desktop and normal on mobile; do not stretch the blue header across the page. */
#tma-ai-root #tma-ai-panel:not(.tma-ai-expanded){
  position:absolute !important;
  right:0 !important;
  left:auto !important;
  bottom:58px !important;
  width:min(420px, calc(100vw - 24px)) !important;
  max-width:420px !important;
  height:min(560px, calc(100dvh - 110px)) !important;
  max-height:calc(100dvh - 110px) !important;
  border-radius:16px !important;
  overflow:hidden !important;
}
#tma-ai-root #tma-ai-panel .tma-ai-panel-head{
  width:auto !important;
  min-width:0 !important;
}
#tma-ai-root #tma-ai-messages{min-width:0}
@media (max-width: 600px) {
  #tma-ai-root #tma-ai-panel:not(.tma-ai-expanded){
    width:min(360px, calc(100vw - 20px)) !important;
    max-width:calc(100vw - 20px) !important;
    bottom:50px !important;
    height:min(520px, calc(100dvh - 92px)) !important;
    max-height:calc(100dvh - 92px) !important;
  }
}

/* v1.0.3: Site themes sometimes apply fixed-position rules to HTML <header> elements.
   Use our own div-based title bar and explicitly keep it inside the right-hand chat panel. */
#tma-ai-root #tma-ai-panel .tma-ai-panel-head {
    box-sizing: border-box !important;
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    float: none !important;
    transform: none !important;
    display: flex !important;
    flex: 0 0 auto !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px;
    margin: 0 !important;
    padding: 12px 14px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    background: #1266d6 !important;
    color: #ffffff !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    text-align: left !important;
}
#tma-ai-root #tma-ai-panel .tma-ai-panel-head .tma-ai-head-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: break-word;
}
#tma-ai-root #tma-ai-panel .tma-ai-panel-head strong {
    display: block;
    font-size: 16px;
    line-height: 1.3;
    color: #fff;
}
#tma-ai-root #tma-ai-panel .tma-ai-panel-head small {
    display: block;
    font-size: 12px;
    line-height: 1.35;
    color: #fff;
}
#tma-ai-root #tma-ai-panel .tma-ai-panel-head .tma-ai-header-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}
@media (max-width: 600px) {
    #tma-ai-root #tma-ai-panel .tma-ai-panel-head { padding: 10px 12px !important; }
}

/* v1.0.4: Cards for real published WordPress articles. */
#tma-ai-panel .tma-ai-articles{display:grid;gap:8px;width:100%;margin:8px 0 4px;min-width:0}
#tma-ai-panel .tma-ai-article{display:flex;gap:9px;align-items:flex-start;min-width:0;padding:9px;text-decoration:none;background:#fff;border:1px solid #dce5f2;border-radius:10px;color:#163b73}
#tma-ai-panel .tma-ai-article:hover{background:#f0f6ff;border-color:#aac8e6}
#tma-ai-panel .tma-ai-article img{height:58px;width:64px;object-fit:cover;border-radius:6px;flex-shrink:0}
#tma-ai-panel .tma-ai-article-info{min-width:0;display:flex;flex-direction:column;gap:3px}
#tma-ai-panel .tma-ai-article-title{font-size:13px;line-height:1.4;font-weight:700}
#tma-ai-panel .tma-ai-article-excerpt{font-size:12px;line-height:1.35;color:#5b6a7a;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
