/* PSI Pro Group returns and technical support chat. Look: DESIGN.md (Pro Navy, PSI Black, Spray Blue accent,
   white on mist, Kanit headings, Roboto text, flat). Every rule is under .psichat or a pc- class, so the page
   and the chat cannot reach each other. */
.psichat, .pc-cta {
  --navy: #243972; --black: #231F20; --spray: #1787C0; --mist: #F4F4F4; --white: #FFFFFF; --yellow: #F2C230;
  --line: #D9DDE3; --field: #AEB4BD; --soft: #4A4F57;
  --head: Kanit, "Arial Narrow", Arial, sans-serif;
  --text: Roboto, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
.psichat {
  --edge: 20px;
  --lift: 0px; /* room for the page's fixed call bar on small screens */
  font: 16px/1.45 var(--text);
  color: var(--black);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 1023px) { .psichat { --lift: 72px; --edge: 16px; } }
.psichat *, .psichat *::before, .psichat *::after { box-sizing: border-box; }
.psichat [hidden] { display: none !important; }
.psichat :focus-visible { outline: 3px solid var(--spray); outline-offset: 2px; }
:where(.psichat) button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
.pc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pc-ic { display: inline-grid; place-items: center; flex: none; }
.pc-ic svg { display: block; width: 22px; height: 22px; }

/* the page's own "Chat with our returns team" button and the floating launcher: primary buttons */
.site .pc-cta, .pc-launch {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border: 1.5px solid var(--white); border-radius: 6px;
  background: var(--navy); color: var(--white);
  font: 500 17px/1.15 var(--head);
  cursor: pointer; touch-action: manipulation;
  transition: transform 160ms var(--ease-out);
}
.site .pc-cta:active, .pc-launch:active { transform: scale(.97); }
.site .pc-cta:focus-visible { outline: 3px solid var(--spray); outline-offset: 2px; }

/* ---------------------------------------------------------------- launcher */
.pc-launch {
  position: fixed; z-index: 50;
  right: max(var(--edge), env(safe-area-inset-right));
  bottom: calc(max(var(--edge), env(safe-area-inset-bottom)) + var(--lift));
  min-height: 52px; padding: 0 20px 0 16px;
  box-shadow: 0 8px 24px rgba(35, 31, 32, .16);
}
.pc-dot { position: absolute; top: -6px; right: -6px; width: 16px; height: 16px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--white); }
.psichat.is-open .pc-launch { display: none; }

/* ---------------------------------------------------------------- panel (a native <dialog>) */
.pc-panel {
  position: fixed; z-index: 55;
  inset: auto max(var(--edge), env(safe-area-inset-right)) max(var(--edge), env(safe-area-inset-bottom)) auto;
  width: 400px;
  height: min(680px, calc(100dvh - 2 * var(--edge)));
  max-width: none; max-height: none; margin: 0; padding: 0;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--mist); color: var(--black);
  box-shadow: 0 8px 24px rgba(35, 31, 32, .16);
  overflow: hidden;
  transform-origin: 100% 100%;
}
.pc-panel[open] { display: flex; flex-direction: column; }
.pc-panel:focus { outline: none; }
.pc-panel:modal { overscroll-behavior: contain; }
.pc-panel::backdrop { background: var(--mist); overflow: hidden; overscroll-behavior: contain; }
@media (prefers-reduced-motion: no-preference) {
  .pc-panel[open] { transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out); }
  @starting-style { .pc-panel[open] { opacity: 0; transform: translateY(12px) scale(.98); } }
}
/* phone: the whole screen, following the visible viewport (keyboard open or not) */
@media (max-width: 479px) {
  .pc-panel { inset: var(--vvt, 0px) 0 auto 0; width: 100%; height: var(--vvh, 100dvh); border: 0; border-radius: 0; }
}

