/* May Finder AI — chat, in the May AI layout (turquoise accent) */
html, body { height: 100%; }
body { overflow: hidden; }

.app { display: grid; grid-template-columns: 300px 1fr; height: 100dvh; }

/* ---------- Sidebar ---------- */
.side { background: var(--bg); display: flex; flex-direction: column; padding: 12px 10px 12px; min-width: 0; border-right: 1px solid var(--edge); }
.side-top { display: flex; justify-content: center; gap: 10px; padding: 2px 0 8px; position: relative; }
.side-top .only-mobile { position: absolute; right: 4px; top: 2px; }
.side-brand { align-self: center; margin: 6px 0 4px; }
.side-sub { text-align: center; font-size: 13px; color: var(--muted); margin: 6px 0 14px; }
.history { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.history button { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 12px; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 16px; color: var(--ink); min-width: 0; }
.history button:hover { background: var(--comp); }
.history button.on { background: var(--btn); }
.history .h-ava { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.history .h-ava.deep { background: radial-gradient(circle at 30% 30%, #7beee4, #13998d); color: #032220; }
.history .h-txt { min-width: 0; }
.history .h-t { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history .h-s { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.history .none { font-size: 13px; color: var(--muted); padding: 10px; text-align: center; line-height: 1.5; }
.side-foot { padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.side-actions { display: flex; gap: 8px; align-items: center; }
.basket-link { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border: 0; border-radius: 999px; background: var(--btn); font-size: 14px; font-weight: 500; transition: background .15s; }
.basket-link:hover { background: var(--hover); }
.basket-link .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--hover); color: var(--ink2); font-size: 11.5px; display: inline-grid; place-items: center; }
.basket-link .count.has { background: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; height: 100dvh; background: var(--bg); position: relative; }
.topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 10px 14px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.title-chip { display: inline-flex; align-items: center; gap: 8px; max-width: min(460px, 60vw); background: rgba(28,28,30,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 999px; padding: 5px 14px 5px 5px; box-shadow: 0 0 0 1px var(--edge); }
.title-chip img { width: 24px; height: 24px; border-radius: 7px; }
.topbar-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-right { position: absolute; right: 14px; display: flex; gap: 8px; align-items: center; }
.topbar .only-mobile { position: absolute; left: 12px; }
.demo-pill { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--accent-line); color: var(--accent); }
.icon-round .dot { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--bg); }
.only-mobile { display: none !important; }

/* ---------- Thread ---------- */
.thread { flex: 1; overflow-y: auto; padding: 70px 20px 16px; scroll-behavior: smooth; }
.thread > * { max-width: 760px; margin-left: auto; margin-right: auto; }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 7vh 0 20px; }
.empty-logo { position: relative; width: 96px; height: 96px; display: grid; place-items: center; }
.empty-logo .brand-icon { width: 80px; height: 80px; border-radius: 20px; position: relative; z-index: 1; box-shadow: 0 18px 50px rgba(0,0,0,.7), 0 0 0 1px rgba(255,255,255,.05); }
.orbit { position: absolute; inset: -40px; }
.orbit i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(63,217,204,.14); animation: orbit 9s linear infinite; }
.orbit i::after { content: ""; position: absolute; top: -3px; left: 50%; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.orbit i:nth-child(2) { inset: 14px; animation-duration: 6.5s; animation-direction: reverse; border-color: rgba(63,217,204,.1); }
.orbit i:nth-child(3) { inset: 28px; animation-duration: 4.5s; border-color: transparent; }
@keyframes orbit { to { transform: rotate(360deg); } }
.empty-word { height: 15px; margin-top: 30px; }
.empty-h { font-family: var(--font-display); font-weight: 600; font-size: clamp(24px, 3vw, 30px); margin: 22px 0 8px; letter-spacing: -.02em; }
.empty-p { color: var(--ink2); margin: 0 0 28px; font-size: 15.5px; max-width: 480px; line-height: 1.5; }
.starters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 620px; }
.starter { text-align: left; background: var(--comp); border: 1px solid var(--edge); border-radius: var(--radius); padding: 14px 16px; font-size: 14.5px; color: var(--ink); line-height: 1.4; transition: background .15s, border-color .15s, transform .15s; }
.starter:hover { background: var(--raise); border-color: var(--edge-2); transform: translateY(-1px); }
.starter-k { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 500; }
.starter-k i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }

/* messages — May AI bubbles */
.msg { display: flex; margin: 0 auto 14px; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--bubble-user); padding: 10px 16px; border-radius: 20px; max-width: 78%; font-size: 16px; line-height: 1.42; white-space: pre-wrap; word-wrap: break-word; animation: pop .25s ease both; }
.msg.bot { flex-direction: column; gap: 10px; align-items: flex-start; }
.bot-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.avatar { width: 22px; height: 22px; border-radius: 6px; background: url(/assets/brand/may-finder-icon.svg) center / cover; font-size: 0; flex: none; }
.avatar i { display: none; }
.bot-name { font-weight: 500; }
.msg.bot.deep .bot-name::after { content: "Deep search"; margin-left: 8px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--accent-line); border-radius: 999px; padding: 2px 7px; }
.bot-text { background: var(--bubble); border-radius: 20px; padding: 10px 16px; font-size: 16px; line-height: 1.45; color: var(--ink); max-width: 100%; animation: pop .25s ease both; }
.bot-text:empty { display: none; }
.bot-text p { margin: 0 0 8px; }
.bot-text p:last-child { margin-bottom: 0; }
.bot-text a { color: var(--accent); text-underline-offset: 3px; }
.bot-text ul { margin: 6px 0 8px; padding-left: 20px; }
.bot-text strong { color: #fff; font-weight: 600; }
.bot-text .err { color: var(--bad); }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.99); } }

