.iws-chat-root {
  --iws-chat-ink: var(--ink, #07130f);
  --iws-chat-paper: var(--paper, #f2f0e7);
  --iws-chat-white: var(--white, #fffef8);
  --iws-chat-lime: var(--lime, #b8ff48);
  --iws-chat-green: var(--green, #64dc9a);
  --iws-chat-purple: var(--purple, #b998ff);
  --iws-chat-line: rgba(7, 19, 15, .16);
  --iws-chat-muted: rgba(7, 19, 15, .58);
  --iws-chat-mono: var(--mono, "DM Mono", ui-monospace, monospace);
  --iws-chat-sans: var(--sans, "Manrope", system-ui, sans-serif);
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  color: var(--iws-chat-ink);
  font-family: var(--iws-chat-sans);
  font-size: 14px;
  line-height: 1.45;
}

.iws-chat-root *,
.iws-chat-root *::before,
.iws-chat-root *::after {
  box-sizing: border-box;
}

.iws-chat-launcher {
  position: relative;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-left: auto;
  padding: 0;
  color: var(--iws-chat-lime);
  background: var(--iws-chat-ink);
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 18px;
  box-shadow: 0 18px 46px rgba(7, 19, 15, .25);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.iws-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 52px rgba(7, 19, 15, .3);
}

.iws-chat-launcher:focus-visible,
.iws-chat-panel button:focus-visible,
.iws-chat-panel input:focus-visible,
.iws-chat-panel textarea:focus-visible {
  outline: 3px solid var(--iws-chat-purple);
  outline-offset: 3px;
}

.iws-chat-launcher-icon {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  padding-bottom: 8px;
  font: 700 18px/1 var(--iws-chat-mono);
  letter-spacing: 1px;
}

.iws-chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  padding: 0 6px;
  color: var(--iws-chat-ink);
  background: var(--iws-chat-lime);
  border: 3px solid var(--iws-chat-paper);
  border-radius: 999px;
  font: 700 10px/1 var(--iws-chat-mono);
}

.iws-chat-badge[hidden] {
  display: none;
}

.iws-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100dvh - 124px));
  min-height: 430px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  color: var(--iws-chat-ink);
  background: var(--iws-chat-white);
  border: 1px solid var(--iws-chat-line);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(7, 19, 15, .28);
  transform-origin: right bottom;
}

.iws-chat-panel[hidden] {
  display: none;
}

.iws-chat-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 18px 18px 15px;
  color: var(--iws-chat-white);
  background: var(--iws-chat-ink);
}

.iws-chat-heading {
  min-width: 0;
}

.iws-chat-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--iws-chat-lime);
  font: 500 9px/1.2 var(--iws-chat-mono);
  letter-spacing: .11em;
  text-transform: uppercase;
}

.iws-chat-title {
  display: block;
  overflow: hidden;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iws-chat-identity-button,
.iws-chat-close,
.iws-chat-name-cancel {
  min-width: 40px;
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  color: var(--iws-chat-white);
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 11px;
  cursor: pointer;
}

.iws-chat-identity-button {
  max-width: 116px;
  overflow: hidden;
  font: 500 9px/1 var(--iws-chat-mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iws-chat-close {
  font-size: 23px;
  line-height: 1;
}

.iws-chat-statusbar {
  min-height: 35px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  color: var(--iws-chat-muted);
  background: #eeece3;
  border-bottom: 1px solid var(--iws-chat-line);
  font: 500 10px/1.3 var(--iws-chat-mono);
}

.iws-chat-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: #9b9b91;
  border-radius: 50%;
}

.iws-chat-statusbar[data-tone="online"] .iws-chat-status-dot {
  background: var(--iws-chat-green);
  box-shadow: 0 0 0 4px rgba(100, 220, 154, .17);
}

.iws-chat-statusbar[data-tone="busy"] .iws-chat-status-dot {
  background: #ffb35c;
}

.iws-chat-statusbar[data-tone="error"] .iws-chat-status-dot,
.iws-chat-statusbar[data-tone="offline"] .iws-chat-status-dot {
  background: #e85d5d;
}

.iws-chat-messages {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px;
  background:
    linear-gradient(rgba(255, 254, 248, .92), rgba(255, 254, 248, .92)),
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(7, 19, 15, .035) 27px 28px);
  overscroll-behavior: contain;
  scrollbar-color: rgba(7, 19, 15, .25) transparent;
}

.iws-chat-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  gap: 9px;
  padding: 30px;
  color: var(--iws-chat-muted);
  text-align: center;
}