.pc-head {
  flex: none; display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
  background: var(--navy); color: var(--white);
}
.pc-who { flex: 1; min-width: 0; display: grid; gap: 8px; justify-items: start; }
/* the logo, unchanged, on a white plate with clear space around it */
.pc-plate { display: block; padding: 6px 10px; border-radius: 6px; background: var(--white); line-height: 0; }
.pc-plate img { display: block; width: 168px; height: auto; }
.pc-title { margin: 0; font: 500 16px/1.15 var(--head); color: var(--white); }
.pc-icon-btn {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 6px; background: transparent;
  transition: transform 120ms var(--ease-out);
}
.pc-icon-btn:active { transform: scale(.95); }
.pc-head :focus-visible { outline-color: var(--white); }

/* status banner: solved, with a person, return opened (a word and a mark, never colour alone) */
.pc-status {
  flex: none; display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 10px 16px;
  font-weight: 500; border-bottom: 1px solid var(--line); background: var(--white); border-left: 4px solid var(--navy);
}
.pc-status .pc-ic { margin-top: 1px; }
.pc-status .pc-ic svg { width: 20px; height: 20px; }
.pc-status[data-state="with_person"] { background: var(--yellow); border-left-color: var(--black); }
.pc-status[data-state="return_opened"] { border-left-color: var(--black); }
@media (prefers-reduced-motion: no-preference) { .pc-status { animation: pc-in 260ms var(--ease-out); } }

.pc-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  scrollbar-width: thin; scrollbar-color: var(--field) transparent;
}
.pc-intro { margin: 0 0 12px; color: var(--soft); }
.pc-log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pc-msg { max-width: 86%; display: flex; flex-direction: column; gap: 4px; }
.pc-msg p { margin: 0; padding: 10px 14px; border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; }
.pc-msg.from-me { align-self: flex-end; align-items: flex-end; }
.pc-msg.from-me p { background: var(--navy); color: var(--white); }
.pc-msg.from-me a { color: var(--white); }
.pc-msg.from-us { align-self: flex-start; align-items: flex-start; }
.pc-msg.from-us p { background: var(--white); border: 1px solid var(--line); }
.pc-msg.from-us a { color: var(--navy); }
.pc-msg.from-team p { border-left: 4px solid var(--navy); }
.pc-by { margin-left: 2px; font: 500 14px/1.15 var(--head); color: var(--navy); }
.pc-photo { display: block; max-width: 220px; max-height: 220px; border-radius: 8px; border: 1px solid var(--line); object-fit: cover; }
@media (prefers-reduced-motion: no-preference) {
  .pc-msg, .pc-res, .pc-typing:not([hidden]), .pc-progress:not([hidden]) { animation: pc-in 220ms var(--ease-out); }
}
@keyframes pc-in { from { opacity: 0; transform: translateY(6px); } }

/* typing dots and the "working on it" line */
.pc-typing:not([hidden]) {
  display: inline-flex; align-items: center; margin: 8px 0 0; padding: 14px;
  background: var(--white); border: 1px solid var(--line); border-radius: 8px;
}
.pc-dots { display: inline-flex; gap: 5px; }
.pc-dots i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--navy); opacity: .4; animation: pc-fade 1.2s ease-in-out infinite; }
.pc-dots i:nth-child(2) { animation-delay: .16s; }
.pc-dots i:nth-child(3) { animation-delay: .32s; }
@media (prefers-reduced-motion: no-preference) {
  .pc-dots i { animation-name: pc-dot; animation-timing-function: cubic-bezier(0.77, 0, 0.175, 1); }
}
@keyframes pc-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes pc-fade { 0%, 60%, 100% { opacity: .4; } 30% { opacity: 1; } }
.pc-progress { display: flex; align-items: center; gap: 10px; margin: 10px 0 0 4px; color: var(--soft); font-style: italic; }
.pc-pulse { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--spray); }
@media (prefers-reduced-motion: no-preference) { .pc-pulse { animation: pc-pulse 1s ease-in-out infinite alternate; } }
@keyframes pc-pulse { from { transform: translateX(-3px); opacity: .5; } to { transform: translateX(3px); opacity: 1; } }
.pc-note { margin: 12px 0 0; padding: 10px 12px; border-left: 4px solid var(--black); border-radius: 6px; background: var(--yellow); color: var(--black); font-weight: 500; }

