/* ============================================================
   COMPONENTS.CSS — every reusable public-site component.
   Extracted out of the old inline <style> blocks in index.php
   and includes/footer.php (brief §21: no thousands of lines
   living inside page templates), then extended with the new
   premium pieces: hero 3D stage, featured-deals rail, category
   glass panels, coupon flip-reveal, toast.

   Depends on the token layer in theme.css. Contains NO colour
   literals except where a value must stay identical in both
   themes (semantic greens/reds and pure white text on accent).
   Ordering: buttons -> hero -> stats -> section shell -> cards
   -> code reveal -> marquee -> pills -> zones -> rail ->
   categories -> filters -> newsletter -> footer -> overlays.
   ============================================================ */

/* ============================================================
   BUTTONS
   .ch-btn        primary, gradient fill
   .ch-btn-ghost  secondary, outlined glass (brief §1 wants BOTH
                  a primary and a secondary hero CTA)
   .ch-magnetic   opt-in hook interactions.js uses to pull the
                  button toward the cursor
   ============================================================ */
.ch-btn,
.ch-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 13px 24px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    /* relative + overflow so the ripple interactions.js appends is
       clipped to the button's own rounded shape */
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease-out-quint),
                box-shadow 0.3s var(--ease-out-quint),
                background 0.3s, border-color 0.3s, color 0.3s;
}

/* Ripple ink, positioned from the real click point by JS. Sized and
   placed inline, so all this rule owns is the look and the motion. */
.ch-ripple {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    opacity: 0.6;
    animation: ch-ripple 0.6s var(--ease-out-quint) forwards;
}
.ch-btn-ghost .ch-ripple { background: var(--accent-glow-soft); }
@keyframes ch-ripple {
    to { transform: scale(1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .ch-ripple { display: none; }
}

/* Lazy logos: JS adds .is-loaded once the bitmap is actually decoded,
   so they cross-fade in instead of popping one at a time. The hidden
   state is gated on html.ch-img-fade, which interactions.js only adds
   immediately before it starts watching — if this file ever throws
   earlier than that, every image simply stays visible. */
.ch-card-logo img,
.ch-store-logo img,
img[loading="lazy"] {
    transition: opacity 0.4s ease;
}
html.ch-img-fade .ch-card-logo img:not(.is-loaded),
html.ch-img-fade .ch-store-logo img:not(.is-loaded),
html.ch-img-fade img[loading="lazy"]:not(.is-loaded) { opacity: 0; }
.ch-btn {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 8px 25px var(--accent-glow);
}
.ch-btn:hover {
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 16px 38px var(--accent-glow);
}
.ch-btn:active { transform: translateY(-1px); }

.ch-btn-ghost {
    background: var(--glass-bg);
    border-color: var(--border);
    color: var(--text);
}
@media (min-width: 768px) {
    .ch-btn-ghost {
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
    }
}
.ch-btn-ghost:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    background: var(--accent-glow-soft);
    transform: translateY(-3px);
}

/* Trailing arrow slides on hover — the "premium" tell in §12 */
.ch-btn i.ch-btn-arrow,
.ch-btn-ghost i.ch-btn-arrow {
    font-size: 0.8rem;
    transition: transform 0.35s var(--ease-out-quint);
}
.ch-btn:hover i.ch-btn-arrow,
.ch-btn-ghost:hover i.ch-btn-arrow { transform: translateX(5px); }

/* interactions.js writes --mx/--my in px; falls back to 0 with no JS */
.ch-magnetic {
    transform: translate3d(var(--mx, 0px), var(--my, 0px), 0);
    will-change: transform;
}

/* ============================================================
   HERO
   ============================================================ */
.ch-hero {
    position: relative;
    overflow: hidden;
    padding: 96px 0 72px;
    background: var(--hero-bg);
    border-bottom: 1px solid var(--border);
    transition: background var(--dur-theme), border-color var(--dur-theme);
}
/* Two large soft blobs, rotated so they never read as circles.
   Purely decorative, so they sit behind everything and ignore hits. */
.ch-hero::before,
.ch-hero::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    border-radius: 56px;
    background: var(--accent-gradient);
    opacity: 0.07;
    filter: blur(3px);
    transform: rotate(24deg);
    pointer-events: none;
}
.ch-hero::before { top: -140px; right: 7%; }
.ch-hero::after {
    bottom: -190px; left: -80px;
    background: linear-gradient(135deg, var(--accent-light), var(--accent-2));
}
.ch-hero > .container { position: relative; z-index: 2; }

/* ---- Hero copy ---- */
.ch-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 8px;
    margin-bottom: 22px;
    border-radius: 30px;
    background: var(--glass-bg);
    border: 1px solid var(--border-accent);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.ch-hero-eyebrow .ch-hero-eyebrow-dot {
    width: 20px; height: 20px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.6rem;
}
.ch-hero-heading {
    font-size: var(--fs-display);
    font-weight: 850;
    letter-spacing: -0.045em;
    line-height: 0.98;
    margin-bottom: 22px;
    color: var(--text);
}
/* One accented span inside the headline — single hue, per §16 */
.ch-hero-heading .ch-accent-text {
    background: linear-gradient(120deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.ch-hero-sub {
    color: var(--text-secondary);
    font-size: 1.08rem;
    line-height: 1.65;
    margin-bottom: 30px;
    max-width: 540px;
}
.ch-hero-cta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 26px;
}

/* ---- Hero search: glass field with an animated focus ring ---- */
.ch-hero-search { max-width: 560px; }
.ch-hero-search-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 6px 18px;
    border-radius: 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: border-color 0.3s, box-shadow 0.3s, background var(--dur-theme);
}
/* Focus ring drawn on a pseudo-element so it can scale independently */
.ch-hero-search-field::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 19px;
    border: 1.5px solid var(--accent);
    opacity: 0;
    transform: scale(1.02);
    transition: opacity 0.3s var(--ease-out-quint), transform 0.3s var(--ease-out-quint);
    pointer-events: none;
}
.ch-hero-search-field:focus-within {
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-glow-soft);
}
.ch-hero-search-field:focus-within::after { opacity: 1; transform: scale(1); }
.ch-hero-search-field > i.fa-search {
    color: var(--text-muted);
    font-size: 0.95rem;
    transition: color 0.3s, transform 0.3s var(--ease-out-quint);
}
.ch-hero-search-field:focus-within > i.fa-search {
    color: var(--accent);
    transform: scale(1.12);
}
.ch-hero-search-field input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    padding: 12px 0;
}
.ch-hero-search-field input::placeholder { color: var(--text-muted); }
.ch-hero-search-field button[type="submit"] {
    flex-shrink: 0;
    border: none;
    border-radius: 13px;
    padding: 12px 22px;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.25s var(--ease-out-quint), box-shadow 0.25s;
}
.ch-hero-search-field button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px var(--accent-glow);
}
/* Quick-search suggestions under the field */
.ch-hero-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
}
/* "Popular:" prefix — deliberately quieter than the pills next to it */
.ch-hero-tag-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ch-hero-tag {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 13px;
    border-radius: 20px;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: color 0.25s, background 0.25s, border-color 0.25s, transform 0.25s;
}
.ch-hero-tag:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    background: var(--accent-glow-soft);
    transform: translateY(-2px);
}

/* ---- Hero right column: 3D stage ----------------------------
   The canvas is ALWAYS rendered now (it used to appear only when
   no featured deal existed). When a featured deal is present the
   deal card floats in front of the canvas instead of replacing
   it, which is what gives the hero its depth.
   ------------------------------------------------------------- */
