/* Infinity AI — /ai-assistant/ workspace (standalone page, no theme CSS). */
:root {
  --bg: #080a12;
  --surface: #0e1017;
  --raised: #131620;
  --sunken: #0a0c12;
  --muted: #1b1f2c;
  --line: rgba(148, 163, 184, .14);
  --line-strong: rgba(148, 163, 184, .3);
  --ink: #f1f5f9;
  --soft: #b6bfcc;
  --faint: #7c8798;
  --accent: #6366f1;
  --violet: #8b5cf6;
  --cyan: #22d3ee;
  --ok: #34d399;
  --warn: #f59e0b;
  --bad: #f87171;
  --side-w: 280px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.iai-chat-body {
  background: var(--bg); color: var(--ink);
  font: 400 15px/1.6 Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Hind Siliguri", "Noto Sans Bengali", sans-serif;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
.bn { font-family: "Hind Siliguri", "Noto Sans Bengali", Inter, system-ui, sans-serif; }
a { color: #a5b4fc; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.filled { fill: currentColor; }
.mark { display: inline-block; flex: none; border-radius: 999px; box-shadow: 0 6px 20px -8px rgba(99, 102, 241, .8); }
.mark svg { display: block; width: 100%; height: 100%; }
.grow { flex: 1; }

.ibtn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: var(--soft); transition: background .15s, color .15s; text-decoration: none; }
.ibtn:hover { background: var(--muted); color: var(--ink); }
.ibtn.sm { width: 30px; height: 30px; border-radius: 8px; }
.ibtn.sm .ico { width: 15px; height: 15px; }
.ibtn.on { color: #c4b5fd; }
.ibtn.danger { color: var(--bad); background: rgba(248, 113, 113, .12); }

/* ---------------- shell ---------------- */
.iai-app, .shell { height: 100%; }
.shell { display: flex; height: 100vh; height: 100dvh; }
.side {
  width: var(--side-w); flex: none; display: flex; flex-direction: column; gap: 10px; padding: 12px;
  background: var(--surface); border-right: 1px solid var(--line); transition: margin .25s cubic-bezier(.2, .8, .2, 1), transform .25s cubic-bezier(.2, .8, .2, 1);
  margin-left: calc(-1 * var(--side-w));
}
.shell.side-open .side { margin-left: 0; }
.side-scrim { display: none; }
.side__brand { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 2px 0 6px; }
.side__logo img { display: block; max-height: 34px; max-width: 180px; width: auto; }
.side__logo--text { font-weight: 700; color: var(--ink); text-decoration: none; }
.side__close { display: none; }
.side__new {
  display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--raised); font-weight: 600; font-size: 14px; transition: border-color .15s, background .15s;
}
.side__new:hover { border-color: rgba(139, 92, 246, .6); background: rgba(99, 102, 241, .1); }
.side__search { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--sunken); color: var(--faint); }
.side__search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--ink); font: inherit; font-size: 14px; }
.side__search input::placeholder { color: var(--faint); }
.side__list { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
.side__label { margin: 12px 8px 4px; font: 500 10.5px/1.4 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.side__empty { margin: 16px 8px; font-size: 13px; color: var(--faint); }
.conv { position: relative; display: flex; align-items: center; border-radius: 10px; }
.conv:hover, .conv.is-active { background: var(--raised); }
.conv.is-active { box-shadow: inset 0 0 0 1px var(--line); }
.conv__open { flex: 1; min-width: 0; padding: 9px 10px; text-align: left; font-size: 13.5px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.is-active .conv__open { color: var(--ink); }
.conv__acts { display: none; padding-right: 4px; }
.conv:hover .conv__acts, .conv:focus-within .conv__acts, .conv.is-active .conv__acts { display: flex; }
.conv__rename { width: 100%; margin: 2px 0; padding: 8px 10px; border-radius: 10px; border: 1px solid rgba(139, 92, 246, .7); background: var(--sunken); color: var(--ink); font: inherit; font-size: 13.5px; outline: none; }
.side__foot { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.side__user, .side__wa, .side__signin { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; color: var(--soft); text-decoration: none; font-size: 13.5px; }
.side__user:hover, .side__wa:hover { background: var(--raised); color: var(--ink); }
.side__signin { flex-direction: column; align-items: flex-start; gap: 0; background: var(--raised); border: 1px solid var(--line); }
.side__signin strong { color: var(--ink); }
.side__signin span { font-size: 12.5px; color: var(--faint); }
.side__wa .ico { color: #25d366; }

/* ---------------- main ---------------- */
.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; background: radial-gradient(ellipse 60% 40% at 50% 0%, rgba(99, 102, 241, .08), transparent 70%), var(--bg); }
.top { display: flex; align-items: center; gap: 6px; min-height: 58px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: rgba(8, 10, 18, .8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.top__title { display: flex; align-items: center; gap: 8px; margin-left: 4px; font-weight: 600; font-size: 15px; }
.tier { display: flex; margin-left: 10px; padding: 2px; border-radius: 10px; background: var(--muted); }
.tier button { min-height: 30px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--soft); }
.tier button[aria-pressed="true"] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.top__back { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; padding: 8px 12px; border-radius: 10px; color: var(--soft); text-decoration: none; font-size: 13.5px; font-weight: 500; }
.top__back:hover { background: var(--muted); color: var(--ink); }
.only-narrow { display: none; }

.thread { flex: 1; overflow-y: auto; scroll-behavior: auto; scrollbar-width: thin; scrollbar-color: var(--muted) transparent; }
.msgs { max-width: 780px; margin: 0 auto; padding: 28px 20px 40px; display: grid; gap: 26px; }
.msg--user { display: flex; justify-content: flex-end; }
.bubble { max-width: min(78%, 560px); padding: 10px 16px; border-radius: 18px 18px 4px 18px; background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; font-size: 15px; overflow-wrap: anywhere; box-shadow: 0 10px 30px -14px rgba(99, 102, 241, .9); }
.msg--ai { display: flex; gap: 12px; align-items: flex-start; }
.msg__col { min-width: 0; flex: 1; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.act { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--soft); }
.act .ico { width: 13px; height: 13px; color: var(--ok); }
.spin { width: 11px; height: 11px; border-radius: 99px; border: 2px solid rgba(139, 92, 246, .3); border-top-color: var(--violet); animation: spin .8s linear infinite; }
.typing { display: inline-flex; gap: 5px; padding: 12px 2px; }
.typing span { width: 7px; height: 7px; border-radius: 99px; background: var(--faint); animation: bounce 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
.caret { display: inline-block; width: 8px; height: 1.1em; margin-left: 2px; vertical-align: -3px; background: #c4b5fd; border-radius: 2px; animation: blink 1s steps(2) infinite; }

.prose { color: #dbe2ea; font-size: 15px; line-height: 1.7; overflow-wrap: anywhere; }
.prose.bn { font-size: 16px; line-height: 1.85; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 .8em; }
.prose strong { color: var(--ink); font-weight: 650; }
.prose h3, .prose h4, .prose h5, .prose h6 { margin: 1.1em 0 .4em; color: var(--ink); font-size: 1.02em; }
.prose ul, .prose ol { margin: 0 0 .9em; padding-left: 1.3em; }
.prose li { margin: .25em 0; }
.prose li::marker { color: var(--violet); }
.prose code { padding: .1em .4em; border-radius: 6px; background: var(--muted); font: .88em ui-monospace, Menlo, Consolas, monospace; }
.prose pre { margin: 0 0 1em; padding: 12px 14px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--line); overflow-x: auto; }
.prose pre code { padding: 0; background: none; }
.prose blockquote { margin: 0 0 1em; padding-left: 12px; border-left: 3px solid var(--violet); color: var(--soft); }
.prose a { color: #a5b4fc; text-decoration: underline; text-decoration-color: rgba(165, 180, 252, .4); text-underline-offset: 2px; }
.prose .table { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--line); border-radius: 12px; }
.prose table { border-collapse: collapse; width: 100%; font-size: 14px; }
.prose th, .prose td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.prose th { background: var(--surface); color: var(--ink); font-weight: 600; }
.prose tr:last-child td { border-bottom: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-top: 14px; }
.card { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); animation: rise .35s cubic-bezier(.2, .8, .2, 1) both; }
.card.is-out { opacity: .75; }
.card.is-out img { filter: grayscale(1); }
.card__img img { display: block; width: 64px; height: 64px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); background: var(--muted); }
.card__body { min-width: 0; }
.card__name { display: block; color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.35; text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card__name:hover { color: #c4b5fd; }
.card__price { margin: 4px 0 0; font: 600 14px/1.3 ui-monospace, Menlo, Consolas, monospace; }
.card__price s { color: var(--faint); font-weight: 400; font-size: 12px; }
.card__stock { margin: 2px 0 0; font-size: 12px; }
.card__stock.ok { color: var(--ok); } .card__stock.off { color: var(--faint); }
.card__add { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; min-height: 32px; padding: 0 12px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; font-size: 13px; font-weight: 600; }
.card__add .ico { width: 15px; height: 15px; }
.card__add.done { background: rgba(52, 211, 153, .15); color: var(--ok); }
.card__opts { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.opt { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--raised); font-size: 12px; color: var(--soft); transition: border-color .15s, background .15s, color .15s; text-align: left; }
.opt b { color: var(--ink); font-family: ui-monospace, Menlo, Consolas, monospace; }
.opt:hover { border-color: var(--accent); background: rgba(99, 102, 241, .12); color: var(--ink); }
.opt.done { border-color: rgba(52, 211, 153, .6); color: var(--ok); }
.busy { opacity: .6; cursor: progress !important; }

.err { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .08); font-size: 13.5px; }
.err .ico { color: var(--bad); }
.err button { margin-left: auto; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line-strong); font-size: 12.5px; font-weight: 600; }
.tools { display: flex; gap: 2px; margin-top: 8px; margin-left: -6px; opacity: .85; }

.thread.is-empty { display: flex; }
.empty { margin: auto; max-width: 680px; padding: 32px 20px; text-align: center; }
.empty .mark { box-shadow: 0 12px 40px -10px rgba(99, 102, 241, .9); }
.empty h1 { margin: 18px 0 8px; font-size: clamp(24px, 4vw, 32px); line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
.empty p { margin: 0 auto; max-width: 520px; color: var(--soft); }
.empty .warn { margin-top: 14px; padding: 10px 14px; border-radius: 12px; border: 1px solid rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .08); color: var(--ink); }
.starters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-top: 26px; text-align: left; }
.starters button { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--soft); font-size: 14px; line-height: 1.4; transition: border-color .15s, color .15s, transform .1s; }
.starters button:hover { border-color: rgba(139, 92, 246, .55); color: var(--ink); }
.starters button:active { transform: scale(.98); }

/* ---------------- composer ---------------- */
.composer-wrap { padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); }
.composer { max-width: 780px; margin: 0 auto; border-radius: 22px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: 0 0 0 4px rgba(99, 102, 241, .08), 0 18px 50px -24px rgba(0, 0, 0, .9); transition: border-color .15s, box-shadow .15s; }
.composer:focus-within { border-color: rgba(139, 92, 246, .6); box-shadow: 0 0 0 4px rgba(99, 102, 241, .16), 0 18px 50px -24px rgba(0, 0, 0, .9); }
.composer__ctx:empty { display: none; }
.composer__ctx { padding: 10px 10px 0; }
.ctx { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 4px 4px 6px; border-radius: 12px; background: rgba(99, 102, 241, .12); border: 1px solid rgba(99, 102, 241, .3); font-size: 13px; color: var(--soft); }
.ctx img { width: 26px; height: 26px; border-radius: 7px; object-fit: cover; }
.ctx span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx b { color: var(--ink); font-weight: 600; }
.composer__row { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 16px; }
.composer textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 200px; padding: 9px 0; resize: none; border: 0; outline: none; background: none; color: var(--ink); font: inherit; font-size: 15.5px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--faint); }
.composer__tools { display: flex; align-items: center; gap: 4px; }
.lang { min-width: 38px; height: 28px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line); font: 600 11.5px/1 ui-monospace, Menlo, Consolas, monospace; color: var(--soft); }
.lang.bn { font-family: "Hind Siliguri", sans-serif; font-size: 12.5px; }
.mic.on { color: #fff; background: linear-gradient(135deg, #06b6d4, var(--accent)); animation: pulse 1.4s ease-in-out infinite; }
.send { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--muted); color: var(--faint); transition: background .15s, color .15s; }
.send.ready { background: linear-gradient(135deg, var(--accent), var(--violet)); color: #fff; }
.send.stop { background: var(--ink); color: var(--bg); }
.composer__interim { margin: 0; padding: 0 16px 10px; font-size: 13px; color: #67e8f9; font-style: italic; }
.disclaimer { max-width: 780px; margin: 8px auto 0; text-align: center; font-size: 12px; color: var(--faint); }
.disclaimer a { color: var(--soft); }

.toast { position: absolute; left: 50%; bottom: 120px; z-index: 30; transform: translate(-50%, 10px); opacity: 0; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line-strong); box-shadow: 0 18px 40px -16px rgba(0, 0, 0, .9); font-size: 14px; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast a { color: #c4b5fd; font-weight: 600; }

/* ---------------- phones / tablets ---------------- */
@media (max-width: 899px) {
  .side { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; margin-left: 0; transform: translateX(-100%); width: min(86vw, 320px); box-shadow: 20px 0 60px rgba(0, 0, 0, .6); }
  .shell.side-open .side { transform: none; }
  .shell.side-open .side-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(2, 6, 23, .6); }
  .side__close { display: inline-grid; }
  .only-wide { display: none; } .only-narrow { display: block; }
  .top__back span { display: none; }
  .top__title span { display: none; }
  .msgs { padding: 20px 14px 32px; gap: 22px; }
  .msg--ai .mark { width: 26px !important; height: 26px !important; }
  .bubble { max-width: 88%; }
  .cards { grid-template-columns: 1fr; }
  .composer-wrap { padding-left: 10px; padding-right: 10px; }
  .toast { bottom: 110px; }
}
@media (max-width: 420px) { .tier button { padding: 0 9px; } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); opacity: .5; } 40% { transform: translateY(-5px); opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, .5); } 50% { box-shadow: 0 0 0 6px rgba(34, 211, 238, 0); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }
