:root {
  --v43-red: #c41e2d;
  --v43-red-dark: #9f1723;
  --v43-green: #15803d;
  --v43-amber: #d97706;
  --v43-text: #202124;
  --v43-muted: #667085;
  --v43-border: #e5e7eb;
}

[hidden] { display: none !important; }

/* Encabezado e identidad de Carlos */
.header {
  display: grid;
  grid-template-columns: var(--chat-start, 340px) minmax(0, 1fr) auto;
  align-items: center !important;
  gap: 0;
  box-sizing: border-box;
  height: auto !important;
  min-height: 78px;
  padding: 8px 20px !important;
}

.header-logo-slot {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-right: 20px;
}

.header-logo-slot .brand-logo-image {
  flex: 0 0 auto;
  width: 118px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.assistant-identity {
  display: flex;
  align-items: center;
  align-self: center;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  position: static;
  transform: none;
}

.assistant-profile-image {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border: 2px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  background: #f3f4f6;
  box-shadow: 0 2px 9px rgba(17, 24, 39, .13);
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 0 1 auto;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 0;
}

.brand-text h1 {
  margin: 0;
  color: var(--v43-text);
  font-size: 18px;
  line-height: 1.1;
}

.assistant-role {
  color: var(--v43-muted);
  font-size: 11px;
  line-height: 1.25;
}

.assistant-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--v43-green);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.assistant-status .status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .14);
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 4px;
  padding-left: 12px;
  position: static;
  transform: none;
}

.header-account-slot {
  min-width: 0;
}

.customer-access {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  margin: 0;
  padding: 0;
}

.customer-profile-btn {
  margin: 0;
}

.customer-label {
  display: block;
  max-width: 230px;
  color: var(--v43-muted);
  font-size: 11px;
  line-height: 1.3;
  text-align: right;
}

.google-signin-button {
  margin-top: 4px;
}

/* Botón y aviso del carrito */
.cart-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid #e4b7bc;
  border-radius: 50%;
  box-shadow: none;
  background: #fff;
  color: var(--v43-red-dark);
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transform: none;
}

.cart-button:hover {
  border-color: var(--v43-red);
  box-shadow: 0 5px 14px rgba(159, 23, 35, .10);
  background: #fff7f7;
  transform: none;
}

.cart-button:focus-visible {
  outline: 2px solid rgba(196, 30, 45, .24);
  outline-offset: 2px;
}

.cart-button:focus:not(:focus-visible) {
  outline: none;
}

.cart-notice button:focus-visible,
.cart-drawer button:focus-visible {
  outline: 3px solid rgba(196, 30, 45, .24);
  outline-offset: 2px;
}

.cart-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.cart-button-label {
  display: none;
}

.cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  display: none;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--v43-red);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
}

.cart-button.has-items .cart-count {
  display: grid;
}

.header-actions .cart-button {
  align-self: center;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0;
  position: relative;
  inset: auto;
}

.cart-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: 0 0 auto;
  margin: 0 18px 10px;
  padding: 12px 14px;
  border: 1px solid #a7e1ba;
  border-radius: 14px;
  background: #ecfdf3;
  color: #14532d;
  box-shadow: 0 8px 24px rgba(21, 128, 61, .10);
}

.cart-notice-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}

.cart-notice-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.cart-notice button,
.cart-drawer button {
  margin: 0;
  font: inherit;
  cursor: pointer;
  transform: none;
}

.cart-notice button:hover,
.cart-drawer button:hover {
  transform: none;
}

.cart-notice-primary,
.cart-notice-secondary {
  padding: 8px 11px;
  border-radius: 9px;
  font-size: 12px !important;
  font-weight: 750 !important;
}

.cart-notice-primary {
  border: 1px solid var(--v43-green) !important;
  background: var(--v43-green) !important;
  color: #fff !important;
}

.cart-notice-secondary {
  border: 1px solid #9acdaa !important;
  box-shadow: none !important;
  background: #fff !important;
  color: #166534 !important;
}

/* Carrito: lateral en escritorio, hoja inferior en mobile */
body.cart-open {
  overflow: hidden;
}

.cart-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  justify-content: flex-end;
}

.cart-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, .52);
  backdrop-filter: blur(2px);
}

.cart-drawer {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  height: 100%;
  overflow: hidden;
  border-left: 1px solid var(--v43-border);
  background: #fff;
  box-shadow: -18px 0 50px rgba(17, 24, 39, .18);
  animation: cart-slide-in .2s ease-out;
}

@keyframes cart-slide-in {
  from { transform: translateX(22px); opacity: .7; }
  to { transform: translateX(0); opacity: 1; }
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--v43-border);
}

