#portman-assistant-root,
#portman-assistant-root * {
  box-sizing: border-box;
}

#portman-assistant-root {
  --pa-red: #8a0d24;
  --pa-red-dark: #65101f;
  --pa-gold: #a66d12;
  --pa-ink: #241a1c;
  --pa-muted: #6f6567;
  --pa-line: #eadfe1;
  --pa-cream: #f7f1e7;
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 2147483000;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--pa-ink);
  line-height: 1.45;
}

.pa-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 10px 18px 10px 11px;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: var(--pa-red);
  color: #fff;
  box-shadow: 0 15px 38px rgba(55, 10, 20, .28);
  font: 700 16px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
}

.pa-launcher:hover { background: var(--pa-red-dark); transform: translateY(-1px); }
.pa-launcher:focus-visible,
.pa-panel button:focus-visible,
.pa-panel textarea:focus-visible,
.pa-panel a:focus-visible { outline: 3px solid #e0a63c; outline-offset: 2px; }

.pa-launcher-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
}

.pa-brand-logo {
  display: block;
  width: 78%;
  height: 78%;
  object-fit: contain;
}

.pa-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  display: flex;
  flex-direction: column;
  width: min(410px, calc(100vw - 28px));
  height: min(560px, calc(100dvh - 100px));
  min-height: 430px;
  overflow: hidden;
  border: 1px solid var(--pa-line);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(48, 20, 27, .26);
  transform-origin: bottom right;
}

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

.pa-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--pa-red), var(--pa-red-dark));
  color: #fff;
}

.pa-brand {
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: #fff;
}

.pa-title { min-width: 0; flex: 1; }
.pa-title strong { display: block; font-size: 17px; letter-spacing: .01em; }
.pa-title span { display: block; margin-top: 2px; color: rgba(255,255,255,.8); font-size: 12px; }

.pa-icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.pa-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 15px;
  border-bottom: 1px solid var(--pa-line);
  background: var(--pa-cream);
  color: var(--pa-muted);
  font-size: 12px;
}

.pa-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2f9b63;
}

.pa-status.is-listening .pa-status-dot {
  background: #d53a48;
  box-shadow: 0 0 0 5px rgba(213,58,72,.15);
  animation: pa-pulse 1.1s infinite;
}

@keyframes pa-pulse { 50% { transform: scale(.72); opacity: .65; } }

.pa-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px;
  background: #fff;
  scroll-behavior: smooth;
}

