/*
 * AISmart Content Chat admin.
 *
 * `.tw-chat-admin` is also the wrapper of the companion commerce admin pages, so the few base rules those pages
 * rely on stay exactly as they were. Everything of the AI Chat Hub design lives under `.tw-aihub`.
 */
.tw-chat-admin {
  --tw-ink: #19272b;
  --tw-muted: #627277;
  --tw-line: #cfdad8;
  --tw-soft: #edf5f2;
  --tw-accent: #087a57;
  --tw-accent-dark: #075e46;
  --tw-coral: #d95d42;
  max-width: 1180px;
  color: var(--tw-ink);
  font-family: "Trebuchet MS", "Aptos", sans-serif;
}

.tw-chat-admin h2 {
  margin: 0;
  color: var(--tw-ink);
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0;
}

.tw-chat-admin > .notice {
  margin: 16px 0 0;
}

/* ------------------------------------------------------------------------------------------------------------
   Design tokens
   ------------------------------------------------------------------------------------------------------------ */
.tw-aihub {
  --tw-ink: #0e1d17;
  --tw-ink-2: #465c53;
  --tw-ink-3: #6b7f76;
  --tw-muted: #5b6f66;
  --tw-line: rgba(14, 29, 23, .09);
  --tw-line-2: rgba(14, 29, 23, .17);
  --tw-accent: #087a57;
  --tw-accent-deep: #064d38;
  --tw-accent-soft: #2fd6a1;
  --tw-cool: #38bdf8;
  --tw-violet: #8b5cf6;
  --tw-online: #22c55e;
  --tw-away: #f59e0b;
  --tw-danger: #b42318;
  --tw-card: #fff;
  --tw-soft: #eef6f2;
  --tw-focus: rgba(8, 122, 87, .18);
  --tw-shadow: 0 22px 50px -32px rgba(6, 40, 29, .55), 0 2px 6px -2px rgba(6, 40, 29, .08);
  position: relative;
  isolation: isolate;
  max-width: 1180px;
  padding-bottom: 44px;
  color: var(--tw-ink);
  font: 14px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans Thai UI", "Noto Sans Thai", Sarabun, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* A soft aurora behind the whole page. */
.tw-aihub::before {
  position: absolute;
  z-index: -1;
  inset: -10px 0 auto 0;
  height: 460px;
  background:
    radial-gradient(60% 80% at 12% 0, rgba(47, 214, 161, .2), transparent 70%),
    radial-gradient(50% 70% at 92% 8%, rgba(139, 92, 246, .15), transparent 70%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  content: "";
  pointer-events: none;
}

.tw-aihub h1,
.tw-aihub h2 {
  margin: 0;
  color: var(--tw-ink);
  font-family: inherit;
  letter-spacing: -.015em;
}

.tw-aihub h2 {
  font-size: 19px;
  font-weight: 750;
  line-height: 1.25;
}

.tw-aihub p {
  font-size: 14px;
}

/* ------------------------------------------------------------------------------------------------------------
   Hero header and page navigation
   ------------------------------------------------------------------------------------------------------------ */
.tw-aihub .tw-chat-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin: 20px 0 0;
  padding: 30px 32px 64px;
  border: 0;
  border-radius: 30px;
  color: #fff;
  background:
    radial-gradient(65% 130% at 100% 0, rgba(139, 92, 246, .55), transparent 62%),
    radial-gradient(70% 120% at 0 100%, rgba(47, 214, 161, .38), transparent 62%),
    linear-gradient(135deg, #03231a, #06553d 58%, #087a57);
  box-shadow: 0 36px 70px -36px rgba(4, 40, 29, .85);
}

.tw-aihub .tw-chat-header::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(120% 120% at 100% 0, #000, transparent 70%);
  mask-image: radial-gradient(120% 120% at 100% 0, #000, transparent 70%);
  content: "";
}

.tw-aihub .tw-chat-header::after {
  position: absolute;
  z-index: -1;
  top: -150px;
  right: -90px;
  width: 340px;
  height: 340px;
  background: radial-gradient(closest-side, rgba(139, 92, 246, .5), transparent);
  content: "";
  animation: tw-drift 12s ease-in-out infinite alternate;
}

.tw-aihub .tw-chat-header h1 {
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
}

.tw-aihub .tw-chat-header p:not(.tw-chat-eyebrow) {
  max-width: 640px;
  margin: 7px 0 0;
  color: rgba(255, 255, 255, .82);
  font-size: 14px;
}

.tw-aihub .tw-chat-eyebrow,
.tw-aihub .tw-chat-kicker {
  margin: 0 0 5px;
  color: var(--tw-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.tw-aihub .tw-chat-header .tw-chat-eyebrow {
  color: rgba(255, 255, 255, .78);
}

.tw-chat-kicker {
  display: block;
}

/* The assistant mark: a ring that slowly turns around a glass orb with a spark. */
.tw-aihub .tw-chat-orb {
  --size: 58px;
  position: relative;
  display: block;
  flex: none;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--tw-accent-soft), var(--tw-cool), var(--tw-violet), var(--tw-accent-soft));
  box-shadow: 0 16px 28px -12px rgba(0, 0, 0, .55);
  animation: tw-spin 12s linear infinite;
}

.tw-aihub .tw-chat-orb::before {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .5), transparent 46%),
    linear-gradient(145deg, var(--tw-accent-soft), var(--tw-accent) 55%, var(--tw-accent-deep));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .55);
  content: "";
}

