* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f0f0;
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ── LEFT PANEL ── */
.left-panel {
  width: 62%;
  height: 100vh;
  background: #f0f0f0;
  padding: 24px 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.left-panel.grid-mode {
  background: #cc0000;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-header-text h1 {
  font-size: 20px;
  font-weight: 700;
  color: #111;
  transition: color 0.2s;
}

.left-panel.grid-mode .panel-header-text h1 {
  color: #fff;
}

.panel-header-text p {
  font-size: 13px;
  color: #777;
  margin-top: 2px;
  transition: color 0.2s;
}

.left-panel.grid-mode .panel-header-text p {
  color: rgba(255, 255, 255, 0.7);
}

.view-toggle {
  display: flex;
  align-items: center;
  background: #e0e0e0;
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toggle-btn {
  width: 32px;
  height: 28px;
  border-radius: 999px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s;
  color: #888;
}

.toggle-btn.active {
  background: #fff;
  color: #111;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.toggle-btn svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.search-bar {
  width: 100%;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 13px;
  background: #fff;
  color: #111;
  outline: none;
  font-family: inherit;
}

.search-bar:focus {
  border-color: #aaa;
}

/* ── LIST VIEW ── */
.cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-list-item {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e8e8e8;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.card-list-item:hover {
  border-color: #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
}

.card-sub {
  font-size: 11px;
  color: #aaa;
  margin-top: 1px;
}

.card-sub-model {
  font-size: 12px;
  font-weight: 600;
  color: #111;
  line-height: 1.3;
  margin-top: 1px;
}

.card-sub-year {
  font-size: 11px;
  font-weight: 700;
  color: #e02424;
  margin-top: 1px;
}

.card-arrow {
  font-size: 18px;
  color: #ccc;
  flex-shrink: 0;
  line-height: 1;
}

/* ── iPad model / gen cards ── */
.back-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 0 12px 0;
  display: block;
}

.back-btn:hover {
  opacity: 0.8;
}

.ipad-heading {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ── iPad detail page ── */
.detail-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-title {
  font-size: 20px;
  font-weight: 700;
  color: #111;
}

.detail-subtitle {
  font-size: 16px;
  font-weight: 700;
  color: #111;
}

.detail-text {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.detail-text a,
.msg-bubble a {
  color: #cc0000;
  font-weight: 600;
  text-decoration: underline;
}

.detail-ios {
  font-size: 13px;
  font-weight: 600;
  color: #cc0000;
}

.detail-img {
  width: 100%;
  max-width: 300px;
  border-radius: 12px;
  align-self: center;
}

.detail-btn {
  display: inline-block;
  background: #cc0000;
  color: #fff;
  padding: 12px 24px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  align-self: flex-start;
  cursor: pointer;
  transition: background 0.2s;
}

.detail-btn:hover {
  background: #a50000;
  color: #fff;
}

.detail-divider {
  border-top: 1px solid #eee;
}

.detail-kits {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-kits li {
  font-size: 14px;
  color: #374151;
}

/* ── PRODUCT SUGGESTIONS PICKER ── */
.suggestion-panels {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.suggestion-show-results-btn {
  align-self: stretch;
  text-align: center;
}

.suggestion-back-btn {
  align-self: flex-start;
  background: none;
  border: none;
  color: #cc0000;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

/* Holds the back button (left) and the page-level View Cart button (right,
   hidden until something's been added to the cart from the results grid —
   see onCartAdded in product-suggestions.js). */
.suggestion-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.suggestion-page-viewcart {
  background: #16a34a;
  color: #fff;
  padding: 8px 16px;
  font-size: 13px;
  align-self: auto;
}

.suggestion-page-viewcart:hover {
  background: #15803d;
  color: #fff;
}

.suggestion-panel {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggestion-panel-title {
  font-size: 15px;
  font-weight: 700;
  color: #111;
}

.suggestion-item-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.suggestion-panel-next-btn {
   align-self: flex-start;
   background: #cc0000;
   color: #fff;
   border: none;
   padding: 10px 18px;
   border-radius: 12px;
   font-size: 13px;
   font-weight: 700;
   cursor: pointer;
   transition: background 0.2s;
}

.suggestion-panel-next-btn:hover {
   background: #a50000;
}

.suggestion-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f7f7f7;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.suggestion-pill:hover {
  border-color: #cc0000;
}

.suggestion-pill.selected {
  background: #cc0000;
  border-color: #cc0000;
  color: #fff;
}

.suggestion-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggestion-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.suggestion-product-card {
  background: #fff;
  border: 1.5px solid #e5e5e5;
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  aspect-ratio: 4 / 6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.suggestion-product-card:hover {
  border-color: #cc0000;
  box-shadow: 0 10px 24px rgba(204, 0, 0, 0.14);
  transform: translateY(-3px);
}

.suggestion-product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  background: #f7f7f7;
  cursor: pointer;
}

/* Fixed to exactly 2 lines (min-height reserves the space for a 1-line
   title, line-clamp truncates anything longer with an ellipsis) so every
   card's title block is the same height regardless of how long the actual
   product title is — otherwise price/tags/buttons drift out of alignment
   row to row in the results grid. */
.suggestion-product-title {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
  min-height: calc(1.3em * 2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.suggestion-product-price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.suggestion-product-price {
  font-size: 14px;
  font-weight: 700;
  color: #cc0000;
}

.suggestion-product-compare-price {
  font-size: 12px;
  color: #999;
  text-decoration: line-through;
}

/* Fixed to exactly 4 rows of badges (badge box is 20px tall: 14px line-height
   + 3px top/bottom padding; 4 rows + 3 x 4px row gaps = 92px) so this
   section is the same height on every card, same reasoning as the title's
   fixed 2-line height above — keeps price/buttons aligned row to row in the
   grid. Sized for the worst case of MAX_CARD_TAGS (4) in JS: at this card
   width, a long label like "Critical Thinking" can take a whole row by
   itself, so 4 tags can need up to 4 separate rows — a shorter fixed height
   was cutting those off instead of just capping rare overflow past 4 tags.
*/
.suggestion-product-card-tags {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 4px;
  height: 48px;
  overflow: hidden;
}

.suggestion-product-card-tag {
  background: #f7f7f7;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 10px;
  line-height: 14px;
  font-weight: 600;
  color: #666;
  white-space: nowrap;
}

.suggestion-product-card-tag.active {
  background: #cc0000;
  border-color: #cc0000;
  color: #fff;
}

.suggestion-product-link-row {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin-top: auto;
}

.suggestion-product-link,
.suggestion-product-cart-actions {
  flex: 1 1 50%;
}

.suggestion-product-link,
.suggestion-product-addtocart,
.suggestion-product-viewcart {
  align-self: stretch;
  padding: 8px 2px;
  font-size: 10.5px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.suggestion-product-cart-actions {
  display: flex;
  gap: 6px;
}

.suggestion-product-cart-actions .suggestion-product-addtocart,
.suggestion-product-cart-actions .suggestion-product-viewcart {
  flex: 1 1 50%;
  min-width: 0;
}

.suggestion-product-addtocart {
  background: #38bdf8;
}

.suggestion-product-addtocart:hover {
  background: #0ea5e9;
}

.suggestion-product-viewcart {
  background: #16a34a;
  color: #fff;
}

.suggestion-product-viewcart:hover {
  background: #15803d;
}

.suggestion-product-detail {
  display: flex;
  flex-direction: row;
  gap: 20px;
}

.suggestion-product-detail-left {
  flex: 1 1 50%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.suggestion-product-detail-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
}

.suggestion-product-detail-right {
  flex: 1 1 50%;
  min-width: 0;
}

.suggestion-product-detail-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #666;
}

.suggestion-product-detail-stars {
  color: #f5a623;
  font-size: 15px;
  letter-spacing: 1px;
}

.suggestion-product-slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
}

.suggestion-product-slider {
  position: relative;
}

.suggestion-product-slider-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  background: #f7f7f7;
}

.suggestion-product-slider-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #111;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.suggestion-product-slider-arrow:hover {
  background: #fff;
}

.suggestion-product-slider-prev {
  left: 8px;
}

.suggestion-product-slider-next {
  right: 8px;
}

.suggestion-product-slider-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.suggestion-product-slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: #ddd;
  cursor: pointer;
}

.suggestion-product-slider-dot.active {
  background: #cc0000;
}

.suggestion-product-detail-description {
  font-size: 14px;
  color: #555;
  line-height: 1.6;
}

.suggestion-product-detail-description img {
  max-width: 100%;
  border-radius: 12px;
}

.suggestion-product-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.suggestion-product-detail-tag {
  background: #f7f7f7;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #555;
}

.suggestion-product-detail-tag.active {
  background: #cc0000;
  border-color: #cc0000;
  color: #fff;
}

/* Standalone CTA here, not squeezed into the half-width results-grid row —
   restore normal .detail-btn proportions instead of the row's sizing. */
.suggestion-product-detail .suggestion-product-cart-actions {
  flex: none;
  align-self: flex-start;
}

.suggestion-product-detail .suggestion-product-addtocart,
.suggestion-product-detail .suggestion-product-viewcart {
  flex: none;
  padding: 12px 24px;
  font-size: 14px;
}

/* ── REFUND LOOKUP FORM ── */
.refund-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.refund-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.refund-field-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.refund-field-label {
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
}

.refund-field-hint {
  font-size: 12px;
  color: #a8a29a;
}

.refund-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fbf3e5;
  border: 1px solid #f0e4cc;
  border-radius: 12px;
  padding: 12px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.refund-input-wrap:focus-within {
  border-color: #e0cd9e;
  box-shadow: 0 0 0 3px rgba(224, 205, 158, 0.25);
}

.refund-input-icon {
  display: flex;
  flex-shrink: 0;
  color: #8a8272;
}

.refund-input-icon svg {
  width: 18px;
  height: 18px;
}

.refund-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: 14px;
  font-family: inherit;
  color: #111;
  outline: none;
}

.refund-input::placeholder {
  color: #b3ab98;
}

.refund-submit-btn {
  background: #cc0000;
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-start;
  transition: background 0.2s;
}

.refund-submit-btn:hover {
  background: #a50000;
}

.refund-submit-btn:disabled {
  background: #e0a0a0;
  cursor: default;
}

.refund-feedback {
  font-size: 14px;
  color: #111;
}

.refund-error {
  color: #cc0000;
}

/* ── ORDER ITEMS PANEL (shown after a refund lookup) ── */
.order-items {
  margin-top: 8px;
  background: #fbf3e5;
  border: 1px solid #f0e4cc;
  border-radius: 18px;
  padding: 26px;
}

.order-items-header h3 {
  font-size: 22px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 4px;
}

.order-items-header p {
  font-size: 15px;
  color: #a8a29a;
  margin: 0 0 14px;
}

.order-items-list {
  display: flex;
  flex-direction: column;
}

.order-item-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid #f0e4cc;
}

.order-items-list > .order-item-row:last-child {
  border-bottom: none;
}

.order-item-checkbox input[type="checkbox"],
.order-item-checkbox input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: #cc0000;
  cursor: pointer;
}

.order-item-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eee0c8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
  overflow: hidden;
}

.order-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.order-item-info {
  flex: 1;
  min-width: 0;
}

.order-item-title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  line-height: 1.3;
}

.order-item-number {
  font-size: 13px;
  color: #a8a29a;
  margin-top: 1px;
}

.order-item-note {
  font-size: 13px;
  color: #a8a29a;
  margin-top: 3px;
  font-style: italic;
}

.order-item-price,
.order-item-qty,
.order-item-subtotal {
  font-size: 15px;
  color: #1a1a1a;
  flex-shrink: 0;
  text-align: right;
}

.order-item-price {
  width: 52px;
  color: #6b6456;
}

.order-item-qty {
  width: 18px;
  text-align: center;
  color: #a8a29a;
}

.order-item-subtotal {
  width: 64px;
  font-weight: 700;
}

.order-item-bundle {
  margin: 2px 0 8px 44px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid #f0e4cc;
  border-radius: 10px;
}

.order-item-bundle-title {
  font-size: 12px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 2px;
}

.order-item-bundle-hint {
  font-size: 11px;
  color: #a8a29a;
  margin: 0 0 8px;
}

.order-item-bundle-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #8a6d1f;
  background: #f5e8c8;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.order-item-row-nested {
  padding: 6px 0;
}

