* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: #e9eef0; color: #111827; -webkit-font-smoothing: antialiased;
}
.app {
  height: 100dvh; max-width: 720px; margin: 0 auto; display: flex; flex-direction: column;
  background: #f4f6f5; box-shadow: 0 0 0 1px rgba(0,0,0,.04), 0 10px 40px rgba(0,0,0,.06);
}
.top {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--brand); color: #fff; flex-shrink: 0;
}
.logo { width: 40px; height: 40px; border-radius: 12px; background: #fff; object-fit: contain; }
.logo.ph { display: grid; place-items: center; color: var(--brand); font-weight: 700; font-size: 20px; }
.who { flex: 1; min-width: 0; }
.name { font-weight: 650; font-size: 17px; line-height: 1.2; }
.sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; opacity: .95; margin-top: 2px; }
.ai-badge { background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.35); padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.reset { background: transparent; border: 0; color: #fff; padding: 8px; border-radius: 10px; cursor: pointer; opacity: .9; }
.reset:active { background: rgba(255,255,255,.15); }

.msgs { flex: 1; overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.note { align-self: center; max-width: 92%; text-align: center; font-size: 12px; color: #6b7280; background: #fff8dc; border: 1px solid #f3e7b3; border-radius: 10px; padding: 6px 10px; margin-bottom: 6px; }
.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.bubble {
  max-width: 84%; padding: 8px 12px; border-radius: 16px; font-size: 15.5px; line-height: 1.42;
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0,0,0,.06);
}
.bot .bubble { background: #fff; border-top-left-radius: 5px; }
.me .bubble { background: var(--brand); color: #fff; border-top-right-radius: 5px; }
.me .bubble a { color: #fff; }
.bubble a { color: var(--brand); word-break: break-all; }
.bubble ul { margin: 4px 0; padding-left: 18px; white-space: normal; }
.bubble li { margin: 2px 0; }
.bubble .kvkk { display: block; font-size: 12.5px; color: #6b7280; border-bottom: 1px dashed #e5e7eb; padding-bottom: 6px; margin-bottom: 6px; }
.msg.handoff .bubble { border-left: 3px solid #f59e0b; }
.tag { align-self: center; font-size: 12px; color: #92400e; background: #fef3c7; border-radius: 999px; padding: 3px 10px; margin: 2px 0; }
.tag.ok { color: #065f46; background: #d1fae5; }

.typing .bubble { display: inline-flex; gap: 4px; align-items: center; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; background: #9ca3af; border-radius: 50%; display: block; animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.chips button {
  border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); color: var(--brand); background: #fff;
  border-radius: 999px; padding: 7px 12px; font-size: 14px; cursor: pointer;
}

.composer {
  display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px;
  padding-bottom: max(8px, env(safe-area-inset-bottom)); background: #f4f6f5; border-top: 1px solid #e5e7eb; flex-shrink: 0;
}
.composer textarea {
  flex: 1; resize: none; border: 1px solid #d1d5db; border-radius: 22px; padding: 10px 14px; font: inherit;
  font-size: 16px; line-height: 1.35; max-height: 120px; background: #fff; outline: none;
}
.composer textarea:focus { border-color: var(--brand); }
.composer button {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: 0; background: var(--brand); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.composer button:disabled { opacity: .5; }

/* --- zengin mesajlar: ilan kartı, butonlar, konum --- */
.bubble.kvkk { font-size: 12.5px; color: #6b7280; background: #fffbea; }
.bubble.card { padding: 4px; max-width: 86%; }
.bubble.card img { display: block; width: 100%; max-width: 360px; aspect-ratio: 3 / 2; object-fit: cover; border-radius: 12px; cursor: zoom-in; background: #e5e7eb; }
.bubble.card .caption { padding: 6px 8px 4px; }
.opts { display: flex; flex-direction: column; margin: 8px -12px -8px; border-top: 1px solid #eef0f2; white-space: normal; }
.opts button {
  border: 0; border-bottom: 1px solid #eef0f2; background: transparent; color: var(--brand);
  font: inherit; font-weight: 600; font-size: 15px; padding: 10px 12px; cursor: pointer; text-align: center;
}
.opts button:last-child { border-bottom: 0; border-radius: 0 0 16px 16px; }
.opts button:hover { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.opts.list button { text-align: left; font-weight: 500; }
.opts button small { display: block; font-size: 12px; font-weight: 400; color: #667781; }
.bubble.loc { display: flex; gap: 10px; align-items: center; white-space: normal; }
.bubble.loc .map {
  width: 64px; height: 64px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; color: #dc2626;
  background: repeating-linear-gradient(45deg, #e8f0e3 0 10px, #dfe9d8 10px 20px);
}
.bubble.loc .loc-text { font-size: 14px; line-height: 1.35; }
.bubble.loc .loc-text div { color: #6b7280; font-size: 13px; }