.ch-hero-stage {
    position: relative;
    min-height: 460px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ch-hero-canvas {
    position: absolute;
    inset: -8% -6%;
    z-index: 1;
    pointer-events: none;
}
.ch-hero-canvas canvas { display: block; width: 100%; height: 100%; }
/* Shown when WebGL is skipped, so the column is never empty */
.ch-hero-canvas-fallback {
    background:
        radial-gradient(340px circle at 62% 34%, var(--accent-glow-soft), transparent 62%),
        radial-gradient(300px circle at 30% 72%, var(--accent-2-glow-soft), transparent 64%);
}

/* Floating discount badges layered around the stage (§1).
   animations.js gives each a slow independent float. */
.ch-hero-badge {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: 14px;
    font-weight: 800;
    font-size: 0.86rem;
    letter-spacing: -0.01em;
    color: var(--text);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    pointer-events: none;
    white-space: nowrap;
}
@media (min-width: 768px) {
    .ch-hero-badge {
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
    }
}
.ch-hero-badge i { color: var(--accent); font-size: 0.8rem; }
.ch-hero-badge.ch-hero-badge-ok i { color: var(--ok); }
.ch-hero-badge-1 { top: 6%;  left: -2%; }
.ch-hero-badge-2 { top: 34%; right: -3%; }
.ch-hero-badge-3 { bottom: 9%; left: 6%; }

/* ---- Featured deal card floating on the stage ---- */
.ch-hero-deal {
    position: relative;
    z-index: 4;
    width: 100%;
    max-width: 420px;
    overflow: hidden;
    padding: 30px;
    border-radius: 26px;
    color: var(--text);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    transform: perspective(1000px) rotateY(-6deg) rotateX(3deg);
    transform-style: preserve-3d;
    transition: transform 0.5s var(--ease-out-quint), box-shadow 0.5s,
                background var(--dur-theme), border-color var(--dur-theme);
}
@media (min-width: 768px) {
    .ch-hero-deal {
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
    }
}
.ch-hero-deal:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg) translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}
.ch-hero-deal::after {
    content: '';
    position: absolute;
    width: 190px; height: 190px;
    right: -70px; top: -75px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.07;
    pointer-events: none;
}
.ch-hero-deal > * { position: relative; z-index: 1; }
.ch-hero-deal h2 {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 12px;
    color: var(--text);
}
.ch-hero-deal p {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: 18px;
}
.ch-hero-deal-logo {
    width: 54px; height: 54px;
    padding: 8px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--dur-theme), border-color var(--dur-theme);
}
.ch-hero-deal-logo img { width: 100%; height: 100%; object-fit: contain; }
/* Shared store-logo placeholder: FA tag glyph via ::after so the
   markup does not need a second element when a logo is missing. */
.ch-logo-fallback {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: var(--accent-glow-soft) !important;
}
.ch-logo-fallback::after {
    content: '\f54e';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    color: var(--accent);
    font-size: 1.05rem;
}

/* ============================================================
   STATS STRIP
   ============================================================ */
.ch-stats {
    background: var(--bg-surface-t);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 34px 0;
    transition: background var(--dur-theme), border-color var(--dur-theme);
}
@media (min-width: 768px) {
    .ch-stats {
        backdrop-filter: blur(10px) saturate(1.2);
        -webkit-backdrop-filter: blur(10px) saturate(1.2);
    }
}
.ch-stat-num {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    background: linear-gradient(135deg, var(--text), var(--accent-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.ch-stat-label {
    color: var(--text-muted);
    font-size: var(--fs-meta);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ============================================================
   SECTION SHELL
   Sections are transparent so the ambient WebGL field reads
   through; ".ch-alt" zones get a glassy tint to separate them.
   Backdrop blur is desktop-only — it is the single most
   expensive thing on a mobile GPU (§17).
   ============================================================ */
.ch-section { padding: 88px 0; background: transparent; position: relative; }
.ch-section.ch-alt { background: var(--bg-surface-t); }
@media (min-width: 768px) {
    .ch-section.ch-alt {
        backdrop-filter: blur(12px) saturate(1.2);
        -webkit-backdrop-filter: blur(12px) saturate(1.2);
    }
}
.ch-section-head { margin-bottom: 32px; }
/* Page titles: coupons.php, stores.php, categories.php and search.php
   all put an <h1> in the section head, which until now fell through to
   Bootstrap's default h1 and missed the tuned scale and tracking. */
.ch-section-head h1 {
    font-size: var(--fs-h1);
    font-weight: 850;
    letter-spacing: -0.035em;
    line-height: 1.08;
    margin-bottom: 8px;
    color: var(--text);
}
.ch-section-head h2 {
    font-size: var(--fs-h2);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
    color: var(--text);
}
.ch-section-head p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}
.ch-viewall {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    transition: gap 0.25s var(--ease-out-quint), color 0.25s;
}
.ch-viewall:hover { color: var(--accent-dark); gap: 12px; }
[data-theme="dark"] .ch-viewall:hover { color: var(--accent-light); }

/* ============================================================
   COUPON CARD (brief §4)
   Every card carries: store logo, store name, category, verified
   badge, title, discount, expiry, code row, CTA and a save
   button. `perspective` lives on the card itself so the tilt in
   interactions.js and the reveal flip share one 3D context.
   ============================================================ */
.ch-card {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 22px;
    /* overflow: hidden is removed to allow the 3D flip to work correctly.
       The reveal face (back face) is an absolutely positioned child that
       rotates in 3D space; overflow: hidden on the parent would clip it
       during the flip animation. */
    border-radius: 22px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transform-style: preserve-3d;
    /* ONE transform for the whole card, composed from custom
       properties so the pointer tilt (--tx/--ty, written by
       interactions.js) and the reveal flip (--fy) can never overwrite
       each other. perspective() has to live INSIDE the transform: the
       `perspective` property only affects descendants, not the
       element itself, so the flip would otherwise be flat.
       The transform transition is what animates the flip; while the
       pointer is tilting, .is-tilting removes it so tracking is
       instant instead of lagging 0.6s behind the cursor. */
    --tx: 0deg;
    --ty: 0deg;
    --fy: 0deg;
    --lift: 0px;
    transform: perspective(1000px) translateY(var(--lift))
               rotateY(var(--fy)) rotateX(var(--tx)) rotateY(var(--ty));
    transition: transform 0.6s var(--ease-out-quint),
                box-shadow 0.4s var(--ease-out-quint),
                border-color 0.35s,
                background var(--dur-theme);
}
.ch-card.is-tilting {
    transition: box-shadow 0.4s var(--ease-out-quint),
                border-color 0.35s,
                background var(--dur-theme);
}
/* Flipped: the card turns, and the front content is taken out of
   sight AND out of the accessibility tree — mirrored text behind a
   coupon code would otherwise still be read out and focusable. */
.ch-card.is-flipped { --fy: 180deg; }
.ch-card.is-flipped > *:not(.ch-card-reveal) {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s linear;
}
/* Accent hairline that wipes in from the left on hover */
.ch-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 5;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s var(--ease-out-quint);
}
.ch-card:hover::before { transform: scaleX(1); }
.ch-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--card-hover-shadow);
}
/* Real content sits above the glow/shine layers injected by JS.
   .ch-card-reveal is excluded as well: this selector carries three
   classes of specificity and would otherwise beat .ch-card-reveal's
   own `position:absolute; z-index:6`, dropping the reveal face back
   into the flow as a relatively-positioned block. */
.ch-card > *:not(.ch-card-glow):not(.ch-card-shine):not(.ch-card-reveal) {
    position: relative;
    z-index: 3;
}

/* Cursor-tracking layers (injected by interactions.js).
   --mouse-x / --mouse-y are written as percentages. */
.ch-card-glow,
.ch-card-shine {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s;
}
.ch-card-glow {
    z-index: 1;
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
                var(--accent-glow-soft), transparent 42%);
}
.ch-card-shine {
    z-index: 2;
    background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
                rgba(255, 255, 255, 0.07), transparent 40%);
}
.ch-card:hover .ch-card-glow,
.ch-card:hover .ch-card-shine { opacity: 1; }

/* Content parallax (§4 "content parallax").
   interactions.js writes --px/--py in px on the CARD; every element
   marked data-parallax drifts by that value times its own --pdepth,
   so the logo, discount and title separate slightly as the card
   tilts. Cheap (one composited translate each), and with no JS the
   variables resolve to 0px so nothing moves. */
.ch-card [data-parallax] {
    transform: translate3d(calc(var(--px, 0px) * var(--pdepth, 1)),
                           calc(var(--py, 0px) * var(--pdepth, 1)), 0);
    transition: transform 0.5s var(--ease-out-quint);
}
/* While actively tracking the pointer the drift must be instant, for
   the same reason .is-tilting drops the card's own transition. */
.ch-card.is-tilting [data-parallax] { transition: none; }