.tw-aihub .tw-chat-orb::after {
  position: absolute;
  inset: 27%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M12 1.5c.9 5.6 4.9 9.6 10.5 10.5-5.6.9-9.6 4.9-10.5 10.5-.9-5.6-4.9-9.6-10.5-10.5C7.1 11.1 11.1 7.1 12 1.5z'/%3E%3C/svg%3E") center / contain no-repeat;
  content: "";
  animation: tw-spin 12s linear infinite reverse;
}

.tw-aihub .tw-chat-orb--lg { --size: 64px; }
.tw-aihub .tw-chat-orb--md { --size: 46px; }

.tw-aihub .tw-chat-brand {
  display: grid;
  place-items: center;
}

/* Status pill: glass on the hero, soft tint on cards. */
.tw-aihub .tw-chat-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 12.5px;
  font-weight: 750;
  white-space: nowrap;
}

.tw-aihub .tw-chat-status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tw-away);
  content: "";
}

.tw-aihub .tw-chat-status.is-connected::before {
  background: var(--tw-online);
  animation: tw-pulse 2.2s ease-out infinite;
}

.tw-aihub .tw-chat-feature-band .tw-chat-status {
  border-color: rgba(8, 122, 87, .22);
  background: #eaf7f2;
  color: #075e46;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.tw-aihub .tw-chat-feature-band .tw-chat-status:not(.is-connected) {
  border-color: rgba(245, 158, 11, .38);
  background: #fff7e6;
  color: #8a5a00;
}

/* Page navigation: a floating glass pill that overlaps the hero, like the tabs of the chat box. */
.tw-aihub .tw-chat-nav {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: -27px 24px 0;
  padding: 6px;
  border: 1px solid var(--tw-line);
  border-radius: 21px;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 44px -24px rgba(6, 40, 29, .6);
}

.tw-aihub .tw-chat-nav a {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 11px 16px;
  border-radius: 15px;
  color: var(--tw-ink-2);
  font-size: 13px;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
  transition: background .2s, color .2s, box-shadow .2s;
}

.tw-aihub .tw-chat-nav a:hover {
  background: var(--tw-soft);
  color: var(--tw-ink);
}

.tw-aihub .tw-chat-nav a:focus {
  box-shadow: none;
}

.tw-aihub .tw-chat-nav a:focus-visible {
  outline: 2px solid var(--tw-accent);
  outline-offset: 1px;
}

.tw-aihub .tw-chat-nav a[aria-current="page"] {
  background: linear-gradient(135deg, var(--tw-accent), var(--tw-accent-deep));
  box-shadow: 0 14px 24px -14px var(--tw-accent);
  color: #fff;
}

.tw-aihub > .notice {
  margin: 18px 0 0;
  border: 1px solid var(--tw-line);
  border-left-width: 4px;
  border-radius: 16px;
  box-shadow: var(--tw-shadow);
}

/* ------------------------------------------------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------------------------------------------------ */
.tw-aihub .tw-chat-connection,
.tw-aihub .tw-chat-operators,
.tw-aihub .tw-chat-feature-band,
.tw-aihub .tw-chat-settings,
.tw-aihub .tw-chat-preview,
.tw-aihub .tw-chat-table__row {
  border: 1px solid var(--tw-line);
  border-radius: 26px;
  background: var(--tw-card);
  box-shadow: var(--tw-shadow);
}

.tw-aihub .tw-chat-connection,
.tw-aihub .tw-chat-operators,
.tw-aihub .tw-chat-feature-band {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  margin-top: 18px;
  padding: 22px 26px;
}

.tw-aihub .tw-chat-connection:first-of-type {
  margin-top: 24px;
}

.tw-aihub .tw-chat-connection p,
.tw-aihub .tw-chat-operators p,
.tw-aihub .tw-chat-feature-band p {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--tw-muted);
  line-height: 1.55;
}

.tw-aihub .tw-chat-connection__icon {
  position: relative;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(145deg, #fbbf24, var(--tw-away));
  box-shadow: 0 16px 26px -14px var(--tw-away);
}

.tw-aihub .tw-chat-connection.is-connected .tw-chat-connection__icon {
  background: linear-gradient(145deg, var(--tw-accent-soft), var(--tw-accent));
  box-shadow: 0 16px 26px -14px var(--tw-accent);
}

.tw-aihub .tw-chat-connection__icon::after {
  position: absolute;
  top: 48%;
  left: 50%;
  width: 11px;
  height: 21px;
  border: solid #fff;
  border-width: 0 3.5px 3.5px 0;
  content: "";
  transform: translate(-50%, -58%) rotate(45deg);
}

.tw-aihub .tw-chat-connection:not(.is-connected) .tw-chat-connection__icon::after {
  top: 50%;
  width: 4px;
  height: 17px;
  border: 0;
  border-radius: 3px;
  background: #fff;
  transform: translate(-50%, -72%);
}

.tw-aihub .tw-chat-connection:not(.is-connected) .tw-chat-connection__icon::before {
  position: absolute;
  bottom: 12px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #fff;
  content: "";
}

.tw-aihub .tw-chat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 13px 0 0;
  padding: 0;
  list-style: none;
}