.order-item-row-nested .order-item-title {
  font-size: 12px;
  font-weight: 600;
}

.order-item-row-nested .order-item-number {
  font-size: 10px;
}

.order-items-refund-btn {
  margin-top: 16px;
  background: #cc0000;
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.order-items-refund-btn:hover:not(:disabled) {
  background: #a50000;
}

.order-items-refund-btn:disabled {
  background: #e6ddc9;
  color: #a8a29a;
  cursor: default;
}

.order-items-confirmation {
  margin-top: 10px;
  font-size: 15px;
  color: #1a1a1a;
}

/* ── TRACKING PANEL (shown after a shipping-issue lookup) ── */
.tracking-empty {
  font-size: 15px;
  color: #6b6456;
  margin: 4px 0 0;
}

.tracking-shipment {
  background: #fff;
  border: 1px solid #f0e4cc;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 14px;
}

.tracking-shipment:last-child {
  margin-bottom: 0;
}

.tracking-shipment-pending {
  background: transparent;
  border-style: dashed;
}

.tracking-shipment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.tracking-shipment-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a1a;
}

.tracking-status {
  font-size: 13px;
  font-weight: 700;
  color: #8a6d1f;
  background: #f5e8c8;
  padding: 4px 10px;
  border-radius: 7px;
}