/* ---------------------------------------------------------------- resource cards */
.pc-res { align-self: stretch; display: grid; gap: 8px; max-width: 320px; }
.pc-card {
  display: flex; flex-direction: column; overflow: hidden; text-align: left; text-decoration: none; color: var(--black);
  background: var(--white); border: 1px solid var(--line); border-radius: 8px;
}
.pc-card.is-article { transition: border-color 160ms ease; }
@media (hover: hover) and (pointer: fine) { .pc-card.is-article:hover { border-color: var(--navy); } }
.pc-play { display: block; width: 100%; padding: 0; border: 0; background: none; }
.pc-play:focus-visible, .pc-card.is-article:focus-visible { outline-offset: -3px; }
.pc-media { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; background: var(--line); overflow: hidden; }
.pc-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; background: var(--black); }
.pc-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pc-media .pc-ic { position: absolute; inset: 0; margin: auto; }
.is-video .pc-media .pc-ic {
  width: 56px; height: 56px; border-radius: 50%; background: var(--spray); color: var(--white); border: 2px solid var(--white);
  transition: transform 160ms var(--ease-out);
}
.is-video .pc-media .pc-ic svg { width: 26px; height: 26px; margin-left: 3px; }
@media (hover: hover) and (pointer: fine) { .pc-play:hover .pc-ic { transform: scale(1.06); } }
.pc-play:active .pc-ic { transform: scale(.95); }
.is-article .pc-media .pc-ic { width: 32px; height: 32px; color: var(--soft); }
.is-article .pc-media .pc-ic svg { width: 32px; height: 32px; }
.is-article .pc-media img + .pc-ic { display: none; }
.is-article .pc-media:not(:has(img)) { aspect-ratio: auto; height: 56px; } /* no picture: a slim strip, not an empty frame */
.pc-info { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; padding: 10px 12px 12px; }
.pc-ctitle { font: 500 16px/1.25 var(--head); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.pc-meta { font-size: 14px; color: var(--soft); overflow-wrap: anywhere; }
.pc-start { font-size: 14px; font-weight: 500; color: var(--navy); }
.pc-online { padding: 1px 7px; border-radius: 4px; border: 1px solid var(--field); color: var(--soft); font-size: 14px; }
.pc-open { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 500; color: var(--navy); }
.pc-open .pc-ic svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- compose */
.pc-compose {
  flex: none; margin: 0; padding: 10px max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left));
  border-top: 1px solid var(--line); background: var(--white);
}
.pc-row { display: flex; align-items: flex-end; gap: 6px; }
.pc-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pc-attach { color: var(--navy) !important; height: 48px; }
.psichat textarea {
  flex: 1; min-width: 0; min-height: 48px; max-height: 128px; margin: 0; padding: 11px 12px; resize: none;
  font: 16px/1.45 var(--text); /* 16px: iOS does not zoom */
  color: var(--black); background: var(--white); border: 1.5px solid var(--field); border-radius: 6px;
}
.psichat textarea::placeholder { color: var(--soft); }
.psichat textarea:focus-visible { outline: 3px solid var(--spray); outline-offset: 0; }
.pc-send {
  flex: none; display: grid; place-items: center; width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 6px; background: var(--navy); color: var(--white) !important;
  transition: transform 120ms var(--ease-out);
}
.pc-send:active { transform: scale(.95); }
.pc-send:disabled { opacity: .5; cursor: progress; }
.pc-preview { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 2px 6px 6px; background: var(--mist); border: 1px solid var(--line); border-radius: 6px; }
.pc-preview img { flex: none; width: 52px; height: 52px; border-radius: 4px; object-fit: cover; }
.pc-prev-name { flex: 1; min-width: 0; font-size: 14px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pc-foot {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0;
  padding: 0 max(14px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: var(--white); font-size: 14px; color: var(--soft);
}
.pc-new { min-height: 36px; padding: 0 4px; border: 0; background: none; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; color: var(--navy) !important; }

@media (prefers-reduced-motion: reduce) {
  .psichat *, .pc-panel[open], .pc-cta { transition: none !important; }
}