/* ---- Card head: logo + store + category ---- */
.ch-card-store {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 12px;
    padding-right: 42px; /* clears the absolutely-placed save button */
}
.ch-card-logo {
    width: 40px; height: 40px;
    flex-shrink: 0;
    padding: 5px;
    border-radius: 10px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: background var(--dur-theme), border-color var(--dur-theme), transform 0.3s var(--ease-out-quint);
}
.ch-card:hover .ch-card-logo { transform: scale(1.06); }
.ch-card-logo img { width: 100%; height: 100%; object-fit: contain; }
.ch-card-store-meta { min-width: 0; }
.ch-card-store-name {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Verified badge — the ONLY place the secondary accent is a fill */
.ch-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--accent-2);
}
.ch-verified i { font-size: 0.7rem; }
.ch-card-category {
    display: block;
    font-size: var(--fs-meta);
    color: var(--text-muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---- Card body ---- */
.ch-card-title {
    margin: 6px 0 12px;
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.45;
    min-height: 46px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ch-card-metarow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
/* Optional extra meta line (e.g. "Saved on 3 Aug 2026" on
   saved-coupons.php). Emitted by ch_coupon_card()'s $opts['note']. */
.ch-card-note {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: var(--fs-meta);
    font-weight: 600;
    color: var(--text-muted);
}
/* Discount chip — large, because it is what the user scans for */
.ch-discount {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    padding: 4px 11px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.92rem;
    letter-spacing: -0.02em;
    color: var(--accent);
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
}
.ch-expiry {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: var(--fs-meta);
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}
.ch-expiry.is-soon { color: var(--heart); }
.ch-expiry i { font-size: 0.72rem; }
.ch-exclusive-tag {
    display: inline-block;
    margin-bottom: 10px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
}
/* Bootstrap badge inside a card, re-tinted to the token system */
.ch-card .badge {
    background: var(--accent-glow-soft) !important;
    color: var(--accent) !important;
    border: 1px solid var(--border-accent) !important;
    font-weight: 600;
}
[data-theme="dark"] .ch-card .badge,
[data-theme="dark"] .ch-discount,
[data-theme="dark"] .ch-exclusive-tag { color: var(--accent-light) !important; }
/* The CTA is always pinned to the bottom so ragged card heights
   still line their buttons up across a row. */
.ch-card > .ch-btn,
.ch-card > .ch-card-cta { margin-top: auto; }

/* ---- Save / favourite button ---- */
.ch-save-btn,
.ch-login-nudge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s var(--ease-out-quint), color 0.2s,
                border-color 0.2s, background 0.2s;
}
.ch-save-btn {
    position: absolute;
    top: 18px; right: 18px;
    z-index: 4;
}
.ch-save-btn:hover,
.ch-login-nudge:hover,
.ch-save-btn.ch-saved {
    color: var(--heart);
    border-color: var(--heart-border);
    background: var(--heart-soft);
}
.ch-save-btn:hover,
.ch-login-nudge:hover { transform: scale(1.12); }
.ch-login-nudge { width: 30px; height: 30px; font-size: 0.85rem; }
/* Heart pop when a save succeeds (class added then removed by JS) */
.ch-save-btn.ch-pop { animation: ch-heart-pop 0.45s var(--ease-out-quint); }

/* ============================================================
   CODE ROW + 3D REVEAL (brief §5)
   Locked state shows a masked code and a "Get Code" button.
   On success the whole card performs a real 3D half-turn and the
   .ch-card-reveal face is what the user sees on the way back —
   no modal, no page jump, exactly as §5 requires.
   ============================================================ */
.ch-code-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 48px;
    margin-top: 14px;
    padding: 8px 10px 8px 14px;
    border-radius: 12px;
    background: var(--accent-glow-soft);
    border: 1px dashed var(--border-accent);
    transition: background var(--dur-theme), border-color var(--dur-theme);
}
.ch-code-actions { display: flex; align-items: center; gap: 6px; }
.ch-code {
    font-family: 'Courier New', ui-monospace, monospace;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: var(--accent);
    word-break: break-all;
}
[data-theme="dark"] .ch-code { color: var(--accent-light); }
.ch-code-mask { color: var(--text-muted); letter-spacing: 3px; font-weight: 800; }
.ch-code-revealed {
    border-style: solid;
    background: var(--ok-soft);
    border-color: var(--ok-border);
}
.ch-code-revealed .ch-code { color: var(--ok); }
.ch-copy-btn,
.ch-unlock-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 9px;
    padding: 8px 13px;
    background: var(--accent);
    color: #fff;
    font-size: 0.77rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s var(--ease-out-quint), background 0.2s;
}
.ch-copy-btn:hover,
.ch-unlock-btn:hover { background: var(--accent-dark); transform: translateY(-2px); }
.ch-copy-btn.is-copied { background: var(--ok); }
.ch-unlock-btn[disabled] { opacity: 0.65; cursor: progress; transform: none; }

/* ---- The revealed "back" face of the card ---- */
.ch-card-reveal {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 26px 22px;
    text-align: center;
    border-radius: inherit;
    background: var(--bg-card);
    /* Counter-rotated so that when the card turns 180deg this face
       reads the right way round. backface-visibility keeps it hidden
       while the card is still front-facing. */
    transform: rotateY(180deg);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Perforated ticket edge, drawn with a repeating gradient so no
       extra element or image is needed. */
    border-top: 2px dashed var(--border-accent);
    border-bottom: 2px dashed var(--border-accent);
}
.ch-card-reveal::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 50% 0%, var(--accent-glow-soft), transparent 62%);
    pointer-events: none;
}
.ch-card-reveal > * { position: relative; }
/* While the card faces front the reveal face must be genuinely inert.
   backface-visibility hides it from view, but its copy button would
   still be tabbable — keyboard users would land on an invisible
   control. The face is left in the DOM on purpose so re-opening an
   already-revealed coupon costs no second request. */
.ch-card:not(.is-flipped) .ch-card-reveal {
    visibility: hidden;
    pointer-events: none;
    /* Delayed so the face is still there for the first half of the
       turn back, when it is genuinely still facing the viewer. */
    transition: visibility 0s linear 0.3s;
}

/* Explicitly show the reveal face when the card is flipped.
   This ensures the face becomes visible immediately when .is-flipped
   is added, without relying on the default visibility which can be
   affected by the transition on the :not(.is-flipped) rule. */
.ch-card.is-flipped .ch-card-reveal {
    visibility: visible;
    pointer-events: auto;
}
.ch-card-reveal .ch-reveal-store {
    font-size: var(--fs-meta);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ch-card-reveal .ch-reveal-code {
    display: inline-block;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'Courier New', ui-monospace, monospace;
    font-size: 1.28rem;
    font-weight: 800;
    letter-spacing: 2px;
    word-break: break-all;
    color: var(--ok);
    background: var(--ok-soft);
    border: 1px dashed var(--ok-border);
}
.ch-card-reveal .ch-reveal-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0;
}
.ch-card-reveal .ch-reveal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}
/* Small ghost button used for "Back" / "Visit store" on the face */
.ch-reveal-back {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 9px;
    padding: 8px 13px;
    font-size: 0.77rem;
    font-weight: 700;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.ch-reveal-back:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    background: var(--accent-glow-soft);
}
/* Success burst — a ring that expands once and fades */
.ch-reveal-burst {
    position: absolute;
    left: 50%; top: 50%;
    width: 40px; height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 50%;
    border: 2px solid var(--ok);
    opacity: 0;
    pointer-events: none;
}
.ch-reveal-burst.is-on { animation: ch-burst 0.7s var(--ease-out-quint) forwards; }

/* ============================================================
   STORE MARQUEE
   The edge masks use a mask-image rather than a solid gradient
   overlay so the strip fades against whatever is behind it —
   including the translucent .ch-alt tint and the WebGL field.
   ============================================================ */
.ch-marquee-wrap {
    position: relative;
    overflow: hidden;
    padding: 30px 0;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.ch-marquee-track { display: flex; gap: 24px; width: max-content; }
.ch-marquee-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 132px;
    padding: 18px 24px;
    border-radius: 18px;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: transform 0.35s var(--ease-out-quint), border-color 0.3s,
                box-shadow 0.3s, background var(--dur-theme), color 0.3s;
}
.ch-marquee-item:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow);
    transform: translateY(-5px) scale(1.04);
}
.ch-marquee-item img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: grayscale(0.35);
    transition: filter 0.3s;
}
.ch-marquee-item:hover img { filter: grayscale(0); }
.ch-marquee-item span { font-size: 0.82rem; font-weight: 600; }