.tw-aihub .tw-chat-meta li {
  display: inline-flex;
  gap: 7px;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--tw-soft);
  font-size: 12px;
}

.tw-aihub .tw-chat-meta span {
  color: var(--tw-ink-3);
  font-weight: 600;
}

.tw-aihub .tw-chat-meta strong {
  font-weight: 750;
}

.tw-aihub .tw-chat-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tw-aihub .tw-chat-actions form {
  margin: 0;
}

/* Operators: the people visitors meet, each in a ring that says online (green) or away (amber). */
.tw-aihub .tw-chat-operators__faces {
  display: flex;
  align-items: center;
  min-width: 64px;
}

.tw-aihub .tw-chat-faces {
  display: inline-flex;
  align-items: center;
}

.tw-aihub .tw-chat-face {
  --size: 50px;
  --ring: var(--tw-online);
  --ring-hi: #b9f5cf;
  --gap: #fff;
  position: relative;
  display: inline-flex;
  flex: none;
  padding: 3px;
  border-radius: 50%;
  background: conic-gradient(from 200deg, var(--ring), var(--ring-hi) 38%, var(--ring) 62%, var(--ring-hi) 90%, var(--ring));
  box-shadow: 0 10px 18px -10px rgba(0, 0, 0, .5);
}

.tw-aihub .tw-chat-face.is-idle {
  --ring: var(--tw-away);
  --ring-hi: #fde6a8;
}

.tw-aihub .tw-chat-face img,
.tw-aihub .tw-chat-face b {
  display: grid;
  place-items: center;
  width: var(--size);
  height: var(--size);
  border: 2.5px solid var(--gap);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--tw-accent), var(--tw-accent-deep));
  color: #fff;
  font-size: calc(var(--size) * .34);
  font-weight: 800;
  object-fit: cover;
}

.tw-aihub .tw-chat-face::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: max(11px, calc(var(--size) * .3));
  height: max(11px, calc(var(--size) * .3));
  border: 2.5px solid var(--gap);
  border-radius: 50%;
  background: var(--ring);
  content: "";
}

.tw-aihub .tw-chat-face.no-dot::after {
  display: none;
}

.tw-aihub .tw-chat-face + .tw-chat-face {
  margin-left: calc(var(--size) * -.3);
}

.tw-aihub .tw-chat-face-more {
  display: inline-grid;
  place-items: center;
  height: 28px;
  margin-left: -4px;
  padding: 0 10px;
  border: 1px solid var(--tw-line-2);
  border-radius: 999px;
  background: #fff;
  color: var(--tw-ink-2);
  font-size: 11.5px;
  font-weight: 800;
}

/* ------------------------------------------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------------------------------------------ */
.tw-aihub .button {
  min-height: 40px;
  padding: 0 20px;
  border: 1px solid var(--tw-line-2);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 8px 16px -12px rgba(6, 40, 29, .55);
  color: var(--tw-ink);
  font-weight: 700;
  line-height: 38px;
  transition: transform .18s, box-shadow .18s, border-color .18s, background .18s, filter .18s;
}

.tw-aihub .button:hover,
.tw-aihub .button:focus {
  border-color: var(--tw-accent);
  background: #fff;
  box-shadow: 0 14px 22px -14px rgba(6, 40, 29, .6);
  color: var(--tw-accent-deep);
  transform: translateY(-1px);
}

.tw-aihub .button:focus-visible {
  outline: 2px solid var(--tw-accent);
  outline-offset: 2px;
}

.tw-aihub .button-primary,
.tw-aihub .button-primary:hover,
.tw-aihub .button-primary:focus {
  border: 0;
  background: linear-gradient(135deg, #0b9a6d, var(--tw-accent) 55%, var(--tw-accent-deep));
  box-shadow: 0 18px 28px -16px var(--tw-accent);
  color: #fff;
}

.tw-aihub .button-primary:hover,
.tw-aihub .button-primary:focus {
  filter: brightness(1.07);
}

.tw-aihub .button-primary[disabled],
.tw-aihub .button-primary:disabled {
  border: 0;
  background: linear-gradient(135deg, #9db8ad, #86a396);
  box-shadow: none;
  color: #fff;
  cursor: not-allowed;
  filter: none;
  opacity: .75;
  transform: none;
}

.tw-aihub .button-link-delete {
  border-color: rgba(180, 35, 24, .25);
  color: var(--tw-danger);
}

.tw-aihub .button-link-delete:hover,
.tw-aihub .button-link-delete:focus {
  border-color: var(--tw-danger);
  background: #fff5f4;
  color: var(--tw-danger);
}

/* ------------------------------------------------------------------------------------------------------------
   Settings form
   ------------------------------------------------------------------------------------------------------------ */
.tw-aihub .tw-chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  align-items: start;
  gap: 24px;
  margin-top: 24px;
}

.tw-aihub .tw-chat-settings {
  min-width: 0;
  padding: 26px 28px;
}

.tw-aihub .tw-chat-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
}

