/* Customer portal (catering + bread) */
/* Prevent unintended capitalization on credentials (some mobile keyboards / CSS) */
.customer-account-page input[type="email"],
.customer-account-page input[type="password"] {
  text-transform: none;
}

.customer-account-page .catering-hero {
  padding-bottom: 1rem;
}

.customer-account-card {
  max-width: 28rem;
  margin: 0 auto 3rem;
  padding: 0 1rem 2rem;
}

.customer-account-wide {
  max-width: 52rem;
}

.customer-account-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e8e0d8;
}

.customer-account-section:last-of-type {
  border-bottom: none;
}

.customer-account-section-title {
  font-family: var(--font-primary, Georgia, serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: #333;
  margin: 0 0 0.75rem;
}

.customer-account-optional {
  font-weight: 400;
  color: #666;
  font-size: 0.9em;
}

.customer-account-legend {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.customer-account-form .catering-field {
  margin-bottom: 1rem;
}

/* Checkbox row: avoid catering-field width/padding applied to checkbox input */
.customer-account-form .customer-account-checkbox.catering-field {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
}

.customer-account-checkbox input[type="checkbox"] {
  width: auto;
  max-width: none;
  min-width: 1.125rem;
  min-height: 1.125rem;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  align-self: center;
  vertical-align: middle;
}

.customer-account-checkbox label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  cursor: pointer;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

/* Wrapped checkbox + copy (e.g. settings marketing opt-in): one flex child fills the row */
.customer-account-checkbox.catering-field > label:only-child {
  flex: 1 1 100%;
  width: 100%;
  align-items: flex-start;
}

.customer-account-checkbox.catering-field > label:only-child input[type="checkbox"] {
  align-self: flex-start;
  margin-top: 0.2em;
}

.customer-account-muted {
  margin-top: 1.25rem;
  font-size: 0.95rem;
  color: #555;
}

.customer-account-muted a {
  color: #9c1c34;
  text-decoration: underline;
}

.customer-account-note {
  font-size: 0.9rem;
  color: #555;
  margin-top: 1rem;
}

.customer-account-quick-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}

.customer-account-table-wrap {
  overflow-x: auto;
}

.customer-account-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.customer-account-table th,
.customer-account-table td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e8e0d8;
}

.customer-account-table th {
  font-weight: 600;
  color: #333;
}

.customer-account-actions {
  white-space: nowrap;
}

.customer-account-btn {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: #9c1c34;
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 4px;
  font-size: 0.9rem;
}

.customer-account-btn:hover {
  background: #7a1528;
}

/* Expandable order line items (customer dashboard) */
.customer-order-lines-row td {
  padding-top: 0;
  border-bottom: 1px solid #e8e0d8;
  vertical-align: top;
}

.customer-order-lines-details {
  margin: 0 0 0.75rem;
  padding: 0 0.75rem 0.5rem;
}

.customer-order-lines-summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: #9c1c34;
  padding: 0.35rem 0;
  user-select: none;
}

.customer-order-lines-summary::-webkit-details-marker {
  display: none;
}

.customer-order-lines-summary::before {
  content: "";
  display: inline-block;
  width: 0.35em;
  height: 0.35em;
  margin-right: 0.45em;
  border-right: 2px solid #9c1c34;
  border-bottom: 2px solid #9c1c34;
  transform: rotate(-45deg);
  vertical-align: 0.15em;
  transition: transform 0.15s ease;
}

.customer-order-lines-details[open] .customer-order-lines-summary::before {
  transform: rotate(45deg);
  vertical-align: 0.05em;
}

.customer-order-lines-body {
  padding: 0.5rem 0 0 1.1rem;
  font-size: 0.9rem;
  color: #444;
}

.customer-order-lines-list {
  margin: 0 0 0.75rem;
  padding-left: 1.1rem;
}

.customer-order-lines-list li {
  margin-bottom: 0.45rem;
  line-height: 1.45;
}

.customer-order-lines-primary {
  font-weight: 600;
  color: #333;
}

.customer-order-lines-secondary {
  font-weight: 400;
  color: #555;
}

.customer-order-lines-qty {
  color: #666;
  font-size: 0.92em;
  white-space: nowrap;
}

.customer-order-lines-empty {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: #666;
  max-width: 40rem;
}

.customer-order-lines-reorder {
  margin: 0;
}

.customer-account-legend {
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0;
  margin: 0 0 0.5rem;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1rem;
}

/*
 * Customer dashboard & settings must not use the catering form’s negative-margin
 * hero bleed: those pages are NOT wrapped in .catering-layout, so -20px pushes
 * past the viewport edge and mobile.css’s body { overflow-x: hidden } crops it.
 */
.customer-account-page.catering-page {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  /* Sticky footer (~100px) + iOS home indicator */
  padding-bottom: max(7.5rem, calc(env(safe-area-inset-bottom, 0px) + 6.5rem));
}

.customer-account-page .catering-hero {
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.customer-account-page .catering-hero p {
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.customer-account-card {
  box-sizing: border-box;
  max-width: min(52rem, 100%);
  width: 100%;
}

.customer-account-table-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scroll-padding: 0 4px;
}

/* Wide table: prefer horizontal scroll over squashed / clipped columns */
.customer-account-table {
  min-width: 32rem;
}

.customer-account-table td:nth-child(2),
.customer-account-table th:nth-child(2) {
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 12rem;
}

.customer-order-lines-list li {
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .customer-account-card {
    padding-left: max(0.75rem, env(safe-area-inset-left));
    padding-right: max(0.75rem, env(safe-area-inset-right));
    margin-bottom: 2rem;
  }

  .customer-account-page .catering-hero {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
    padding-top: 1.75rem;
    padding-bottom: 1.75rem;
  }

  .customer-account-quick-actions .customer-account-btn {
    flex: 1 1 calc(50% - 0.375rem);
    text-align: center;
  }

  .customer-account-table th,
  .customer-account-table td {
    padding: 0.45rem 0.5rem;
  }
}

@media (max-width: 400px) {
  .customer-account-quick-actions .customer-account-btn {
    flex: 1 1 100%;
  }

  .customer-account-table {
    min-width: 28rem;
    font-size: 0.875rem;
  }
}
