/* Apex Cosmetics: the remaining customer pages (round 17, DESIGN_PARITY_AUDIT.md). Linked in each page's markup, never
   in <head>. Two halves, each scoped to its own wrapper so nothing else is restyled:
   - .cs-page ... storefront pages: About, Contact, the public Rewards overview, Order status, "This page is no longer
     available" (retired routes) and "Page not found". Tokens come from cosmetics-storefront.css (.cs-page).
   - .cx-account ... account pages: Change password, Two-step sign-in, Stock alerts, Support tickets, Rewards and
     Affiliate sales. Tokens come from cosmetics-account.css (.cx-account).
   Navy / ink text on white or ivory only (every pair below is at least 4.5:1). */

/* ============================================================ storefront */
.cs-page label { padding: 0; }  /* app.css pads every label by .375rem */
.cs-section { padding-top: 40px; padding-bottom: 8px; }
.cs-section-soft { background: var(--cs-soft); margin-top: 40px; padding-top: 40px; padding-bottom: 48px; }
.cs-page .cs-section-title { font-size: clamp(26px, 2.6vw, 32px); margin-bottom: 20px; }
.cs-prose { max-width: 720px; }
.cs-lead-text { font-size: 19px; line-height: 1.6; color: var(--cs-ink); }
.cs-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* Message pages: retired routes, not found */
.cs-info { display: flex; justify-content: center; padding: 56px 16px 24px; }
.cs-info-card { display: flex; flex-direction: column; gap: 14px; width: 100%; max-width: 620px; padding: 40px 40px 34px; text-align: left;
    background: var(--cs-white); border: 1px solid var(--cs-line); border-radius: 14px; box-shadow: 0 14px 36px rgba(11, 31, 58, .08); }
.cs-page .cs-info-card h1 { font-size: clamp(28px, 3vw, 36px); color: var(--cs-navy); }
.cs-info-card p { color: var(--cs-ink); font-size: 17px; }
.cs-info-card .cs-actions { margin-top: 10px; }

/* Collection tiles (About) */
.cs-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; list-style: none; margin: 0; padding: 0; }
.cs-tile { display: flex; flex-direction: column; height: 100%; overflow: hidden; border: 1px solid var(--cs-line); border-radius: 12px; background: var(--cs-white);
    color: var(--cs-ink) !important; text-decoration: none !important; transition: box-shadow .15s, transform .15s; }
.cs-tile:hover { box-shadow: 0 10px 28px rgba(11, 31, 58, .12); transform: translateY(-2px); }
.cs-tile img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; background: var(--cs-tint); }
.cs-tile-body { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 18px; }
.cs-tile-body strong { font-family: var(--cs-serif); font-size: 21px; font-weight: 500; color: var(--cs-navy); }
.cs-tile-body span { color: var(--cs-muted); font-size: 15px; }

