.ks-support {
  --chat-x: max(clamp(14px, 2vw, 30px), env(safe-area-inset-right));
  --chat-y: max(clamp(14px, 2vw, 26px), env(safe-area-inset-bottom));
  --chat-edge: #cdd3c6;
}

.ks-chat-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  position: fixed;
  z-index: 8;
  right: var(--chat-x);
  bottom: var(--chat-y);
  padding: 0 20px;
  min-height: 48px;
  border: 1px solid #355642;
  border-radius: 99px;
  background: #234a34;
  color: #fff;
  box-shadow: 0 3px 16px #14251a33;
  font: 600 14px/1.2 var(--sans);
}

.ks-chat-launch:hover, .ks-chat-send:enabled:hover { background: #173925; }
.ks-chat-launch[aria-expanded=true] { visibility: hidden; }
.ks-support svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.65; }

.ks-chat-panel {
  position: fixed;
  inset: auto var(--chat-x) var(--chat-y) auto;
  margin: 0;
  padding: 0;
  width: min(390px, calc(100% - 2 * var(--chat-x)));
  max-width: none;
  height: min(530px, calc(100dvh - 2 * var(--chat-y)));
  max-height: none;
  overflow: hidden;
  border: 1px solid #a7b4a4;
  border-radius: 16px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 14px 58px #11211838;
}
.ks-chat-panel[open] { display: flex; flex-direction: column; }
.ks-chat-view { display: flex; flex: 1 1 0; min-height: 0; flex-direction: column; }
.ks-chat-panel [hidden] { display: none; }
.workshop-contact { background: transparent; border: 0; border-bottom: 1px solid #7c897a; color: inherit; }
.ks-chat-panel::backdrop { background: rgb(17 32 22 / 14%); }
.ks-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 16px 18px;
  border-bottom: 1px solid var(--chat-edge);
  background: #e7eddf;
}
.ks-chat-logo { width: 36px; height: 36px; object-fit: contain; flex: none; }
.ks-chat-head h2 { font: 400 26px/1.05 var(--serif); letter-spacing: -.025em; color: #1c3b2a; }
.ks-chat-head p { margin-top: 3px; font-size: 12px; color: #49614e; }
.ks-chat-close, .ks-chat-send { display: grid; place-items: center; padding: 0; border: 0; flex: none; }
.ks-chat-close { margin-left: auto; width: 40px; height: 40px; border-radius: 50%; background: transparent; color: #244331; }
.ks-chat-close:hover { background: #d7e2d1; }
.ks-chat-close svg { width: 18px; }
.ks-chat-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
}
.ks-chat-start { padding: 6px 0 12px; }
.ks-chat-start h3 { font: 400 32px/1.1 var(--serif); letter-spacing: -.035em; }
.ks-chat-topics { display: grid; justify-items: start; gap: 8px; margin-top: 17px; }
.ks-chat-topics button {
  min-height: 37px;
  padding: 7px 13px;
  border: 1px solid var(--chat-edge);
  border-radius: 16px;
  background: #fffefa;
  color: var(--green);
  font-size: 13px;
  text-align: left;
}
.ks-chat-topics button:hover, .ks-chat-links :is(a, button):hover { border-color: #839980; background: #eaf0e4; }
.ks-chat-log { display: flex; flex-direction: column; align-items: start; gap: 12px; }
.ks-chat-message { max-width: 94%; padding: 11px 13px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.ks-chat-message p { white-space: pre-wrap; }
.ks-chat-user { align-self: end; background: #244d36; border-radius: 15px 15px 3px 15px; color: #fff; }
.ks-chat-reply { background: #eef1e9; border-radius: 15px 15px 15px 3px; }
.ks-chat-links { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.ks-chat-links :is(a, button) { display: inline-flex; align-items: center; min-height: 32px; padding: 4px 8px; border: 1px solid #becab7; border-radius: 5px; background: var(--paper); color: var(--green); font: 600 12px/1.3 var(--sans); }
.ks-chat-status:empty { display: none; }
.ks-chat-status { margin-top: 10px; color: var(--muted); font-size: 12px; }
.ks-chat-foot { padding: 11px 14px 10px; border-top: 1px solid var(--line); }
.ks-chat-form { display: flex; align-items: end; gap: 7px; padding: 6px; background: #fffefa; border: 1px solid var(--chat-edge); border-radius: 12px; }
.ks-chat-form:focus-within { border-color: #657f67; }
.ks-chat-form textarea { flex: 1; min-width: 0; max-height: 100px; padding: 4px 5px; resize: none; border: 0; border-radius: 4px; background: transparent; color: var(--ink); font: 400 16px/1.4 var(--sans); }
.ks-chat-form textarea::placeholder { color: #667064; }
.ks-chat-form textarea:focus-visible { outline: 2px solid #7c8f76; outline-offset: -1px; }
.ks-chat-send { width: 40px; height: 40px; border-radius: 8px; background: var(--green); color: #fff; }
.ks-chat-send:disabled { background: #e1e6da; color: #6b7c67; }
.ks-chat-contact, .ks-contact-back { border: 0; background: transparent; color: #4d604f; font: 500 13px/1.4 var(--sans); }
.ks-chat-contact { display: inline-block; padding: 7px 2px 3px; text-decoration: underline; text-underline-offset: 2px; }
.ks-contact-view { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 20px max(20px, env(safe-area-inset-bottom)); }
.ks-contact-back { padding: 5px 0; margin-bottom: 8px; }
.ks-contact-back:hover { text-decoration: underline; }
.ks-inquiry-form fieldset { display: grid; gap: 4px; min-width: 0; padding: 0; margin: 0; border: 0; }
.ks-inquiry-form label { margin-top: 7px; color: var(--ink); font: 600 13px/1.4 var(--sans); }
.ks-inquiry-form input, .ks-inquiry-form textarea { width: 100%; min-width: 0; padding: 8px 11px; border: 1px solid var(--chat-edge); border-radius: 6px; color: var(--ink); background: #fffefa; font: 400 16px/1.4 var(--sans); }
.ks-inquiry-form textarea { min-height: 84px; resize: vertical; }
.ks-inquiry-form :is(input, textarea):focus-visible { outline: 2px solid #68816c; outline-offset: 1px; }
.ks-contact-preview, .ks-contact-error { margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ks-contact-submit { margin-top: 10px; width: 100%; min-height: 40px; border: 0; border-radius: 6px; color: white; background: var(--green); font: 600 14px var(--sans); }
.ks-contact-submit:disabled { opacity: .65; }
.ks-contact-error { color: #873c2b; }
.ks-contact-error:empty { display: none; }
.ks-contact-receipt h3 { margin: 12px 0 8px; font: 400 32px/1.1 var(--serif); }
.ks-contact-receipt p { overflow-wrap: anywhere; color: var(--muted); font-size: 14px; }
.ks-chat-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 540px) {
  .ks-chat-panel {
    inset: auto 0 0;
    width: 100%;
    height: min(560px, 86dvh);
    border-width: 1px 0 0;
    border-radius: 17px 17px 0 0;
  }
  .ks-chat-foot { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .ks-chat-launch { min-height: 44px; padding: 0 14px; font-size: 13px; }
}