.iws-chat-empty-mark {
  width: 55px;
  height: 55px;
  display: grid;
  place-items: center;
  margin: 0 auto 5px;
  color: var(--iws-chat-lime);
  background: var(--iws-chat-ink);
  border-radius: 17px;
  font: 500 17px/1 var(--iws-chat-mono);
}

.iws-chat-empty strong {
  color: var(--iws-chat-ink);
  font-size: 16px;
}

.iws-chat-empty span {
  font-size: 12px;
  line-height: 1.6;
}

.iws-chat-message {
  max-width: 88%;
  margin: 0 0 13px;
}

.iws-chat-message[data-own="true"] {
  margin-left: auto;
}

.iws-chat-message-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin: 0 7px 5px;
  color: var(--iws-chat-muted);
  font: 500 9px/1.25 var(--iws-chat-mono);
}

.iws-chat-message[data-own="true"] .iws-chat-message-meta {
  justify-content: flex-end;
}

.iws-chat-message-name {
  max-width: 190px;
  overflow: hidden;
  color: var(--iws-chat-ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.iws-chat-message-bubble {
  padding: 11px 13px;
  background: #ece9df;
  border: 1px solid rgba(7, 19, 15, .08);
  border-radius: 6px 16px 16px 16px;
  box-shadow: 0 5px 14px rgba(7, 19, 15, .04);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.iws-chat-message[data-own="true"] .iws-chat-message-bubble {
  background: var(--iws-chat-lime);
  border-color: rgba(7, 19, 15, .12);
  border-radius: 16px 6px 16px 16px;
}

.iws-chat-composer {
  padding: 13px;
  background: var(--iws-chat-white);
  border-top: 1px solid var(--iws-chat-line);
}

.iws-chat-compose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
}

.iws-chat-textarea {
  width: 100%;
  min-height: 46px;
  max-height: 118px;
  resize: none;
  padding: 12px 13px;
  color: var(--iws-chat-ink);
  background: var(--iws-chat-paper);
  border: 1px solid var(--iws-chat-line);
  border-radius: 13px;
  font: 500 13px/1.45 var(--iws-chat-sans);
}

.iws-chat-textarea::placeholder {
  color: rgba(7, 19, 15, .45);
}

.iws-chat-send {
  min-width: 48px;
  height: 46px;
  padding: 0 14px;
  color: var(--iws-chat-ink);
  background: var(--iws-chat-lime);
  border: 1px solid rgba(7, 19, 15, .12);
  border-radius: 13px;
  font: 800 11px/1 var(--iws-chat-sans);
  cursor: pointer;
}

.iws-chat-send:disabled,
.iws-chat-textarea:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.iws-chat-compose-help {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--iws-chat-muted);
  font: 500 9px/1.3 var(--iws-chat-mono);
}

.iws-chat-name-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 19, 15, .76);
  backdrop-filter: blur(7px);
}

.iws-chat-name-layer[hidden] {
  display: none;
}

.iws-chat-name-card {
  width: 100%;
  padding: 25px;
  background: var(--iws-chat-white);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

.iws-chat-name-card .iws-chat-kicker {
  color: rgba(7, 19, 15, .52);
}

.iws-chat-name-card h2 {
  margin: 9px 0 9px;
  font-size: 25px;
  line-height: 1.08;
  letter-spacing: -.04em;
}

.iws-chat-name-card p {
  margin: 0 0 18px;
  color: var(--iws-chat-muted);
  font-size: 12px;
  line-height: 1.6;
}

.iws-chat-name-label {
  display: block;
  margin-bottom: 7px;
  font: 700 10px/1.3 var(--iws-chat-mono);
  text-transform: uppercase;
}

.iws-chat-name-input {
  width: 100%;
  min-height: 48px;
  padding: 0 13px;
  color: var(--iws-chat-ink);
  background: var(--iws-chat-paper);
  border: 1px solid var(--iws-chat-line);
  border-radius: 12px;
  font: 600 14px/1 var(--iws-chat-sans);
}

.iws-chat-name-error {
  min-height: 18px;
  margin: 7px 0 0;
  color: #a83232;
  font: 600 10px/1.4 var(--iws-chat-mono);
}

.iws-chat-name-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  margin-top: 11px;
}

