/* Amara chat (amara.css). Owner: ui. Contract: docs/AMARA_CONTRACT.md section 8. Tokens from pt.css (docs/DESIGN_V2.md).
   Prefix am-. Phone first: < 900 px the chat fills the screen under the header with the composer above the tab bar;
   >= 900 px a split view (chat card left, form or live record right). */

.am { --am-bg: var(--pt-gray-25); --am-bot: #fff; --am-user: var(--pt-gray-900); --am-r: 20px; --am-chat-w: 480px;
      position: relative; color: var(--pt-text); }

/* ---------- avatar ---------- */
.am-avatar { position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  background: radial-gradient(120% 120% at 25% 15%, #fff 0%, var(--pt-red-50) 38%, #f8d3cf 72%, #f1c2bd 100%);
  color: var(--pt-red-700); font: 800 1.0625rem/1 var(--pt-font-display); letter-spacing: -.02em;
  box-shadow: inset 0 0 0 1px rgba(207, 31, 29, .12), 0 1px 2px rgba(17, 17, 16, .06); }
.am-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.am-avatar--lg { width: 52px; height: 52px; font-size: 1.375rem; }
.am-avatar--sm { width: 28px; height: 28px; font-size: .8125rem; }
.am-avatar__dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: #22c55e; border: 2px solid #fff; z-index: 1; }

/* ---------- chat shell ---------- */
.am-chat { display: flex; flex-direction: column; min-height: 0; background: var(--am-bg); }
.am-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--pt-border); flex: none; }
@supports (backdrop-filter: blur(8px)) { .am-head { backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); } }
.am-head__titles { min-width: 0; flex: 1; }
.am-head__title { margin: 0; font: 700 1rem/1.25 var(--pt-font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-head__role { font: 500 .8125rem/1 var(--pt-font); color: var(--pt-text-3); letter-spacing: 0; }
.am-head__sub { margin: 2px 0 0; font-size: .8125rem; color: var(--pt-text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-formbtn { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border: 1px solid var(--pt-gray-300); border-radius: var(--pt-r-pill);
  background: #fff; color: var(--pt-text); font: 600 .875rem/1 var(--pt-font); cursor: pointer; transition: border-color var(--pt-dur), background var(--pt-dur); }
.am-formbtn:hover { border-color: var(--pt-gray-900); }
@media (max-width: 379px) { .am-formbtn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .am-formbtn { width: 44px; padding: 0; justify-content: center; } }

/* ---------- log ---------- */
.am-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 20px 16px 12px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; }
.am-log:focus-visible { outline-offset: -3px; }
.am-log > :first-child { margin-top: auto; }
.am-log > * { flex-shrink: 0; min-width: 0; } /* never squash cards/blocks when the log overflows (scroll rows have overflow-x) */
.am-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; animation: am-in .26s var(--pt-ease) both; }
.am-row--bot { padding-inline-end: 28px; }
.am-row--user { justify-content: flex-end; padding-inline-start: 44px; }
.am-row--bot + .am-row--bot .am-row__av, .am-row--bot.is-cont .am-row__av { visibility: hidden; }
.am-row__av { align-self: flex-end; }
.am-bubble { position: relative; max-width: 100%; padding: 10px 14px; border-radius: var(--am-r); font-size: .9375rem; line-height: 1.55; overflow-wrap: anywhere; }
.am-bubble p { margin: 0; } .am-bubble p + p, .am-bubble p + ul, .am-bubble ul + p { margin-top: 8px; }
.am-bubble ul { margin: 0; padding-inline-start: 18px; } .am-bubble li + li { margin-top: 2px; }
.am-bubble strong { font-weight: 600; }
.am-row--bot .am-bubble { background: var(--am-bot); color: var(--pt-text); border: 1px solid var(--pt-gray-100); border-end-start-radius: 6px; box-shadow: 0 1px 2px rgba(17, 17, 16, .04); }
.am-row--user .am-bubble { background: var(--am-user); color: #fff; border-end-end-radius: 6px; }
.am-bubble__src { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; font-size: .75rem; font-weight: 600; color: rgba(255, 255, 255, .7); }
.am-bubble__src .pt-icon { width: 14px; height: 14px; }
.am-bubble.is-streaming::after { content: ""; display: inline-block; width: 7px; height: 1em; margin-inline-start: 2px; vertical-align: -2px; border-radius: 2px; background: var(--pt-red-600); opacity: .55; animation: am-caret 1s steps(2) infinite; }
.am-sys { align-self: center; display: inline-flex; align-items: center; gap: 6px; max-width: 92%; margin: 4px 0; padding: 5px 12px; border-radius: var(--pt-r-pill); background: var(--pt-gray-100); color: var(--pt-text-2); font-size: .8125rem; line-height: 1.4; text-align: center; animation: am-in .26s var(--pt-ease) both; }
.am-sys .pt-icon { width: 14px; height: 14px; flex: none; }
.am-sys--warn { background: var(--pt-warning-bg); color: var(--pt-warning); }
.am-typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.am-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--pt-gray-400); animation: am-dot 1.2s infinite ease-in-out; }
.am-typing i:nth-child(2) { animation-delay: .15s; } .am-typing i:nth-child(3) { animation-delay: .3s; }
.am-jump { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--am-dock-h, 120px) + 8px); z-index: 3; display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 14px; border: 0; border-radius: var(--pt-r-pill); background: var(--pt-gray-900); color: #fff; font-size: .8125rem; font-weight: 600; box-shadow: var(--pt-shadow-md); cursor: pointer; }

/* ---------- cards ---------- */
.am-cards { display: flex; flex-direction: column; gap: 10px; padding-inline-start: 36px; animation: am-in .3s var(--pt-ease) both; }
.am-cards--scroll { flex-direction: row; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; margin-inline: -16px; padding: 2px 16px 6px 52px; scroll-padding-inline: 52px; }
.am-cards--scroll::-webkit-scrollbar { display: none; }
.am-cards--scroll > .am-card { flex: none; width: min(248px, 72vw); scroll-snap-align: start; }
.am-card { position: relative; display: flex; flex-direction: column; max-width: 400px; background: #fff; border: 1px solid var(--pt-gray-200); border-radius: var(--pt-r-lg); overflow: hidden; box-shadow: var(--pt-shadow-sm); transition: box-shadow var(--pt-dur) var(--pt-ease), transform var(--pt-dur) var(--pt-ease); }
.am-card__media { position: relative; display: block; aspect-ratio: 4 / 3; background: linear-gradient(135deg, var(--pt-gray-50), var(--pt-gray-100)); overflow: hidden; }
.am-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s var(--pt-ease); }
.am-card__ph { position: absolute; inset: 0; display: none; place-items: center; color: var(--pt-gray-400); }
.am-card--noimg .am-card__media img { display: none; } .am-card--noimg .am-card__ph { display: grid; }
.am-card__body { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; min-width: 0; }
.am-card__eyebrow { display: flex; align-items: center; gap: 6px; margin: 0; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--pt-text-3); }
.am-card__eyebrow .pt-icon { width: 15px; height: 15px; color: var(--pt-red-600); }
.am-card__price { margin: 0; font: 700 1.125rem/1.25 var(--pt-font-display); letter-spacing: -.01em; font-variant-numeric: tabular-nums; color: var(--pt-text); }
.am-card__title { margin: 0; font-size: .9375rem; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.am-card__title a { color: var(--pt-text); text-decoration: none; }
.am-card--listing .am-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* whole card clickable */
.am-card__title a:hover { text-decoration: underline; }
.am-card__meta { display: flex; flex-wrap: wrap; gap: 2px 0; margin: 2px 0 0; padding: 0; list-style: none; font-size: .8125rem; color: var(--pt-text-2); }
.am-card__meta li { white-space: nowrap; }
.am-card__meta li + li::before { content: "·"; margin: 0 6px; color: var(--pt-gray-400); }
.am-card__note { margin: 0; font-size: .875rem; color: var(--pt-text-2); }
.am-card__fav { position: absolute; z-index: 2; top: 8px; right: 8px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; color: var(--pt-text); }
.am-card__fav::before { content: ""; position: absolute; width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, .94); box-shadow: var(--pt-shadow-sm); z-index: -1; }
.am-card__fav[aria-pressed="true"] { color: var(--pt-red-600); }
.am-card__fav[aria-pressed="true"] .pt-icon { fill: currentColor; }
@media (hover: hover) { .am-card--listing:hover { box-shadow: var(--pt-shadow-md); transform: translateY(-2px); } .am-card--listing:hover .am-card__media img { transform: scale(1.03); } }
.am-card__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.am-card--action { align-self: flex-start; max-width: 100%; white-space: normal; text-align: start; box-shadow: none; overflow: visible; border-radius: var(--pt-r); }
.am-card--action.pt-btn--secondary { border-color: var(--pt-gray-300); }
.am-card--action.pt-btn--primary { border: 0; background: var(--pt-red-600); color: #fff; } /* .am-card sets a white background: keep the primary look (white text was invisible) */
.am-card--action.pt-btn--primary:hover { background: var(--pt-red-700); color: #fff; }
/* valuation */
.am-card--valuation { padding: 16px; gap: 10px; }
.am-val__mid { margin: 0; font: 800 2rem/1.1 var(--pt-font-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.am-val__range { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.am-val__end { display: flex; flex-direction: column; font-variant-numeric: tabular-nums; }
.am-val__end small { font-size: .75rem; color: var(--pt-text-3); } .am-val__end b { font-size: .875rem; font-weight: 600; }
.am-val__end--hi { text-align: end; }
.am-val__bar { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--pt-red-100), var(--pt-red-200) 50%, var(--pt-red-100)); }
.am-val__bar i { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--pt-red-600); box-shadow: 0 0 0 3px #fff, 0 1px 3px rgba(0, 0, 0, .2); }
.am-badge { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 4px 10px; border-radius: var(--pt-r-pill); font-size: .8125rem; font-weight: 600; }
.am-badge .pt-icon { width: 15px; height: 15px; }
.am-badge--high { background: var(--pt-success-bg); color: var(--pt-success); }
.am-badge--medium { background: var(--pt-warning-bg); color: var(--pt-warning); }
.am-badge--low { background: var(--pt-gray-100); color: var(--pt-gray-700); }
/* photos */
.am-card--photos { flex-direction: row; align-items: flex-start; gap: 0; padding-inline-start: 14px; }
.am-photos__icon { flex: none; width: 44px; height: 44px; margin-top: 14px; border-radius: 12px; display: grid; place-items: center; background: var(--pt-red-50); color: var(--pt-red-700); }
.am-photos__needed { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.am-photos__label { font-size: .8125rem; color: var(--pt-text-2); }
.am-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.am-tags li { padding: 3px 10px; border-radius: var(--pt-r-pill); background: var(--pt-gray-100); font-size: .8125rem; font-weight: 500; }
.am-card--photos .pt-btn { align-self: flex-start; }
/* summary */
.am-card--summary { padding: 14px 16px; gap: 8px; }
.am-rows { margin: 0; display: flex; flex-direction: column; }
.am-rows > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-top: 1px solid var(--pt-gray-100); font-size: .875rem; }
.am-rows > div:first-child { border-top: 0; }
.am-rows dt { color: var(--pt-text-2); } .am-rows dd { margin: 0; font-weight: 600; text-align: end; font-variant-numeric: tabular-nums; }

/* ---------- inline blocks: consent, login, callback, error ---------- */
.am-block { display: flex; gap: 12px; align-items: flex-start; max-width: 440px; margin-inline-start: 36px; padding: 14px 16px; background: #fff; border: 1px solid var(--pt-gray-200); border-radius: var(--pt-r-lg); box-shadow: var(--pt-shadow-sm); animation: am-in .3s var(--pt-ease) both; }
.am-block > div { min-width: 0; flex: 1; }
.am-block__icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--pt-gray-100); color: var(--pt-gray-800); }
.am-block--consent .am-block__icon, .am-block--callback .am-block__icon { background: var(--pt-red-50); color: var(--pt-red-700); }
.am-block--error { border-color: #fecdd3; background: var(--pt-danger-bg); }
.am-block--error .am-block__icon { background: #fff; color: var(--pt-danger); }
.am-block__title { margin: 0 0 4px; font: 700 1rem/1.3 var(--pt-font-display); }
.am-block__text { margin: 0; font-size: .875rem; line-height: 1.5; color: var(--pt-text-2); }
.am-block--error .am-block__text { color: var(--pt-danger); font-weight: 500; }
.am-block__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 12px; }
.am-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .875rem; font-weight: 600; color: var(--pt-red-700); }
.am-block.is-done { opacity: .7; }
.am-block.is-done .am-block__row { display: none; }
.am-block.is-pulse { animation: am-pulse .9s var(--pt-ease) 2; }
.am-cb__fields { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.am-cb__consent { font-size: .8125rem; line-height: 1.45; color: var(--pt-text-2); padding-block: 4px; }
.am-cb__done { display: flex; align-items: center; gap: 8px; margin: 12px 0 0; font-weight: 600; color: var(--pt-success); }
.am-cb__done:focus { outline: none; }

/* ---------- dock: chips, autosend, composer ---------- */
.am-dock { position: sticky; bottom: calc(var(--pt-tabbar-h, 0px) + var(--pt-consent-h, 0px)); z-index: 2; flex: none; padding: 8px 12px max(10px, calc(env(safe-area-inset-bottom) - var(--pt-tabbar-h, 0px))); background: #fff; border-top: 1px solid var(--pt-border); }
.am-chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px 8px; padding: 2px 12px; scroll-padding-inline: 12px; }
.am-chips::-webkit-scrollbar { display: none; }
.am-chip { flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1px solid var(--pt-gray-300); border-radius: var(--pt-r-pill); background: #fff; color: var(--pt-text); font: 600 .875rem/1.2 var(--pt-font); cursor: pointer; white-space: nowrap; animation: am-in .24s var(--pt-ease) both; transition: border-color var(--pt-dur), background var(--pt-dur), color var(--pt-dur); -webkit-tap-highlight-color: transparent; }
.am-chip:hover { border-color: var(--pt-gray-900); }
.am-chip:active { background: var(--pt-gray-900); color: #fff; border-color: var(--pt-gray-900); }
.am-autosend { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 4px 4px 4px 12px; border-radius: var(--pt-r-pill); background: var(--pt-gray-50); border: 1px solid var(--pt-gray-200); font-size: .8125rem; color: var(--pt-text-2); }
.am-autosend [data-am-autosend-text] { flex: 1; min-width: 0; }
.am-autosend__ring { flex: none; width: 16px; height: 16px; border-radius: 50%; background: conic-gradient(var(--pt-red-600) var(--am-p, 0%), var(--pt-gray-200) 0); -webkit-mask: radial-gradient(circle, transparent 4px, #000 5px); mask: radial-gradient(circle, transparent 4px, #000 5px); }
.am-autosend__btn { min-height: 36px; padding: 0 12px; border: 0; border-radius: var(--pt-r-pill); background: none; font: 600 .8125rem/1 var(--pt-font); color: var(--pt-text); cursor: pointer; }
.am-autosend__btn:hover { background: var(--pt-gray-100); }
.am-autosend__btn--go { background: var(--pt-gray-900); color: #fff; } .am-autosend__btn--go:hover { background: var(--pt-gray-800); }
.am-composer { position: relative; display: flex; align-items: flex-end; gap: 4px; padding: 4px 4px 4px 16px; background: var(--pt-gray-50); border: 1px solid var(--pt-gray-200); border-radius: 26px; transition: border-color var(--pt-dur), box-shadow var(--pt-dur), background var(--pt-dur); }
.am-composer:focus-within { background: #fff; border-color: var(--pt-gray-400); box-shadow: 0 0 0 4px rgba(23, 23, 22, .05); }
.am-input { flex: 1; min-width: 0; min-height: 44px; max-height: 160px; margin: 0; padding: 11px 0; border: 0; background: transparent; resize: none; font-size: 1rem; line-height: 1.4; color: var(--pt-text); outline: none; overflow-y: auto; }
.am-input::placeholder { color: var(--pt-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-mic, .am-send { flex: none; position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; transition: background var(--pt-dur), color var(--pt-dur), transform .08s; -webkit-tap-highlight-color: transparent; }
.am-mic { background: transparent; color: var(--pt-gray-700); }
.am-mic:hover { background: var(--pt-gray-100); }
.am-send { background: var(--pt-red-600); color: #fff; }
.am-send:hover { background: var(--pt-red-700); }
.am-send:active, .am-mic:active { transform: scale(.94); }
.am-send[disabled] { background: var(--pt-gray-200); color: var(--pt-gray-500); cursor: default; }
.am-send:focus-visible, .am-mic:focus-visible { outline: 3px solid var(--pt-ring); outline-offset: 2px; border-radius: 50%; }
.am-mic__stop { display: none; width: 14px; height: 14px; border-radius: 3px; background: #fff; }
.am-mic.is-recording { background: var(--pt-red-600); color: #fff; }
.am-mic.is-recording .pt-icon { display: none; } .am-mic.is-recording .am-mic__stop { display: block; }
.am-mic.is-recording::before { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--pt-red-200); animation: am-ring 1.4s ease-out infinite; }
.am-mic.is-busy { pointer-events: none; color: var(--pt-gray-400); }
.am-mic.is-busy::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; border: 2px solid var(--pt-gray-200); border-top-color: var(--pt-gray-700); animation: pt-spin .8s linear infinite; }
.am-composer.is-recording .am-input, .am-composer.is-recording .am-send { display: none; }
.am-rec { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 44px; margin-inline-start: -12px; }
.am-rec__cancel { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--pt-gray-700); cursor: pointer; }
.am-rec__cancel:hover { background: var(--pt-gray-100); }
.am-rec__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--pt-red-600); animation: am-blink 1.2s ease-in-out infinite; }
.am-rec__label { flex: none; font-size: .875rem; font-weight: 600; color: var(--pt-text); }
.am-rec__meter { flex: 1; min-width: 0; height: 28px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.am-rec__meter i { flex: none; width: 3px; height: 100%; border-radius: 2px; background: var(--pt-gray-800); transform: scaleY(.12); transform-origin: center; transition: transform .08s linear; }
.am-rec__timer { flex: none; min-width: 34px; font-size: .8125rem; font-weight: 600; color: var(--pt-text-2); font-variant-numeric: tabular-nums; text-align: end; }
.am-fine { margin: 6px 4px 0; font-size: .6875rem; line-height: 1.4; color: var(--pt-text-3); text-align: center; }
.am-composer.is-locked .am-input { opacity: .6; }

/* ---------- live record panel ---------- */
.am-record { display: none; }
.am-record__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.am-record__title { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 1.125rem; }
.am-record__title .pt-icon { color: var(--pt-red-600); }
.am-record__meta { margin: 0; font-size: .8125rem; color: var(--pt-text-2); }
.am-record__list { margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.am-record__list > div { padding: 12px 14px; border-radius: var(--pt-r); background: var(--pt-gray-50); border: 1px solid transparent; transition: background .6s var(--pt-ease), border-color .6s; }
.am-record__list dt { font-size: .75rem; font-weight: 600; letter-spacing: .02em; color: var(--pt-text-3); }
.am-record__list dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.am-record__list > div.is-new { background: var(--pt-red-50); border-color: var(--pt-red-100); }
.am-record__empty { margin: 0; padding: 28px 16px; border: 1px dashed var(--pt-gray-300); border-radius: var(--pt-r-lg); text-align: center; font-size: .875rem; color: var(--pt-text-2); }
.am-progress { height: 4px; border-radius: 2px; background: var(--pt-gray-100); overflow: hidden; margin-top: 8px; width: 100%; }
.am-progress i { display: block; height: 100%; background: var(--pt-red-600); border-radius: 2px; transition: width .5s var(--pt-ease); }

/* ---------- form sync highlight ---------- */
.am-filled { animation: am-fill 1.8s var(--pt-ease); }
[data-amara-field].am-filled { border-color: var(--pt-red-600) !important; }

/* ---------- full page (amara/page.html) ---------- */
.am-page { width: 100%; }
.am-page__head { display: none; }
.am-page__panel { display: none; }

/* ---------- phone (< 900 px) ---------- */
@media (max-width: 899px) {
  body.am-page-body .pt-footer { display: none; }
  body.am-page-body .pt-main { display: flex; flex-direction: column; }
  .am { height: calc(100vh - var(--pt-header-h) - var(--pt-tabbar-h, 0px) - var(--pt-consent-h, 0px));
        height: calc(100dvh - var(--pt-header-h) - var(--pt-tabbar-h, 0px) - var(--pt-consent-h, 0px)); min-height: 380px; display: flex; flex-direction: column; }
  .am-chat { flex: 1; height: 100%; }
  .am-page__panel.is-open { display: flex; flex-direction: column; position: fixed; inset: 0; z-index: var(--pt-z-modal); background: #fff; overflow-y: auto; overscroll-behavior: contain; animation: am-sheet .28s var(--pt-ease) both; padding-bottom: env(safe-area-inset-bottom); }
  .am-panel__bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; min-height: 60px; padding: env(safe-area-inset-top) 12px 0 4px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--pt-border); }
  .am-panel__title { margin: 0; font-size: 1.0625rem; flex: 1; text-align: end; padding-inline-end: 8px; }
  .am-panel__back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--pt-r-pill); background: none; color: var(--pt-text); font: 600 .9375rem/1 var(--pt-font); cursor: pointer; }
  .am-panel__back:hover { background: var(--pt-gray-100); }
  .am-panel__note { display: flex; gap: 8px; align-items: flex-start; margin: 16px 20px 0; padding: 10px 12px; border-radius: var(--pt-r); background: var(--pt-gray-50); font-size: .8125rem; color: var(--pt-text-2); }
  .am-panel__note .pt-icon { color: var(--pt-red-600); width: 16px; height: 16px; margin-top: 1px; }
  .am-panel__body { padding: 16px 20px 32px; }
  /* chips: wrap into at most two rows on very small phones is too tall: keep one swipeable row */
}

/* ---------- desktop (>= 900 px) ---------- */
@media (min-width: 900px) {
  .am { --am-chat-h: max(560px, calc(100vh - var(--pt-header-h) - var(--am-offset, 48px))); }
  .am-chat { height: var(--am-chat-h); border: 1px solid var(--pt-gray-200); border-radius: var(--pt-r-xl); overflow: hidden; box-shadow: var(--pt-shadow-md); }
  .am-head { padding: 14px 16px 14px 20px; }
  .am-log { padding: 24px 20px 12px; }
  .am-dock { padding: 10px 16px 12px; }
  .am-chips { flex-wrap: wrap; overflow: visible; margin: 0 0 10px; padding: 0; }
  .am-formbtn { display: none; }
  .am--with-record { display: grid; grid-template-columns: minmax(400px, var(--am-chat-w)) minmax(0, 1fr); gap: 32px; align-items: start; }
  .am--with-record .am-chat { position: sticky; top: calc(var(--pt-header-h) + 24px); }
  .am-record { display: block; padding: 28px; background: #fff; border: 1px solid var(--pt-gray-200); border-radius: var(--pt-r-xl); box-shadow: var(--pt-shadow-sm); }

  .am-page { max-width: var(--pt-container); margin: 0 auto; padding: 28px var(--pt-gutter) 56px; }
  .am-page .am { --am-offset: 172px; }
  .am-page__head { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
  .am-page__brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
  .am-page__title { margin: 0; font-size: 1.875rem; font-weight: 800; letter-spacing: -.02em; }
  .am-page__sub { margin: 4px 0 0; color: var(--pt-text-2); font-size: 1rem; max-width: 640px; }
  .am-page--form .am-page__grid { display: grid; grid-template-columns: minmax(400px, 480px) minmax(0, 1fr); gap: 32px; align-items: start; }
  .am-page--form .am-page__chat { position: sticky; top: calc(var(--pt-header-h) + 24px); }
  .am-page--form .am-page__panel { display: block; padding: 28px 32px 32px; background: #fff; border: 1px solid var(--pt-gray-200); border-radius: var(--pt-r-xl); box-shadow: var(--pt-shadow-sm); }
  .am-panel__bar { display: flex; align-items: center; margin-bottom: 8px; }
  .am-panel__back { display: none; }
  .am-panel__title { margin: 0; font-size: 1.25rem; }
  .am-panel__note { display: flex; gap: 8px; align-items: center; margin: 0 0 20px; font-size: .875rem; color: var(--pt-text-2); }
  .am-panel__note .pt-icon { color: var(--pt-red-600); width: 16px; height: 16px; }
}
@media (min-width: 1200px) { .am-log { padding-inline: 24px; } }

/* ---------- motion ---------- */
@keyframes am-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes am-sheet { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes am-dot { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-4px); opacity: 1; } }
@keyframes am-caret { 50% { opacity: 0; } }
@keyframes am-blink { 50% { opacity: .25; } }
@keyframes am-ring { from { transform: scale(.9); opacity: 1; } to { transform: scale(1.35); opacity: 0; } }
@keyframes am-fill { 0%, 30% { box-shadow: 0 0 0 4px rgba(207, 31, 29, .18); background-color: var(--pt-red-50); } 100% { box-shadow: 0 0 0 0 rgba(207, 31, 29, 0); } }
@keyframes am-pulse { 50% { box-shadow: 0 0 0 4px var(--pt-red-100); } }
@media (prefers-reduced-motion: reduce) {
  .am-row, .am-sys, .am-cards, .am-block, .am-chip, .am-page__panel.is-open { animation: none !important; }
  .am-log { scroll-behavior: auto; }
  .am-bubble.is-streaming::after, .am-rec__dot, .am-mic.is-recording::before, .am-typing i { animation: none !important; }
  .am-card, .am-card__media img, .am-rec__meter i { transition: none !important; }
  .am-filled { animation: none; box-shadow: 0 0 0 3px rgba(207, 31, 29, .22); }
}

/* small phones: blocks and single cards use the full width of the log */
@media (max-width: 599px) {
  .am-block { margin-inline-start: 0; max-width: none; padding: 14px; gap: 10px; }
  .am-block__icon { width: 34px; height: 34px; border-radius: 10px; }
  .am-block--callback { flex-direction: column; }
  .am-cards:not(.am-cards--scroll) { padding-inline-start: 0; }
  .am-cards--scroll { padding-inline-start: 16px; scroll-padding-inline: 16px; }
  .am-row--bot { padding-inline-end: 12px; }
}

/* call-back form: always fits its column (phone picker + long Turkish labels) */
.am-block--callback, .am-cb, .am-cb__fields, .am-cb__fields > * { min-width: 0; max-width: 100%; }
.am-block--callback { width: 100%; max-width: 440px; }
.am-cb__fields .pt-input, .am-cb__fields .pt-select, .am-cb__fields .ptp { width: 100%; min-width: 0; }
.am-cb .pt-label, .am-cb__consent span, .am-block__text, .am-block__title { overflow-wrap: anywhere; }
.am-cb .am-block__row .pt-btn { white-space: normal; text-align: center; }
@media (max-width: 599px) { .am-block--callback { max-width: none; } .am-cb .am-block__row .pt-btn--primary { flex: 1 1 100%; } }
/* action cards are links styled as buttons: keep them visible and readable in any width */
.am-card--action { display: inline-flex; flex: none; min-height: 44px; }
/* desktop: the cookie card sits bottom-left by default, which is exactly where the chat composer is; move it right on Amara pages */
@media (min-width: 900px) { body.am-page-body .pt-consent { left: auto; right: var(--pt-s5); } }
/* action cards: label and arrow on one line (.am-card is a column flexbox) */
.am-card--action { flex-direction: row; align-items: center; gap: 8px; }
/* phones with the "Fill in the form" button: drop the "· AI assistant" tag instead of cutting it mid-word (the sub line says the journey) */
@media (max-width: 480px) { .am--with-form .am-head__role { display: none; } }
/* a single listing card used to fill the whole phone chat (4:3 photo at full width); keep it the size of a carousel card */
.am-cards:not(.am-cards--scroll) > .am-card--listing { width: min(300px, 86%); }
