/* =====================================================================
   Chat history + PDF / image attachments, each with its own motion.
   ===================================================================== */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); --out: cubic-bezier(.16, 1, .3, 1); }

/* Attachment chip in the composer: it slides in like a card being placed on the desk */
.att-chip { display: flex; align-items: center; gap: 9px; max-width: 240px; min-width: 0; flex-shrink: 1; height: 40px; padding: 4px 6px 4px 4px; border-radius: 12px; border: 1px solid rgba(62,230,168,.35); background: rgba(62,230,168,.07); }
.att-chip[hidden] { display: none; }
.att-chip.in { animation: chipPlace .5s var(--spring) both; }
@keyframes chipPlace { from { opacity: 0; transform: translate3d(0, 10px, 0) rotate(-4deg) scale(.85); } }
.att-chip img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.att-chip .ac-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; background: rgba(242,180,90,.16); color: #f2b45a; }
.att-chip .ac-meta { min-width: 0; line-height: 1.2; }
.att-chip .ac-meta b { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-chip .ac-meta small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-chip .ac-x { width: 24px; height: 24px; border-radius: 7px; border: 0; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: background .2s, color .2s; }
.att-chip .ac-x .i { width: 14px; height: 14px; transition: transform .3s var(--spring); }
.att-chip .ac-x:hover { background: rgba(248,113,113,.14); color: #f87171; }
.att-chip .ac-x:hover .i { transform: rotate(90deg); }
@media (max-width: 560px) { .att-chip { max-width: 46px; padding: 4px; } .att-chip .ac-meta, .att-chip .ac-x { display: none; } }

/* The sent file inside your message */
.msg.user .bubble.att { display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 10px; }
.bubble.att .att-file { display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 12px; background: rgba(0,0,0,.16); animation: fileDrop .55s var(--spring) both; }
@keyframes fileDrop { from { opacity: 0; transform: translate3d(0, -12px, 0) scale(.9); } }
.bubble.att .att-img { width: 120px; max-width: 40vw; height: 84px; border-radius: 9px; object-fit: cover; display: block; }
.bubble.att .att-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(255,255,255,.2); }
.bubble.att .att-file b { display: block; font-size: 13.5px; word-break: break-word; }
.bubble.att .att-file small { display: block; font-size: 11.5px; opacity: .8; }
.bubble.att .att-q { padding: 0 6px; white-space: pre-wrap; }

/* History tab: search, time groups, rows that slide in and fold away on delete */
.hist-search { display: flex; align-items: center; gap: 8px; margin: 2px 0 12px; padding: 0 12px; height: 38px; border-radius: 11px; border: 1px solid var(--border-2, rgba(255,255,255,.1)); background: rgba(255,255,255,.03); color: var(--muted); transition: border-color .2s; }
.hist-search:focus-within { border-color: rgba(62,230,168,.5); }
.hist-search .i { width: 15px; height: 15px; flex-shrink: 0; }
.hist-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 13.5px; }
.hist-group { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); margin: 14px 4px 6px; }
.hist-group:first-child { margin-top: 2px; }
.hist { display: flex; align-items: center; gap: 4px; border-radius: 12px; animation: histIn .45s var(--out) both; transition: background .2s; }
.hist:nth-of-type(2) { animation-delay: .03s; } .hist:nth-of-type(3) { animation-delay: .06s; } .hist:nth-of-type(4) { animation-delay: .09s; } .hist:nth-of-type(5) { animation-delay: .12s; } .hist:nth-of-type(n+6) { animation-delay: .15s; }
@keyframes histIn { from { opacity: 0; transform: translate3d(16px, 0, 0); } }
.hist:hover { background: rgba(255,255,255,.04); }
.hist-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; border-radius: 12px; }
.hist-open .av { width: 30px; height: 30px; flex-shrink: 0; transition: transform .35s var(--spring); }
.hist:hover .hist-open .av { transform: rotate(-8deg) scale(1.08); }
.hist-open span { min-width: 0; }
.hist-open b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-open small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist .x { width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--dim); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .2s, background .2s, color .2s; flex-shrink: 0; }
.hist:hover .x, .hist .x:focus-visible { opacity: 1; }
@media (pointer: coarse) { .hist .x { opacity: .7; } }
.hist .x:hover { background: rgba(248,113,113,.14); color: #f87171; }
.hist .x .i { width: 14px; height: 14px; }

@media (prefers-reduced-motion: reduce) { .att-chip.in, .bubble.att .att-file, .hist { animation: none !important; } }

/* =====================================================================
   Knowledge agents: documents in the builder, sources under answers
   ===================================================================== */
.b-docs { display: grid; gap: 8px; margin: 6px 0 10px; }
.b-docs-field { border-radius: 14px; transition: background .2s, box-shadow .2s; }
.b-docs-field.drag { background: rgba(62,230,168,.06); box-shadow: 0 0 0 2px rgba(62,230,168,.45); }
.doc-item { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 8px; border-radius: 12px; border: 1px solid var(--border-2, rgba(255,255,255,.1)); background: rgba(255,255,255,.03); animation: docIn .5s var(--spring) both; }
@keyframes docIn { from { opacity: 0; transform: translate3d(-10px, 0, 0) rotate(-1.5deg) scale(.96); } }
.doc-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; background: rgba(242,180,90,.15); color: #f2b45a; }
.doc-ico .i { width: 17px; height: 17px; }
.doc-meta { flex: 1; min-width: 0; }
.doc-meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta small { display: block; font-size: 11.5px; color: var(--muted); }
.doc-del { width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--dim); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: background .2s, color .2s; }
.doc-del .i { width: 14px; height: 14px; transition: transform .3s var(--spring); }
.doc-del:hover { background: rgba(248,113,113,.14); color: #f87171; }
.doc-del:hover .i { transform: rotate(90deg); }
/* Reading: the page icon flips like it is being scanned, a bar sweeps underneath */
.doc-item.reading .doc-ico .i { animation: pageScan 1.2s ease-in-out infinite; }
@keyframes pageScan { 50% { transform: rotateY(180deg); } }
.doc-bar { display: block; height: 3px; margin-top: 6px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.doc-bar i { display: block; height: 100%; width: 40%; border-radius: 3px; background: linear-gradient(90deg, transparent, #f2b45a, transparent); animation: docSweep 1.2s ease-in-out infinite; }
@keyframes docSweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.doc-cap { height: 3px; border-radius: 3px; background: rgba(255,255,255,.06); overflow: hidden; }
.doc-cap i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #46e3a6, #f2b45a); transition: width .6s var(--out); }

/* Sources under an answer: chips that pop in one after another */
.doc-refs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 2px; }
.doc-refs .dr-l { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); margin-right: 2px; }
.doc-refs .dr { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; padding: 3px 10px 3px 7px; border-radius: 999px; font-size: 12px; color: var(--text); background: rgba(242,180,90,.09); border: 1px solid rgba(242,180,90,.28); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: refPop .45s var(--spring) both; }
.doc-refs .dr:nth-child(3) { animation-delay: .06s; } .doc-refs .dr:nth-child(4) { animation-delay: .12s; } .doc-refs .dr:nth-child(5) { animation-delay: .18s; }
.doc-refs .dr .i { width: 12px; height: 12px; color: #f2b45a; flex-shrink: 0; }
@keyframes refPop { from { opacity: 0; transform: scale(.7) translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .doc-item, .doc-refs .dr, .doc-item.reading .doc-ico .i, .doc-bar i { animation: none !important; } }

/* =====================================================================
   Live market card: the price ticks in, the year-range marker slides to place
   ===================================================================== */
.mk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; margin: 4px 0 12px; }
.mk { --mk: #3ee6a8; position: relative; overflow: hidden; padding: 14px 14px 10px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--mk) 30%, transparent); background: linear-gradient(160deg, color-mix(in srgb, var(--mk) 10%, transparent), rgba(255,255,255,.02) 60%); animation: mkIn .6s var(--out) both; }
.mk.down { --mk: #f87171; }
@keyframes mkIn { from { opacity: 0; transform: translate3d(0, 12px, 0) scale(.97); } }
.mk-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mk-sym { font-weight: 800; font-size: 13px; letter-spacing: .02em; padding: 2px 8px; border-radius: 7px; background: color-mix(in srgb, var(--mk) 18%, transparent); color: var(--mk); }
.mk-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-live { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mk-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--mk); animation: livePulse 1.4s ease-in-out infinite; }
.mk-price { display: flex; align-items: baseline; gap: 10px; margin: 10px 0 8px; }
.mk-price b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; animation: tickIn .7s var(--spring) .1s both; }
@keyframes tickIn { from { opacity: 0; transform: translate3d(0, 14px, 0); clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.mk-chg { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 13.5px; color: var(--mk); font-variant-numeric: tabular-nums; }
.mk-chg .i { width: 13px; height: 13px; }
.mk.down .mk-chg .i { transform: rotate(180deg); }
.mk-range .mk-l { font-size: 11px; color: var(--dim); }
.mk-bar { position: relative; height: 4px; margin: 6px 0 4px; border-radius: 4px; background: linear-gradient(90deg, rgba(248,113,113,.45), rgba(255,255,255,.12), rgba(62,230,168,.5)); }
.mk-bar i { position: absolute; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--mk) 45%, transparent); animation: markerSlide 1s var(--out) .25s both; }
@keyframes markerSlide { from { left: 0; opacity: 0; } }
.mk-range small { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mk-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.07); font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mk-stats span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-stats small { display: block; font-size: 10.5px; font-weight: 500; color: var(--dim); margin-bottom: 1px; }
.mk-foot { margin-top: 8px; font-size: 10.5px; color: var(--dim); }
.mk-mini { margin-top: 4px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text); animation: chipIn .4s var(--spring) both; }
.mk-mini span { color: #3ee6a8; font-weight: 700; }
.mk-mini.down span { color: #f87171; }
@media (prefers-reduced-motion: reduce) { .mk, .mk-price b, .mk-bar i, .mk-live::before { animation: none !important; } }

/* About you: a calm memory card, chips that drop text in */
.about-box textarea { width: 100%; box-sizing: border-box; min-height: 130px; resize: vertical; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-2, rgba(255,255,255,.12)); background: rgba(255,255,255,.03); color: var(--text); font: inherit; font-size: 14px; line-height: 1.5; outline: 0; transition: border-color .2s, box-shadow .2s; }
.about-box textarea:focus { border-color: rgba(62,230,168,.55); box-shadow: 0 0 0 4px rgba(62,230,168,.1); }
.about-ex { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 4px; font-size: 12px; color: var(--dim); }
.about-ex button { font: 500 12px Inter, system-ui, sans-serif; padding: 4px 10px; border-radius: 999px; border: 1px solid rgba(62,230,168,.3); background: rgba(62,230,168,.06); color: var(--text); cursor: pointer; transition: transform .25s var(--spring), background .2s; }
.about-ex button:hover { transform: translateY(-2px); background: rgba(62,230,168,.14); }
.about-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.about-foot span { font-size: 12px; color: #f2b45a; }
#aboutModal:not([hidden]) .lite-box { animation: aboutGlow .55s var(--out) both; }
@keyframes aboutGlow { from { opacity: 0; transform: translate3d(0, 18px, 0) scale(.97); filter: blur(3px); } }
#aboutBtn .i { color: #3ee6a8; }
#aboutBtn:hover .i { transform: rotate(25deg) scale(1.15); }
.steps-list .st-d { color: var(--dim); }

/* "Remember this?" chip: slides in under the answer, folds away when handled */
.mem-chip { display: flex; align-items: center; gap: 10px; margin: 10px 0 2px; padding: 8px 8px 8px 12px; border-radius: 14px; border: 1px dashed rgba(62,230,168,.45); background: rgba(62,230,168,.06); animation: memIn .55s var(--spring) both; transition: opacity .3s, transform .3s; }
.mem-chip.out { opacity: 0; transform: translateY(-6px) scale(.97); }
@keyframes memIn { from { opacity: 0; transform: translate3d(-12px, 0, 0); } }
.mem-chip .mc-ic { color: #3ee6a8; display: grid; place-items: center; flex-shrink: 0; }
.mem-chip .mc-ic .i { width: 16px; height: 16px; animation: memTwinkle 2.6s ease-in-out infinite; }
@keyframes memTwinkle { 50% { transform: rotate(18deg) scale(1.15); } }
.mem-chip .mc-t { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.mem-chip .mc-t b { color: var(--text); margin-right: 4px; }
.mem-chip .mc-save { font: 600 12.5px Inter, system-ui, sans-serif; padding: 6px 12px; border-radius: 999px; border: 0; background: #3ee6a8; color: #03140d; cursor: pointer; transition: transform .25s var(--spring); }
.mem-chip .mc-save:hover { transform: translateY(-1px) scale(1.04); }
.mem-chip .mc-x { width: 28px; height: 28px; border-radius: 8px; border: 0; background: transparent; color: var(--dim); display: grid; place-items: center; cursor: pointer; }
.mem-chip .mc-x .i { width: 14px; height: 14px; }
.mem-chip .mc-x:hover { color: #f87171; background: rgba(248,113,113,.12); }

/* Edit your last message */
.u-edit { align-self: center; margin-right: 8px; width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border-2, rgba(255,255,255,.1)); background: rgba(255,255,255,.03); color: var(--muted); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .2s, transform .25s var(--spring), color .2s; }
.u-edit .i { width: 14px; height: 14px; }
.msg.user:hover .u-edit, .u-edit:focus-visible { opacity: 1; }
.u-edit:hover { color: #3ee6a8; transform: rotate(-8deg); }
@media (pointer: coarse) { .u-edit { opacity: .8; } }

/* Images Nova made: they develop in like a photo, with quiet actions underneath */
.gen-imgs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 6px 0 14px; }
.gen-img { margin: 0; border-radius: 18px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.03); box-shadow: 0 24px 50px -28px rgba(0,0,0,.8); animation: imgDevelop 1.1s var(--out) both; max-width: 520px; }
@keyframes imgDevelop { from { opacity: 0; filter: blur(14px) saturate(.4); transform: scale(.97); } }
.gen-img img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; background: rgba(255,255,255,.04); transition: transform .5s var(--out); }
.gen-img:hover img { transform: scale(1.02); }
.gen-img figcaption { display: flex; gap: 6px; padding: 8px; border-top: 1px solid rgba(255,255,255,.07); }
.gen-img figcaption .act { text-decoration: none; }

/* Line icons replace the old emoji in the agent builder and agent cards */
.b-icons button { display: inline-grid; place-items: center; color: var(--muted); }
.b-icons button .i { width: 18px; height: 18px; }
.b-icons button.sel { color: var(--text); }
.pv-card .big.av-svg, .share-card .big.av-svg { color: #fff; }
.pv-card .big.av-svg .i { width: 28px; height: 28px; }
.share-card .big.av-svg .i { width: 24px; height: 24px; }
.bubble.file .fi { color: inherit; }
.bubble.file .fi .i { width: 18px; height: 18px; }

/* Social links at the bottom: round buttons that lift and glow mint on hover */
.social { display: inline-flex; gap: 10px; align-items: center; }
.social a { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; color: #c9d4dc; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.04); text-decoration: none; transition: transform .3s cubic-bezier(.34,1.56,.64,1), color .2s, border-color .2s, background .2s; }
.social a:hover { transform: translateY(-3px); color: #03140d; background: #3ee6a8; border-color: #3ee6a8; }
.social svg { display: block; }
.side-social { padding: 10px 12px 4px; }
.side-social .social a { width: 34px; height: 34px; }