.tw-aihub .tw-chat-fields {
  display: grid;
  gap: 24px;
  padding: 24px 0 6px;
  border-top: 1px solid var(--tw-line);
}

.tw-aihub .tw-chat-fields > label,
.tw-aihub .tw-chat-color-field > label {
  display: grid;
  gap: 8px;
}

.tw-aihub .tw-chat-fields > label > span,
.tw-aihub .tw-chat-color-field > label > span:first-child,
.tw-aihub .tw-chat-fields legend {
  color: var(--tw-ink);
  font-size: 13px;
  font-weight: 750;
}

.tw-aihub .tw-chat-fields input[type="text"],
.tw-aihub .tw-chat-fields textarea {
  width: 100%;
  max-width: none;
  padding: 11px 15px;
  border: 1px solid var(--tw-line-2);
  border-radius: 15px;
  background: #fff;
  box-shadow: none;
  color: var(--tw-ink);
  font: inherit;
  transition: border-color .18s, box-shadow .18s;
}

.tw-aihub .tw-chat-fields textarea {
  min-height: 92px;
  line-height: 1.5;
  resize: vertical;
}

.tw-aihub .tw-chat-fields input[type="text"]:focus,
.tw-aihub .tw-chat-fields textarea:focus {
  border-color: var(--tw-accent);
  box-shadow: 0 0 0 4px var(--tw-focus);
  outline: 0;
}

.tw-aihub .tw-chat-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tw-aihub .tw-chat-fields input[type="color"] {
  width: 56px;
  height: 42px;
  padding: 3px;
  border: 1px solid var(--tw-line-2);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

.tw-aihub .tw-chat-color-row output {
  color: var(--tw-ink-2);
  font: 650 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.tw-aihub .tw-chat-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.tw-aihub .tw-chat-swatch {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px var(--tw-line-2), 0 8px 14px -8px rgba(0, 0, 0, .45);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}

.tw-aihub .tw-chat-swatch:hover {
  transform: scale(1.14);
}

.tw-aihub .tw-chat-swatch:focus-visible {
  outline: 2px solid var(--tw-ink);
  outline-offset: 3px;
}

.tw-aihub .tw-chat-swatch.is-selected {
  box-shadow: 0 0 0 2px var(--swatch), 0 8px 14px -8px rgba(0, 0, 0, .45);
}

.tw-aihub .tw-chat-fields fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.tw-aihub .tw-chat-fields legend {
  width: 100%;
  margin-bottom: 4px;
  padding: 0;
}

.tw-aihub .tw-chat-choice,
.tw-aihub .tw-chat-page-grid label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 15px;
  border: 1px solid var(--tw-line-2);
  border-radius: 15px;
  background: #fff;
  font-weight: 650;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}

.tw-aihub .tw-chat-choice:hover,
.tw-aihub .tw-chat-page-grid label:hover {
  border-color: var(--tw-accent);
}

.tw-aihub .tw-chat-choice:has(input:checked) {
  border-color: var(--tw-accent);
  background: var(--tw-soft);
  box-shadow: 0 0 0 3px var(--tw-focus);
}

.tw-aihub .tw-chat-page-grid label:has(input:checked) {
  border-color: rgba(8, 122, 87, .45);
  background: #fff;
}

.tw-aihub .tw-chat-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 4px;
  padding: 14px;
  border: 1px dashed rgba(8, 122, 87, .28);
  border-radius: 20px;
  background: var(--tw-soft);
}

.tw-aihub .tw-chat-page-grid label {
  padding: 8px 12px;
  font-size: 13px;
}

/* Radios and check boxes drawn by the plugin, so they match in every admin colour scheme. */
.tw-aihub input[type="radio"],
.tw-aihub .tw-chat-page-grid input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 19px;
  height: 19px;
  min-width: 19px;
  margin: 0;
  padding: 0;
  border: 2px solid var(--tw-line-2);
  background: #fff;
  box-shadow: none;
  line-height: 1;
  transition: border-color .15s, background .15s;
}

.tw-aihub input[type="radio"] {
  border-radius: 50%;
}

.tw-aihub .tw-chat-page-grid input[type="checkbox"] {
  border-radius: 6px;
}

.tw-aihub input[type="radio"]::before {
  float: none;
  width: 9px;
  height: 9px;
  margin: 0;
  border-radius: 50%;
  background: var(--tw-accent);
  content: "";
  transform: scale(0);
  transition: transform .15s;
}

