/* v5: class disclaimer, saved items drawer, contact, toast, back to top, faster tab switching */
html.ht-lock, html.ht-lock body { overflow: hidden; }
.xmodal { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(20,17,11,.62); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .25s, visibility 0s .25s; }
.xmodal.open { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .25s; }
.xpanel { position: relative; width: min(560px, 100%); max-height: calc(100svh - 40px); overflow: auto; background: var(--bg); border: 1px solid var(--accent); border-radius: 26px; padding: clamp(26px, 4vw, 40px); box-shadow: 0 60px 100px -40px rgba(0,0,0,.6); transform: translateY(14px) scale(.98); transition: transform .3s var(--ease); }
.xmodal.open .xpanel { transform: none; }
.xpanel h2 { font-size: clamp(1.6rem, 3.4vw, 2.1rem); margin-bottom: 14px; }
.xpanel > p { color: var(--text); font-size: 15px; line-height: 1.65; }
.disc-list { margin: 18px 0 26px; padding: 0; list-style: none; display: grid; gap: 10px; }
.disc-list li { position: relative; padding-left: 22px; font-size: 14px; color: var(--muted); line-height: 1.55; }
.disc-list li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.disc-panel .btn, .ct-panel .btn { width: 100%; justify-content: center; }
.ct-panel form { display: grid; gap: 14px; margin-top: 18px; }
.ct-panel .input { border-radius: 14px; padding: 12px 14px; font-size: 14px; width: 100%; font-family: inherit; resize: vertical; }
.ct-panel .rv-f { display: grid; gap: 6px; font-size: 12px; font-weight: 500; }
.ct-panel .hp, .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Saved drawer */
.drawer { place-items: stretch end; padding: 0; }
.dr-panel { width: min(420px, 100%); max-height: none; height: 100%; border-radius: 26px 0 0 26px; padding: 22px 22px 40px; transform: translateX(40px); }
.drawer.open .dr-panel { transform: none; }
@media (max-width: 520px) { .dr-panel { border-radius: 0; } }
.dr-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.dr-top h2 { margin: 0; font-size: 1.6rem; }
.dr-close { position: static; }
.dr-item { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--accent); }
.dr-img img { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: #fff; }
.dr-info { display: grid; gap: 4px; align-content: start; min-width: 0; }
.dr-info b { font-family: var(--serif); font-weight: 600; font-size: 1.02rem; line-height: 1.25; }
.dr-info span { font-size: 12px; color: var(--muted); }
.dr-acts { display: flex; gap: 14px; margin-top: 4px; align-items: center; flex-wrap: wrap; }
.dr-buy { font-size: 12px; font-weight: 600; border-bottom: 1px solid var(--dark); }
.dr-rm, .dr-clear { font-size: 12px; color: var(--muted); text-decoration: underline; }
.dr-total { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 0 4px; font-size: 14px; }
.dr-total b { font-family: var(--serif); font-size: 1.4rem; }
.dr-fine { font-size: 12px; color: var(--muted); margin: 4px 0 10px; }
.dr-empty { padding: 30px 0; text-align: center; color: var(--muted); font-size: 14px; }
.dr-empty b { display: block; font-family: var(--serif); font-size: 1.25rem; color: var(--dark); margin-bottom: 6px; font-weight: 500; }
.dr-h { font-size: 1.15rem; margin: 30px 0 4px; }

/* Header saved button */
.ht-saved-btn { position: relative; }
.ht-count { position: absolute; top: 3px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--dark); color: #fff; font-size: 10px; font-weight: 600; display: grid; place-items: center; line-height: 1; }
.ht-count[hidden] { display: none; }

/* Hearts */
.ht-heart { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.92); border: 1px solid var(--accent); color: var(--dark); transition: transform .2s, background .2s, color .2s; }
.ht-heart:hover { transform: scale(1.08); }
.ht-heart.on { background: var(--dark); color: var(--gold); border-color: var(--dark); }
.ht-heart.on svg { fill: currentColor; }
.pcard > .ht-heart { position: absolute; top: 12px; right: 12px; z-index: 3; }
.pcard { position: relative; }
.ht-heart.wide { width: auto; height: auto; border-radius: 999px; padding: 11px 18px; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 500; }
.pd-extra { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.ht-share { font-size: 13px; color: var(--muted); text-decoration: underline; }
.pd-class-note { margin-top: 18px; font-size: 12px; color: var(--muted); max-width: 32rem; }
.pd-class-note button { text-decoration: underline; color: var(--dark); }

/* Footer extras */
.footer-note { margin-top: 16px; padding: 14px 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 14px; font-size: 12.5px !important; line-height: 1.55; color: #cfc8b8 !important; max-width: 30rem !important; }
.footer-note button { display: inline !important; margin: 0 !important; color: var(--gold) !important; text-decoration: underline; font-size: 12.5px !important; }

/* Toast and back to top */
#toast { position: fixed; left: 50%; bottom: 96px; z-index: 130; transform: translate(-50%, 12px); background: var(--dark); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#to-top { position: fixed; right: 18px; bottom: 146px; z-index: 45; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--dark); color: var(--gold); box-shadow: 0 14px 30px -12px rgba(0,0,0,.5); opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
#to-top.on { opacity: 1; transform: none; pointer-events: auto; }
@media (min-width: 900px) { #to-top { bottom: 92px; right: 30px; } #toast { bottom: 28px; } }

/* Faster tab switching: no heavy filter or layout work during the quick fade */

@media (prefers-reduced-motion: reduce) { .xmodal, .xpanel, #toast, #to-top { transition: none; } }

/* ---------- Hair Theory Assistant (scripted chat helper) ---------- */
#cb-launch { position: fixed; right: 16px; bottom: 84px; z-index: 46; display: inline-flex; align-items: center; gap: 8px; height: 52px; padding: 0 20px 0 16px; border-radius: 999px; background: var(--dark); color: #fff; font-size: 14px; font-weight: 500; box-shadow: 0 18px 40px -14px rgba(0,0,0,.55); transition: transform .25s var(--ease), opacity .2s, box-shadow .25s; }
#cb-launch svg { color: var(--gold); }
#cb-launch:hover { transform: translateY(-3px); box-shadow: 0 24px 46px -14px rgba(0,0,0,.6); }
#cb-launch.hide { opacity: 0; pointer-events: none; transform: scale(.9); }
@media (min-width: 900px) { #cb-launch { right: 24px; bottom: 24px; } }
#cb-panel { position: fixed; right: 16px; bottom: 16px; z-index: 125; width: min(390px, calc(100vw - 32px)); height: min(600px, calc(100svh - 32px)); display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--accent); border-radius: 24px; box-shadow: 0 50px 90px -30px rgba(0,0,0,.55); overflow: hidden; opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(18px) scale(.97); transform-origin: bottom right; transition: opacity .22s, transform .28s var(--ease), visibility 0s .28s; }
#cb-panel.open { opacity: 1; visibility: visible; pointer-events: auto; transform: none; transition: opacity .22s, transform .28s var(--ease); }
@media (min-width: 900px) { #cb-panel { right: 24px; bottom: 24px; } }
@media (max-width: 520px) { #cb-panel { right: 0; bottom: 0; width: 100vw; height: 100svh; border-radius: 0; border: 0; } }
.cb-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; background: var(--dark); color: #fff; }
.cb-head b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.1rem; }
.cb-head span { display: block; font-size: 11.5px; color: #b9b2a0; margin-top: 2px; }
.cb-x { width: 34px; height: 34px; border-radius: 50%; font-size: 24px; line-height: 1; color: #fff; display: grid; place-items: center; }
.cb-x:hover { background: rgba(255,255,255,.14); }
.cb-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.cb-msg { max-width: 92%; padding: 11px 14px; border-radius: 18px; font-size: 14px; line-height: 1.5; animation: cbIn .25s var(--ease); }
@keyframes cbIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cb-msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--accent); border-bottom-left-radius: 6px; color: var(--text); }
.cb-msg.me { align-self: flex-end; background: var(--dark); color: #fff; border-bottom-right-radius: 6px; }
.cb-msg p { margin: 0 0 8px; } .cb-msg p:last-child { margin-bottom: 0; }
.cb-msg ul { margin: 4px 0 8px; padding-left: 18px; display: grid; gap: 6px; } .cb-msg ul:last-child { margin-bottom: 0; }
.cb-msg a:not(.cb-act) { text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 2px; font-weight: 500; }
.cb-dim { color: var(--muted); font-size: 12.5px; }
.cb-small { color: var(--muted); font-size: 12.5px; }
.cb-act { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--dark); color: #fff !important; font-size: 12.5px; font-weight: 500; text-decoration: none !important; }
.cb-act:hover { background: #000; }
.cb-typing { display: flex; gap: 4px; padding: 14px 16px; }
.cb-typing span { width: 6px; height: 6px; border-radius: 50%; background: #b9b2a0; animation: cbDot 1s infinite ease-in-out; }
.cb-typing span:nth-child(2) { animation-delay: .15s; } .cb-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes cbDot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.cb-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 16px 10px; }
.cb-chip { padding: 8px 13px; border-radius: 999px; border: 1px solid var(--accent); background: #fff; font-size: 12.5px; color: var(--dark); transition: background .2s, border-color .2s; }
.cb-chip:hover { background: var(--sage); border-color: #cfc9bb; }
.cb-form { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--accent); background: #fff; }
.cb-form input { flex: 1; min-width: 0; border: 1px solid var(--accent); border-radius: 999px; padding: 11px 16px; font: inherit; font-size: 16px; background: var(--bg); color: var(--dark); }
.cb-form input:focus { outline: none; border-color: var(--dark); }
.cb-form button { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--dark); color: var(--gold); display: grid; place-items: center; }
.cb-foot { padding: 8px 16px 12px; font-size: 11px; color: var(--muted); background: #fff; text-align: center; }
@media (prefers-reduced-motion: reduce) { #cb-panel, #cb-launch, .cb-msg { transition: none; animation: none; } .cb-typing span { animation: none; opacity: .6; } }
