/* Dashboard: sidebar + chat. */

.boot { min-height: 100dvh; display: grid; place-items: center; }

/* ---------- auth screens ---------- */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); border-radius: var(--r-lg); padding: 34px 30px 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font: 700 20px var(--display); letter-spacing: -0.01em; margin-bottom: 22px; }
.auth-brand img { width: 36px; height: 36px; }
.auth h1 { font: 700 26px/1.15 var(--display); letter-spacing: -0.02em; margin: 0 0 6px; }
.auth p.lede { margin: 0 0 22px; color: var(--ink-soft); }
.auth-foot { margin-top: 18px; font-size: 13px; color: var(--ink-faint); text-align: center; }

/* ---------- shell ---------- */

.shell { display: grid; grid-template-columns: 284px minmax(0, 1fr); height: 100dvh; }
.side {
  display: flex; flex-direction: column; gap: 6px; min-height: 0; margin: 10px 0 10px 10px; border-radius: var(--r-lg);
  padding: 14px 10px 10px; background: var(--glass);
}
.side-brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 10px; font: 700 18px var(--display); letter-spacing: -0.01em; }
.side-brand img { width: 30px; height: 30px; }
.side-brand .icon-btn { margin-left: auto; display: none; }
.side .new-chat { margin: 0 4px 10px; justify-content: flex-start; padding: 10px 14px; }
.side-scroll { flex: 1; min-height: 80px; overflow-y: auto; padding: 0 2px; scrollbar-width: thin; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: transparent; cursor: pointer;
  text-align: left; padding: 8px 10px; border-radius: 10px; color: var(--ink-soft); font-size: 14px; position: relative;
}
.nav-item:hover { background: var(--accent-soft); color: var(--ink); }
.nav-item[aria-current="true"] { background: var(--glass-strong); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.nav-item .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; opacity: 0.8; }
.nav-item .del { opacity: 0; width: 26px; height: 26px; border-radius: 7px; margin: -4px -4px -4px 0; }
.nav-item:hover .del, .nav-item:focus-within .del { opacity: 1; }
.empty-side { padding: 6px 12px; font-size: 13px; color: var(--ink-faint); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; box-shadow: 0 0 0 3px var(--ok-bg); }
.dot.err { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.plat { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font: 700 11px var(--display); flex: none; color: #fff; background: var(--ink-faint); }
.plat.shopify { background: #5e8e3e; }
.plat.sample { background: linear-gradient(135deg, #8a7cf4, #f0a878); }
.plat.magento { background: #ee672f; }
.plat.woocommerce { background: #7f54b3; }
.plat.bigcommerce { background: #34313f; }
.avatar { width: 24px; height: 24px; font-size: 11px !important; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-deep); font: 700 13px var(--display); flex: none; }

/* ---------- main ---------- */

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 22px 8px; min-height: 58px; }
.topbar .burger { display: none; }
.topbar h1 { flex: 1; min-width: 0; margin: 0; font: 650 16px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.005em; }
.scope-btn { display: inline-flex; align-items: center; gap: 7px; max-width: 260px; }
.scope-btn .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-pop { position: absolute; z-index: 30; right: 22px; top: 54px; width: 300px; border-radius: var(--r-md); padding: 8px; background: var(--glass-strong); animation: rise 0.16s ease; }
.scope-pop label { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.scope-pop label:hover { background: var(--accent-soft); }
.scope-pop input { accent-color: var(--accent); width: 16px; height: 16px; }
.scope-pop .cur { margin-left: auto; font-size: 12px; color: var(--ink-faint); }

.thread { flex: 1; overflow-y: auto; padding: 8px 22px 24px; scroll-behavior: smooth; }
.thread-inner { max-width: 820px; margin: 0 auto; }

.welcome { max-width: 760px; margin: 7vh auto 0; text-align: center; }
.welcome img { width: 64px; height: 64px; margin-bottom: 10px; }
.welcome h2 { font: 720 clamp(26px, 4vw, 36px)/1.1 var(--display); letter-spacing: -0.025em; margin: 0 0 8px; }
.welcome p { color: var(--ink-soft); margin: 0 auto 26px; max-width: 520px; }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.suggest button {
  border: 0; cursor: pointer; text-align: left; padding: 14px 16px; border-radius: var(--r-md); color: var(--ink);
  font-size: 14px; line-height: 1.4; transition: transform 0.15s, background 0.2s;
}
.suggest button:hover { transform: translateY(-2px); background: var(--glass-strong); }
.suggest button span { display: block; font-size: 12.5px; color: var(--ink-faint); margin-top: 3px; }
.connect-cta { border-radius: var(--r-lg); padding: 24px; display: grid; gap: 12px; justify-items: center; max-width: 520px; margin: 0 auto; }
.connect-cta .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

.msg-user { display: flex; justify-content: flex-end; margin: 22px 0 10px; }
.msg-user .bubble { max-width: min(78%, 620px); background: var(--user-bubble); padding: 10px 15px; border-radius: 18px 18px 6px 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user .scope { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; text-align: right; }
.msg-ai { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; margin: 6px 0 14px; }
.msg-ai > img { width: 30px; height: 30px; margin-top: 1px; }
.msg-ai .body { min-width: 0; }
.msg-ai .md { font-size: 15px; line-height: 1.62; }
.steps { display: grid; gap: 3px; margin: 2px 0 10px; }
.step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-faint); }
.step .ok { width: 14px; height: 14px; color: var(--ok); }
.step .ok svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.step.error { color: var(--bad); }
.thinking { display: inline-flex; gap: 4px; padding: 8px 0; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: 0.4; animation: pulse 1.2s infinite ease-in-out; }
.thinking i:nth-child(2) { animation-delay: 0.15s; } .thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 50% { opacity: 1; transform: translateY(-2px); } }
.ai-error { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--r-md); background: var(--bad-bg); color: var(--bad); font-size: 14px; margin: 6px 0; }

.kpis { margin: 10px 0 14px; }
.kpis .label { display: block; margin-bottom: 8px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { border-radius: var(--r-md); padding: 14px 16px; background: var(--chart-surface); box-shadow: inset 0 0 0 1px var(--line); }
.kpi .k { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }
.kpi .v { font: 700 24px/1.15 var(--display); letter-spacing: -0.02em; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12.5px; color: var(--ink-faint); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.delta { font-weight: 700; border-radius: 999px; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.delta.up { background: var(--ok-bg); color: var(--ok); }
.delta.down { background: var(--bad-bg); color: var(--bad); }
.delta.flat { background: var(--rule); color: var(--ink-soft); }

.file-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--r-md); background: var(--chart-surface); box-shadow: inset 0 0 0 1px var(--line); margin: 10px 0 14px; max-width: 480px; }
.file-card .ico { width: 42px; height: 42px; border-radius: 11px; background: #1d6f42; color: #fff; display: grid; place-items: center; flex: none; }
.file-card .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.file-card .meta { flex: 1; min-width: 0; }
.file-card .fn { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-card .sz { font-size: 12.5px; color: var(--ink-faint); }

.composer-wrap { padding: 6px 22px max(14px, env(safe-area-inset-bottom)); }
.composer { max-width: 820px; margin: 0 auto; border-radius: 24px; padding: 8px 8px 8px 18px; display: flex; align-items: flex-end; gap: 8px; background: var(--glass-strong); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; max-height: 200px; min-height: 24px; padding: 8px 0; line-height: 1.5; outline: none; }
.composer textarea::placeholder { color: var(--ink-faint); }
.composer .send { width: 40px; height: 40px; padding: 0; border-radius: 50%; flex: none; }
.composer-hint { max-width: 820px; margin: 7px auto 0; text-align: center; font-size: 12px; color: var(--ink-faint); }

/* ---------- connect modal ---------- */

.plat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.plat-card { display: grid; grid-template-columns: 34px 1fr; gap: 4px 12px; align-items: start; text-align: left; border: 0; cursor: pointer; padding: 14px; border-radius: var(--r-md); background: var(--field); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); transition: background 0.15s, transform 0.15s; }
.plat-card:hover:not(:disabled) { background: var(--glass-strong); transform: translateY(-1px); }
.plat-card:disabled { cursor: default; opacity: 0.72; }
.plat-card .plat { width: 34px; height: 34px; border-radius: 9px; font-size: 15px; grid-row: span 2; }
.plat-card b { font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plat-card small { color: var(--ink-faint); font-size: 12.5px; line-height: 1.4; }
.method-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.method-tabs button { border: 0; cursor: pointer; padding: 7px 13px; border-radius: 999px; background: var(--field); box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.method-tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: none; }
.method-desc { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 14px; }
.notice { padding: 10px 13px; border-radius: var(--r-sm); background: var(--warn-bg); color: var(--warn); font-size: 13px; margin-bottom: 14px; }
.store-info dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; font-size: 14px; }
.store-info dt { color: var(--ink-faint); }
.store-info dd { margin: 0; overflow-wrap: anywhere; }

.soon-hero { text-align: center; padding: 8px 0 4px; }
.soon-hero .big { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 12px; display: grid; place-items: center; background: linear-gradient(135deg, #f6cdae, #b9b0f2); color: #27233f; }
.soon-hero .big svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.soon-list { text-align: left; display: grid; gap: 8px; margin: 16px 0 4px; padding: 0; list-style: none; }
.soon-list li { display: flex; gap: 10px; font-size: 14px; color: var(--ink-soft); }
.soon-list li::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--peach); margin-top: 8px; flex: none; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; inset: 0 auto 0 0; width: min(300px, 86vw); margin: 0; border-radius: 0 var(--r-lg) var(--r-lg) 0; transform: translateX(-104%); transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); background: var(--glass-strong); }
  .side.open { transform: none; box-shadow: var(--shadow); }
  .side-brand .icon-btn { display: inline-grid; }
  .scrim { position: fixed; inset: 0; z-index: 35; background: rgba(20, 16, 40, 0.3); }
  .topbar { padding: 10px 12px 6px; }
  .topbar .burger { display: inline-grid; }
  .thread { padding: 6px 14px 20px; }
  .composer-wrap { padding: 6px 10px max(10px, env(safe-area-inset-bottom)); }
  .suggest, .plat-grid { grid-template-columns: 1fr; }
  .scope-pop { right: 10px; width: min(300px, calc(100vw - 20px)); }
  .scope-btn { max-width: 150px; }
  .msg-ai { grid-template-columns: 1fr; gap: 4px; }
  .msg-ai > img { width: 24px; height: 24px; }
  .welcome { margin-top: 3vh; }
}

.msg-ai .body > .step { margin: 3px 0; }
.msg-ai .body > .md + .step { margin-top: 10px; }
.msg-ai .body > .step + .md, .msg-ai .body > .step + .viz, .msg-ai .body > .step + .kpis { margin-top: 10px; }

/* simplified sidebar: brand, new chat, recent chats, three quiet rows */
@media (min-width: 861px) { .side { position: relative; } }
.side-foot { display: grid; gap: 1px; border-top: 1px solid var(--rule); padding-top: 8px; margin-top: 4px; }
.side-foot .count { font-size: 12px; font-weight: 700; color: var(--ink-faint); min-width: 18px; text-align: right; }
.side-foot .count.bad { color: var(--bad); }
.side-foot .count.bad::after { content: ' •'; }
.side-foot .soon { font-size: 11.5px; color: var(--ink-faint); }
.side-foot .who .avatar { margin-left: -3px; }
.account-pop { position: absolute; left: 10px; right: 10px; bottom: 54px; z-index: 30; border-radius: var(--r-md); padding: 6px; background: var(--panel); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); animation: rise 0.14s ease; }
.account-pop .acct { padding: 8px 10px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.account-pop .n { font-weight: 650; font-size: 14px; }
.account-pop .e { font-size: 12.5px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pop button { display: flex; align-items: center; gap: 9px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink); text-align: left; }
.account-pop button:hover { background: var(--accent-soft); }
.account-pop svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.store-rows { display: grid; gap: 4px; }
.store-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; cursor: pointer; text-align: left; padding: 10px 12px; border-radius: var(--r-sm); background: var(--field); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink); font-size: 14px; }
.store-row:hover { background: var(--glass-strong); }
.store-row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-scroll .nav-item { font-size: 13.5px; padding: 7px 10px; }