/* live search steps — May AI chips */
.status { display: flex; flex-direction: column; gap: 6px; }
.status:empty { display: none; }
.step { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; font-size: 12.5px; color: var(--ink2); background: var(--comp); border: 1px solid var(--edge); border-radius: 999px; padding: 5px 12px 5px 8px; max-width: 100%; animation: pop .2s ease both; }
.step .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .spin { width: 13px; height: 13px; border-radius: 50%; border: 1.6px solid var(--edge-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; position: relative; }
.step.done { color: var(--muted); }
.step.done .spin { animation: none; border: 0; background: var(--accent-soft); }
.step.done .spin::after { content: ""; position: absolute; inset: 3.5px; border-radius: 50%; background: var(--accent); }
.step q { color: var(--ink); quotes: "“" "”"; }
@keyframes spin { to { transform: rotate(360deg); } }
.typing { display: inline-flex; gap: 4px; background: var(--bubble); border-radius: 20px; padding: 14px 16px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink2); opacity: .3; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 40% { opacity: 1; } }

/* ---------- Product cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; width: 100%; }
.card { background: var(--comp); border: 1px solid var(--edge); border-radius: 20px; padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 7px; transition: border-color .2s, transform .2s; animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.card:nth-child(2) { animation-delay: .06s; } .card:nth-child(3) { animation-delay: .12s; } .card:nth-child(4) { animation-delay: .18s; } .card:nth-child(5) { animation-delay: .24s; } .card:nth-child(6) { animation-delay: .3s; }
.card:hover { border-color: var(--edge-2); transform: translateY(-2px); }
.card.best { border-color: var(--accent-line); box-shadow: 0 0 0 1px rgba(63,217,204,.12), 0 18px 40px -20px rgba(63,217,204,.35); }
.card-img { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: 14px; background: #f4f4f2; overflow: hidden; color: #b5b5b0; margin-bottom: 4px; }
.card-img img { width: 100%; height: 100%; object-fit: contain; padding: 10px; opacity: 0; transition: opacity .3s; position: absolute; inset: 0; }
.card-img.loaded img { opacity: 1; }
.card-img.loaded .ph { display: none; }
.card-top, .card-name, .card-part, .card-note, .card-bottom { padding: 0 4px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-shop { font-size: 12px; color: var(--ink2); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-del { font-size: 11.5px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }
.card-name { font-size: 15px; font-weight: 600; line-height: 1.32; margin: 0; color: var(--ink); }
.card-part { font-size: 12px; color: var(--ink2); font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0; }
.card-part b { color: var(--muted); font-weight: 500; font-family: var(--font); font-size: 11px; margin-right: 6px; }
.card-note { font-size: 13px; color: var(--muted); margin: 0; line-height: 1.45; flex: 1; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.card-price { font-weight: 700; font-size: 19px; color: #fff; letter-spacing: -.02em; }
.card-actions { display: flex; gap: 6px; }
.btn.sm { padding: 7px 14px; font-size: 13px; }
.btn.added { background: var(--accent-soft); color: var(--accent); }
.best-tag { display: inline-block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); background: var(--accent); padding: 2px 7px; border-radius: 999px; font-weight: 700; margin-right: 6px; vertical-align: 2px; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.sources { display: none; }

/* ---------- Composer — May AI pill ---------- */
.composer { padding: 8px 20px 14px; background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer-box { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 6px; background: var(--raise); border-radius: 28px; padding: 7px 7px 7px 8px; box-shadow: 0 0 0 1px var(--edge); transition: box-shadow .2s; }
.composer-box:focus-within { box-shadow: 0 0 0 1px var(--edge-2), 0 0 0 4px rgba(63,217,204,.08); }
.composer textarea { flex: 1; background: none; border: 0; outline: 0; resize: none; color: var(--ink); font: inherit; font-size: 16px; line-height: 1.45; padding: 9px 4px; max-height: 200px; letter-spacing: -0.011em; }
.composer textarea::placeholder { color: var(--muted); }
.attach { width: 40px; height: 40px; border-radius: 50%; border: 0; background: none; color: var(--ink2); display: grid; place-items: center; flex: none; }
.attach:hover { background: var(--btn); color: var(--ink); }
.attach.on { color: var(--accent); }
.send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--ink); color: #0a0a0a; display: grid; place-items: center; flex: none; transition: background .15s, transform .1s, opacity .15s; }
.send:hover:not(:disabled) { background: #fff; }
.send:active:not(:disabled) { transform: scale(.94); }
.send:disabled { background: var(--btn); color: var(--muted); cursor: default; }
.send.stop { background: var(--ink); }
body.deep-mode .send:not(:disabled):not(.stop) { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 20px rgba(63,217,204,.35); }
.attach-preview { max-width: 760px; margin: 0 auto 8px; display: flex; align-items: center; gap: 10px; background: var(--raise); border-radius: 18px; padding: 6px 8px 6px 6px; font-size: 13px; color: var(--ink2); box-shadow: 0 0 0 1px var(--edge); }
.attach-preview img { width: 44px; height: 44px; object-fit: cover; border-radius: 12px; }
.attach-preview span { flex: 1; }
.attach-preview button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--btn); color: var(--ink); display: grid; place-items: center; }
.bubble .sent-photo { display: block; max-width: 220px; max-height: 220px; border-radius: 14px; margin: -4px -10px 8px; object-fit: cover; }
.bubble .photo-tag { display: inline-block; font-size: 12px; color: var(--accent); margin-bottom: 4px; }