/* ============================================================
   PILLS (category shortcuts, filter chips)
   ============================================================ */
.ch-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0 8px 8px 0;
    padding: 10px 18px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.87rem;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    text-decoration: none;
    transition: transform 0.3s var(--ease-out-quint), background 0.3s,
                border-color 0.3s, box-shadow 0.3s, color 0.3s;
}
.ch-pill:hover,
.ch-pill.is-active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 8px 25px var(--accent-glow);
    transform: translateY(-3px);
}
.ch-pill.is-active { transform: none; }

/* ============================================================
   ZONE DIVIDER
   Pinned while scrolling past; bg-scene re-tints the ambient
   field during the pin (see the zone trigger in animations.js).
   ============================================================ */
.ch-zone-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 48px 0;
    overflow: hidden;
}
.ch-zone-line {
    height: 1px;
    flex: 1;
    max-width: 220px;
    background: linear-gradient(90deg, transparent, var(--border-accent));
}
.ch-zone-line:last-child { background: linear-gradient(-90deg, transparent, var(--border-accent)); }
.ch-zone-label {
    font-size: clamp(1.6rem, 4vw, 2.6rem);
    font-weight: 850;
    letter-spacing: -0.03em;
    white-space: nowrap;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ============================================================
   FEATURED DEALS RAIL (brief §6)
   Vertical scroll is translated into horizontal movement by a
   pinned ScrollTrigger in animations.js, which writes
   translateX on .ch-rail-track. Below 768px the pin is skipped
   and the rail becomes a native scroll-snap carousel — a real
   mobile layout rather than a shrunken desktop one (§18).
   ============================================================ */
.ch-rail-section { padding: 88px 0 0; position: relative; }
.ch-rail-viewport { position: relative; overflow: hidden; }
.ch-rail-track {
    display: flex;
    gap: 26px;
    padding: 8px 0 40px;
    will-change: transform;
}
.ch-rail-card {
    position: relative;
    flex: 0 0 auto;
    width: min(78vw, 420px);
    overflow: hidden;
    border-radius: 26px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: border-color 0.35s, box-shadow 0.4s var(--ease-out-quint),
                background var(--dur-theme);
}
.ch-rail-card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--card-hover-shadow);
}
/* Image is oversized and shifted by JS for a parallax interior */
.ch-rail-media {
    position: relative;
    height: 210px;
    overflow: hidden;
    background: var(--bg-elevated);
}
.ch-rail-media img {
    width: 100%;
    height: 118%;
    object-fit: cover;
    will-change: transform;
}
.ch-rail-media.ch-rail-media-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(300px circle at 30% 30%, var(--accent-glow-soft), transparent 60%),
        var(--bg-elevated);
}
.ch-rail-media.ch-rail-media-empty i { font-size: 2.4rem; color: var(--accent); opacity: 0.5; }

.ch-rail-badge {
    position: absolute;
    top: 14px; left: 14px;
    z-index: 2;
    padding: 7px 13px;
    border-radius: 12px;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: -0.02em;
    color: #fff;
    background: var(--accent);
    box-shadow: 0 6px 18px var(--accent-glow);
}
.ch-rail-logo {
    position: absolute;
    bottom: -22px; right: 18px;
    z-index: 2;
    width: 52px; height: 52px;
    padding: 8px;
    border-radius: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ch-rail-logo img { width: 100%; height: 100%; object-fit: contain; }
.ch-rail-body { padding: 26px 22px 22px; }
.ch-rail-body h3 {
    font-size: 1.12rem;
    line-height: 1.4;
    margin-bottom: 8px;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ch-rail-body p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ch-rail-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* Rail progress indicator (§6) */
.ch-rail-progress {
    position: relative;
    height: 3px;
    margin: 4px 0 0;
    border-radius: 4px;
    background: var(--border);
    overflow: hidden;
}
.ch-rail-progress-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 18%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transform-origin: left;
}
.ch-rail-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    font-size: var(--fs-meta);
    color: var(--text-muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Mobile: no pin, native horizontal snap scrolling instead */
@media (max-width: 767px) {
    .ch-rail-section { padding: 56px 0 0; }
    .ch-rail-viewport {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ch-rail-viewport::-webkit-scrollbar { display: none; }
    .ch-rail-track { transform: none !important; padding-bottom: 24px; }
    .ch-rail-card { width: 84vw; scroll-snap-align: center; }
}

/* ============================================================
   CATEGORY GLASS PANELS (brief §7)
   Floating glass tiles with a real 3D tilt on hover. The moving
   background is a single slow-drifting gradient, not a stack of
   animated layers — §7 asks for "not excessive gradients".
   ============================================================ */
.ch-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}
.ch-cat-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    min-height: 168px;
    padding: 24px 22px;
    overflow: hidden;
    border-radius: 22px;
    text-decoration: none;
    color: var(--text);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-sm);
    transform-style: preserve-3d;
    perspective: 900px;
    transition: transform 0.45s var(--ease-out-quint), box-shadow 0.45s,
                border-color 0.35s, background var(--dur-theme);
}
@media (min-width: 768px) {
    .ch-cat-panel {
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
    }
}
/* Drifting tint behind the glass — animation lives in animations.css */
.ch-cat-panel::before {
    content: '';
    position: absolute;
    inset: -40%;
    z-index: 0;
    background: conic-gradient(from 0deg,
        var(--accent-glow-soft), transparent 38%,
        var(--accent-2-glow-soft) 62%, transparent);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}
.ch-cat-panel:hover::before { opacity: 1; }
.ch-cat-panel > * { position: relative; z-index: 1; }
.ch-cat-panel:hover {
    color: var(--text);
    border-color: var(--border-accent);
    box-shadow: var(--card-hover-shadow);
    transform: translateY(-6px);
}
.ch-cat-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px; height: 50px;
    border-radius: 15px;
    font-size: 1.2rem;
    color: var(--accent);
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
    transition: transform 0.45s var(--ease-out-quint), background 0.35s, color 0.35s;
}
.ch-cat-panel:hover .ch-cat-icon {
    transform: translateZ(26px) rotate(-8deg);
    background: var(--accent);
    color: #fff;
}
.ch-cat-name {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin: 0;
}
.ch-cat-count {
    font-size: var(--fs-meta);
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.ch-cat-panel .ch-cat-go {
    margin-top: auto;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap 0.3s var(--ease-out-quint);
}
.ch-cat-panel:hover .ch-cat-go { gap: 11px; }

/* ============================================================
   STORE TILES — stores.php and category.php
   Ported out of the inline <style> stores.php used to carry, so
   the two pages share one definition and the rules stop being
   re-sent on every request. Kept as a distinct component from
   .ch-cat-panel because a store tile leads with a logo PLATE
   (brands need a neutral background to sit on) rather than an
   icon chip, and its whole surface is the link.
   ============================================================ */
.ch-store-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border-radius: 20px;
    text-decoration: none;
    color: var(--text);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.45s var(--ease-out-quint), box-shadow 0.45s,
                border-color 0.35s, background var(--dur-theme);
}
/* Accent bar that wipes in across the top edge on hover — the
   cheapest possible "this is interactive" cue (transform only). */
.ch-store-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    z-index: 2;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.45s var(--ease-out-quint);
}
.ch-store-tile:hover::before,
.ch-store-tile:focus-visible::before { transform: scaleX(1); }
.ch-store-tile:hover,
.ch-store-tile:focus-visible {
    color: var(--text);
    transform: translateY(-6px);
    border-color: var(--border-accent);
    box-shadow: var(--card-hover-shadow);
}
/* Fixed-height plate so a wall of logos lines up no matter how
   differently the uploaded files are proportioned. */