.pa-message { display: flex; margin: 0 0 10px; }
.pa-message.is-user { justify-content: flex-end; }
.pa-bubble {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 16px 16px 16px 5px;
  background: #f4eff0;
  color: var(--pa-ink);
  font-size: 14px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.pa-bubble p { margin: 0 0 9px; }
.pa-bubble p:last-child { margin-bottom: 0; }
.pa-bubble h4 { margin: 14px 0 7px; color: var(--pa-red); font: 700 15px/1.3 Arial, Helvetica, sans-serif; }
.pa-bubble h4:first-child { margin-top: 0; }
.pa-bubble ul { margin: 7px 0 9px; padding-left: 20px; list-style: disc outside !important; }
.pa-bubble li { display: list-item !important; margin: 4px 0; }
.pa-bubble strong { font-weight: 700; }
.pa-bubble a { color: var(--pa-red); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.pa-message.is-user .pa-bubble a { color: #fff; }
.pa-message.is-user .pa-bubble {
  border-radius: 16px 16px 5px 16px;
  background: var(--pa-red);
  color: #fff;
}
.pa-message.is-error .pa-bubble { background: #fff1f2; color: #8b1b2c; }

.pa-related {
  display: inline-flex;
  align-items: center;
  margin: 0 0 14px 2px;
  color: var(--pa-red);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

button.pa-related {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

.pa-handoff {
  position: absolute;
  inset: 104px 0 0;
  z-index: 5;
  overflow-y: auto;
  padding: 16px;
  background: rgba(255,255,255,.98);
}
.pa-handoff[hidden] { display: none; }
.pa-handoff-card h3 {
  margin: 0 0 6px;
  color: var(--pa-red);
  font: 700 19px/1.25 Arial, Helvetica, sans-serif;
}
.pa-handoff-intro,
.pa-handoff-note { margin: 0 0 12px; color: var(--pa-muted); font-size: 12px; }
.pa-handoff-destination {
  margin: 0 0 13px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--pa-cream);
  color: var(--pa-ink);
  font-size: 12px;
  font-weight: 700;
}
.pa-handoff-card label {
  display: block;
  margin-bottom: 6px;
  color: var(--pa-ink);
  font-size: 12px;
  font-weight: 700;
}
#portman-assistant-root .pa-handoff textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  margin: 0 0 8px;
  padding: 11px;
  resize: vertical;
  border: 1px solid #d9ced0;
  border-radius: 12px;
  color: var(--pa-ink);
  background: #fff;
  font: 13px/1.45 Arial, Helvetica, sans-serif;
}
.pa-handoff-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pa-handoff-actions button {
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #d9ced0;
  border-radius: 12px;
  background: #fff;
  color: var(--pa-red);
  font: 700 12px/1 Arial, Helvetica, sans-serif;
  cursor: pointer;
}
.pa-handoff-actions .pa-handoff-open { border-color: var(--pa-red); background: var(--pa-red); color: #fff; }

.pa-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 0 14px 10px;
}
.pa-chip {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #dbc9cd;
  border-radius: 999px;
  background: #fff;
  color: var(--pa-red);
  font: 700 12px/1.15 Arial, Helvetica, sans-serif;
  cursor: pointer;
}
.pa-chip:hover { background: #fbf5f6; }

#portman-assistant-root .pa-composer {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 8px;
  align-items: end;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 9px 12px 10px;
  border-top: 1px solid var(--pa-line);
  background: #fff;
}

#portman-assistant-root .pa-mic { display: none !important; }

#portman-assistant-root .pa-composer textarea {
  display: block !important;
  flex: 1 1 auto !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 42px;
  max-height: 110px;
  margin: 0 !important;
  resize: none;
  padding: 11px 12px;
  border: 1px solid #d9ced0;
  border-radius: 14px;
  background: #fff;
  color: var(--pa-ink);
  font: 14px/1.4 Arial, Helvetica, sans-serif;
}

#portman-assistant-root .pa-composer .pa-send {
  display: grid !important;
  flex: 0 0 42px !important;
  margin: 0 !important;
}

.pa-action {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: var(--pa-red);
  color: #fff;
  cursor: pointer;
}
.pa-action svg { width: 21px; height: 21px; }
.pa-action:disabled { opacity: .48; cursor: not-allowed; }
.pa-action.is-live { background: #d22f42; animation: pa-pulse 1.1s infinite; }

.pa-disclaimer {
  padding: 0 13px 9px;
  color: var(--pa-muted);
  font-size: 10px;
  text-align: center;
}
.pa-disclaimer a { color: var(--pa-red); }

@media (max-width: 560px) {
  #portman-assistant-root {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
  }
  .pa-launcher { min-height: 52px; padding: 8px 14px 8px 8px; font-size: 15px; }
  .pa-launcher-mark { width: 36px; height: 36px; }
  .pa-panel {
    position: fixed;
    top: auto;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
    height: min(580px, calc(100dvh - 24px));
    min-height: 0;
    border-radius: 20px;
    transform-origin: bottom center;
  }
  .pa-header { min-height: 66px; padding: 10px 12px; }
  .pa-title strong { font-size: 16px; }
  .pa-title span { font-size: 11px; }
  .pa-messages { padding: 12px; }
  .pa-bubble { max-width: 90%; font-size: 14px; }
  .pa-quick { padding: 0 12px 9px; }
  .pa-composer { padding: 8px 10px 9px; }
  .pa-disclaimer { padding-bottom: 8px; }
}

@media (max-height: 560px) {
  .pa-panel {
    height: calc(100dvh - 20px);
    min-height: 0;
  }
  .pa-quick { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .pa-launcher:hover { transform: none; }
  .pa-status.is-listening .pa-status-dot,
  .pa-action.is-live { animation: none; }
}

@media print {
  #portman-assistant-root { display: none !important; }
}
