/* ST-21 brand launcher: one opt-in Tawk, no iframe styling or duplicate embed. */
.pms-st21-launcher[hidden] { display: none !important; }
.pms-st21-launcher {
  position: fixed;
  left: 20px;
  bottom: 22px;
  z-index: 2147483000;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: auto;
  min-width: 146px;
  min-height: 48px;
  padding: 12px 19px;
  border: 0;
  border-radius: 999px;
  background: #C4622E;
  color: #FFFFFF;
  font: 700 14px/1.3 Manrope, system-ui, -apple-system, Segoe UI, sans-serif;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 5px 18px rgba(36,68,60,.2);
  transition: transform .16s ease, background-color .16s ease, box-shadow .16s ease;
}
.pms-st21-launcher svg { display: block; flex: none; width: 19px; height: 19px; }
.pms-st21-launcher-label { display: block; white-space: nowrap; }
.pms-st21-launcher:hover { background: #AA4F20; transform: translateY(-2px); box-shadow: 0 8px 22px rgba(36,68,60,.27); }
.pms-st21-launcher:focus-visible { outline: 3px solid #24443C; outline-offset: 3px; }
/* Mobile stays compact, remains in the brand palette, and respects phone safe areas. */
@media (max-width: 860px) {
  .pms-st21-launcher {
    left: calc(16px + env(safe-area-inset-left, 0px));
    bottom: calc(20px + env(safe-area-inset-bottom, 0px));
    width: 56px;
    min-width: 56px;
    height: 56px;
    min-height: 56px;
    padding: 0;
    gap: 0;
    border-radius: 50%;
    box-shadow: 0 6px 21px rgba(36,68,60,.24), 0 0 0 3px rgba(248,245,238,.92);
  }
  .pms-st21-launcher svg { width: 25px; height: 25px; }
  .pms-st21-launcher-label { display: none !important; }
  /* Woo checkout may have a fixed bottom action region. Keep chat above it. */
  body.woocommerce-checkout .pms-st21-launcher,
  body.page-id-checkout .pms-st21-launcher {
    bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  }
}
@media (prefers-reduced-motion: reduce) { .pms-st21-launcher { transition: none; } }

/* ST-21 contextual permission – entirely local until explicit chat opt-in. */
.pms-st21-consent-overlay[hidden], .pms-st21-withdraw[hidden] { display: none !important; }
.pms-st21-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 22px;
  background: rgba(30, 43, 37, .55);
}
.pms-st21-consent-panel {
  width: min(100%, 455px);
  max-height: calc(100dvh - 44px);
  overflow-y: auto;
  padding: 25px;
  border-radius: 16px;
  background: #F8F5EE;
  color: #2B302D;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  font: 400 14px/1.6 Manrope, system-ui, sans-serif;
}
.pms-st21-consent-panel h2 { color: #24443C; font-size: 21px; line-height: 1.25; margin: 0 0 12px; }
.pms-st21-consent-panel p { margin: 0 0 13px; }
.pms-st21-consent-panel .pms-st21-consent-note { font-size: 12px; }
.pms-st21-consent-panel a { color: #24443C; text-decoration: underline; }
.pms-st21-consent-actions { display: flex; gap: 10px; margin-top: 19px; }
.pms-st21-consent-actions button {
  padding: 11px 14px;
  min-height: 43px;
  border: 1px solid #24443C;
  border-radius: 9px;
  font: 700 13px/1.3 Manrope,system-ui,sans-serif;
  cursor: pointer;
}
.pms-st21-consent-cancel { background: transparent; color: #24443C; }
.pms-st21-consent-accept { background: #24443C; color: white; flex: 1; }
.pms-st21-consent-panel button:focus-visible { outline: 3px solid #C4622E; outline-offset: 2px; }
.pms-st21-consent-error { color: #A43629; font-weight: 600; }
.pms-st21-withdraw {
  position: fixed;
  left: 20px;
  bottom: 80px;
  z-index: 2147483001;
  max-width: min(240px, calc(100vw - 40px));
  border: 1px solid rgba(36,68,60,.12);
  background: #F8F5EE;
  color: #24443C;
  padding: 6px 10px;
  border-radius: 999px;
  font: 600 11px/1.25 Manrope, system-ui, sans-serif;
  box-shadow: 0 2px 9px rgba(0,0,0,.13);
  cursor: pointer;
}
/* Tawk is a cross-origin iframe and may occupy nearly the entire phone viewport.
 * An external revoke button must never float over its chat form or actions.
 * During expansion, offer consent withdrawal after minimizing with Tawk's own
 * close/minimize control; the button reappears immediately upon minimization.
 */
html.pms-st21-chat-expanded .pms-st21-withdraw { display: none !important; }
.pms-st21-withdraw:focus-visible { outline: 3px solid #C4622E; }
@media (max-width: 860px) {
  .pms-st21-consent-overlay { padding: 14px; }
  .pms-st21-consent-panel { padding: 20px; max-height: calc(100dvh - 28px); }
  .pms-st21-consent-actions { flex-wrap: wrap; }
  .pms-st21-consent-actions button { flex: 1; }
  .pms-st21-withdraw {
    left: calc(16px + env(safe-area-inset-left, 0px));
    bottom: calc(85px + env(safe-area-inset-bottom, 0px));
    max-width: min(220px, calc(100vw - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  }

  body.woocommerce-checkout .pms-st21-withdraw,
  body.page-id-checkout .pms-st21-withdraw { bottom: calc(156px + env(safe-area-inset-bottom, 0px)); }
}

/* Pending 0.5.24 horizontal controls: revoke BESIDE the launcher, not above it.
   Tawk chat is cross-origin; hide both site controls when expanded. */
.pms-st21-controls {
  position:fixed;
  z-index:2147483000;
  left:20px;
  bottom:22px;
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  max-width:calc(100vw - 40px);
}
html.pms-st21-chat-expanded .pms-st21-controls {display:none!important;}
.pms-st21-controls .pms-st21-launcher,
.pms-st21-controls .pms-st21-withdraw {
  position:static!important;
  inset:auto!important;
  z-index:auto;
  margin:0!important;
}
.pms-st21-controls .pms-st21-launcher {flex:0 0 auto;}
.pms-st21-controls .pms-st21-withdraw {
  flex:0 1 auto;
  min-width:0;
  max-width:min(220px,calc(100vw - 120px));
  min-height:40px;
  padding:8px 12px;
  white-space:normal;
  text-align:center;
  line-height:1.35;
}
@media(max-width:860px) {
  .pms-st21-controls {
    left:calc(16px + env(safe-area-inset-left,0px));
    bottom:calc(20px + env(safe-area-inset-bottom,0px));
    gap:8px;
    max-width:calc(100vw - 32px - env(safe-area-inset-left,0px) - env(safe-area-inset-right,0px));
  }
  body.woocommerce-checkout .pms-st21-controls,
  body.page-id-checkout .pms-st21-controls {
    bottom:calc(90px + env(safe-area-inset-bottom,0px));
  }
  .pms-st21-controls .pms-st21-withdraw {
    max-width:min(200px,calc(100vw - 116px));
    font-size:10.5px;
  }
}