.tracking-line {
  font-size: 16px;
  color: #1a1a1a;
  margin-bottom: 6px;
}

.tracking-link {
  color: #cc0000;
  font-weight: 600;
  text-decoration: none;
}

.tracking-link:hover {
  text-decoration: underline;
}

.tracking-eta {
  font-size: 14px;
  color: #a8a29a;
  margin-bottom: 6px;
}

.tracking-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tracking-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tracking-item-thumb {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #eee0c8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
  overflow: hidden;
}

.tracking-item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tracking-item-label {
  font-size: 14px;
  color: #6b6456;
}

/* ── GRID VIEW ── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.card-grid-item {
  background: #fff;
  border-radius: 16px;
  padding: 28px 16px 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s;
  border: none;
}

.card-grid-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.grid-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 4px;
}

.grid-title {
  font-size: 14px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
}

.grid-sub {
  font-size: 12px;
  color: #888;
}

.grid-sub-model {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  line-height: 1.3;
}

.grid-sub-year {
  font-size: 12px;
  font-weight: 700;
  color: #e02424;
}

.hidden {
  display: none !important;
}

/* ── RIGHT PANEL (desktop) ── */
.right-panel {
  width: 38%;
  height: 100vh;
  background: #fff;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e5e5e5;
}

/* Hide drag handle and close button on desktop */
.sheet-handle,
.chat-close-btn {
  display: none;
}