/* Contact (compact heading, support card first, shortcuts, short FAQ) */
.cs-contact-head { padding-top: 36px; padding-bottom: 4px; }
.cs-contact-head h1 { margin: 6px 0 8px; font-family: var(--cs-serif); font-size: clamp(30px, 4vw, 40px); font-weight: 500; color: var(--cs-navy); }
.cs-contact-lead { margin: 0; max-width: 560px; font-size: 17px; color: var(--cs-ink); }
.cs-contact { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: stretch; padding-top: 24px; }
.cs-card { padding: 28px; border: 1px solid var(--cs-line); border-radius: 14px; background: var(--cs-white); box-shadow: 0 1px 2px rgba(11, 31, 58, .04); }
.cs-page .cs-card h2 { font-size: 26px; margin-bottom: 12px; color: var(--cs-navy); }
.cs-card p + p { margin-top: 12px; }
.cs-contact-card { color: var(--cs-navy); }
.cs-contact-btn { margin: 18px 0 6px; }
.cs-contact-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.cs-contact-email { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cs-email-link { display: inline-flex; align-items: center; min-height: 44px; font-size: 18px; font-weight: 600; overflow-wrap: anywhere; user-select: text; }
.cs-contact-address { padding-top: 14px; border-top: 1px solid var(--cs-line); font-size: 15px; color: var(--cs-muted); }
.cs-contact-aside { display: flex; flex-direction: column; gap: 12px; }
.cs-page .cs-contact-aside-title { margin: 0 0 2px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--cs-muted); font-family: inherit; }
.cs-aside-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border: 1px solid var(--cs-line); border-radius: 12px; background: var(--cs-white); color: var(--cs-navy); }
.cs-aside-card > svg { flex: none; width: 24px; height: 24px; margin-top: 2px; fill: none; stroke: var(--cs-cobalt); stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.cs-aside-card > div { display: flex; flex-direction: column; gap: 2px; }
.cs-aside-card strong { color: var(--cs-navy); font-size: 16px; }
.cs-aside-card a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; font-weight: 600; color: var(--cs-cobalt); }
.cs-aside-card a:focus-visible, .cs-contact-faq summary:focus-visible { outline: 2px solid var(--cs-cobalt); outline-offset: 3px; border-radius: 4px; }
.cs-contact-faq { padding-top: 32px; padding-bottom: 48px; }
.cs-page .cs-contact-faq h2 { margin-bottom: 12px; font-size: 24px; color: var(--cs-navy); }
.cs-contact-faq details { border-top: 1px solid var(--cs-line); background: var(--cs-white); }
.cs-contact-faq details:last-of-type { border-bottom: 1px solid var(--cs-line); }
.cs-contact-faq summary { display: flex; align-items: center; min-height: 52px; padding: 10px 16px; font-weight: 600; color: var(--cs-navy); cursor: pointer; }
.cs-contact-faq details p { margin: 0; padding: 0 16px 16px; color: var(--cs-ink); }
.cs-contact-faq-more { margin: 14px 0 0; }
.cs-aside-card strong { color: var(--cs-navy); font-size: 16px; }
.cs-aside-card span { color: var(--cs-muted); font-size: 15px; }
.cs-aside-card .cs-aside-link { color: var(--cs-cobalt); font-weight: 600; }
.cs-checklist { margin: 12px 0 0; padding-left: 20px; }
.cs-checklist li + li { margin-top: 6px; }

/* Rewards overview */
.cs-rewards { padding-top: 32px; }
.cs-draft { padding: 14px 16px; border: 1px solid #f1d58a; border-radius: 8px; background: #fef3c7; color: #5b3a05; font-size: 15px; }
.cs-rule-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 22px 0 30px; }
.cs-rule-card { display: flex; flex-direction: column; gap: 6px; padding: 18px; border: 1px solid var(--cs-line); border-radius: 12px; background: var(--cs-white); }
.cs-rule-card strong { font-family: var(--cs-serif); font-size: 26px; font-weight: 500; color: var(--cs-navy); }
.cs-rule-card span { color: var(--cs-ink); font-size: 15px; }
.cs-page .cs-rewards h2 { font-size: 26px; margin-bottom: 12px; }
.cs-includes { margin: 0 0 16px; padding-left: 20px; max-width: 760px; }
.cs-includes li + li { margin-top: 8px; }

/* Order status */
.cs-order-status { max-width: 880px; padding-top: 36px; }
.cs-order-status .cs-card { margin-bottom: 18px; }
.cs-order-status .cs-auth-field { margin-bottom: 14px; max-width: 420px; }
.cs-order-status .cs-auth-submit { width: auto; padding: 0 26px; }
.cs-order-status .cs-auth-notice, .cs-order-status .cs-auth-alert { margin-bottom: 14px; }
.cs-steps { margin: 12px 0 0; padding-left: 20px; }
.cs-steps li + li { margin-top: 6px; }
.cs-order-note { margin-top: 14px; color: var(--cs-muted); font-size: 15px; }
.cs-divider { height: 1px; margin: 22px 0; background: var(--cs-line); border: 0; }
.cs-page .cs-subtitle { font-size: 22px; margin-bottom: 8px; color: var(--cs-navy); }
.cs-form-intro { margin-bottom: 16px !important; }
.cs-form-foot { margin-top: 12px !important; }
.cs-account-offer { margin-top: 18px; }
.cs-account-offer .cs-actions { margin-top: 14px; }
.cs-page .cs-card h3 { font-family: var(--cs-serif); font-size: 21px; font-weight: 500; margin-bottom: 8px; color: var(--cs-navy); }

