:root {
  --bg: #eceff3;
  --surface: #ffffff;
  --text: #1d2939;
  --muted: #667085;
  --border: #d0d5dd;
  --primary: #344054;
  --silver: #c0c6d0;
  --chat-vvh: 100dvh;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, #f8fafc, var(--bg) 38%);
}
.app-shell { min-height: 100vh; }
.topbar {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, #3b4553 0%, #2b3441 100%);
  color: white;
  border-bottom: 1px solid #1f2a44;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #d0d5dd;
  box-shadow: 0 0 0 8px rgba(208, 213, 221, .18);
}
.brand-title { margin: 0; font-size: 15px; font-weight: 600; }
.brand-subtitle { margin: 0; font-size: 12px; color: #a6b0c3; }
.nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.nav a {
  color: #c5d0e6;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .02);
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.nav a:hover {
  background: rgba(255, 255, 255, .11);
  color: white;
  border-color: rgba(197, 208, 230, .26);
}
.nav a.is-active {
  background: rgba(197, 208, 230, .18);
  color: #ffffff;
  border-color: rgba(197, 208, 230, .46);
  box-shadow: inset 0 0 0 1px rgba(197, 208, 230, .15);
}
.nav-logout-mobile { display: none; }
.burger-btn {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  padding: 7px 10px 8px;
  border: 1px solid rgba(197, 208, 230, .34);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.burger-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 14px;
}
.burger-icon span {
  display: block;
  width: 18px;
  height: 2px;
  background: #d9e1f2;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.burger-btn.is-open .burger-icon span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger-btn.is-open .burger-icon span:nth-child(2) { opacity: 0; }
.burger-btn.is-open .burger-icon span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.burger-label {
  font-size: 10px;
  font-weight: 700;
  color: #e8edf7;
  line-height: 1;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.dash-quick-nav {
  margin-bottom: 22px;
}
.dash-sections-hint {
  margin-top: 0;
  margin-bottom: 14px;
  font-size: 13px;
}
.dash-nav-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.dash-nav-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(16, 24, 40, .06);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
  min-height: 0;
}
.dash-nav-card:hover {
  border-color: #98a2b3;
  box-shadow: 0 10px 22px rgba(16, 24, 40, .1);
  background: #fafbfc;
}
.dash-nav-card.is-current {
  border-color: #64748b;
  box-shadow: 0 0 0 1px rgba(100, 116, 139, .35);
  background: #f8fafc;
}
.dash-nav-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}
.dash-nav-card-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-lang-card {
  margin-bottom: 22px;
  padding: 16px 18px;
}
.dash-lang-hint {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 13px;
}
.dash-lang-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.lang-pill {
  font: inherit;
  cursor: pointer;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.lang-pill:hover {
  border-color: #98a2b3;
  background: #fafbfc;
}
.lang-pill.is-current {
  border-color: #475467;
  background: #f2f4f7;
  box-shadow: inset 0 0 0 1px rgba(71, 84, 103, .2);
  font-weight: 600;
}
.container--stock .stock-page-head .stock-page-lead {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  max-width: 52rem;
}
.stock-list-head {
  margin-bottom: 10px;
}
.stock-list-head .stock-list-sub {
  margin-top: 4px;
  font-size: 13px;
}
.stock-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.stock-list-item-main {
  min-width: 0;
}
.stock-empty {
  padding: 20px 18px;
  text-align: center;
}
.stock-empty .nav-link-inline {
  display: inline-block;
  margin-top: 8px;
  font-weight: 600;
  color: var(--primary);
}
.stock-form .stock-submit {
  margin-top: 12px;
}
.stock-flash {
  margin-bottom: 14px;
}
.stock-back {
  margin-top: 18px;
  font-size: 14px;
}
.stock-back a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}
.stock-back a:hover {
  text-decoration: underline;
}
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 108;
  background: rgba(15, 23, 42, .54);
}
.nav-overlay[hidden] {
  display: none;
}
.container { max-width: 1040px; margin: 0 auto; padding: 22px 16px 32px; }
.cards-main {
  max-width: min(1460px, 100vw - 24px);
  width: 100%;
}
.page-head h1 { margin: 0 0 8px; }
.page-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.muted { color: var(--muted); margin: 0 0 12px; }
.error { color: #b42318; font-size: 14px; margin: 8px 0; }
.grid { display: grid; gap: 14px; }
.metrics-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(16, 24, 40, .05);
}
.metric-label { margin: 0; color: var(--muted); font-size: 13px; }
.metric-value { margin: 6px 0 0; font-size: 26px; font-weight: 700; }
.chatbox { min-height: 280px; max-height: 56vh; overflow: auto; margin-bottom: 14px; }
body.page-chat {
  min-height: var(--chat-vvh);
  overflow: hidden;
  overscroll-behavior-y: none;
}
body.page-chat .app-shell {
  min-height: var(--chat-vvh);
  height: var(--chat-vvh);
  display: flex;
  flex-direction: column;
}
body.page-chat main.container.container--chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(var(--chat-vvh) - 58px);
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
  padding: 16px 16px 0;
}
.chat-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-page-scroll {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-page-head .muted.chat-page-hint {
  margin-top: 6px;
  margin-bottom: 10px;
}
.chat-generate-strip {
  margin-bottom: 10px;
  flex-shrink: 0;
}
.chat-no-card-note {
  margin: 0 0 10px 0;
  flex-shrink: 0;
}
.chat-messages-wrap {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.page-chat .chatbox--thread {
  flex: 1;
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.msg-body {
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-composer-wrap {
  flex-shrink: 0;
  z-index: 40;
  padding-top: 8px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  margin-top: 6px;
  background: linear-gradient(180deg, rgba(236, 239, 243, 0) 0%, rgba(236, 239, 243, 0.88) 14%, var(--bg) 32%);
}
.chat-composer-inner {
  padding: 16px 18px 18px;
  border-radius: 16px;
  border: 1px solid #d0d5dd;
  box-shadow: 0 -10px 32px rgba(16, 24, 40, 0.1);
  background: #ffffff;
  overflow: hidden;
}
.chat-recent-strip {
  flex-shrink: 0;
  margin-top: 10px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(16, 24, 40, 0.06);
}
.chat-recent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.chat-recent-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.chat-recent-link {
  font-size: 12px;
  font-weight: 600;
  color: #0e7490;
  text-decoration: none;
  white-space: nowrap;
}
.chat-recent-link:hover {
  text-decoration: underline;
}
.chat-recent-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.chat-mini-card {
  flex: 0 0 min(300px, 88vw);
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 12px;
  padding: 10px;
  background: linear-gradient(180deg, #fff 0%, #f9fafb 100%);
}
.chat-mini-card-img {
  border-radius: 10px;
  overflow: hidden;
  background: #f1f5f9;
  aspect-ratio: 1;
}
.chat-mini-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.chat-mini-card-body {
  min-width: 0;
}
.chat-mini-card-title {
  margin: 0 0 4px 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
.chat-mini-card-meta {
  margin: 0 0 6px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.chat-mini-chip {
  display: inline-block;
  max-width: 100%;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-mini-price {
  font-weight: 700;
  color: var(--text);
}
.chat-mini-card-desc {
  margin: 0 0 6px 0;
  font-size: 12px;
  color: #475467;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-mini-card-sku {
  margin: 0 0 6px 0;
  font-size: 11px;
}
.chat-mini-card-open {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: #1d4ed8;
  text-decoration: none;
}
.chat-mini-card-open:hover {
  text-decoration: underline;
}
.chat-composer-head {
  margin-bottom: 10px;
}
.chat-composer-title {
  margin: 0 0 4px 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.chat-prefill-note {
  margin: 0;
  font-size: 12px;
}
.chat-fields-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}
.chat-field--wide {
  grid-column: 1 / -1;
}
.chat-fields-hint {
  font-size: 12px;
  line-height: 1.45;
  margin: 4px 0 10px;
}
body.page-chat .chat-send-form {
  margin-bottom: 0;
}
body.page-chat .chat-send-form textarea {
  min-height: 88px;
  max-height: 220px;
}
.msg { margin-bottom: 10px; line-height: 1.45; padding: 10px 12px; border-radius: 10px; background: #f8faff; }
.msg.user { border-left: 3px solid #4caf50; }
.msg.ai { border-left: 3px solid var(--primary); }
.msg.ai:has(.msg-role) { background: #f8f9fc; }
.msg-role { display: inline-block; margin-right: 8px; color: var(--muted); text-transform: uppercase; font-size: 11px; }
.msg.user .msg-role { text-transform: none; }
.ai-hint {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border: 1px solid #c7d2fe;
  color: #1f2a44;
  font-size: 13px;
  line-height: 1.45;
}
.ai-hint-label {
  font-weight: 700;
  margin-right: 6px;
  color: #3730a3;
}
.form { display: grid; gap: 8px; margin-bottom: 14px; }
label { font-size: 13px; color: var(--muted); }
textarea, input {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  background: white;
}
textarea { min-height: 116px; resize: vertical; }
button {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: linear-gradient(180deg, #4b5563 0%, #344054 100%);
  color: white;
  cursor: pointer;
  font-weight: 600;
}
button:hover { filter: brightness(1.05); }
.secondary {
  background: #ffffff;
  color: #344054;
  border: 1px solid #d0d5dd;
}
.secondary:hover {
  background: #f8fafc;
}
.ghost-btn { background: transparent; border: 1px solid #415171; color: #d9e1f2; }
.list { display: grid; gap: 10px; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.list-title { margin: 0 0 4px; font-weight: 600; }
.history-details summary { list-style: none; cursor: pointer; }
.history-details summary::-webkit-details-marker { display: none; }
.history-summary { padding: 2px 0; }
.history-body { margin-top: 8px; }
.history-params-label { margin: 0 0 6px; font-size: 13px; }
.history-params-list { margin: 0 0 12px 18px; padding: 0; font-size: 14px; line-height: 1.45; }
.history-params-list li { margin-bottom: 4px; }
.history-chat { margin-top: 10px; display: grid; gap: 8px; }
.history-msg-content { white-space: pre-wrap; word-break: break-word; margin-top: 4px; }
.history-card-actions { margin-top: 14px; padding-top: 12px; border-top: 1px solid #e8ecf4; }
.history-card-actions a { text-decoration: none; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #c7d7ff;
  padding: 4px 10px;
  font-size: 12px;
  color: #2643d4;
  background: #eef2ff;
}
.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  align-items: start;
}
.cards-notice {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #6ce9a6;
  background: #ecfdf3;
  color: #075e3a;
  font-weight: 600;
  box-shadow: 0 6px 16px rgba(22, 101, 52, .12);
}
.product-card {
  display: grid;
  grid-template-columns: minmax(320px, 42%) minmax(0, 1fr);
  gap: 22px;
  min-width: 0;
  padding: 22px;
  overflow: hidden;
}
.product-card__media,
.product-card__content {
  min-width: 0;
}
.product-card__media {
  display: grid;
  gap: 14px;
  align-self: start;
}
.product-card__content {
  display: grid;
  gap: 12px;
  align-content: start;
}
.product-card p { margin: 0; }
.product-card__title {
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.15;
  letter-spacing: 0;
}
.product-card__sku {
  font-size: 13px;
}
.product-card__description {
  color: #344054;
  line-height: 1.55;
  font-size: 15px;
}
.product-card__actions {
  margin-top: 2px;
}
.product-card button,
.product-card input,
.product-card textarea {
  min-width: 0;
}
.product-card button {
  white-space: normal;
  text-wrap: balance;
  line-height: 1.25;
}
.marketplace-generate-title {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.marketplace-generate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.marketplace-generate-grid .generate-btn {
  min-height: 44px;
  padding-left: 10px;
  padding-right: 10px;
}
.product-card .product-image {
  display: block;
  width: 100%;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, rgba(248, 250, 252, .9), rgba(255, 255, 255, .96)),
    #fff;
  box-shadow: 0 12px 28px rgba(16, 24, 40, .08);
}
.product-card .product-image--hero {
  height: clamp(320px, 38vw, 560px);
}
.previewable-image { cursor: zoom-in; }
.danger-btn {
  border-color: #fda29b;
  color: #b42318;
  background: #fff5f4;
}
.danger-btn:hover { background: #ffe4e1; }
.gallery-section {
  min-width: 0;
}
.gallery-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.gallery-title {
  margin: 0;
  font-weight: 700;
  color: var(--text);
}
.gallery-count {
  margin: 0;
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #eef2ff;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
}
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(280px, min(78vw, 360px));
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  margin-top: 0;
  padding: 2px 4px 16px;
}
.carousel-item {
  display: grid;
  gap: 8px;
  margin: 0;
  scroll-snap-align: start;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .06);
}
.product-card .carousel-image {
  height: clamp(260px, 28vw, 360px);
}
.gallery-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 10010;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.preview-modal[hidden] {
  display: none;
}
.preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .72);
}
.preview-dialog {
  position: relative;
  z-index: 1;
  width: min(900px, 95vw);
  max-height: 92vh;
  display: grid;
  gap: 10px;
}
.preview-image-full {
  width: 100%;
  max-height: 72vh;
  object-fit: contain;
  border-radius: 10px;
  background: #0f172a;
}
.preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.preview-close {
  justify-self: end;
}
body.modal-open {
  overflow: hidden;
}
.gen-progress { margin-top: 8px; }
.gen-progress-bar {
  width: 100%;
  height: 10px;
  background: #e4e7ec;
  border-radius: 999px;
  overflow: hidden;
}
.gen-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  --target: 0%;
  --soft-cap: 0%;
  background: linear-gradient(90deg, #64748b 0%, #334155 45%, #64748b 100%);
  background-size: 220% 100%;
  transition: width .35s ease;
  animation: progressShift 1.2s linear infinite;
}
.gen-progress-fill.is-waiting {
  animation: progressShift 1.2s linear infinite, progressCreep 8s linear forwards;
}
.gen-progress-text { margin-top: 6px; margin-bottom: 0; font-size: 13px; }
.chat-progress.complete .gen-progress-fill {
  animation: none;
}
.chat-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-send-form {
  gap: 10px;
}
.chat-send-form textarea {
  min-height: 132px;
}
.chat-file-input {
  font-size: 14px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed #98a2b3;
  background: #f8fafc;
}
.chat-file-input::file-selector-button {
  margin-right: 10px;
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: linear-gradient(180deg, #5f6b7a 0%, #344054 100%);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.chat-submit-btn {
  width: 100%;
  min-height: 46px;
  font-size: 16px;
}
@keyframes progressShift {
  0% { background-position: 0% 0; }
  100% { background-position: 220% 0; }
}
@keyframes progressCreep {
  from { width: var(--target); }
  to { width: var(--soft-cap); }
}
.profile-card { display: grid; gap: 8px; }
.profile-line { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px dashed var(--border); padding: 8px 0; }
.profile-line:last-child { border-bottom: 0; }
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at top, #f8fafc, #e6eaef 45%);
}
.auth-card {
  width: 100%;
  max-width: 420px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(26, 36, 67, .12);
  padding: 24px;
}
.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.lang-tile {
  text-align: left;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #bfc7d1;
  background: linear-gradient(180deg, #f8fafc 0%, #e5e7eb 100%);
  color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lang-tile small {
  color: #475467;
  font-weight: 700;
}
.lang-tile:hover {
  border-color: #98a2b3;
  background: linear-gradient(180deg, #ffffff 0%, #dbe0e7 100%);
}
.auth-card h1 { margin-top: 0; }
@media (max-width: 700px) {
  .container { padding-top: 16px; }
  .topbar {
    padding: 12px;
    flex-wrap: nowrap;
    position: sticky;
    top: 0;
    z-index: 120;
  }
  .brand { min-width: 0; max-width: calc(100% - 118px); }
  .brand-subtitle {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
  }
  .topbar > form { display: none; }
  .burger-btn {
    display: inline-flex;
    z-index: 131;
    flex-shrink: 0;
  }
  .dash-nav-grid {
    grid-template-columns: 1fr;
  }
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 130;
    width: min(82vw, 340px);
    height: 100dvh;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 72px 14px 18px;
    background: #1f2937;
    border-left: 1px solid #364152;
    transform: translateX(104%);
    transition: transform .24s ease;
    flex-wrap: nowrap;
    overflow-y: auto;
    pointer-events: none;
  }
  .nav.is-open {
    transform: translateX(0);
    pointer-events: auto;
  }
  .nav a {
    display: block;
    padding: 12px 12px;
    font-size: 15px;
  }
  .nav-logout-mobile {
    display: block;
    margin-top: 10px;
  }
  .nav-logout-mobile .ghost-btn {
    width: 100%;
    justify-content: center;
  }
  body.menu-open {
    overflow: hidden;
  }
  .cards-main {
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }
  .chat-send-form {
    gap: 9px;
    padding: 0;
  }
  body.page-chat main.container.container--chat {
    height: calc(var(--chat-vvh) - 58px);
    padding: 8px 10px 0;
    max-width: 100%;
  }
  .chat-page-scroll {
    order: 1;
  }
  .chat-page-head {
    order: 1;
    margin-bottom: 6px;
  }
  .chat-page-head .page-head-row {
    margin-bottom: 4px;
  }
  .chat-page-head h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.15;
  }
  .chat-page-head form button {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
  }
  .chat-page-head .muted.chat-page-hint {
    margin-bottom: 6px;
    font-size: 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .chat-messages-wrap {
    order: 3;
    min-height: 0;
  }
  .chat-recent-strip {
    order: 2;
    margin-top: 0;
    margin-bottom: 8px;
    padding: 8px 10px;
    max-height: none;
    overflow-y: visible;
    overflow-x: hidden;
    position: relative;
    z-index: 2;
    background: #ffffff;
  }
  .chat-recent-head {
    margin-bottom: 6px;
  }
  .chat-recent-title {
    font-size: 13px;
    line-height: 1.2;
  }
  .chat-recent-scroll {
    gap: 8px;
    padding-bottom: 4px;
  }
  .chat-mini-card {
    padding: 8px;
  }
  .chat-mini-card-title {
    font-size: 13px;
  }
  .chat-mini-card-meta,
  .chat-mini-card-desc,
  .chat-mini-card-sku {
    margin-bottom: 4px;
  }
  .chat-mini-card-desc {
    -webkit-line-clamp: 2;
  }
  body.page-chat .chatbox--thread {
    padding: 10px;
  }
  .msg {
    margin-bottom: 8px;
    padding: 9px 10px;
    font-size: 14px;
    line-height: 1.42;
    border-radius: 10px;
  }
  .msg-role {
    font-size: 10px;
  }
  .chat-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
  .chat-actions a,
  .chat-actions form,
  .chat-actions button {
    width: 100%;
  }
  .chat-composer-wrap {
    order: 3;
    margin-left: -10px;
    margin-right: -10px;
    margin-top: 0;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom, 0px));
    background: var(--bg);
    border-top: 1px solid #d9e0ea;
  }
  .chat-composer-inner {
    max-height: min(50dvh, 430px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 10px;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 24px rgba(16, 24, 40, .14);
  }
  .chat-composer-head {
    margin-bottom: 6px;
  }
  .chat-composer-title {
    font-size: 14px;
    line-height: 1.2;
  }
  .chat-prefill-note {
    font-size: 11px;
  }
  .chat-fields-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  .chat-field--wide {
    grid-column: 1 / -1;
  }
  label { font-size: 12px; }
  textarea,
  input {
    min-height: 42px;
    padding: 10px 11px;
    font-size: 16px;
    border-radius: 10px;
  }
  .chat-send-form textarea {
    min-height: 68px;
    max-height: 120px;
  }
  .chat-fields-hint {
    margin: 2px 0 6px;
    font-size: 11px;
    line-height: 1.35;
  }
  .chat-mini-card {
    grid-template-columns: 72px 1fr;
    flex: 0 0 min(320px, 92vw);
  }
  .chat-file-input {
    font-size: 15px;
    padding: 12px 10px;
  }
  .chat-file-input::file-selector-button {
    width: 100%;
    margin-right: 0;
    margin-bottom: 10px;
    padding: 12px 12px;
    font-size: 15px;
  }
  .chat-submit-btn {
    min-height: 50px;
    font-size: 17px;
    position: sticky;
    bottom: 0;
    z-index: 1;
  }
  body.keyboard-open .chat-page-head,
  body.keyboard-open .chat-recent-strip {
    display: none;
  }
  body.keyboard-open .chat-composer-inner {
    max-height: min(58dvh, 360px);
  }
  .product-card button {
    padding: 9px 10px;
    font-size: 13px;
  }
  .cards-main {
    max-width: 100%;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
  .cards-grid {
    gap: 16px;
  }
  .product-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    border-radius: 16px;
  }
  .product-card__title {
    font-size: 21px;
  }
  .product-card__description {
    font-size: 14px;
  }
  .product-card .product-image--hero {
    height: min(88vw, 430px);
    min-height: 250px;
  }
  .card {
    padding: 12px;
  }
  .card.product-card {
    padding: 14px;
  }
  .carousel {
    grid-auto-columns: minmax(242px, 84vw);
    gap: 12px;
  }
  .product-card .carousel-image {
    height: min(78vw, 330px);
    min-height: 230px;
  }
}

@media (max-width: 380px) {
  .marketplace-generate-grid {
    grid-template-columns: 1fr;
  }
  .chat-fields-grid {
    grid-template-columns: 1fr;
  }
  .chat-mini-card {
    grid-template-columns: 64px 1fr;
    flex-basis: calc(100vw - 24px);
  }
  .chat-mini-card-desc {
    -webkit-line-clamp: 3;
  }
  .carousel {
    grid-auto-columns: minmax(218px, 86vw);
  }
  .product-card .carousel-image {
    height: min(78vw, 300px);
    min-height: 210px;
  }
}

@media (min-width: 840px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1360px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
}

.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(17, 24, 39, .32);
  opacity: 1;
  transition: opacity .26s ease;
}
.upload-overlay.fade-out { opacity: 0; }
.upload-bubble {
  width: 160px;
  height: 160px;
  border-radius: 16px;
  box-shadow: 0 12px 34px rgba(0,0,0,.24);
  background: rgba(15, 23, 42, .18);
  position: relative;
  overflow: hidden;
}
.upload-bubble.server-wait {
  animation: none;
}
.upload-bubble-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #0f172a;
}
.upload-label { margin-top: 6px; font-size: 13px; color: #e2e8f0; text-align: center; }
.gear-spinner {
  width: 92px;
  height: 92px;
  margin-bottom: 6px;
  opacity: 0;
  transform: scale(.92);
  transition: opacity .2s ease, transform .2s ease;
  background: transparent;
}
.gear-spinner.show {
  opacity: 1;
  transform: scale(1);
}

.upload-toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(14px);
  padding: 10px 14px;
  border-radius: 10px;
  background: #1f2937;
  color: #fff;
  font-size: 13px;
  z-index: 10000;
  opacity: 0;
  transition: opacity .22s ease, transform .22s ease;
}
.upload-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
