/* Klarschmiede mobile assistant — visible only at <= 768px */
.ks-assist, .ks-assist * { box-sizing: border-box; }
.ks-assist { display: none; font-family: "Segoe UI", "Avenir Next", "Helvetica Neue", Arial, sans-serif; }

@media (min-width: 769px) {
  .ks-assist { display: none !important; }
}

@media (max-width: 768px) {
  .ks-assist { display: block; }
  .ks-assist-btn {
    position: fixed;
    right: max(0.9rem, env(safe-area-inset-right, 0px));
    bottom: calc(4.85rem + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    width: 52px;
    height: 52px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #163A6B;
    color: #fff;
    font: 650 0.9rem/1.2 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    box-shadow: 0 8px 24px rgba(18, 32, 58, 0.22);
    cursor: pointer;
  }
  .ks-assist-btn:hover, .ks-assist-btn:focus-visible { background: #0F2748; }
  .ks-assist-btn:focus-visible { outline: 3px solid #B45309; outline-offset: 3px; }
  .ks-assist-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .ks-assist-btn { transition: opacity .2s, transform .2s; }
  body.hero-in-view .ks-assist-btn { opacity: 0; pointer-events: none; transform: translateY(0.75rem); }
  .ks-assist-btn svg { flex: 0 0 auto; }
  body.ks-assist-open .sticky-cta { visibility: hidden; pointer-events: none; }
  body.ks-assist-open { overflow: hidden; }

  .ks-assist-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(18, 32, 58, 0.4);
    z-index: 70;
  }
  .ks-assist-open .ks-assist-backdrop { display: block; }

  .ks-assist-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    height: 75vh;
    max-height: 75vh;
    margin: 0;
    padding: 0 0 env(safe-area-inset-bottom, 0px) !important;
    background: #F5F7FB;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px rgba(18, 32, 58, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
  }
  .ks-assist-open .ks-assist-panel { display: flex; }

  .ks-assist-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin: 0;
    padding: 0.85rem 1rem;
    background: #163A6B;
    color: #fff;
    border-radius: 18px 18px 0 0;
    flex: 0 0 auto;
  }
  .ks-assist-head strong { font-family: "Iowan Old Style", Palatino, Georgia, serif; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
  .ks-assist-head span { display: block; font-size: 0.75rem; opacity: 0.85; font-weight: 400; }
  .ks-assist-close {
    margin-left: auto;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
  }
  .ks-assist-close:focus-visible { outline: 2px solid #B45309; outline-offset: 2px; }

  .ks-assist-log {
    flex: 1;
    overflow-y: auto;
    padding: 0.9rem 0.9rem 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
  }
  .ks-msg {
    max-width: 88%;
    padding: 0.7rem 0.85rem;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    color: #12203A;
  }
  .ks-msg p { margin: 0 0 0.5rem; }
  .ks-msg p:last-child { margin-bottom: 0; }
  .ks-msg ul { margin: 0.35rem 0 0; padding-left: 1.15rem; }
  .ks-msg-bot { align-self: flex-start; background: #fff; border: 1px solid #D5DCE6; border-bottom-left-radius: 4px; }
  .ks-msg-user { align-self: flex-end; background: #163A6B; color: #fff; border-bottom-right-radius: 4px; }

  .ks-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.45rem 0.9rem 0.55rem;
  }
  .ks-chip {
    border: 1px solid #D5DCE6;
    background: #fff;
    color: #163A6B;
    font: 600 0.8rem/1.2 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    cursor: pointer;
    min-height: 36px;
  }
  .ks-chip:hover, .ks-chip:focus-visible { border-color: #163A6B; outline: none; }

  .ks-assist-form {
    display: flex;
    gap: 0.45rem;
    padding: 0.55rem 0.9rem 0.7rem;
    border-top: 1px solid #D5DCE6;
    background: #fff;
  }
  .ks-assist-form input {
    flex: 1;
    font: 1rem/1.4 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    padding: 0.65rem 0.75rem;
    border: 1px solid #D5DCE6;
    border-radius: 10px;
    color: #12203A;
    min-height: 44px;
  }
  .ks-assist-form input:focus { outline: 3px solid #FDE8D0; border-color: #B45309; }
  .ks-assist-form button[type="submit"] {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    background: #B45309;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    padding: 0 0.85rem;
  }
  .ks-assist-form button[type="submit"]:hover { background: #9A3412; }
}