.ch-store-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 130px;
    padding: 20px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    transition: background var(--dur-theme);
}
.ch-store-logo img {
    max-width: 100%;
    max-height: 84px;
    width: auto;
    object-fit: contain;
    transition: transform 0.45s var(--ease-out-quint);
}
.ch-store-tile:hover .ch-store-logo img { transform: scale(1.06); }
.ch-store-icon-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 62px; height: 62px;
    border-radius: 18px;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent);
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
}
.ch-store-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 auto;
    padding: 18px 18px 20px;
}
.ch-store-name {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
}
.ch-store-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ch-badge-count,
.ch-badge-featured {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.ch-badge-count {
    color: var(--accent);
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
}
.ch-badge-featured {
    color: #fff;
    background: var(--accent-gradient);
    border: 1px solid transparent;
}
.ch-store-desc {
    margin: 0;
    font-size: var(--fs-meta);
    line-height: 1.55;
    color: var(--text-muted);
}
.ch-store-cat {
    margin-top: auto;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   SEARCH RESULTS + FILTER BAR (brief §8)
   Used by search.php and coupons.php. Every control is a plain
   <a>/<select> inside a GET form, so filtering keeps working
   with JS disabled and the existing query params are untouched.
   ============================================================ */
.ch-searchbox {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px 6px 18px;
    border-radius: 18px;
    background: var(--glass-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: border-color 0.3s, box-shadow 0.3s, background var(--dur-theme);
}
@media (min-width: 768px) {
    .ch-searchbox {
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
    }
}
.ch-searchbox:focus-within {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg), 0 0 0 4px var(--accent-glow-soft);
}
.ch-searchbox > i.fa-search { color: var(--text-muted); transition: color 0.3s; }
.ch-searchbox:focus-within > i.fa-search { color: var(--accent); }
.ch-searchbox input {
    flex: 1;
    min-width: 0;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    padding: 13px 0;
}
.ch-searchbox input::placeholder { color: var(--text-muted); }
.ch-searchbox button[type="submit"] {
    flex-shrink: 0;
    border: none;
    border-radius: 13px;
    padding: 12px 22px;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: transform 0.25s var(--ease-out-quint), box-shadow 0.25s;
}
.ch-searchbox button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px var(--accent-glow);
}

.ch-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 16px 18px;
    margin: 22px 0 28px;
    border-radius: 18px;
    background: var(--bg-surface-t);
    border: 1px solid var(--border);
    transition: background var(--dur-theme), border-color var(--dur-theme);
}
.ch-filterbar-label {
    font-size: var(--fs-meta);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-right: 4px;
}
.ch-filter-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 9px 34px 9px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    background-color: var(--bg-card);
    /* Chevron drawn as an inline SVG data URI — no extra request,
       and currentColor is not available in background-image so the
       muted grey is hard-coded to a theme-neutral tone. */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 14px 14px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.25s, box-shadow 0.25s, background-color var(--dur-theme);
}
.ch-filter-select:hover { border-color: var(--border-accent); }
.ch-filter-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.ch-filter-clear {
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    transition: color 0.2s;
}
.ch-filter-clear:hover { color: var(--heart); }
/* The bar's own submit button. .ch-btn is 13px/24px and 14px-radius by
   default, which stands ~6px taller than .ch-filter-select and makes
   the row look mis-set; this matches it to the selects sitting beside
   it without touching .ch-btn anywhere else. coupons.php needs a real
   submit button because its filters are a plain GET form — the page
   ships no JavaScript of its own. */
.ch-filterbar .ch-btn {
    padding: 9px 20px;
    font-size: 0.85rem;
    border-radius: 12px;
    box-shadow: 0 6px 18px var(--accent-glow);
}
.ch-filterbar .ch-btn:hover { transform: translateY(-2px); }

/* Result count / empty state */
.ch-result-count { font-size: 0.9rem; color: var(--text-secondary); }
.ch-result-count strong { color: var(--text); }
.ch-result-count a { color: var(--accent); font-weight: 700; }
.ch-result-count a:hover { text-decoration: underline; }
.ch-empty {
    text-align: center;
    padding: 70px 24px;
    border-radius: 22px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
}
.ch-empty i { font-size: 2.6rem; color: var(--accent); opacity: 0.45; margin-bottom: 16px; }
.ch-empty h3 { margin-bottom: 8px; }
.ch-empty p { color: var(--text-secondary); margin-bottom: 20px; }

/* ============================================================
   NEWSLETTER PANEL (index.php section)
   ============================================================ */
.ch-newsletter {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    padding: 52px 0;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: background var(--dur-theme), border-color var(--dur-theme), box-shadow 0.3s;
}
.ch-newsletter::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(520px circle at 12% 0%, var(--accent-glow-soft), transparent 62%),
                radial-gradient(420px circle at 88% 100%, var(--accent-2-glow-soft), transparent 60%);
    pointer-events: none;
}
.ch-newsletter > * { position: relative; }
.ch-newsletter h2 { color: var(--text); }
.ch-newsletter p { color: var(--text-secondary); }
.ch-newsletter input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 12px 0 0 12px;
    padding: 13px 16px;
    transition: background var(--dur-theme), border-color 0.25s, color var(--dur-theme), box-shadow 0.25s;
}
.ch-newsletter input::placeholder { color: var(--text-muted); }
.ch-newsletter input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.ch-newsletter .ch-sub-btn {
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 0 12px 12px 0;
    font-weight: 700;
    padding: 0 24px;
    transition: transform 0.25s var(--ease-out-quint), box-shadow 0.25s;
}
.ch-newsletter .ch-sub-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px var(--accent-glow);
}

/* Inline form feedback used by subscribe.php / contact.php */
.ch-alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px 17px;
    margin-bottom: 20px;
    border-radius: 14px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
}
.ch-alert i { margin-top: 2px; }
.ch-alert-ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.ch-alert-err { background: var(--heart-soft); border-color: var(--heart-border); color: var(--heart); }

/* Bootstrap form controls pulled onto the token system */
.form-control {
    background: var(--bg-input);
    color: var(--text);
    border-color: var(--border);
    transition: background var(--dur-theme), color var(--dur-theme), border-color 0.25s, box-shadow 0.25s;
}
.form-control:focus {
    background: var(--bg-card);
    color: var(--text);
    border-color: var(--accent);
    box-shadow: 0 0 0 0.22rem var(--accent-glow-soft);
}
.form-control::placeholder { color: var(--text-muted); }
.text-muted { color: var(--text-muted) !important; }

/* ============================================================
   FOOTER (moved out of includes/footer.php)
   ============================================================ */
.ch-footer {
    position: relative;
    overflow: hidden;
    padding: 68px 0 28px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    transition: background var(--dur-theme), border-color var(--dur-theme), color var(--dur-theme);
}
/* Concentric rings echoing the hero blobs — ties the page ends together */
.ch-footer::before {
    content: '';
    position: absolute;
    width: 280px; height: 280px;
    right: -85px; bottom: -150px;
    border: 1px solid var(--border-accent);
    border-radius: 50%;
    box-shadow: 0 0 0 38px var(--accent-glow-soft),
                0 0 0 76px var(--accent-2-glow-soft);
    opacity: 0.5;
    pointer-events: none;
}
.ch-footer .container { position: relative; }
.ch-footer-top { margin-bottom: 30px; max-width: 650px; }
.ch-footer-logo {
    display: inline-block;
    margin-bottom: 10px;
    font-size: 1.65rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
    transition: color var(--dur-theme);
}
.ch-footer-logo span { color: var(--accent); }
.ch-footer-disclosure {
    max-width: 560px;
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.65;
    color: var(--text-muted);
}
.ch-footer-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    transition: border-color var(--dur-theme);
}
.ch-footer-menu a {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s, transform 0.25s var(--ease-out-quint);
}
.ch-footer-menu a:hover { color: var(--accent); transform: translateX(4px); }
.ch-footer-section {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 150px;
    padding: 15px 17px;
    border-radius: 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: background var(--dur-theme), border-color var(--dur-theme);
}
.ch-footer-section h6 {
    margin: 0 0 3px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.ch-footer-newsletter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 24px;
    border-radius: 18px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: background var(--dur-theme), border-color var(--dur-theme);
}
.ch-footer-newsletter h6 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--text);
}
.ch-footer-newsletter .ch-footer-sub-note {
    margin: 4px 0 0;
    font-size: var(--fs-meta);
    color: var(--text-muted);
}
.ch-footer-sub-form { display: flex; width: 100%; max-width: 380px; }
.ch-footer-sub-form input {
    flex: 1;
    min-width: 0;
    padding: 12px 14px;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 10px 0 0 10px;
    background: var(--bg-input);
    color: var(--text);
    transition: background var(--dur-theme), border-color 0.25s, color var(--dur-theme), box-shadow 0.25s;
}
.ch-footer-sub-form input::placeholder { color: var(--text-muted); }
.ch-footer-sub-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.ch-footer-sub-form button {
    flex-shrink: 0;
    padding: 0 20px;
    border: none;
    border-radius: 0 10px 10px 0;
    background: var(--accent-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 0.88rem;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.25s var(--ease-out-quint), box-shadow 0.25s;
}
.ch-footer-sub-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px var(--accent-glow);
}
.ch-footer-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 22px 0 18px;
    opacity: 1;
    transition: border-color var(--dur-theme);
}
.ch-footer-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.ch-copyright { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.ch-social { display: flex; gap: 10px; }
.ch-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 37px; height: 37px;
    border-radius: 50%;
    font-size: 0.95rem;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: background 0.25s, border-color 0.25s, color 0.25s,
                transform 0.25s var(--ease-out-quint), box-shadow 0.25s;
}
.ch-social a:hover {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

/* ============================================================
   OVERLAYS: page loader, scroll progress, toast
   ============================================================ */
.ch-page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    pointer-events: none;
    transition: background var(--dur-theme);
    /* Self-clearing fallback: animations.js normally fades this out on
       load, but if JS never runs the loader must not trap the page. */
    animation: ch-loader-auto 0.45s 1.8s forwards;
}
.ch-page-loader .loader-spinner {
    width: 40px; height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: ch-spin 0.8s linear infinite;
}
.ch-scroll-progress {
    position: fixed;
    top: 0; left: 0;
    width: 0%;
    height: 2px;
    z-index: 9999;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    /* Subtle by design (§10) — a hairline, not a bar */
    box-shadow: 0 0 12px var(--accent-glow);
}