.cart-drawer-kicker {
  display: block;
  margin-bottom: 3px;
  color: var(--v43-red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.cart-drawer h2,
.cart-empty h3,
.confirmed-order-summary h3 {
  margin: 0;
  color: var(--v43-text);
}

.cart-drawer h2 {
  font-size: 23px;
}

.cart-modal-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0 !important;
  border: 1px solid var(--v43-border) !important;
  border-radius: 50% !important;
  box-shadow: none !important;
  background: #fff !important;
  color: #374151 !important;
  font-size: 24px !important;
  line-height: 1 !important;
}

.cart-content {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 22px 24px;
}

.cart-items {
  display: grid;
  gap: 10px;
}

.cart-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 11px;
  padding: 14px;
  border: 1px solid var(--v43-border);
  border-radius: 14px;
  background: #fff;
}

.cart-item-quantity {
  display: grid;
  place-items: center;
  align-self: start;
  min-width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #f5f5f5;
  color: #374151;
  font-size: 12px;
  font-weight: 800;
}

.cart-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cart-item-info strong {
  overflow-wrap: anywhere;
  color: var(--v43-text);
  font-size: 13px;
  line-height: 1.35;
}

.cart-item-info span {
  color: var(--v43-muted);
  font-size: 11px;
  line-height: 1.35;
}

.cart-item-stock.is-available {
  color: var(--v43-green);
  font-weight: 750;
}

.cart-item-stock.is-pending {
  color: var(--v43-amber);
  font-weight: 750;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  text-align: right;
}

.cart-item-actions strong {
  color: var(--v43-text);
  font-size: 12px;
  white-space: nowrap;
}

.remove-order-btn {
  padding: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  color: #b42318 !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  text-decoration: underline;
}

.cart-footer {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 20px;
}

.cart-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--v43-border);
  color: var(--v43-text);
}

.cart-total span {
  font-size: 13px;
  font-weight: 650;
}

.cart-total strong {
  font-size: 19px;
}

.cart-pending-note {
  margin: 0;
  color: var(--v43-amber);
  font-size: 11px;
  line-height: 1.45;
}

.cart-checkout-btn,
.cart-continue-btn {
  width: 100%;
  min-height: 44px;
  border-radius: 11px !important;
  font-size: 13px !important;
  font-weight: 800 !important;
}

.cart-checkout-btn {
  border: 1px solid var(--v43-red) !important;
  background: var(--v43-red) !important;
  color: #fff !important;
}

.cart-checkout-btn:hover {
  background: var(--v43-red-dark) !important;
}

.cart-continue-btn {
  border: 1px solid var(--v43-border) !important;
  box-shadow: none !important;
  background: #fff !important;
  color: #374151 !important;
}

.cart-empty {
  display: grid;
  place-items: center;
  gap: 9px;
  margin: auto 0;
  padding: 36px 16px;
  color: var(--v43-muted);
  text-align: center;
}

.cart-empty-icon {
  font-size: 34px;
}

.cart-empty h3 {
  font-size: 17px;
}

.cart-empty p {
  max-width: 290px;
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.5;
}

/* Confirmación y resumen final */
.order-success-message {
  margin: 0 0 14px;
  padding: 13px 14px;
  border: 1px solid #a7e1ba;
  border-radius: 12px;
  background: #ecfdf3;
  color: var(--v43-green) !important;
  font-weight: 700;
  line-height: 1.5;
}

.confirmed-order-summary {
  display: grid;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--v43-border);
  border-radius: 14px;
  background: #fafafa;
}

.confirmed-order-summary h3 {
  font-size: 15px;
}

.confirmed-order-items {
  display: grid;
  gap: 8px;
}

.confirmed-order-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--v43-border);
}

.confirmed-order-item > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.confirmed-order-item strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.4;
}

.confirmed-order-item span {
  color: var(--v43-muted);
  font-size: 10px;
  line-height: 1.4;
}

.confirmed-order-item b {
  flex: 0 0 auto;
  font-size: 11px;
  white-space: nowrap;
}

.confirmed-order-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  color: var(--v43-text);
  font-size: 12px;
}

.confirmed-order-total strong {
  font-size: 15px;
  white-space: nowrap;
}

.confirmed-customer-data {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--v43-border);
}

.confirmed-customer-data dl {
  display: grid;
  gap: 6px;
  margin: 0;
}

.confirmed-customer-data dl > div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
}

.confirmed-customer-data dt {
  color: var(--v43-muted);
  font-size: 11px;
  font-weight: 650;
}

