/* POS Direktchat: isolated styles, no theme or content changes. */
#poschat {
  --poschat-ink: #183b32;
  --poschat-green: #24634e;
  --poschat-cream: #f7f6f1;
  --poschat-line: #d9e0d9;
  --poschat-red: #c9161d;
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 2147483646;
  max-width: calc(100vw - 24px);
  color: var(--poschat-ink);
  font: 400 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  text-align: left;
  letter-spacing: normal;
}
#poschat *, #poschat *::before, #poschat *::after { box-sizing: border-box; }
#poschat [hidden] { display: none !important; }
#poschat button, #poschat input, #poschat textarea { font: inherit; letter-spacing: normal; }
#poschat button {
  min-height: 44px;
  border: 1px solid var(--poschat-line);
  border-radius: 10px;
  background: #fff;
  color: var(--poschat-ink);
  padding: 10px 14px;
  line-height: 1.35;
  cursor: pointer;
  text-transform: none;
  touch-action: manipulation;
}
#poschat button:disabled { cursor: default; opacity: .62; }
#poschat button:focus-visible, #poschat a:focus-visible, #poschat textarea:focus-visible {
  outline: 3px solid #176ca4;
  outline-offset: 3px;
}
#poschat .poschat-launch {
  border: 2px solid #ef1721;
  background: var(--poschat-red);
  color: #fff;
  border-radius: 25px;
  min-height: 48px;
  padding: 11px 19px;
  box-shadow: 0 5px 22px #183b3229;
  font-weight: 650;
  white-space: normal;
}
#poschat .poschat-launch:hover { background: #ae1118; }
#poschat-dialog {
  position: fixed;
  inset: auto max(20px, env(safe-area-inset-right)) var(--poschat-bottom, max(20px, env(safe-area-inset-bottom))) auto;
  width: 420px;
  max-width: calc(100vw - 24px);
  height: 580px;
  max-height: min(580px, var(--poschat-available-height, calc(100dvh - 40px)));
  margin: 0;
  padding: 0;
  border: 2px solid #e21922;
  border-radius: 20px;
  color: #183b32;
  background: #fff;
  box-shadow: 0 14px 55px #00000030;
  overflow: hidden;
  font: inherit;
  text-align: left;
  color-scheme: light;
}
#poschat-dialog:not([open]) { display: none; }
#poschat-dialog[open] { display: flex; flex-direction: column; }
#poschat-dialog::backdrop { background: rgb(0 0 0 / .22); }
#poschat-dialog.poschat-staff-dialog {
  width: min(1280px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  height: var(--poschat-available-height, calc(100dvh - 40px));
  max-height: var(--poschat-available-height, calc(100dvh - 40px));
}
#poschat .poschat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid var(--poschat-line);
  background: var(--poschat-cream);
}
#poschat .poschat-header > div { flex: 1; min-width: 0; }
#poschat .poschat-header strong, #poschat .poschat-heading {
  display: block;
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.35;
}
#poschat .poschat-header small { display: block; font-size: 13px; line-height: 1.4; margin-top: 3px; }
#poschat .poschat-header .poschat-heading { font-size: 13px; font-weight: 400; margin-top: 3px; }
#poschat .poschat-close { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; font-size: 28px; line-height: 1; }
#poschat .poschat-office {
  flex: 0 0 auto;
  padding: 9px 16px;
  border-bottom: 1px solid var(--poschat-line);
  background: #fff;
  color: #405c52;
  font-size: 12px;
  line-height: 1.45;
}
#poschat .poschat-log {
  flex: 1 1 auto;
  min-height: 48px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  scroll-padding: 12px;
  -webkit-overflow-scrolling: touch;
}
#poschat .poschat-message {
  margin: 0 20px 13px 0;
  padding: 12px 14px;
  border-radius: 14px 14px 14px 4px;
  background: var(--poschat-cream);
  color: var(--poschat-ink);
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.55;
}
#poschat .poschat-message[data-role="visitor"] {
  margin: 0 0 13px 20px;
  background: #e5eee9;
  border-radius: 14px 14px 4px 14px;
}
#poschat .poschat-message p { margin: 0; font: inherit; white-space: pre-wrap; }
#poschat .poschat-message > div:not(.poschat-meta) { white-space: pre-wrap; }
#poschat .poschat-message a { color: #1c5946; text-decoration: underline; text-underline-offset: 2px; }
#poschat .poschat-meta { color: #486257; margin: 0 0 6px; font-size: 11px; line-height: 1.4; }
#poschat .poschat-note {
  margin: 0 14px 12px;
  padding: 11px 12px;
  border: 1px solid #e2dbc6;
  border-radius: 12px;
  background: #fff8e9;
  color: #5c4a24;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