/* Toast — replaces the old alert()/confirm() paths in the coupon
   flow so nothing "intrusive" interrupts the reveal (§5). */
.ch-toast-stack {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transform: translateX(-50%);
    pointer-events: none;
    width: min(92vw, 420px);
}
.ch-toast {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 13px 18px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.3s var(--ease-out-quint), transform 0.3s var(--ease-out-quint);
}
@media (min-width: 768px) {
    .ch-toast {
        backdrop-filter: var(--glass-blur);
        -webkit-backdrop-filter: var(--glass-blur);
    }
}
.ch-toast.is-in { opacity: 1; transform: translateY(0); }
/* Direct child only: the dismiss button carries its own icon and must
   not be tinted with the status colour. */
.ch-toast > i { flex-shrink: 0; }
.ch-toast.ch-toast-ok > i { color: var(--ok); }
.ch-toast.ch-toast-err > i { color: var(--heart); }
.ch-toast.ch-toast-info > i { color: var(--accent); }
.ch-toast-msg { flex: 1 1 auto; min-width: 0; }
.ch-toast-x {
    flex-shrink: 0;
    width: 26px; height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    /* The stack ignores pointer events so it never blocks the page;
       anything interactive inside has to opt back in. */
    pointer-events: auto;
    transition: color 0.2s, background 0.2s;
}
.ch-toast-x:hover { color: var(--text); background: var(--bg-elevated); }
/* Toasts carry an action link (e.g. "Login") that must be clickable
   even though the stack itself ignores pointer events. */
.ch-toast a { color: var(--accent); font-weight: 700; pointer-events: auto; }

/* ============================================================
   PAGINATION
   ============================================================ */
.ch-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin-top: 42px;
}
.ch-pagination a,
.ch-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: color 0.25s, background 0.25s, border-color 0.25s, transform 0.25s;
}
.ch-pagination a:hover {
    color: var(--accent);
    border-color: var(--border-accent);
    background: var(--accent-glow-soft);
    transform: translateY(-2px);
}
.ch-pagination .is-current {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}
.ch-pagination .is-disabled { opacity: 0.45; pointer-events: none; }

/* ============================================================
   ACCOUNT AREA (profile / saved coupons / activity)
   These three pages were built entirely from raw Bootstrap 5.1.3
   cards and list-groups. Bootstrap 5.1 has no dark mode, so in the
   dark theme they rendered as white blocks on a near-black page —
   the account area looked like a different website. Everything below
   is token-driven, so it follows the theme toggle like the rest of
   the site and needs no per-page CSS.
   ============================================================ */