.tw-aihub input[type="radio"]:checked {
  border-color: var(--tw-accent);
}

.tw-aihub input[type="radio"]:checked::before {
  width: 9px;
  height: 9px;
  margin: 0;
  background: var(--tw-accent);
  content: "";
  transform: scale(1);
}

.tw-aihub .tw-chat-page-grid input[type="checkbox"]::before {
  float: none;
  width: 5px;
  height: 9px;
  margin: -2px 0 0;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  background: none;
  content: "";
  transform: rotate(45deg) scale(0);
  transition: transform .15s;
}

.tw-aihub .tw-chat-page-grid input[type="checkbox"]:checked {
  border-color: var(--tw-accent);
  background: var(--tw-accent);
}

.tw-aihub .tw-chat-page-grid input[type="checkbox"]:checked::before {
  width: 5px;
  height: 9px;
  margin: -2px 0 0;
  border: solid #fff;
  border-width: 0 2.5px 2.5px 0;
  background: none;
  content: "";
  transform: rotate(45deg) scale(1);
}

.tw-aihub input[type="radio"]:focus,
.tw-aihub .tw-chat-page-grid input[type="checkbox"]:focus {
  box-shadow: 0 0 0 4px var(--tw-focus);
  outline: 0;
}

/* Tiny screen corner that shows where the launcher sits. */
.tw-aihub .tw-chat-corner {
  position: relative;
  width: 28px;
  height: 20px;
  border: 2px solid var(--tw-line-2);
  border-radius: 6px;
  background: #f4f8f6;
}

.tw-aihub .tw-chat-corner::after {
  position: absolute;
  bottom: 2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tw-accent);
  content: "";
}

.tw-aihub .tw-chat-corner--left::after { left: 2px; }
.tw-aihub .tw-chat-corner--right::after { right: 2px; }

/* Enabled switch */
.tw-aihub .tw-chat-switch {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 750;
  cursor: pointer;
}

.tw-aihub .tw-chat-switch input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 50px;
  min-width: 50px;
  height: 29px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #c6d2cd;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, .12);
  cursor: pointer;
  line-height: 1;
  transition: background .2s;
}

.tw-aihub .tw-chat-switch input[type="checkbox"]::before,
.tw-aihub .tw-chat-switch input[type="checkbox"]:checked::before {
  position: absolute;
  top: 3px;
  left: 3px;
  float: none;
  width: 23px;
  height: 23px;
  margin: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
  content: "";
  transition: transform .24s cubic-bezier(.2, .9, .25, 1.25);
}

.tw-aihub .tw-chat-switch input[type="checkbox"]:checked {
  background: linear-gradient(135deg, var(--tw-accent-soft), var(--tw-accent));
}

.tw-aihub .tw-chat-switch input[type="checkbox"]:checked::before {
  transform: translateX(21px);
}

.tw-aihub .tw-chat-switch input[type="checkbox"]:focus {
  box-shadow: 0 0 0 4px var(--tw-focus);
  outline: 0;
}

.tw-aihub .tw-chat-save-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  padding-top: 22px;
  color: var(--tw-ink-3);
  font-size: 12.5px;
}

/* ------------------------------------------------------------------------------------------------------------
   Live preview: a small replica of the chat box visitors get
   ------------------------------------------------------------------------------------------------------------ */
.tw-aihub .tw-chat-preview {
  position: sticky;
  top: 52px;
  align-self: start;
  overflow: hidden;
}

.tw-aihub .tw-chat-preview__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--tw-line);
  background: linear-gradient(#fff, #f5f9f7);
  font-size: 12.5px;
}

.tw-aihub .tw-chat-preview__bar strong {
  flex: 1;
  font-weight: 750;
}

.tw-aihub .tw-chat-preview__dots {
  display: inline-flex;
  gap: 6px;
}

.tw-aihub .tw-chat-preview__dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff6b5f;
}

.tw-aihub .tw-chat-preview__dots i:nth-child(2) { background: #ffbd2e; }
.tw-aihub .tw-chat-preview__dots i:nth-child(3) { background: #28c840; }

.tw-aihub .tw-chat-seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--tw-soft);
}

.tw-aihub .tw-chat-seg button {
  padding: 5px 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--tw-ink-2);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1.3;
  cursor: pointer;
  transition: background .18s, color .18s, box-shadow .18s;
}

.tw-aihub .tw-chat-seg button.is-active {
  background: #fff;
  box-shadow: 0 4px 10px -4px rgba(6, 40, 29, .4);
  color: var(--tw-ink);
}

.tw-aihub .tw-chat-seg button:focus-visible {
  outline: 2px solid var(--tw-accent);
  outline-offset: 1px;
}