.composer-foot { max-width: 760px; margin: 8px auto 0; display: flex; align-items: center; gap: 10px; position: relative; }
.composer-note { flex: 1; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.modes { display: inline-flex; background: var(--comp); border-radius: 999px; padding: 3px; flex: none; box-shadow: 0 0 0 1px var(--edge); }
.modes button { border: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 6px 13px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s; }
.modes button[aria-checked="true"] { background: var(--btn); color: var(--ink); }
.modes button[data-mode="deep"][aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
.modes .ai-dot { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; opacity: .8; }

/* agent picker */
.agents-wrap { position: relative; flex: none; }
.agents-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: var(--comp); box-shadow: 0 0 0 1px var(--accent-line); color: var(--ink); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 500; white-space: nowrap; max-width: 260px; }
.agents-btn span { overflow: hidden; text-overflow: ellipsis; }
.agents-btn:hover { background: var(--raise); }
.agents-pop { position: absolute; bottom: calc(100% + 10px); left: 0; width: min(380px, calc(100vw - 32px)); background: var(--raise); border-radius: 22px; padding: 14px; box-shadow: 0 0 0 1px var(--edge), 0 24px 60px rgba(0,0,0,.6); z-index: 30; animation: pop .18s ease both; }
.agents-head strong { display: block; font-size: 15px; }
.agents-head span { display: block; font-size: 13px; color: var(--ink2); margin: 3px 0 12px; line-height: 1.45; }
.agent-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; margin-bottom: 6px; background: var(--comp); cursor: pointer; }
.agent-row.off { opacity: .55; }
.agent-row.na { opacity: .45; cursor: default; }
.agent-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.agent-row .an { font-size: 14.5px; font-weight: 600; line-height: 1.2; }
.agent-row .an small { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }
.agent-row .lead { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-left: 6px; font-weight: 700; }
.agent-row select { background: var(--btn); color: var(--ink); border: 0; border-radius: 10px; font: inherit; font-size: 12.5px; padding: 7px 9px; max-width: 150px; }
.agents-foot { font-size: 12px; color: var(--muted); line-height: 1.45; margin-top: 6px; }