.confirmed-customer-data dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--v43-text);
  font-size: 11px;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

@media (max-width: 900px) {
  .header {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 8px;
    width: 100%;
    height: auto !important;
    min-height: 62px !important;
    padding: 8px 10px !important;
  }

  .header-logo-slot,
  .header-account-slot {
    display: none;
  }

  .assistant-identity {
    flex: 1 1 auto;
    gap: 8px;
    overflow: hidden;
    align-self: center !important;
    width: auto;
    margin: 0 !important;
    position: static !important;
    transform: none !important;
  }

  .assistant-profile-image { width: 43px; height: 43px; }
  .brand-text { flex: 1 1 auto; overflow: hidden; }
  .brand-text h1 { font-size: 16px; }
  .assistant-role { max-width: none; overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
  .assistant-status { font-size: 9px; }

  .header-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex-direction: row !important;
    flex: 0 0 auto;
    width: auto;
    gap: 8px;
    margin: 0 0 0 auto !important;
    padding: 3px;
    position: static !important;
    transform: none !important;
  }

  .cart-button {
    flex-basis: 40px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin: 0 !important;
    position: relative !important;
    inset: auto !important;
  }

  .sidebar-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    width: 40px;
    min-width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    border: 1px solid #d9dde3;
    border-radius: 50%;
    box-shadow: none;
    background: #fff;
    color: #374151;
    position: relative !important;
    inset: auto !important;
    transform: none;
  }

  .sidebar-toggle:hover {
    border-color: #b9c0ca;
    box-shadow: none;
    background: #f8f9fa;
    transform: none;
  }

  .sidebar-toggle span {
    position: static !important;
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 !important;
    border: 0;
    border-radius: 2px;
    background: currentColor;
    opacity: 1;
    transform: none !important;
  }

  .sidebar-top {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--v43-border);
  }

  .sidebar-honda-logo {
    display: block;
    width: 112px;
    max-width: 60%;
    height: auto;
    object-fit: contain;
  }

  .sidebar-account-slot {
    display: block !important;
    margin: 14px 0 16px;
    padding: 13px;
    border: 1px solid var(--v43-border);
    border-radius: 13px;
    background: #fafafa;
  }

  .sidebar-account-slot .customer-access {
    display: flex;
    align-items: stretch;
    width: 100%;
    max-width: none;
    gap: 5px;
    margin: 0;
  }

  .sidebar-account-slot .customer-profile-btn {
    width: 100%;
    margin: 0;
    text-align: left;
  }

  .sidebar-account-slot .customer-label {
    max-width: none;
    font-size: 10px;
    text-align: left;
  }

  .sidebar-account-slot .google-signin-button {
    align-self: flex-start;
    max-width: 100%;
  }
}

@media (max-width: 700px) {
  .cart-notice {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
    margin: 0 10px 8px;
    padding: 11px;
  }

  .cart-notice-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .cart-notice button { min-height: 38px; }

  .cart-modal { align-items: flex-end; }

  .cart-drawer {
    width: 100%;
    height: min(86vh, 720px);
    height: min(86dvh, 720px);
    border: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -18px 50px rgba(17, 24, 39, .20);
    animation-name: cart-slide-up;
  }

  @keyframes cart-slide-up {
    from { transform: translateY(24px); opacity: .7; }
    to { transform: translateY(0); opacity: 1; }
  }

  .cart-drawer-header { padding: 17px 16px 14px; }
  .cart-content { padding: 14px 14px calc(18px + env(safe-area-inset-bottom)); }
}

@media (max-width: 440px) {
  .header { padding: 8px 9px !important; }
  .assistant-profile-image { width: 40px; height: 40px; }
  .assistant-role { max-width: none; white-space: nowrap; }

  .cart-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .cart-item-actions {
    grid-column: 2;
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  .confirmed-order-item {
    flex-direction: column;
    gap: 5px;
  }

  .confirmed-order-item b { white-space: normal; }
  .confirmed-customer-data dl > div { grid-template-columns: 70px minmax(0, 1fr); }
}

@media (max-width: 380px) {
  .header { gap: 5px; min-height: 58px !important; padding: 7px !important; }
  .assistant-identity { gap: 6px; }
  .assistant-profile-image { width: 36px; height: 36px; }
  .brand-text h1 { font-size: 15px; }
  .assistant-role { max-width: none; font-size: 9px; }
  .assistant-status { font-size: 8px; }
  .header-actions { gap: 5px; padding: 2px; }
  .cart-button,
  .sidebar-toggle {
    flex-basis: 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
  }
  .cart-notice-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .cart-drawer { animation: none; }
}