.tw-aihub .tw-chat-preview__site {
  --pv-accent: var(--tw-preview-accent, #087a57);
  --pv-on: #fff;
  --pv-deep: #064d38;
  --pv-mid: #066a4b;
  --pv-accent-2: #066a4b;
  --pv-soft: #2fd6a1;
  --pv-cool: #38bdf8;
  --pv-violet: #8b5cf6;
  --pv-glow: rgba(47, 214, 161, .5);
  position: relative;
  min-height: 540px;
  overflow: hidden;
  padding: 22px;
  background:
    radial-gradient(70% 50% at 100% 100%, var(--tw-focus), transparent 70%),
    linear-gradient(180deg, #f3f7f5, #e8efec);
  transition: opacity .25s;
}

@supports (color: color-mix(in oklab, red, blue)) {
  .tw-aihub .tw-chat-preview__site {
    --pv-deep: color-mix(in oklab, var(--pv-accent) 50%, #02120c);
    --pv-mid: color-mix(in oklab, var(--pv-accent) 62%, #02120c);
    --pv-accent-2: color-mix(in oklab, var(--pv-accent) 80%, #000);
    --pv-soft: color-mix(in oklab, var(--pv-accent) 62%, #6ff3c8);
    --pv-cool: color-mix(in oklab, var(--pv-accent) 38%, #38bdf8);
    --pv-violet: color-mix(in oklab, var(--pv-accent) 42%, #8b5cf6);
    --pv-glow: color-mix(in srgb, var(--pv-soft) 55%, transparent);
  }
}

.tw-aihub .tw-chat-preview__site.is-off {
  opacity: .55;
  filter: grayscale(.6);
}

.tw-aihub .tw-chat-preview__lines {
  display: grid;
  gap: 10px;
}

.tw-aihub .tw-chat-preview__lines span {
  display: block;
  width: 62%;
  height: 10px;
  border-radius: 999px;
  background: #cdd8d3;
}

.tw-aihub .tw-chat-preview__lines span:first-child {
  width: 38%;
  height: 14px;
  background: #b9c8c1;
}

.tw-aihub .tw-chat-preview__lines span:nth-child(3) { width: 48%; }

.tw-aihub .tw-chat-preview__cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}

.tw-aihub .tw-chat-preview__cards i {
  height: 92px;
  border-radius: 16px;
  background: linear-gradient(135deg, #dbe6e1, #cfdcd6);
}

.tw-aihub .tw-chat-preview__panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(292px, calc(100% - 32px));
  overflow: hidden;
  border: 1px solid var(--tw-line-2);
  border-radius: 26px;
  background: #f4f8f6;
  box-shadow: 0 34px 60px -26px rgba(6, 40, 29, .65);
  transform-origin: 100% 100%;
  transition: opacity .25s, transform .32s cubic-bezier(.2, .9, .25, 1), visibility .25s;
}

.tw-aihub .tw-chat-preview__site[data-position="bottom-left"] .tw-chat-preview__panel {
  right: auto;
  left: 16px;
  transform-origin: 0 100%;
}

.tw-aihub .tw-chat-preview__site[data-state="closed"] .tw-chat-preview__panel {
  opacity: 0;
  transform: translateY(18px) scale(.95);
  visibility: hidden;
}

.tw-aihub .tw-pv-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 16px 38px;
  color: #fff;
  background:
    radial-gradient(70% 100% at 0 100%, var(--pv-glow), transparent 72%),
    linear-gradient(155deg, var(--pv-deep), var(--pv-accent) 125%);
}

.tw-aihub .tw-chat-preview__site.is-light .tw-pv-head {
  background:
    radial-gradient(70% 100% at 0 100%, var(--pv-glow), transparent 72%),
    linear-gradient(155deg, var(--pv-deep), var(--pv-mid));
}

.tw-aihub .tw-pv-head .tw-chat-face {
  --size: 34px;
  --gap: rgba(255, 255, 255, .95);
}

.tw-aihub .tw-pv-head .tw-chat-face-more {
  height: 24px;
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 10.5px;
}

.tw-aihub .tw-pv-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tw-aihub .tw-pv-copy strong {
  overflow: hidden;
  color: #fff;
  font-size: 15.5px;
  font-weight: 750;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tw-aihub .tw-pv-status {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  font-size: 11.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tw-aihub .tw-pv-status i {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tw-online);
  animation: tw-pulse 2.2s ease-out infinite;
}

.tw-aihub .tw-pv-status i.is-idle {
  background: var(--tw-away);
  animation: none;
}

.tw-aihub .tw-pv-reply {
  font-size: 10.5px;
  opacity: .78;
}

.tw-aihub .tw-pv-tabs {
  position: relative;
  display: flex;
  gap: 3px;
  margin: -21px 12px 0;
  padding: 4px;
  border: 1px solid var(--tw-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 14px 26px -14px rgba(5, 40, 29, .55);
}

.tw-aihub .tw-pv-tabs span {
  flex: 1;
  padding: 7px 0;
  border-radius: 12px;
  color: var(--tw-ink-2);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.tw-aihub .tw-pv-tabs span.is-active {
  background: linear-gradient(135deg, var(--pv-accent), var(--pv-accent-2));
  box-shadow: 0 10px 18px -12px var(--pv-accent);
  color: var(--pv-on);
}

.tw-aihub .tw-pv-body {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  min-height: 160px;
  padding: 16px 16px 10px;
  text-align: center;
}

.tw-aihub .tw-pv-body .tw-chat-face {
  --size: 52px;
}

.tw-aihub .tw-pv-name {
  font-size: 12px;
  font-weight: 800;
}

.tw-aihub .tw-pv-body p {
  max-width: 100%;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--tw-line);
  border-radius: 17px 17px 17px 5px;
  background: #fff;
  box-shadow: 0 12px 22px -16px rgba(0, 0, 0, .55);
  color: var(--tw-ink);
  font-size: 12.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-align: start;
  white-space: pre-wrap;
}

.tw-aihub .tw-pv-body small {
  color: var(--tw-ink-3);
  font-size: 10.5px;
}

.tw-aihub .tw-pv-composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 12px;
}

.tw-aihub .tw-pv-composer span {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--tw-line-2);
  border-radius: 999px;
  background: #fff;
  color: var(--tw-ink-3);
  font-size: 12px;
}

.tw-aihub .tw-pv-composer i {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pv-soft), var(--pv-accent) 55%, var(--pv-accent-2));
  box-shadow: 0 12px 20px -12px var(--pv-accent);
  color: var(--pv-on);
}

.tw-aihub .tw-pv-composer i::before,
.tw-aihub .tw-pv-composer i::after {
  position: absolute;
  top: 50%;
  left: 50%;
  content: "";
}

.tw-aihub .tw-pv-composer i::before {
  width: 2px;
  height: 12px;
  border-radius: 2px;
  background: currentColor;
  transform: translate(-50%, -42%);
}

.tw-aihub .tw-pv-composer i::after {
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}

/* Launcher mock (the chat box when it is closed). */
.tw-aihub .tw-chat-preview__launcher {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  opacity: 0;
  transform: scale(.8);
  transform-origin: 100% 100%;
  transition: opacity .25s, transform .32s cubic-bezier(.2, .9, .25, 1.25), visibility .25s;
  visibility: hidden;
}

.tw-aihub .tw-chat-preview__site[data-position="bottom-left"] .tw-chat-preview__launcher {
  right: auto;
  left: 16px;
  flex-direction: row-reverse;
  transform-origin: 0 100%;
}

.tw-aihub .tw-chat-preview__site[data-state="closed"] .tw-chat-preview__launcher {
  opacity: 1;
  transform: none;
  visibility: visible;
}

.tw-aihub .tw-chat-faces--launcher {
  position: relative;
  z-index: 1;
  margin-right: -14px;
  align-self: flex-end;
}

.tw-aihub .tw-chat-preview__site[data-position="bottom-left"] .tw-chat-faces--launcher {
  margin-right: 0;
  margin-left: -14px;
}

.tw-aihub .tw-chat-faces--launcher .tw-chat-face {
  --size: 28px;
}

.tw-aihub .tw-pv-bubble {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--pv-soft), var(--pv-cool), var(--pv-violet), var(--pv-soft));
  box-shadow: 0 18px 26px -12px rgba(4, 30, 22, .5);
  color: var(--pv-on);
}

.tw-aihub .tw-pv-bubble::before {
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .38), transparent 46%),
    linear-gradient(145deg, var(--pv-soft), var(--pv-accent) 55%, var(--pv-deep));
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .55);
  content: "";
}