.iws-chat-name-cancel {
  color: var(--iws-chat-ink);
  background: transparent;
  border-color: var(--iws-chat-line);
}

.iws-chat-name-save {
  min-height: 44px;
  padding: 0 16px;
  color: var(--iws-chat-ink);
  background: var(--iws-chat-lime);
  border: 1px solid rgba(7, 19, 15, .12);
  border-radius: 11px;
  font: 800 12px/1 var(--iws-chat-sans);
  cursor: pointer;
}

@media (max-width: 520px) {
  .iws-chat-root {
    right: 10px;
    bottom: 10px;
  }

  .iws-chat-launcher {
    width: 58px;
    height: 58px;
    border-radius: 17px;
  }

  .iws-chat-panel {
    right: 0;
    bottom: 68px;
    width: calc(100vw - 20px);
    height: min(690px, calc(100dvh - 88px));
    min-height: 380px;
    border-radius: 18px;
  }

  .iws-chat-header {
    padding: 13px 12px;
  }

  .iws-chat-title {
    font-size: 15px;
  }

  .iws-chat-identity-button {
    max-width: 92px;
  }

  .iws-chat-messages {
    padding: 14px 12px;
  }

  .iws-chat-message {
    max-width: 92%;
  }

  .iws-chat-composer {
    padding: 10px;
  }

  .iws-chat-compose-help span:first-child {
    display: none;
  }

  .iws-chat-compose-help {
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .iws-chat-launcher {
    transition: none;
  }
}

@media (forced-colors: active) {
  .iws-chat-launcher,
  .iws-chat-panel,
  .iws-chat-message-bubble,
  .iws-chat-name-card {
    border: 1px solid CanvasText;
  }
}

/* Dark portfolio uyumu */
.theme-dark .iws-chat-badge { border-color: #050806; }
.theme-dark .iws-chat-panel { color: #f2f6ef; background: #08110d; border-color: rgba(207,255,183,.18); box-shadow: 0 30px 90px rgba(0,0,0,.62); }
.theme-dark .iws-chat-header { background: #050806; border-bottom: 1px solid rgba(207,255,183,.12); }
.theme-dark .iws-chat-statusbar { color: rgba(242,246,239,.58); background: #0c1712; border-bottom-color: rgba(207,255,183,.12); }
.theme-dark .iws-chat-messages { background: linear-gradient(rgba(8,17,13,.95), rgba(8,17,13,.95)), repeating-linear-gradient(0deg, transparent 0 27px, rgba(207,255,183,.04) 27px 28px); scrollbar-color: rgba(207,255,183,.25) transparent; }
.theme-dark .iws-chat-empty { color: rgba(242,246,239,.54); }
.theme-dark .iws-chat-empty strong { color: #f2f6ef; }
.theme-dark .iws-chat-message-meta { color: rgba(242,246,239,.46); }
.theme-dark .iws-chat-message-name { color: #f2f6ef; }
.theme-dark .iws-chat-message-bubble { background: #14231c; border-color: rgba(207,255,183,.1); box-shadow: 0 5px 14px rgba(0,0,0,.18); }
.theme-dark .iws-chat-message[data-own="true"] .iws-chat-message-bubble { color: #07130f; background: var(--iws-chat-lime); }
.theme-dark .iws-chat-composer { background: #08110d; border-top-color: rgba(207,255,183,.13); }
.theme-dark .iws-chat-textarea { color: #f2f6ef; background: #0d1a14; border-color: rgba(207,255,183,.17); }
.theme-dark .iws-chat-textarea::placeholder { color: rgba(242,246,239,.38); }
.theme-dark .iws-chat-compose-help { color: rgba(242,246,239,.42); }
.theme-dark .iws-chat-name-card { color: #f2f6ef; background: #0b1511; border: 1px solid rgba(207,255,183,.16); }
.theme-dark .iws-chat-name-card .iws-chat-kicker, .theme-dark .iws-chat-name-card p { color: rgba(242,246,239,.52); }
.theme-dark .iws-chat-name-input { color: #f2f6ef; background: #07100c; border-color: rgba(207,255,183,.18); }
.theme-dark .iws-chat-name-cancel { color: #f2f6ef; border-color: rgba(207,255,183,.18); }
