/* Final chatbot layer: desktop card and app-like mobile layout. */
.ai-launcher {
  right: 24px !important;
  bottom: 24px !important;
  width: auto !important;
  height: auto !important;
  min-height: 62px !important;
  padding: 9px 17px !important;
  gap: 10px !important;
  border: 1px solid rgba(232, 216, 191, 0.2) !important;
  border-radius: 19px !important;
  background: linear-gradient(
    145deg,
    rgba(35, 38, 32, 0.97),
    rgba(21, 23, 19, 0.98)
  ) !important;
  color: #f4ebdf !important;
  box-shadow:
    0 18px 55px rgba(0, 0, 0, 0.4),
    inset 0 1px rgba(255, 255, 255, 0.07) !important;
  backdrop-filter: blur(18px);
  transform: none !important;
  overflow: hidden;
}
.ai-launcher:before {
  content: "";
  position: absolute;
  inset: -80% 35% -80% -30%;
  background: linear-gradient(
    115deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  transform: translateX(-100%) rotate(12deg);
  transition: transform 0.7s ease;
}
.ai-launcher:after {
  content: "";
  width: 7px;
  height: 7px;
  margin-left: 2px;
  border-radius: 50%;
  background: #8fb48a;
  box-shadow:
    0 0 0 4px rgba(143, 180, 138, 0.12),
    0 0 12px rgba(143, 180, 138, 0.65);
}
.ai-launcher:hover {
  transform: translateY(-4px) !important;
  border-color: rgba(217, 120, 71, 0.48) !important;
}
.ai-launcher:hover:before {
  transform: translateX(220%) rotate(12deg);
}
.ai-launcher i {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  background: linear-gradient(145deg, #e18a58, #8ca686);
  color: #171914;
}
.ai-launcher span {
  font-size: 0.8rem;
  letter-spacing: -0.01em;
}
section.ai-panel {
  right: 24px !important;
  bottom: 100px !important;
  width: min(430px, calc(100vw - 32px)) !important;
  height: min(650px, calc(100dvh - 130px)) !important;
  max-height: none !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  border: 1px solid rgba(232, 216, 191, 0.16) !important;
  border-radius: 27px !important;
  background: #161813 !important;
  color: #f3eadf !important;
  box-shadow: 0 35px 100px rgba(0, 0, 0, 0.58) !important;
  transform: translateY(22px) scale(0.96) !important;
  transform-origin: bottom right !important;
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease,
    transform 0.38s cubic-bezier(0.2, 0.85, 0.2, 1) !important;
}
section.ai-panel.open {
  transform: none !important;
}
.ai-head {
  position: relative;
  min-height: 82px !important;
  padding: 15px 16px 15px 76px !important;
  border-bottom: 1px solid rgba(232, 216, 191, 0.11) !important;
  background:
    radial-gradient(circle at 8% 0, rgba(217, 120, 71, 0.14), transparent 40%),
    linear-gradient(135deg, #20231d, #191b17) !important;
}
.ai-head:before {
  content: "N";
  position: absolute;
  left: 16px;
  top: 15px;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  background: linear-gradient(145deg, #df8352, #91aa8a);
  color: #171914;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.24);
}
.ai-head strong {
  display: block !important;
  color: #f5ede3 !important;
  font-size: 1rem !important;
}
.ai-head span {
  margin-top: 3px;
  color: #aaa196 !important;
  font-size: 0.67rem !important;
}
.ai-clear,
.ai-close {
  width: 36px !important;
  height: 36px !important;
  border: 1px solid rgba(232, 216, 191, 0.09) !important;
  border-radius: 11px !important;
  background: rgba(255, 255, 255, 0.045) !important;
  color: #bdb3a7 !important;
  transition: 0.2s !important;
}
.ai-clear:hover,
.ai-close:hover {
  background: rgba(217, 120, 71, 0.14) !important;
  color: #f1b188 !important;
  transform: translateY(-1px);
}
.ai-messages {
  padding: 18px !important;
  gap: 12px !important;
  background:
    radial-gradient(
      circle at 100% 0,
      rgba(145, 171, 139, 0.07),
      transparent 35%
    ),
    #10120f !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(229, 207, 173, 0.18) transparent;
}
.ai-msg {
  position: relative;
  max-width: 84% !important;
  padding: 11px 13px !important;
  border: 1px solid transparent !important;
  border-radius: 16px !important;
  font-size: 0.82rem !important;
  line-height: 1.55 !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  animation: aiMessageIn 0.3s ease both;
}
.ai-msg.bot {
  color: #ded5c9 !important;
  background: linear-gradient(145deg, #242720, #1d201b) !important;
  border-color: rgba(232, 216, 191, 0.1) !important;
  border-bottom-left-radius: 5px !important;
}
.ai-msg.user {
  color: #1c1713 !important;
  background: linear-gradient(135deg, #e49a6f, #d9b083) !important;
  border-bottom-right-radius: 5px !important;
  font-weight: 600;
}
.ai-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.ai-suggestion {
  padding: 8px 10px !important;
  border: 1px solid rgba(145, 171, 139, 0.2) !important;
  border-radius: 999px !important;
  background: rgba(145, 171, 139, 0.07) !important;
  color: #c9d3c5 !important;
  font:
    700 0.66rem Manrope,
    sans-serif !important;
}
.ai-suggestion:hover {
  transform: translateY(-2px);
  background: rgba(217, 120, 71, 0.12) !important;
  color: #f2dfd0 !important;
}
.ai-form {
  padding: 12px !important;
  grid-template-columns: minmax(0, 1fr) 48px !important;
  gap: 9px !important;
  border-top: 1px solid rgba(232, 216, 191, 0.1) !important;
  background: #191b17 !important;
}
.ai-input {
  height: 48px !important;
  padding: 0 14px !important;
  border: 1px solid rgba(232, 216, 191, 0.12) !important;
  border-radius: 15px !important;
  background: #22251f !important;
  color: #f1e8dc !important;
  font-size: 0.82rem !important;
}
.ai-input:focus {
  border-color: rgba(217, 120, 71, 0.55) !important;
  box-shadow: 0 0 0 3px rgba(217, 120, 71, 0.08);
}
.ai-send {
  width: 48px !important;
  height: 48px !important;
  border-radius: 15px !important;
  background: linear-gradient(145deg, #e09970, #8fa889) !important;
  color: #171914 !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  transition: 0.2s !important;
}
.ai-send:hover {
  transform: translateY(-2px) rotate(-3deg);
}
body.light .ai-launcher {
  background: rgba(255, 252, 247, 0.96) !important;
  color: #2a2823 !important;
  border-color: rgba(78, 67, 51, 0.13) !important;
  box-shadow: 0 18px 50px rgba(66, 54, 42, 0.18) !important;
}
.light section.ai-panel {
  background: #fffaf4 !important;
  color: #27251f !important;
  border-color: rgba(78, 67, 51, 0.16) !important;
  box-shadow: 0 35px 100px rgba(76, 64, 51, 0.25) !important;
}
.light .ai-head {
  background:
    radial-gradient(circle at 8% 0, rgba(210, 117, 69, 0.14), transparent 42%),
    #f8f1e7 !important;
}
.light .ai-messages {
  background: #fffaf4 !important;
}
.light .ai-msg.bot {
  color: #39352f !important;
  background: #fff !important;
  border-color: rgba(78, 67, 51, 0.13) !important;
}
.light .ai-msg.user {
  color: #211b16 !important;
  background: linear-gradient(135deg, #e99f75, #e1bd91) !important;
}
.light .ai-form {
  background: #f8f1e8 !important;
}
.light .ai-input {
  background: #fff !important;
  color: #292722 !important;
}
@keyframes aiMessageIn {
  from {
    opacity: 0;
    transform: translateY(9px) scale(0.98);
  }
}
@media (max-width: 600px) {
  body.ai-open {
    overflow: hidden !important;
  }
  body.ai-open .ai-launcher {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  .ai-launcher {
    right: 12px !important;
    bottom: 68px !important;
    width: auto !important;
    height: auto !important;
    min-height: 54px !important;
    padding: 7px 12px 7px 7px !important;
    transform: none !important;
  }
  .ai-launcher i {
    width: 40px;
    height: 40px;
  }
  .ai-launcher:after {
    display: none;
  }
  section.ai-panel {
    inset: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    transform: translateY(100%) !important;
    transform-origin: bottom center !important;
    z-index: 4000 !important;
  }
  section.ai-panel.open {
    transform: none !important;
  }
  .ai-head {
    min-height: 76px !important;
    padding: calc(10px + env(safe-area-inset-top)) 12px 10px 66px !important;
  }
  .ai-head:before {
    left: 12px;
    top: calc(8px + env(safe-area-inset-top));
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }
  .ai-messages {
    padding: 15px 13px !important;
    gap: 11px !important;
  }
  .ai-msg {
    max-width: 88% !important;
    font-size: 0.82rem !important;
  }
  .ai-suggestions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
  }
  .ai-suggestion {
    min-height: 38px;
    text-align: left;
  }
  .ai-suggestion:last-child {
    grid-column: 1/-1;
  }
  .ai-form {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom)) !important;
  }
  .ai-input {
    height: 48px !important;
    font-size: 16px !important;
  }
}
@media (max-width: 370px) {
  .ai-head > div:first-child {
    max-width: 145px;
  }
  .ai-head-actions {
    gap: 3px !important;
  }
  .ai-clear,
  .ai-close {
    width: 34px !important;
    height: 34px !important;
  }
  .ai-messages {
    padding: 11px !important;
  }
  .ai-suggestions {
    grid-template-columns: 1fr !important;
  }
  .ai-suggestion:last-child {
    grid-column: auto;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  section.ai-panel {
    inset: 0 !important;
  }
  .ai-head {
    min-height: 58px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
  }
  .ai-head:before {
    top: 6px;
    width: 40px;
    height: 40px;
  }
  .ai-messages {
    padding: 9px 13px !important;
  }
  .ai-form {
    padding: 7px 10px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-msg {
    animation: none !important;
  }
}

/* Conversation history */
section.ai-panel {
  width: min(760px, calc(100vw - 32px)) !important;
}
.ai-head {
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
}
.ai-history-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(232, 216, 191, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  color: #d7cec2;
}
.ai-new {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(232, 216, 191, 0.09);
  border-radius: 11px;
  background: rgba(145, 171, 139, 0.12);
  color: #bcd1b8;
  cursor: pointer;
}
.ai-body {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  overflow: hidden;
}
.ai-sidebar {
  min-height: 0;
  padding: 15px 12px 12px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(232, 216, 191, 0.1);
  background: #171914;
}
.ai-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3px 5px 13px;
}
.ai-sidebar-head span {
  display: block;
  color: #d98758;
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: 0.16em;
}
.ai-sidebar-head strong {
  display: block;
  margin-top: 3px;
  color: #e9dfd2 !important;
  font-size: 0.78rem;
}
.ai-sidebar-close {
  display: none;
}
.ai-new-wide {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(145, 171, 139, 0.25);
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(145, 171, 139, 0.15),
    rgba(217, 120, 71, 0.08)
  );
  color: #e5ddd2;
  font:
    750 0.72rem Manrope,
    sans-serif;
  text-align: left;
  cursor: pointer;
}
.ai-new-wide i {
  margin-right: 8px;
  color: #a9c1a5;
}
.ai-chat-list {
  min-height: 0;
  margin-top: 12px;
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
}
.ai-chat-item {
  position: relative;
  width: 100%;
  padding: 9px 7px;
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #8f887e;
  text-align: left;
  cursor: pointer;
}
.ai-chat-item:hover,
.ai-chat-item.active {
  background: rgba(255, 255, 255, 0.055);
  color: #dca078;
}
.ai-chat-item > i {
  font-size: 0.65rem;
}
.ai-chat-item > span {
  min-width: 0;
}
.ai-chat-item strong {
  display: block !important;
  overflow: hidden;
  color: inherit !important;
  font-size: 0.66rem !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-item small {
  display: block;
  margin-top: 2px;
  color: #756f67;
  font-size: 0.53rem;
}
.ai-chat-delete {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #716b63;
  opacity: 0;
}
.ai-chat-item:hover .ai-chat-delete {
  opacity: 1;
}
.ai-chat-delete:hover {
  background: rgba(217, 120, 71, 0.14);
  color: #df8d62;
}
.ai-history-note {
  margin: 10px 4px 0 !important;
  color: #716b63 !important;
  font-size: 0.55rem !important;
}
.ai-history-note i {
  margin-right: 5px;
}
.ai-empty-history {
  padding: 26px 8px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #756f67;
}
.ai-empty-history > i {
  margin-bottom: 9px;
  font-size: 1.1rem;
}
.ai-empty-history span {
  font-size: 0.67rem;
  font-weight: 700;
}
.ai-empty-history small {
  margin-top: 3px;
  font-size: 0.55rem;
}
.ai-chat-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}
.ai-sidebar-backdrop {
  display: none;
}
.light .ai-sidebar {
  background: #f5eee5;
  border-color: rgba(78, 67, 51, 0.12);
}
.light .ai-sidebar-head strong {
  color: #35312b !important;
}
.light .ai-new-wide {
  color: #3a3731;
  background: rgba(111, 148, 115, 0.1);
}
.light .ai-chat-item {
  color: #756c62;
}
.light .ai-chat-item:hover,
.light .ai-chat-item.active {
  background: #fff;
  color: #a45632;
}
@media (max-width: 600px) {
  section.ai-panel {
    width: 100vw !important;
  }
  .ai-head {
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    padding-left: 12px !important;
  }
  .ai-head:before {
    display: none !important;
  }
  .ai-history-toggle {
    display: grid;
    place-items: center;
  }
  .ai-head-actions {
    gap: 4px !important;
  }
  .ai-body {
    display: block;
  }
  .ai-chat-main {
    height: 100%;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .ai-sidebar {
    position: absolute;
    z-index: 5;
    inset: 0 auto 0 0;
    width: min(82vw, 310px);
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 25px 0 70px rgba(0, 0, 0, 0.45);
  }
  .history-open .ai-sidebar {
    transform: none;
  }
  .ai-sidebar-close {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    color: #bbb1a5;
  }
  .ai-sidebar-backdrop {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(6, 8, 6, 0.55);
    opacity: 0;
    visibility: hidden;
    transition: 0.25s;
  }
  .history-open .ai-sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }
  .ai-new {
    display: none;
  }
  .ai-chat-delete {
    opacity: 1;
  }
}

/* Desktop layout correction: keep the chat readable and below the navigation. */
@media (min-width: 901px) {
  section.ai-panel {
    right: 24px !important;
    bottom: 88px !important;
    width: min(780px, calc(100vw - 48px)) !important;
    height: min(600px, calc(100dvh - 165px)) !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }
  .ai-body {
    grid-template-columns: 210px minmax(0, 1fr) !important;
  }
  .ai-chat-main {
    min-width: 0 !important;
  }
  .ai-msg {
    max-width: min(82%, 520px) !important;
  }
}
@media (min-width: 601px) and (max-width: 900px) {
  section.ai-panel {
    right: 16px !important;
    bottom: 84px !important;
    width: min(570px, calc(100vw - 32px)) !important;
    height: min(580px, calc(100dvh - 150px)) !important;
  }
  .ai-head {
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    padding-left: 12px !important;
  }
  .ai-head:before {
    display: none !important;
  }
  .ai-history-toggle {
    display: grid !important;
    place-items: center;
  }
  .ai-body {
    display: block !important;
  }
  .ai-chat-main {
    height: 100%;
  }
  .ai-sidebar {
    position: absolute;
    z-index: 5;
    inset: 0 auto 0 0;
    width: 240px;
    transform: translateX(-105%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 25px 0 70px rgba(0, 0, 0, 0.45);
  }
  .history-open .ai-sidebar {
    transform: none;
  }
  .ai-sidebar-close {
    display: grid;
    place-items: center;
  }
  .ai-sidebar-backdrop {
    position: absolute;
    z-index: 4;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(6, 8, 6, 0.55);
    opacity: 0;
    visibility: hidden;
  }
  .history-open .ai-sidebar-backdrop {
    opacity: 1;
    visibility: visible;
  }
}

/* Zoom-safe desktop dimensions. */
@media (min-width: 901px) {
  body.ai-open .ai-launcher {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  section.ai-panel {
    top: 120px !important;
    right: 24px !important;
    bottom: 24px !important;
    width: min(980px, calc(100vw - 48px)) !important;
    height: auto !important;
    max-height: none !important;
  }
  .ai-body {
    grid-template-columns: 220px minmax(0, 1fr) !important;
  }
  .ai-sidebar {
    width: 220px !important;
  }
  .ai-messages {
    padding: 20px !important;
  }
  .ai-form {
    padding: 14px !important;
  }
  .ai-input {
    min-width: 0 !important;
  }
}

/* The animated robot and speech cloud are the launcher; hide its hit-area box. */
.ai-launcher,
.ai-launcher:hover,
body.light .ai-launcher {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  outline: none !important;
}

/* Final phone/tablet authority: no squeezed columns or floating-panel overlap. */
@media (max-width: 900px) {
  body.ai-open {
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }
  body .ai-launcher,
  body .ai-launcher:hover,
  body.light .ai-launcher {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    outline: 0 !important;
  }
  body.ai-open .ai-launcher {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
  section.ai-panel {
    position: fixed !important;
    z-index: 5000 !important;
    inset: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    transform: translateY(100%) !important;
    transform-origin: bottom center !important;
  }
  section.ai-panel.open {
    transform: none !important;
  }
  .ai-head {
    min-width: 0 !important;
    min-height: 68px !important;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px !important;
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) auto !important;
    gap: 8px !important;
    border-radius: 0 !important;
  }
  .ai-head:before {
    display: none !important;
  }
  .ai-history-toggle {
    width: 40px !important;
    height: 40px !important;
    display: grid !important;
    place-items: center !important;
    flex: 0 0 40px !important;
  }
  .ai-head > div:nth-child(2) {
    min-width: 0 !important;
  }
  .ai-head > div:nth-child(2) strong,
  .ai-head > div:nth-child(2) span {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .ai-head > div:nth-child(2) span {
    font-size: 0.6rem !important;
  }
  .ai-head-actions {
    display: flex !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
  }
  .ai-head-actions button {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px !important;
  }
  .ai-new {
    display: none !important;
  }
  .ai-body {
    position: relative !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: block !important;
    overflow: hidden !important;
  }
  .ai-chat-main {
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-rows: minmax(0, 1fr) auto !important;
  }
  .ai-messages {
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 14px 12px !important;
    gap: 10px !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
  }
  .ai-msg {
    max-width: 88% !important;
    padding: 10px 12px !important;
    font-size: 0.82rem !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
  .ai-image-card {
    max-width: 100% !important;
  }
  .ai-form {
    min-width: 0 !important;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom)) !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 48px !important;
    gap: 8px !important;
  }
  .ai-input {
    width: 100% !important;
    min-width: 0 !important;
    height: 48px !important;
    padding: 0 13px !important;
    font-size: 16px !important;
  }
  .ai-send {
    width: 48px !important;
    height: 48px !important;
    flex: 0 0 48px !important;
  }
  .ai-sidebar {
    position: absolute !important;
    z-index: 7 !important;
    inset: 0 auto 0 0 !important;
    width: min(84vw, 310px) !important;
    height: 100% !important;
    padding: 14px 12px calc(12px + env(safe-area-inset-bottom)) !important;
    transform: translateX(-105%) !important;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
    box-shadow: 25px 0 70px rgba(0, 0, 0, 0.5) !important;
  }
  .history-open .ai-sidebar {
    transform: none !important;
  }
  .ai-sidebar-close {
    width: 36px !important;
    height: 36px !important;
    display: grid !important;
    place-items: center !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, 0.07) !important;
    color: #d8cfc3 !important;
  }
  .ai-chat-list {
    overflow-y: auto !important;
  }
  .ai-chat-delete {
    opacity: 1 !important;
  }
  .ai-sidebar-backdrop {
    position: absolute !important;
    z-index: 6 !important;
    inset: 0 !important;
    display: block !important;
    border: 0 !important;
    background: rgba(6, 8, 6, 0.62) !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: 0.25s !important;
  }
  .history-open .ai-sidebar-backdrop {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}
@media (max-width: 380px) {
  .ai-head {
    grid-template-columns: 38px minmax(0, 1fr) auto !important;
    padding-inline: 7px !important;
    gap: 5px !important;
  }
  .ai-history-toggle {
    width: 38px !important;
    height: 38px !important;
  }
  .ai-head-actions button {
    width: 34px !important;
    height: 34px !important;
    flex-basis: 34px !important;
  }
  .ai-clear {
    display: none !important;
  }
  .ai-msg {
    max-width: 92% !important;
  }
  .ai-sidebar {
    width: 88vw !important;
  }
  .ai-form {
    grid-template-columns: minmax(0, 1fr) 46px !important;
  }
  .ai-send {
    width: 46px !important;
    height: 46px !important;
  }
}
@media (max-width: 900px) and (max-height: 520px) and (orientation: landscape) {
  .ai-head {
    min-height: 54px !important;
    padding: 5px 8px !important;
  }
  .ai-history-toggle {
    width: 36px !important;
    height: 36px !important;
  }
  .ai-head-actions button {
    width: 34px !important;
    height: 34px !important;
  }
  .ai-messages {
    padding: 8px 10px !important;
  }
  .ai-form {
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)) !important;
  }
  .ai-input,
  .ai-send {
    height: 44px !important;
  }
  .ai-send {
    width: 44px !important;
  }
  .ai-sidebar {
    width: min(55vw, 300px) !important;
    padding-top: 8px !important;
  }
}