@media (max-width: 900px) {
    .cs-contact { grid-template-columns: minmax(0, 1fr); }
    .cs-rule-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .cs-tiles { grid-template-columns: minmax(0, 1fr); }
    .cs-info { padding: 32px 16px 16px; }
    .cs-info-card { padding: 26px 20px 22px; }
    .cs-card { padding: 22px 18px; }
    .cs-rule-cards { grid-template-columns: minmax(0, 1fr); }
    .cs-actions .cs-btn { width: 100%; }
    .cs-order-status .cs-auth-submit { width: 100%; }
    .cs-lead-text { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
    .cs-tile { transition: none; }
    .cs-tile:hover { transform: none; }
}

/* ============================================================ account */
.cx-account .cx-panel { padding: 20px; margin-bottom: 16px; }
.cx-account .cx-panel > :last-child { margin-bottom: 0; }
.cx-account .cx-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.cx-account .cx-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--cx-ink); }
.cx-account .cx-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--cx-cobalt); }
.cx-account .cx-check label { padding: 0; }
.cx-account label { padding: 0; }
.cx-account .cx-field input, .cx-account .cx-field textarea { width: 100%; }
.cx-account .cx-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; max-width: 560px; }
.cx-account .cx-field-row .cx-field { max-width: none; }
.cx-account .cx-actions-row .cx-btn { min-height: 44px; }
.cx-account .cx-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cx-account .cx-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.cx-account .cx-row-main { display: grid; gap: 2px; min-width: 0; }
.cx-account .cx-row-main strong { color: var(--cx-navy); overflow-wrap: anywhere; }
.cx-account .cx-row-side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* Two-step sign-in: recovery codes and setup key */
.cx-account .cx-codes { margin: 10px 0 14px; padding: 14px 16px; border: 1px solid var(--cx-line); border-radius: var(--cx-radius-sm); background: var(--cx-bg);
    color: var(--cx-ink); font-size: 16px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-account .cx-code { padding: 2px 6px; border-radius: 4px; background: var(--cx-soft); color: var(--cx-ink); font-size: 15px; overflow-wrap: anywhere; }

/* Support tickets */
.cx-account .cx-ticket { margin-bottom: 12px; border-left: 4px solid var(--cx-line); }
.cx-account .cx-ticket.is-open { border-left-color: var(--cx-ok); }
.cx-account .cx-ticket.is-progress { border-left-color: #b45309; }
.cx-account .cx-ticket.is-resolved { border-left-color: var(--cx-cobalt); }
.cx-account .cx-ticket.is-denied { border-left-color: #b42318; }
.cx-account .cx-ticket-toggle { display: grid; gap: 6px; width: 100%; padding: 16px 18px; border: 0; background: transparent; color: var(--cx-ink); text-align: left;
    font: inherit; cursor: pointer; border-radius: var(--cx-radius); }
.cx-account .cx-ticket-toggle:hover { background: var(--cx-bg); }
.cx-account .cx-ticket-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.cx-account .cx-ticket-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cx-account .cx-ticket-text { margin: 0; color: var(--cx-ink); overflow-wrap: anywhere; }
.cx-account .cx-ticket-body { padding: 0 18px 18px; }
.cx-account .cx-thread-title { margin: 4px 0 0; font-family: var(--cx-sans); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cx-muted); }
.cx-account .cx-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--cx-navy); }
.cx-account .cx-thread {display: grid; gap: 8px; margin: 6px 0 14px; }
.cx-account .cx-msg { padding: 12px 14px; border: 1px solid var(--cx-line); border-left: 3px solid var(--cx-muted); border-radius: var(--cx-radius-sm); background: var(--cx-bg); }
.cx-account .cx-msg.is-customer { border-left-color: var(--cx-cobalt); }
.cx-account .cx-msg.is-staff { border-left-color: #b45309; background: var(--cx-white); }
.cx-account .cx-msg.is-denial { border-left-color: #b42318; background: var(--cx-white); }
.cx-account .cx-msg-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 13px; }
.cx-account .cx-msg-head strong { color: var(--cx-navy); }
.cx-account .cx-msg p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cx-account .cx-msg-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cx-account .cx-msg-images img { width: 80px; height: 80px; object-fit: cover; border-radius: var(--cx-radius-sm); }
.cx-account .cx-textarea { display: block; width: 100%; min-height: 88px; padding: 10px 12px; border: 1px solid #7d8799; border-radius: var(--cx-radius-sm); background: var(--cx-white);
    color: var(--cx-ink); font-size: 16px; resize: vertical; }
.cx-account .cx-textarea:focus { outline: 2px solid var(--cx-cobalt); outline-offset: 0; border-color: var(--cx-cobalt); }
.cx-account .cx-attach { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--cx-cobalt); font-weight: 600; font-size: 14px; cursor: pointer; }
.cx-account .cx-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cx-account .cx-attach:focus-within { outline: 2px solid var(--cx-cobalt); outline-offset: 2px; border-radius: 4px; }
.cx-account .cx-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cx-account .cx-thumb-wrap { position: relative; }
.cx-account .cx-thumb-wrap img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--cx-radius-sm); border: 1px solid var(--cx-line); }
.cx-account .cx-thumb-remove { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: #b42318; color: #fff;
    font-size: 16px; line-height: 28px; text-align: center; padding: 0; cursor: pointer; }