.chat-header {
  padding: 14px 18px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #cc0000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
}

.chat-header-info .name {
  font-size: 14px;
  font-weight: 600;
  color: #111;
}

.chat-header-info .status {
  font-size: 11px;
  color: #22c55e;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #f9f9f9;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.msg.agent {
  align-self: flex-start;
}

.msg.user {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-name {
  font-size: 10px;
  color: #bbb;
  margin-bottom: 3px;
  padding: 0 4px;
}

.msg-bubble {
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.msg-product-list {
  margin: 6px 0 0;
  padding-left: 18px;
}

.msg.agent .msg-bubble {
  background: #fff;
  color: #111;
  border: 1px solid #e5e5e5;
  border-bottom-left-radius: 3px;
}

.msg.user .msg-bubble {
  background: #cc0000;
  color: #fff;
  border-bottom-right-radius: 3px;
}

.msg-time {
  font-size: 10px;
  color: #bbb;
  margin-top: 3px;
  padding: 0 4px;
}

.quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}

.quick-reply-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #cc0000;
  background: transparent;
  color: #cc0000;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.quick-reply-btn:hover,
.quick-reply-btn.selected {
  background: #cc0000;
  color: #fff;
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
}

.chat-input-wrap {
  position: relative;
  flex: 1;
}

.chat-input {
  width: 100%;
  padding: 9px 14px;
  border-radius: 999px;
  border: 1px solid #e0e0e0;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}

.chat-input:focus {
  border-color: #cc0000;
}

.keyword-suggestions {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  max-height: 180px;
  overflow-y: auto;
  z-index: 10;
}

.keyword-suggestion-item {
  padding: 8px 14px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}

.keyword-suggestion-item:hover {
  background: #fdf1f1;
  color: #cc0000;
}

.send-btn {
  width: 36px;
  height: 36px;
  background: #cc0000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.send-btn:hover {
  background: #a50000;
}

.send-btn svg {
  width: 14px;
  height: 14px;
  fill: #fff;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  border-bottom-left-radius: 3px;
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: #ccc;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-4px); }
}

/* ── Floating chat button (mobile only, hidden on desktop) ── */
.chat-fab {
  display: none;
}

/* ── Backdrop (mobile only) ── */
.chat-backdrop {
  display: none;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: #ddd; border-radius: 10px; }

/* ════════════════════════════════════════
   MOBILE  ≤ 640px
════════════════════════════════════════ */
@media (max-width: 640px) {

  body {
    overflow: auto;
  }

  /* Cards take full width */
  .left-panel {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    padding: 20px 16px 100px; /* bottom padding so FAB doesn't cover last card */
    overflow-y: auto;
  }

  /* Grid drops to 2 columns on mobile */
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Product detail stacks image-on-top instead of left/right */
  .suggestion-product-detail {
    flex-direction: column;
  }

  .suggestion-product-detail-right {
    order: -1;
  }

  .suggestion-product-slider-wrap {
    position: static;
  }

  /* ── Floating chat button ── */
  .chat-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #cc0000;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(204, 0, 0, 0.45);
    z-index: 100;
    transition: transform 0.2s, background 0.2s;
  }

  .chat-fab:hover {
    background: #a50000;
    transform: scale(1.08);
  }

  .chat-fab svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
  }

  /* Hide FAB when chat is open */
  .chat-fab.hidden-fab {
    display: none;
  }

  /* ── Backdrop ── */
  .chat-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 110;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }

  .chat-backdrop.visible {
    opacity: 1;
    pointer-events: all;
  }

  /* ── Bottom sheet ── */
  .right-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 72vh;
    border-left: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 32px rgba(0, 0, 0, 0.18);
    z-index: 120;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .right-panel.sheet-open {
    transform: translateY(0);
  }

  /* Show drag handle and close button on mobile */
  .sheet-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0 6px;
    cursor: pointer;
    flex-shrink: 0;
  }

  .sheet-handle-bar {
    width: 36px;
    height: 4px;
    background: #ddd;
    border-radius: 999px;
  }

  .chat-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
  }

  .chat-close-btn:hover {
    background: #e0e0e0;
  }
}

