.aiw-fab {
  position: fixed;
  right: 18px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 54;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .34);
  border-radius: 999px;
  padding: 11px 16px 11px 13px;
  background: var(--brand-deep);
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 16px 36px -16px rgba(11, 82, 64, .7);
}
.aiw-fab[hidden] { display: none !important; }
.aiw-fab svg { width: 20px; height: 20px; }
.aiw-fab:hover { background: #083f32; }

.aiw-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(16, 24, 21, .44);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}
.aiw-mask.show { opacity: 1; pointer-events: auto; }

.aiw-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  display: flex;
  flex-direction: column;
  height: min(78vh, 680px);
  overflow: hidden;
  border-radius: 22px 22px 0 0;
  background: #faf8f3;
  box-shadow: 0 -24px 70px -34px rgba(11, 82, 64, .65);
  transform: translateY(102%);
  transition: transform .22s cubic-bezier(.32, .72, 0, 1);
}
.aiw-panel.show { transform: none; }
.aiw-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.aiw-head-avatar {
  display: grid;
  width: 38px;
  height: 38px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.aiw-head-avatar svg { width: 20px; height: 20px; }
.aiw-head-main { min-width: 0; flex: 1; }
.aiw-head-main b { display: block; font-family: var(--font-display); font-size: 16px; }
.aiw-head-main small { display: block; color: var(--faint); font-size: 12px; }
.aiw-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #f4f1ea;
  color: var(--muted);
}
.aiw-close svg { width: 15px; height: 15px; }
.aiw-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  overscroll-behavior: contain;
}
.aiw-msg { display: flex; margin-bottom: 12px; }
.aiw-msg.user { justify-content: flex-end; }
.aiw-bubble {
  max-width: 88%;
  border: 1px solid var(--line);
  border-radius: 17px 17px 17px 5px;
  padding: 11px 13px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.aiw-msg.user .aiw-bubble {
  border-color: var(--brand-deep);
  border-radius: 17px 17px 5px 17px;
  background: var(--brand-deep);
  color: #fff;
}
.aiw-dishes { display: grid; gap: 8px; margin-top: 11px; }
.aiw-dish {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 8px;
  background: #faf8f3;
}
.aiw-dish img, .aiw-dish-ph {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 10px;
  object-fit: cover;
  background: var(--brand-soft);
}
.aiw-dish-ph { display: grid; place-items: center; color: var(--brand-deep); }
.aiw-dish-ph svg { width: 21px; height: 21px; }
.aiw-dish-main { min-width: 0; flex: 1; }
.aiw-dish-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.aiw-dish-main small { display: block; overflow: hidden; color: var(--faint); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.aiw-dish-price { flex: none; color: var(--brand-deep); font-family: var(--font-display); font-size: 14px; font-weight: 800; }
.aiw-add {
  flex: none;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 800;
}
.aiw-add:disabled { opacity: .45; }
.aiw-tip {
  margin: 0 16px 8px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}
.aiw-form {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 11px 12px calc(11px + env(safe-area-inset-bottom, 0px));
  background: #fff;
}
.aiw-input {
  min-width: 0;
  flex: 1;
  height: 43px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
  background: #faf8f3;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  outline: none;
}
.aiw-input:focus { border-color: var(--brand); }
.aiw-send {
  display: grid;
  width: 43px;
  height: 43px;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
}
.aiw-send:disabled { opacity: .45; }
.aiw-send svg { width: 18px; height: 18px; }
.aiw-thinking { color: var(--faint); font-size: 13px; }

@media (min-width: 720px) {
  .aiw-panel {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: min(460px, calc(100vw - 40px));
    height: min(70vh, 660px);
    border-radius: 22px;
    transform: translate(-50%, 24px) scale(.98);
    opacity: 0;
    pointer-events: none;
  }
  .aiw-panel.show {
    transform: translate(-50%, 0) scale(1);
    opacity: 1;
    pointer-events: auto;
  }
}
.aiw-order {
  width: 100%;
  margin-top: 9px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #0b5240;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.aiw-order:disabled {
  opacity: .6;
}
.aiw-order-note {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #8a5413;
  background: #fdf3e3;
  border: 1px solid #f0d9ad;
  border-radius: 10px;
  padding: 8px 10px;
}
