.triibo-assistant {
  --maa-primary: #e30613;
  --maa-ink: #19212b;
  --maa-muted: #647181;
  --maa-border: #dfe5eb;
  color: var(--maa-ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 9999;
}

.triibo-assistant,
.triibo-assistant * {
  box-sizing: border-box;
}

.maa-toggle,
.maa-form button {
  background: var(--maa-primary);
  border: 0;
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.maa-toggle {
  box-shadow: 0 10px 28px rgba(25, 33, 43, .2);
  padding: 14px 19px;
  transition: box-shadow .18s ease, transform .18s ease;
}

.maa-toggle:hover {
  box-shadow: 0 12px 32px rgba(25, 33, 43, .26);
  transform: translateY(-1px);
}

.maa-sparkle {
  font-size: 1.15em;
  margin-right: 5px;
}

.maa-panel {
  background: #fff;
  border: 1px solid var(--maa-border);
  border-radius: 18px;
  bottom: 0;
  box-shadow: 0 18px 60px rgba(25, 33, 43, .2);
  display: flex;
  flex-direction: column;
  height: min(620px, calc(100dvh - 48px));
  overflow: hidden;
  position: absolute;
  right: 0;
  width: min(390px, calc(100vw - 32px));
}

.maa-panel[hidden] {
  display: none;
}

.maa-header {
  align-items: center;
  background: var(--maa-ink);
  color: #fff;
  display: flex;
  justify-content: space-between;
  padding: 17px 18px;
}

.maa-header strong {
  font-size: 1rem;
  line-height: 1.3;
}

.maa-header strong,
.maa-header small {
  display: block;
}

.maa-header-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  gap: 5px;
}

.maa-reset {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 1.25rem;
  height: 36px;
  line-height: 1;
  width: 36px;
}

.maa-reset:hover {
  background: rgba(255, 255, 255, .12);
}

.maa-reset[hidden] {
  display: none;
}

.maa-header small {
  color: #c8d0d9;
  font-size: .8125rem;
  margin-top: 3px;
}

.maa-close {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  border-radius: 8px;
  font-size: 1.75rem;
  height: 36px;
  line-height: 1;
  width: 36px;
}

.maa-close:hover {
  background: rgba(255, 255, 255, .12);
}

.maa-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px;
}

.maa-message {
  border-radius: 14px;
  font-size: .9375rem;
  line-height: 1.5;
  max-width: 88%;
  padding: 11px 13px;
}

.maa-message p {
  margin: 0;
  white-space: pre-line;
}

.maa-assistant {
  align-self: flex-start;
  background: #f1f4f7;
  color: var(--maa-ink);
}

.maa-user {
  align-self: flex-end;
  background: var(--maa-primary);
  color: #fff;
}

.maa-pending {
  min-width: 64px;
  padding: 14px 16px;
}

.maa-typing {
  align-items: center;
  display: inline-flex;
  gap: 5px;
  height: 12px;
}

.maa-typing i {
  animation: maa-typing-bounce 1.05s ease-in-out infinite;
  background: var(--maa-muted);
  border-radius: 50%;
  display: block;
  height: 7px;
  opacity: .55;
  width: 7px;
}

.maa-typing i:nth-child(2) {
  animation-delay: .14s;
}

.maa-typing i:nth-child(3) {
  animation-delay: .28s;
}

@keyframes maa-typing-bounce {
  0%, 60%, 100% { opacity: .45; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .maa-typing i { animation: none; opacity: .8; }
}

.maa-actions {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.maa-action,
.maa-action:visited {
  color: var(--maa-primary);
  font-size: .875rem;
  font-weight: 650;
  text-decoration: none;
}

.maa-action:hover {
  text-decoration: underline;
}

.maa-error {
  color: #9d1b27;
  font-size: .875rem;
  margin: 0;
  padding: 0 16px 8px;
}

.maa-photo-row {
  align-items: center;
  display: flex;
  gap: 8px;
  min-height: 35px;
  padding: 8px 12px 0;
}

.maa-photo-pick {
  align-items: center;
  border: 1px solid var(--maa-border);
  border-radius: 8px;
  color: var(--maa-ink);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .8125rem;
  font-weight: 600;
  gap: 5px;
  padding: 6px 10px;
}

.maa-photo-pick:hover,
.maa-photo-remove:hover {
  background: #f4f6f8;
}

.maa-photo-pick input {
  height: 1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.maa-photo-pick:focus-within {
  outline: 3px solid rgba(227, 6, 19, .35);
  outline-offset: 2px;
}

.maa-photo-name {
  color: var(--maa-muted);
  flex: 1 1 auto;
  font-size: .75rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maa-photo-remove {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--maa-muted);
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: .75rem;
  padding: 5px 7px;
}

.maa-photo-remove[hidden] {
  display: none !important;
}

.maa-photo-remove:disabled {
  cursor: wait;
  opacity: .6;
}

.maa-photo-badge {
  color: var(--maa-muted);
  display: inline-block;
  font-size: .75rem;
  margin: 0 0 4px;
}

.maa-form {
  border-top: 1px solid var(--maa-border);
  display: flex;
  gap: 8px;
  padding: 12px;
}

.maa-form input {
  border: 1px solid var(--maa-border);
  border-radius: 10px;
  color: var(--maa-ink);
  flex: 1;
  font: inherit;
  font-size: .9375rem;
  min-width: 0;
  padding: 11px 12px;
}

.maa-form input:focus-visible,
.maa-form button:focus-visible,
.maa-toggle:focus-visible,
.maa-close:focus-visible,
.maa-action:focus-visible {
  outline: 3px solid rgba(227, 6, 19, .35);
  outline-offset: 2px;
}

.maa-form button {
  border-radius: 10px;
  font-size: .875rem;
  padding: 0 13px;
  transition: opacity .18s ease, transform .18s ease;
}

.maa-form button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.maa-form button:disabled {
  cursor: wait;
  opacity: .6;
}

.screen-reader-text {
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

@media (max-width: 520px) {
  .triibo-assistant {
    bottom: max(12px, env(safe-area-inset-bottom));
    right: max(12px, env(safe-area-inset-right));
  }

  .maa-panel {
    bottom: 0;
    height: min(680px, calc(100dvh - 24px - env(safe-area-inset-top)));
    right: 0;
    width: min(420px, calc(100vw - 24px));
  }
}