/* Image sent by an admin/owner in a SoundGlide live-chat reply */
.msg-bubble .msg-image {
  display: block;
  max-width: 100%;
  border-radius: 8px;
  margin-top: 4px;
}

/* ── DEVICE / TOPIC SEARCH BAR (left panel, Phase 4) ── */
.search-bar {
  position: relative;
  margin: 0 0 14px;
}

.search-input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid #e0e0e0;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
  background: #fff;
}

.search-input:focus {
  border-color: #cc0000;
}

/* The shared .keyword-suggestions popup opens upward (chat input); the
   left-panel search opens downward instead. */
.search-bar .keyword-suggestions {
  bottom: auto;
  top: calc(100% + 6px);
}

/* ── GROUP HEADER (parent title shown once above de-duplicated subcards) ── */
.cards-group-header {
  grid-column: 1 / -1;
  font-size: 15px;
  font-weight: 700;
  color: #1a1a1a;
  padding: 2px 2px 8px;
}

/* ── QUICK-REPLY NAV BUTTON (Next / Show Games in the sectioned tag flow) ── */
.quick-reply-btn.quick-reply-nav {
  background: #cc0000;
  color: #fff;
  border-color: #cc0000;
  font-weight: 600;
}

.quick-reply-btn.quick-reply-nav:hover {
  background: #a50000;
}

/* ── DEVICE COMPATIBILITY WIZARD (iPad / Fire cards) ── */
.device-wizard-progress {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a8a29a;
  margin: 4px 0 2px;
}

.device-wizard-back {
  margin-bottom: 4px;
}

.device-wizard-grid {
  margin-top: 4px;
}

.device-wizard-pill {
  font-size: 14px;
  padding: 12px 16px;
}

.device-wizard-sub {
  font-size: 13px;
  color: #6b6456;
  margin: 2px 0 10px;
}

.device-wizard-sub-model {
  font-size: 13px;
  color: #6b6456;
  margin: 2px 0 0;
}

.device-wizard-sub-year {
  font-size: 12px;
  color: #a8a29a;
  margin: 2px 0 10px;
}

.device-wizard-dial-question {
  font-weight: 700;
  color: #1a1a1a;
}