.tw-aihub .tw-pv-bubble::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 28px;
  height: 21px;
  border: 2.5px solid currentColor;
  border-radius: 10px;
  content: "";
  transform: translate(-50%, -56%);
}

.tw-aihub .tw-pv-bubble i {
  position: absolute;
  top: 28px;
  z-index: 1;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
}

.tw-aihub .tw-pv-bubble i:nth-child(1) { left: 22px; }
.tw-aihub .tw-pv-bubble i:nth-child(2) { left: 30px; opacity: .8; }
.tw-aihub .tw-pv-bubble i:nth-child(3) { left: 38px; opacity: .6; }

.tw-aihub .tw-pv-bubble b {
  position: absolute;
  top: 40px;
  left: 36px;
  z-index: 1;
  width: 0;
  height: 0;
  border-top: 7px solid currentColor;
  border-right: 0 solid transparent;
  border-left: 6px solid transparent;
}

.tw-aihub .tw-chat-preview__note {
  margin: 0;
  padding: 12px 18px 15px;
  border-top: 1px solid var(--tw-line);
  color: var(--tw-ink-3);
  font-size: 12px;
}

/* ------------------------------------------------------------------------------------------------------------
   Plugin Hub tiles and feature bands
   ------------------------------------------------------------------------------------------------------------ */
.tw-aihub .tw-chat-table {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.tw-aihub .tw-chat-table__row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon state"
    "name name"
    "desc desc"
    "action action";
  align-items: center;
  gap: 8px 14px;
  min-height: 0;
  padding: 22px 24px;
  transition: transform .22s, box-shadow .22s;
}