.cx-account .validation-message { margin: 0; font-size: 13px; color: var(--cx-stop-ink); }
.cx-account .cx-error-text { color: #b42318; font-size: 14px; }
.cx-account .cx-ok-text { color: #14532d; font-size: 14px; }

/* Rewards (signed in) */
.cx-account .cx-rw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.cx-account .cx-rw-grid > .is-wide { grid-column: 1 / -1; }
.cx-account .cx-rw-grid > .cx-card { padding: 20px; display: grid; gap: 12px; }
.cx-account .cx-rw-grid h2 { margin: 0; font-size: 20px; }
.cx-account .cx-rw-grid .cx-note { margin: 0; }
.cx-account .cx-rw-balance { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.cx-account .cx-rw-points { font-family: var(--cx-serif); font-size: 48px; line-height: 1; color: var(--cx-navy); }
.cx-account .cx-rw-tier { display: flex; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid var(--cx-line); border-radius: var(--cx-radius-sm); background: var(--cx-bg); }
.cx-account .cx-rw-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--cx-muted); }
.cx-account .cx-rw-value { display: block; margin-top: 2px; font-family: var(--cx-serif); font-size: 22px; color: var(--cx-navy); }
.cx-account .cx-rw-legend { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--cx-muted); margin-bottom: 6px; }
.cx-account .cx-rw-bar { height: 8px; border-radius: 999px; background: var(--cx-soft); overflow: hidden; }
.cx-account .cx-rw-bar span { display: block; height: 100%; min-width: 6px; border-radius: inherit; background: var(--cx-cobalt); }
.cx-account .cx-rw-rules { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.cx-account .cx-rw-activity { list-style: none; margin: 0; padding: 0; }
.cx-account .cx-rw-activity li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--cx-line); }
.cx-account .cx-rw-activity li:last-child { border-bottom: 0; }
.cx-account .cx-rw-activity small { display: block; color: var(--cx-muted); }
.cx-account .cx-rw-plus { color: #14532d; font-weight: 700; white-space: nowrap; }
.cx-account .cx-rw-minus { color: #b42318; font-weight: 700; white-space: nowrap; }
.cx-account .cx-table tr.is-current td { background: var(--cx-tint); }
.cx-account .cx-table .is-num { text-align: right; white-space: nowrap; }

/* Affiliate sales */
.cx-account .cx-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.cx-account .cx-stat { padding: 16px; display: grid; gap: 2px; }
.cx-account .cx-stat strong { font-family: var(--cx-serif); font-size: 24px; font-weight: 500; color: var(--cx-navy); }
.cx-account .cx-period { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 18px; }
.cx-account .cx-period .form-control { min-height: 44px; }

@media (max-width: 900px) {
    .cx-account .cx-rw-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .cx-account .cx-field-row { grid-template-columns: minmax(0, 1fr); }
    .cx-account .cx-stats { grid-template-columns: minmax(0, 1fr); }
    .cx-account .cx-rw-activity li { grid-template-columns: minmax(0, 1fr) auto; row-gap: 2px; }
    .cx-account .cx-rw-activity li > :first-child { grid-column: 1 / -1; }
    .cx-account .cx-rw-points { font-size: 40px; }
    .cx-account .cx-row-side { width: 100%; }
}