.ch-account { padding: 46px 0 80px; }
.ch-account-head { margin-bottom: 30px; }
.ch-account-head h1 {
    font-size: clamp(1.75rem, 3.4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
}
.ch-account-head p { color: var(--text-secondary); margin: 0; }

/* ---- Sidebar identity card ---- */
.ch-account-side {
    position: sticky;
    top: 96px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
@media (max-width: 991px) {
    .ch-account-side { position: static; top: auto; }
}
.ch-idcard {
    padding: 26px 22px;
    text-align: center;
    border-radius: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.ch-avatar {
    width: 74px;
    height: 74px;
    margin: 0 auto 14px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 1.9rem;
    color: var(--accent);
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
}
.ch-idcard-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 2px;
    word-break: break-word;
}
.ch-idcard-mail {
    font-size: 0.84rem;
    color: var(--text-muted);
    margin-bottom: 14px;
    word-break: break-all;
}
.ch-role-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
}
.ch-role-badge.is-staff { color: var(--accent-2); border-color: var(--accent-2); background: transparent; }

/* ---- Sidebar nav ---- */
.ch-account-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px;
    border-radius: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
}
.ch-account-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 14px;
    border-radius: 12px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.25s, background 0.25s, transform 0.25s;
}
.ch-account-nav a i { width: 18px; text-align: center; font-size: 0.9rem; }
.ch-account-nav a:hover {
    color: var(--accent);
    background: var(--accent-glow-soft);
    transform: translateX(3px);
}
.ch-account-nav a.is-active {
    color: #fff;
    background: var(--accent);
}
.ch-account-nav a.is-active:hover { color: #fff; transform: none; }
.ch-account-nav a.is-danger { color: var(--heart); }
.ch-account-nav a.is-danger:hover { background: var(--heart-soft); }
/* ---- Content panels (replaces .card / .card-header) ---- */
.ch-panel {
    border-radius: 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.ch-panel + .ch-panel { margin-top: 22px; }
.ch-panel-head {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
}
.ch-panel-head i { color: var(--accent); }
.ch-panel-head h2 {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
}
.ch-panel-body { padding: 24px; }

/* ---- Form fields (replaces .form-control / .form-label) ---- */
.ch-field { margin-bottom: 18px; }
.ch-field > label {
    display: block;
    margin-bottom: 7px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
}
.ch-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 0.94rem;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-input);
    border: 1px solid var(--border);
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.ch-input::placeholder { color: var(--text-muted); }
.ch-input:focus {
    outline: none;
    background: var(--bg-elevated);
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.ch-input[readonly] { color: var(--text-muted); cursor: default; }
.ch-input[readonly]:focus { border-color: var(--border); box-shadow: none; }
.ch-field-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---- Activity list (replaces .list-group) ---- */
.ch-activity-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ch-activity-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 15px 18px;
    border-radius: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}
.ch-activity-row:hover {
    border-color: var(--border-accent);
    transform: translateX(3px);
    box-shadow: var(--shadow-sm);
}
.ch-activity-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    font-size: 0.9rem;
    color: var(--accent);
    background: var(--accent-glow-soft);
}
.ch-activity-row.is-save .ch-activity-icon { color: var(--heart); background: var(--heart-soft); }
.ch-activity-row.is-copy .ch-activity-icon { color: var(--ok);    background: var(--ok-soft); }
.ch-activity-main { flex: 1 1 auto; min-width: 0; }
.ch-activity-title {
    font-size: 0.94rem;
    font-weight: 600;
    margin: 0 0 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* The base reset sets `a { color: inherit }`, so a link inside a
   title needs its own affordance or it reads as plain text. */
.ch-activity-title a:hover,
.ch-activity-title a:focus-visible { color: var(--accent); }
.ch-activity-meta {
    margin: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.ch-activity-tag {
    flex: 0 0 auto;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
}
@media (max-width: 575px) {
    .ch-activity-row { flex-wrap: wrap; }
    .ch-activity-main { flex-basis: calc(100% - 52px); }
    .ch-activity-tag { margin-left: 52px; }
}

/* ============================================================
   SINGLE-COUPON PAGE (coupon.php, coupon-detail.php)
   coupon.php used to ship its own <head>, its own header/footer and
   ~340 lines of hard-coded light-only CSS, so it rendered as a
   different website — and stayed white in the dark theme. These are
   the same components expressed in theme tokens, so one page now
   inherits the site's header, footer, cursor, toasts and both themes.
   ============================================================ */
.ch-detail { padding: 34px 0 80px; }

.ch-crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0;
    list-style: none;
    font-size: 0.84rem;
    color: var(--text-muted);
}
.ch-crumbs a { color: var(--text-secondary); text-decoration: none; }
.ch-crumbs a:hover { color: var(--accent); }
.ch-crumbs li + li::before {
    content: '/';
    margin-right: 8px;
    color: var(--border);
}
.ch-crumbs li[aria-current] {
    color: var(--text);
    font-weight: 600;
    max-width: 46ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Headline block ---- */
.ch-detail-head {
    position: relative;
    padding: 30px 30px 26px;
    border-radius: 22px;
    background: var(--hero-bg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.ch-detail-head-top {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 16px;
}
.ch-detail-logo {
    flex: 0 0 auto;
    width: 66px; height: 66px;
    display: grid;
    place-items: center;
    padding: 9px;
    border-radius: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--accent);
    font-size: 1.5rem;
}
.ch-detail-logo img { width: 100%; height: 100%; object-fit: contain; }
.ch-detail-store {
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
    margin: 0 0 2px;
}
.ch-detail-store a { color: inherit; text-decoration: none; }
.ch-detail-store a:hover { color: var(--accent); }
.ch-detail-title {
    font-size: clamp(1.5rem, 3.2vw, 2.3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin: 0;
}
.ch-detail-tagline {
    margin: 12px 0 0;
    color: var(--text-secondary);
    font-size: 1.02rem;
    max-width: 62ch;
}
.ch-detail-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 18px;
}
.ch-detail-badges .ch-exclusive-tag { margin-bottom: 0; }
/* The title column has to be allowed to shrink, or a long title pushes
   the discount ring out of the rounded head. */
.ch-detail-head-main { flex: 1 1 auto; min-width: 0; }
.ch-detail-head-top .ch-ring { margin-left: auto; }
@media (max-width: 767px) {
    .ch-detail-head-top { flex-wrap: wrap; }
    .ch-detail-head-top .ch-ring { width: 84px; height: 84px; }
    .ch-detail-head-top .ch-ring .ch-ring-value { font-size: 1.4rem; }
}

/* The detail page reuses the grid card's .ch-code-row verbatim so
   interactions.js drives it unchanged (§5) — this only scales it up
   for a page where the code is the primary object, not a card detail. */
.ch-detail-code {
    min-height: 62px;
    margin-top: 22px;
    padding: 10px 12px 10px 18px;
    border-radius: 15px;
}
.ch-detail-code .ch-code,
.ch-detail-code .ch-code-mask { font-size: 1.12rem; letter-spacing: 2px; }
.ch-detail-code .ch-copy-btn,
.ch-detail-code .ch-unlock-btn { height: 42px; padding: 0 18px; font-size: 0.85rem; }
.ch-code-label {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ch-code-label + .ch-code-row { margin-top: 10px; }
.ch-detail-nocode {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 0;
    padding: 14px 18px;
    border-radius: 15px;
    font-size: 0.94rem;
    color: var(--text-secondary);
    background: var(--ok-soft);
    border: 1px solid var(--border-subtle);
}
.ch-detail-nocode i { color: var(--ok); }

/* Long-form body copy (coupon description, page.php content). Kept
   separate from .ch-panel-body so a panel can hold either prose or a
   dense list without one inheriting the other's rhythm. */
.ch-prose {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-size: 0.97rem;
    line-height: 1.7;
}
.ch-prose:last-child { margin-bottom: 0; }
.ch-prose a { color: var(--accent); }

/* ---- Discount ring ---- */
.ch-ring {
    flex: 0 0 auto;
    width: 108px; height: 108px;
    display: grid;
    place-items: center;
    align-content: center;
    border-radius: 50%;
    color: #fff;
    text-align: center;
    background: var(--accent-gradient);
    box-shadow: var(--shadow-glow);
}
.ch-ring-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
}
.ch-ring-unit {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.92;
}

/* ---- Countdown (§12) ---- */
.ch-countdown {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--heart-soft);
    border: 1px solid var(--heart-border);
}
.ch-countdown-label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.ch-countdown-timer {
    display: flex;
    gap: 8px;
    font-variant-numeric: tabular-nums;
}
.ch-countdown-unit {
    min-width: 54px;
    padding: 6px 8px;
    border-radius: 10px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.ch-countdown-num {
    display: block;
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--heart);
}
.ch-countdown-cap {
    display: block;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ch-countdown.is-expired .ch-countdown-timer { color: var(--heart); font-weight: 800; }

/* ---- Action row. The save button is the SAME .ch-save-btn the grid
   cards use (so interactions.js drives it unchanged) — it is only
   un-pinned from the card corner and given a label here. ---- */
.ch-detail-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
}
.ch-detail-actions .ch-btn,
.ch-detail-actions .ch-btn-ghost { flex: 1 1 220px; justify-content: center; }
.ch-detail-actions .ch-save-btn {
    position: static;
    top: auto; right: auto;
    width: auto; height: 48px;
    gap: 9px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 0.92rem;
    font-weight: 700;
}
/* A labelled pill should not scale like the round card heart does. */
.ch-detail-actions .ch-save-btn:hover { transform: translateY(-2px); }
/* handleSave() in interactions.js only swaps the <i> and the aria
   attributes, so the visible wording is toggled in CSS instead of
   asking that shared function to know about this page. */
.ch-detail-actions .ch-save-btn .ch-save-on { display: none; }
.ch-detail-actions .ch-save-btn.ch-saved .ch-save-on { display: inline; }
.ch-detail-actions .ch-save-btn.ch-saved .ch-save-off { display: none; }

/* ---- Metric strip ---- */
.ch-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 24px;
}
.ch-metric {
    padding: 14px 10px;
    border-radius: 14px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
}
.ch-metric-num {
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--accent);
}
.ch-metric-num .fa-circle-check { color: var(--ok); }
.ch-metric-num .fa-clock { color: var(--text-muted); }
.ch-metric-label {
    margin-top: 3px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}
@media (max-width: 575px) {
    .ch-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ch-detail-head { padding: 24px 20px 22px; }
    .ch-detail-actions .ch-btn,
    .ch-detail-actions .ch-btn-ghost { flex-basis: 100%; }
}

/* ---- Key/value facts ---- */
.ch-kv { margin: 0; padding: 0; list-style: none; }
.ch-kv li {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-subtle);
}
.ch-kv li:last-child { border-bottom: 0; padding-bottom: 0; }
.ch-kv dt,
.ch-kv .ch-kv-key {
    flex: 0 0 42%;
    color: var(--text-muted);
    font-weight: 600;
}
.ch-kv .ch-kv-key i { width: 16px; color: var(--accent); margin-right: 6px; }
.ch-kv .ch-kv-val { flex: 1 1 auto; color: var(--text); min-width: 0; word-break: break-word; }

/* ---- Terms list ---- */
.ch-terms { margin: 0; padding: 0; list-style: none; }
.ch-terms li {
    position: relative;
    padding: 8px 0 8px 26px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}
.ch-terms li:last-child { border-bottom: 0; }
.ch-terms li::before {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 0; top: 8px;
    font-size: 0.78rem;
    color: var(--ok);
}