.tw-aihub .tw-chat-table__row:hover {
  box-shadow: 0 30px 56px -30px rgba(6, 40, 29, .65);
  transform: translateY(-3px);
}

.tw-aihub .tw-chat-table__icon.dashicons {
  display: grid;
  grid-area: icon;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 17px;
  background: linear-gradient(145deg, #aebdb7, #8ea39b);
  box-shadow: 0 14px 22px -14px rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 24px;
}

.tw-aihub .tw-chat-table__row.is-ready .tw-chat-table__icon.dashicons {
  background: linear-gradient(145deg, var(--tw-accent-soft), var(--tw-accent));
}

.tw-aihub .tw-chat-table__state {
  display: inline-flex;
  grid-area: state;
  align-items: center;
  gap: 7px;
  justify-self: end;
  padding: 5px 12px;
  border: 1px solid rgba(245, 158, 11, .38);
  border-radius: 999px;
  background: #fff7e6;
  color: #8a5a00;
  font-size: 12px;
  font-weight: 750;
}

.tw-aihub .tw-chat-table__state::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tw-away);
  content: "";
}

.tw-aihub .tw-chat-table__row.is-ready .tw-chat-table__state {
  border-color: rgba(8, 122, 87, .22);
  background: #eaf7f2;
  color: #075e46;
}

.tw-aihub .tw-chat-table__row.is-ready .tw-chat-table__state::before {
  background: var(--tw-online);
  animation: tw-pulse 2.2s ease-out infinite;
}

.tw-aihub .tw-chat-table__row strong {
  grid-area: name;
  margin-top: 6px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.tw-aihub .tw-chat-table__row p {
  grid-area: desc;
  margin: 0;
  color: var(--tw-muted);
  font-size: 13px;
  line-height: 1.55;
}

.tw-aihub .tw-chat-table__row .button {
  grid-area: action;
  justify-self: start;
  margin-top: 8px;
}

.tw-aihub .tw-chat-footnote {
  max-width: 760px;
  margin: 22px 0 0;
  padding: 14px 18px;
  border: 1px solid var(--tw-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, .7);
  color: var(--tw-muted);
  font-size: 13px;
}

.tw-aihub .tw-chat-feature-band__icon.dashicons {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 17px;
  background: linear-gradient(145deg, var(--tw-accent-soft), var(--tw-accent));
  box-shadow: 0 14px 22px -14px var(--tw-accent);
  color: #fff;
  font-size: 24px;
}

/* ------------------------------------------------------------------------------------------------------------
   Motion
   ------------------------------------------------------------------------------------------------------------ */
@keyframes tw-spin { to { transform: rotate(360deg); } }
@keyframes tw-drift { from { transform: translate(0, 0); } to { transform: translate(-36px, 24px); } }
@keyframes tw-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tw-aihub *,
  .tw-aihub *::before,
  .tw-aihub *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------------------------------------------------
   Smaller screens
   ------------------------------------------------------------------------------------------------------------ */
@media (max-width: 1000px) {
  .tw-aihub .tw-chat-layout { grid-template-columns: 1fr; }
  .tw-aihub .tw-chat-preview { position: static; }
}

@media (max-width: 782px) {
  .tw-aihub .tw-chat-header { grid-template-columns: auto minmax(0, 1fr); padding: 24px 22px 60px; }
  .tw-aihub .tw-chat-header > .tw-chat-status { grid-column: 1 / -1; justify-self: start; }
  .tw-aihub .tw-chat-header h1 { font-size: 25px; }
  .tw-aihub .tw-chat-nav { margin-right: 12px; margin-left: 12px; }
  .tw-aihub .tw-chat-nav a { min-width: 0; padding: 10px 12px; }
  .tw-aihub .tw-chat-connection,
  .tw-aihub .tw-chat-operators,
  .tw-aihub .tw-chat-feature-band { grid-template-columns: auto minmax(0, 1fr); padding: 20px; }
  .tw-aihub .tw-chat-connection .tw-chat-actions,
  .tw-aihub .tw-chat-operators > .button,
  .tw-aihub .tw-chat-feature-band > .button,
  .tw-aihub .tw-chat-feature-band > .tw-chat-status { grid-column: 1 / -1; justify-self: start; }
  .tw-aihub .tw-chat-settings { padding: 22px 20px; }
  .tw-aihub .tw-chat-page-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .tw-aihub .tw-chat-operators { grid-template-columns: 1fr; }
}

@media (forced-colors: active) {
  .tw-aihub .tw-chat-header,
  .tw-aihub .tw-chat-connection,
  .tw-aihub .tw-chat-operators,
  .tw-aihub .tw-chat-feature-band,
  .tw-aihub .tw-chat-settings,
  .tw-aihub .tw-chat-preview,
  .tw-aihub .tw-chat-table__row,
  .tw-aihub .tw-chat-nav {
    border: 1px solid CanvasText;
  }

  .tw-aihub .tw-chat-nav a[aria-current="page"] { outline: 2px solid Highlight; }
}