/* ---------- Basket drawer ---------- */
.basket { position: fixed; top: 0; right: 0; height: 100dvh; width: min(400px, 100vw); background: var(--side); border-left: 1px solid var(--edge); transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); display: flex; flex-direction: column; z-index: 40; }
.basket.open { transform: none; box-shadow: -30px 0 60px rgba(0,0,0,.5); }
.basket-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 18px 14px; }
.basket-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.basket-sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.basket-head .icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--btn); color: var(--ink); display: grid; place-items: center; }
.basket-list { flex: 1; overflow-y: auto; padding: 4px 12px; }
.b-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px; border-radius: 16px; background: var(--comp); margin-bottom: 8px; }
.b-item .b-name { font-size: 14px; font-weight: 500; line-height: 1.35; }
.b-item .b-name a { text-decoration: none; }
.b-item .b-name a:hover { color: var(--accent); }
.b-item .b-price { font-weight: 700; font-size: 14px; text-align: right; }
.b-item .b-shop { font-size: 12px; color: var(--muted); }
.b-item .b-qty { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.b-item .b-qty button { width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--btn); font-size: 14px; line-height: 1; }
.b-item .b-qty span { min-width: 16px; text-align: center; font-size: 13px; }
.b-thumb { width: 42px; height: 42px; object-fit: contain; background: #f4f4f2; border-radius: 10px; padding: 3px; float: left; margin: 0 10px 4px 0; }
.basket-empty { color: var(--muted); font-size: 14px; padding: 40px 10px; text-align: center; line-height: 1.5; }
.basket-foot { padding: 14px 18px 20px; border-top: 1px solid var(--edge); display: flex; flex-direction: column; gap: 12px; }
.basket-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--ink2); }
.basket-total strong { font-size: 24px; color: #fff; letter-spacing: -.02em; }
.btn.wide { width: 100%; padding: 13px; font-size: 15px; }
.basket-note { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; text-align: center; }
.scrim { display: none; }

/* ---------- Phone ---------- */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 300px; z-index: 30; transform: translateX(-100%); transition: transform .3s cubic-bezier(.2,.8,.2,1); background: var(--side); }
  .side.open { transform: none; }
  .scrim.on { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; }
  .only-mobile { display: grid !important; }
  .title-chip { max-width: calc(100vw - 150px); }
  .thread { padding: 64px 14px 8px; }
  .composer { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); }
  .starters { grid-template-columns: 1fr; }
  .empty { padding-top: 3vh; }
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card-name { font-size: 14px; }
  .card-price { font-size: 17px; }
  .card-actions .btn.sm { padding: 7px 11px; }
  .msg.user .bubble { max-width: 86%; }
  .composer-foot { flex-wrap: wrap; justify-content: center; gap: 6px; }
  .composer-note { flex-basis: 100%; text-align: center; }
  .agents-pop { left: 50%; transform: translateX(-50%); }
}
@media (max-width: 420px) { .cards { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