/* ---- Compact coupon list (sidebar) ---- */
.ch-mini-list { display: flex; flex-direction: column; gap: 10px; }
.ch-mini-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 13px;
    text-decoration: none;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    transition: transform 0.2s var(--ease-out-quint), border-color 0.2s, box-shadow 0.2s;
}
.ch-mini-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-sm);
}
.ch-mini-main { min-width: 0; }
.ch-mini-title {
    margin: 0 0 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.ch-mini-meta { display: block; margin: 0; font-size: 0.75rem; color: var(--text-muted); }
.ch-mini-go { flex: 0 0 auto; color: var(--accent); font-size: 0.8rem; }

/* ---- Share row. Brand colours are intentionally literal: they are
   the platforms' own, not part of the site's two-accent palette
   (§16), and they must stay identical in both themes. ---- */
.ch-share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}
.ch-share-label {
    margin-right: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.ch-share-btn {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border-radius: 50%;
    color: #fff;
    text-decoration: none;
    transition: transform 0.2s var(--ease-out-quint), filter 0.2s;
}
.ch-share-btn:hover { transform: translateY(-2px) scale(1.06); color: #fff; filter: brightness(1.08); }
.ch-share-btn.is-fb { background: #3b5998; }
.ch-share-btn.is-x  { background: #1da1f2; }
.ch-share-btn.is-wa { background: #25d366; }
.ch-share-btn.is-mail { background: var(--text-secondary); }

/* ---- Sidebar ---- */
.ch-detail-side { display: flex; flex-direction: column; gap: 18px; }
.ch-detail-side .ch-panel + .ch-panel { margin-top: 0; }
.ch-storecard { text-align: center; }
.ch-storecard .ch-detail-logo { width: 78px; height: 78px; margin: 0 auto 14px; }
.ch-storecard h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px;
}
.ch-storecard p { color: var(--text-secondary); font-size: 0.86rem; margin: 0 0 16px; }
.ch-storecard .ch-btn,
.ch-storecard .ch-btn-ghost { width: 100%; justify-content: center; }
.ch-storecard .ch-btn { margin-bottom: 10px; }
@media (min-width: 992px) {
    .ch-detail-side { position: sticky; top: calc(var(--header-h) + 18px); }
}

/* ============================================================
   AUTH PAGES (login.php, register.php)
   Token-driven, work in both themes. Matches the design language
   of the public site but keeps a tight, centred card.
   ============================================================ */
.ch-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px 80px;
}
.ch-auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.ch-auth-header {
    padding: 32px 28px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
}
.ch-auth-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
    color: var(--accent);
    font-size: 1.75rem;
}
.ch-auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0 auto 16px;
    padding: 14px 18px;
    border-radius: 14px;
    background: var(--accent-glow-soft);
    border: 1px solid var(--border-accent);
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 700;
}
.ch-auth-brand i { font-size: 1.5rem; }
.ch-auth-tagline {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}
.ch-auth-body { padding: 28px; }
.ch-auth-form { display: flex; flex-direction: column; gap: 20px; }
.ch-auth-form .form-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    margin-bottom: 7px;
}
.ch-auth-form .input-group {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-input);
    transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.ch-auth-form .input-group:focus-within {
    border-color: var(--border-accent);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.ch-auth-form .input-group-text {
    padding: 0 14px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
}
.ch-auth-form .form-control {
    border: none;
    background: transparent;
    padding: 14px 16px;
    font-size: 0.94rem;
    color: var(--text);
    min-height: 50px;
}
.ch-auth-form .form-control::placeholder { color: var(--text-muted); }
.ch-auth-form .form-control:focus {
    outline: none;
    box-shadow: none;
}
.ch-auth-form .password-toggle {
    border: none;
    background: transparent;
    padding: 0 14px;
    color: var(--text-muted);
    transition: color 0.2s;
}
.ch-auth-form .password-toggle:hover { color: var(--accent); }
.ch-auth-form .form-text {
    margin-top: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* Password strength meter */
.ch-password-strength { margin-top: 10px; }
.ch-password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    overflow: hidden;
}
.ch-password-strength-fill {
    height: 100%;
    width: 0%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
}
.ch-password-requirements {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.ch-requirement {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.2s;
}
.ch-requirement i { font-size: 0.55rem; width: 0.65rem; text-align: center; }
.ch-requirement.valid { color: var(--ok); }
.ch-requirement.valid i { color: var(--ok); }
.ch-requirement.invalid { color: var(--text-muted); }
.ch-requirement.invalid i { color: var(--border); }

.ch-auth-submit {
    padding: 14px 24px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 4px;
}
.ch-auth-footer {
    padding: 20px 28px 28px;
    text-align: center;
    border-top: 1px solid var(--border-subtle);
}
.ch-auth-footer p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }
.ch-auth-footer a { color: var(--accent); text-decoration: none; }
.ch-auth-footer a:hover { text-decoration: underline; }
.ch-auth-alert {
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 0.85rem;
    margin-bottom: 4px;
    border: 1px solid transparent;
}
.ch-auth-alert.alert-danger {
    background: var(--danger-soft);
    border-color: var(--danger-border);
    color: var(--danger);
}
.ch-auth-alert.alert-warning {
    background: var(--warning-soft);
    border-color: var(--warning-border);
    color: var(--warning);
}
.ch-auth-alert i { margin-right: 8px; }

/* Floating appearance trigger (public site) */
.ch-appearance-trigger {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1050;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    box-shadow: var(--shadow-glow);
    cursor: pointer;
    transition: transform 0.2s var(--ease-out-quint), filter 0.2s;
}
.ch-appearance-trigger:hover {
    transform: scale(1.08);
    filter: brightness(1.1);
}
.ch-appearance-trigger:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow-soft), var(--shadow-glow);
}
@media (max-width: 575px) {
    .ch-appearance-trigger { right: 16px; bottom: 16px; width: 48px; height: 48px; }
}

/* Floating appearance panel (public site) */
.ch-appearance-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 1049;
    width: 320px;
    max-width: calc(100vw - 32px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(31, 42, 68, .22);
    overflow: hidden;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
}
.ch-appearance-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.ch-appearance-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}
.ch-appearance-panel header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.ch-appearance-panel header button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 8px;
    transition: background .15s ease, color .15s ease;
}
.ch-appearance-panel header button:hover {
    background: var(--border);
    color: var(--text);
}
.ch-appearance-body {
    padding: 20px;
}
.ch-appearance-section {
    margin-bottom: 24px;
}
.ch-appearance-section:last-child { margin-bottom: 0; }
.ch-appearance-section legend {
    display: block;
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: 12px;
}
.ch-appearance-section .ch-modes,
.ch-appearance-section .ch-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ch-appearance-section .ch-mode {
    flex: 1 1 calc(33.333% - 7px);
    min-width: 80px;
    padding: 12px 10px;
    text-align: center;
    background: var(--bg-card);
    color: var(--text);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-weight: 650;
    font-size: .85rem;
    line-height: 1.3;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.ch-appearance-section .ch-mode i {
    display: block;
    font-size: 18px;
    margin-bottom: 6px;
    color: var(--accent);
}
.ch-appearance-section .ch-mode:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
}
.ch-appearance-section .ch-mode:focus-visible {
    outline: 3px solid var(--accent-glow-soft);
    outline-offset: 2px;
}
.ch-appearance-section .ch-mode[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow-soft);
}
.ch-appearance-section .ch-swatch {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(31, 42, 68, .15);
    transition: transform .15s ease, box-shadow .15s ease;
}
.ch-appearance-section .ch-swatch:hover { transform: translateY(-2px); }
.ch-appearance-section .ch-swatch:focus-visible {
    outline: 3px solid var(--accent-glow-soft);
    outline-offset: 3px;
}
.ch-appearance-section .ch-swatch[aria-pressed="true"] {
    border-color: var(--text);
    box-shadow: 0 0 0 3px var(--bg-surface), 0 0 0 5px var(--accent);
}
.ch-appearance-section .ch-swatch[aria-pressed="true"]::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    color: #fff;
    font-size: 14px;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .45);
}
.ch-appearance-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.ch-appearance-actions .btn {
    font-size: .85rem;
    padding: .5rem .85rem;
}
@media (max-width: 480px) {
    .ch-appearance-trigger { bottom: 16px; right: 16px; width: 48px; height: 48px; }
    .ch-appearance-panel { bottom: 76px; right: 16px; left: 16px; width: auto; }
    .ch-appearance-section .ch-mode { flex: 1 1 50%; min-width: 0; }
    .ch-appearance-trigger,
    .ch-appearance-panel,
    .ch-appearance-section .ch-mode,
    .ch-appearance-section .ch-swatch { transition: none; }
    .ch-appearance-trigger:hover,
    .ch-appearance-section .ch-mode:hover,
    .ch-appearance-section .ch-swatch:hover { transform: none; }
}