#poschat .poschat-form {
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 14px 10px;
  border-top: 1px solid var(--poschat-line);
  background: #fff;
}
#poschat .poschat-form label { display: block; font-size: 13px; font-weight: 600; margin: 0 0 6px; }
#poschat .poschat-form textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 68px;
  max-height: 140px;
  padding: 10px 11px;
  border: 1px solid #819d8f;
  border-radius: 10px;
  background: #fff;
  color: var(--poschat-ink);
  font-size: 16px !important;
  line-height: 1.45;
  resize: vertical;
}
#poschat .poschat-form textarea::placeholder { color: #5f736a; opacity: 1; }
#poschat .poschat-compose-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
#poschat .poschat-send { background: var(--poschat-green); color: #fff; border-color: var(--poschat-green); font-weight: 600; margin-top: 8px; }
#poschat .poschat-compose-row .poschat-send { margin-top: 0; }
#poschat .poschat-send:hover { background: #1a503e; }
#poschat .poschat-error { color: #a51a22; font-size: 13px; line-height: 1.5; margin: 6px 0; overflow-wrap: anywhere; }
#poschat .poschat-footer { flex: 0 0 auto; padding: 0 14px max(11px, env(safe-area-inset-bottom)); color: #486257; font-size: 11px; line-height: 1.4; }
#poschat .poschat-footer a { color: #245d4a; text-decoration: underline; }
#poschat .poschat-reset { min-height: 44px; padding: 6px 9px; font-size: 12px; }
@media (max-width: 767px) {
  #poschat { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  #poschat .poschat-launch { min-height: 44px; padding: 10px 14px; font-size: 14px; }
  #poschat-dialog {
    inset: auto 0 var(--poschat-bottom, 0px) 0;
    width: 100%;
    max-width: none;
    height: var(--poschat-available-height, 100dvh);
    max-height: var(--poschat-available-height, 100dvh);
    border-radius: 0;
    border-width: 1px;
  }
  #poschat-dialog.poschat-staff-dialog { width:100%; max-width:none; height:var(--poschat-available-height, 100dvh); max-height:var(--poschat-available-height, 100dvh); }
  #poschat .poschat-header { padding:max(10px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 10px max(12px, env(safe-area-inset-left)); }
  #poschat .poschat-office { padding: 7px 12px; }
  #poschat .poschat-log { padding: 12px; }
  #poschat .poschat-form { padding: 10px 12px 8px; }
  #poschat .poschat-footer { padding-left:max(12px, env(safe-area-inset-left)); padding-right:max(12px, env(safe-area-inset-right)); padding-bottom:max(11px, env(safe-area-inset-bottom)); }
}
#poschat-dialog.poschat-compact .poschat-header { padding: 3px 10px; }
#poschat-dialog.poschat-compact .poschat-heading,
#poschat-dialog.poschat-compact .poschat-office { display: none; }
#poschat-dialog.poschat-compact .poschat-log { min-height: 20px; padding: 6px 10px; }
#poschat-dialog.poschat-compact .poschat-note { flex: 0 1 auto; max-height: 66px; overflow: auto; margin: 0 10px 5px; padding: 6px 8px; font-size: 12px; }
#poschat-dialog.poschat-compact .poschat-form { padding: 5px 10px; }
#poschat-dialog.poschat-compact .poschat-form label { margin-bottom: 2px; font-size: 12px; }
#poschat-dialog.poschat-compact .poschat-form textarea { height: 44px; min-height: 44px; max-height: 44px; padding: 6px 8px; }
#poschat-dialog.poschat-compact .poschat-send { margin-top: 4px; }
#poschat-dialog.poschat-compact .poschat-footer { padding: 0 10px 5px; }
@media (max-height: 480px) {
  #poschat .poschat-header { padding-top: 6px; padding-bottom: 6px; }
  #poschat .poschat-form textarea { min-height: 44px; max-height: 70px; }
  #poschat .poschat-form { padding-top: 6px; }
  #poschat .poschat-office { padding-top: 5px; padding-bottom: 5px; }
}
@media (prefers-reduced-motion: reduce) { #poschat * { scroll-behavior: auto !important; } }

/* Staff-only framing leaves the available height to the conversation. */
#poschat-dialog.poschat-staff-dialog .poschat-header { padding:4px 10px; }
#poschat-dialog.poschat-staff-dialog .poschat-header strong { font-size:17px; }
#poschat-dialog.poschat-staff-dialog .poschat-heading,
#poschat-dialog.poschat-staff-dialog .poschat-office { display:none; }
#poschat-dialog.poschat-staff-dialog .poschat-footer { padding:0 10px 4px; }

@media (max-width:767px) {
  #poschat-dialog.poschat-staff-dialog .poschat-header { padding:max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left)); }
  #poschat-dialog.poschat-staff-dialog .poschat-footer { padding:0 max(10px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
}

@media (max-width:767px) {
  #poschat-dialog.poschat-compact .poschat-header { padding:max(3px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 3px max(10px, env(safe-area-inset-left)); }
  #poschat-dialog.poschat-compact .poschat-footer { padding:0 max(10px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
}
