/* ===== CreatorHub theme ===== */
:root {
    /* Defaults; overridden at runtime by SiteSettings via an injected <style>. */
    --primary: #3D2B3D;
    --accent: #E8998D;
    --secondary: #C6A15B;
    --bg: #FBF6F0;
    --surface: #FFFFFF;
    --text: #2A2126;
    --font: 'Poppins', 'Segoe UI', system-ui, sans-serif;
    --muted: #8b8189;
    --line: #ece3da;
    --radius: 20px;
    --shadow: 0 12px 34px rgba(61, 43, 61, 0.10);
    --shadow-lg: 0 28px 60px rgba(61, 43, 61, 0.18);
    --ring: color-mix(in srgb, var(--accent) 40%, transparent);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Soft ambient color blobs behind everything — gives the page depth. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(46rem 46rem at 12% -8%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 60%),
        radial-gradient(40rem 40rem at 100% 6%, color-mix(in srgb, var(--secondary) 22%, transparent), transparent 55%),
        radial-gradient(50rem 50rem at 60% 108%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%);
    pointer-events: none;
}
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { font-weight: 800; line-height: 1.12; letter-spacing: -0.025em; }

.container { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

.gradient-text {
    background: linear-gradient(120deg, var(--accent), var(--secondary));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ===== Top nav ===== */
.topnav {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 72%, white);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topnav .inner { display: flex; align-items: center; gap: 22px; height: 72px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 1.3rem; color: var(--primary); letter-spacing: -.02em; }
.brand .logo-dot { width: 38px; height: 38px; border-radius: 13px; background: linear-gradient(135deg, var(--accent), var(--secondary)); display: grid; place-items: center; color: white; box-shadow: 0 6px 16px var(--ring); }
.brand img.logo-img { height: 40px; width: auto; border-radius: 10px; }
.topnav .links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.topnav .links a { color: var(--text); font-weight: 500; font-size: .95rem; position: relative; }
.topnav .links a:hover { color: var(--accent); }
.nav-toggle { display: none; }
.nav-burger { display: none; width: 40px; height: 40px; border-radius: 10px; margin-left: auto; cursor: pointer;
    flex-direction: column; align-items: center; justify-content: center; gap: 5px; flex-shrink: 0; }
.nav-burger span { display: block; width: 21px; height: 2px; background: var(--primary); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
.nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer;
    font-family: var(--font); font-weight: 700; font-size: .95rem; padding: 12px 22px; border-radius: 999px; transition: transform .15s, box-shadow .15s, filter .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: white; box-shadow: 0 8px 20px rgba(61,43,61,.22); }
.btn-primary:hover { color: white; transform: translateY(-2px); box-shadow: 0 14px 26px rgba(61,43,61,.28); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--secondary)); color: white; box-shadow: 0 10px 24px var(--ring); position: relative; }
.btn-accent:hover { color: white; transform: translateY(-2px); filter: brightness(1.04); box-shadow: 0 16px 32px var(--ring); }
.btn-ghost { background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--primary); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-sm { padding: 8px 15px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ===== Cards / surfaces ===== */
.card { background: color-mix(in srgb, var(--surface) 96%, transparent); border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
    border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 24px; }

/* ===== Hero ===== */
.hero { padding: 70px 0 34px; position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero .eyebrow { display: inline-flex; align-items: center; gap: 8px; background: color-mix(in srgb, var(--accent) 16%, white); color: color-mix(in srgb, var(--accent) 62%, black);
    padding: 7px 15px; border-radius: 999px; font-weight: 700; font-size: .8rem; margin-bottom: 20px; letter-spacing: .01em; box-shadow: 0 4px 14px var(--ring); }
.hero h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); margin: 0 0 16px; color: var(--primary); }
.hero p.lead { font-size: 1.18rem; color: var(--muted); max-width: 540px; margin: 0 0 26px; line-height: 1.55; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-stats { display: flex; gap: 30px; flex-wrap: wrap; }
.hero-stats .s .n { font-size: 1.7rem; font-weight: 800; color: var(--primary); line-height: 1; }
.hero-stats .s .l { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.hero-portrait { position: relative; justify-self: center; }
.hero-portrait .frame { width: min(360px, 78vw); aspect-ratio: 4/5; border-radius: 32px; overflow: hidden;
    box-shadow: var(--shadow-lg); border: 6px solid white; position: relative; z-index: 2;
    background: linear-gradient(150deg, var(--accent), var(--secondary)); display: grid; place-items: center; }
.hero-portrait .frame img { width: 100%; height: 100%; object-fit: cover; object-position: 34% 16%; }
.hero-portrait .frame .initial { font-size: 6rem; font-weight: 800; color: rgba(255,255,255,.9); }
.hero-portrait .halo { position: absolute; inset: -26px; border-radius: 40px; z-index: 1;
    background: conic-gradient(from 120deg, var(--accent), var(--secondary), var(--primary), var(--accent)); filter: blur(34px); opacity: .5; }
.hero-portrait .ch-badge { position: absolute; z-index: 3; background: white; color: var(--text); border-radius: 16px; padding: 10px 14px; box-shadow: var(--shadow); font-weight: 700; font-size: .82rem; display: flex; align-items: center; gap: 8px; }
.hero-portrait .ch-badge.b1 { top: 18px; left: 14px; }
.hero-portrait .ch-badge.b2 { bottom: 18px; right: 14px; }
.hero-portrait .ch-badge .dot { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 20%, white); }

/* ===== Niche bubbles ===== */
.section-eyebrow { text-align: center; color: var(--accent); font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: .78rem; margin: 40px 0 4px; }
.bubbles { display: flex; flex-wrap: wrap; gap: 30px; justify-content: center; padding: 24px 0 60px; }
.bubble { width: 220px; height: 220px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; padding: 22px; color: white; cursor: pointer; position: relative; overflow: hidden;
    transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s; box-shadow: var(--shadow); animation: floaty 6s ease-in-out infinite; }
.bubble::before { content: ""; position: absolute; top: -30%; left: -20%; width: 90%; height: 70%; border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.4), transparent 70%); pointer-events: none; }
.bubble::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 -20px 40px rgba(0,0,0,.15); pointer-events: none; }
.bubble:nth-child(2n) { animation-delay: -2s; }
.bubble:nth-child(3n) { animation-delay: -4s; }
.bubble:hover { transform: translateY(-10px) scale(1.05); box-shadow: var(--shadow-lg); }
.bubble .emoji { font-size: 2.9rem; margin-bottom: 6px; filter: drop-shadow(0 3px 6px rgba(0,0,0,.22)); }
.bubble h3 { margin: 0; font-size: 1.18rem; color: white; text-shadow: 0 2px 8px rgba(0,0,0,.18); }
.bubble .tag { font-size: .76rem; opacity: .92; margin-top: 4px; padding: 0 8px; }
.bubble .price { font-size: .76rem; background: rgba(255,255,255,.28); padding: 4px 13px; border-radius: 999px; margin-top: 12px; backdrop-filter: blur(3px); font-weight: 600; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }

/* ===== Grid of course cards ===== */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.detail-grid { padding: 36px 0; display: grid; grid-template-columns: 1fr 320px; gap: 32px; align-items: start; }

.bundle-locked { opacity: .5; }
.bundle-card { display: block; color: var(--text); transition: transform .2s, box-shadow .2s, border-color .2s; }
.bundle-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--accent); color: var(--text); }

.course-card { overflow: hidden; display: flex; flex-direction: column; transition: transform .25s, box-shadow .25s; padding: 0; }
.course-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.course-card .thumb { height: 168px; position: relative; display: grid; place-items: center; color: white; font-size: 3rem; overflow: hidden;
    background: linear-gradient(135deg, var(--accent), var(--secondary)); text-shadow: 0 3px 10px rgba(0,0,0,.25); }
.course-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.course-card .thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.28)); }
.course-card .thumb .tag-overlay { position: absolute; top: 12px; left: 12px; z-index: 2; background: rgba(255,255,255,.9); color: var(--primary); font-size: .72rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-shadow: none; }
.course-card .body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.course-card h3 { margin: 0 0 4px; font-size: 1.18rem; color: var(--primary); }
.course-card .sub { color: var(--muted); font-size: .9rem; margin-bottom: 14px; }
.course-card .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price-tag { font-weight: 800; font-size: 1.25rem; color: var(--primary); }

/* ===== Chips / badges ===== */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 700; padding: 5px 11px; border-radius: 999px; }
.chip-owned { background: #e6f5ec; color: #227a4b; }
.chip-locked { background: #f3eef0; color: var(--muted); }
.chip-free { background: color-mix(in srgb, var(--secondary) 22%, white); color: color-mix(in srgb, var(--secondary) 60%, black); }
.chip-included { background: color-mix(in srgb, var(--accent) 18%, white); color: color-mix(in srgb, var(--accent) 55%, black); }

/* ===== Curriculum / lesson list ===== */
.module-block { margin-bottom: 22px; }
.module-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 20px; background: color-mix(in srgb, var(--primary) 6%, var(--surface));
    border: 1px solid var(--line); border-radius: 16px 16px 0 0; }
.lesson-row { display: flex; align-items: center; gap: 14px; padding: 15px 20px; border: 1px solid var(--line); border-top: none; background: var(--surface); transition: background .15s; }
.lesson-row:hover { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.lesson-row:last-child { border-radius: 0 0 16px 16px; }
.lesson-row .ico { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .95rem; }
.lesson-row .ico.done { background: #e6f5ec; color: #227a4b; }
.lesson-row .ico.open { background: color-mix(in srgb, var(--accent) 18%, white); color: var(--accent); }
.lesson-row .ico.lock { background: #f3eef0; color: var(--muted); }
.lesson-row .meta { flex: 1; }
.lesson-row .meta .t { font-weight: 600; }
.lesson-row .meta .d { font-size: .85rem; color: var(--muted); }
.lesson-row.locked { opacity: .6; }

/* ===== Section header on colored banners ===== */
.page-banner { color: white; padding: 56px 0; position: relative; overflow: hidden; }
.page-banner::after { content: ""; position: absolute; inset: 0; background: radial-gradient(30rem 30rem at 90% -20%, rgba(255,255,255,.18), transparent 60%); pointer-events: none; }
.page-banner .container { position: relative; z-index: 1; }

/* ===== Lesson player layout ===== */
.player-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 0; min-height: calc(100vh - 72px); }
.player-side { background: var(--surface); border-right: 1px solid var(--line); padding: 22px; overflow-y: auto; }
.player-main { padding: 36px 44px; max-width: 920px; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow-lg); }
.video-frame iframe, .video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Discount price display */
.price-strike { text-decoration: line-through; text-decoration-color: #e0455e; opacity: .6; font-weight: 500; font-size: .85em; margin-right: 8px; }
.price-now { color: var(--primary, inherit); }
.save-pill { display: inline-block; background: color-mix(in srgb, #227a4b 15%, transparent); color: #227a4b; font-weight: 700; font-size: .82rem; padding: 3px 12px; border-radius: 999px; }

/* Media block (feed / offers) */
.media-img { width: 100%; border-radius: 12px; display: block; }
.media-img-link { position: relative; display: block; }
.media-clickme { position: absolute; right: 12px; bottom: 12px; background: var(--accent, #E8998D); color: #fff; font-weight: 700; font-size: .8rem; padding: 6px 14px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.28); }

/* Member post feed */
.feed { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.feed-post { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,.06)); }
.feed-post h3 { margin: 0 0 4px; }
.feed-post .feed-date { color: var(--muted); font-size: .8rem; margin-bottom: 10px; }
.feed-body { line-height: 1.6; }
.feed-body img { max-width: 100%; border-radius: 10px; }

/* Token chips (reminders) */
.token-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.token-chip { display: inline-block; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .78rem; font-family: ui-monospace, monospace; cursor: grab; user-select: none; }
.token-chip:hover { border-color: var(--accent); }
.token-chip:active { cursor: grabbing; }

/* Lead kanban board */
.kanban { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; }
.kanban-col { flex: 0 0 270px; background: var(--bg); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
.kanban-col.kb-over { outline: 2px dashed var(--accent); outline-offset: 2px; }
.kanban-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.kanban-head .dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kanban-head .col-name { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 700; font-size: .92rem; padding: 2px 4px; border-radius: 6px; }
.kanban-head .col-name:hover, .kanban-head .col-name:focus { background: var(--surface); }
.kanban-head .count { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-size: .72rem; padding: 1px 8px; }
.kanban-cards { min-height: 40px; display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--col, var(--accent)); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.kanban-card:hover { border-color: var(--accent); }
.kanban-card.kb-dragging { opacity: .4; }
.kanban-add { flex: 0 0 210px; display: flex; gap: 6px; align-items: center; background: transparent; border-style: dashed; }
.kanban-add input { flex: 1; min-width: 0; }

/* Cart count badge */
.cart-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 3px; border-radius: 999px; background: var(--accent, #E8998D); color: #fff; font-size: .7rem; font-weight: 700; vertical-align: top; }

/* Home carousel */
.carousel { position: relative; width: 100%; aspect-ratio: 16/7; border-radius: var(--radius, 16px); overflow: hidden; background: #000; box-shadow: var(--shadow-lg); margin-bottom: 22px; }
.carousel-track { position: absolute; inset: 0; }
.carousel-slide { position: absolute; inset: 0; opacity: 0; transition: opacity .8s ease; }
.carousel-slide.active { opacity: 1; }
.carousel-slide img, .carousel-slide video { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-slide a { position: absolute; inset: 0; display: block; }
.carousel-cta { position: absolute; right: 16px; bottom: 16px; background: var(--accent, #E8998D); color: #fff; font-weight: 700; padding: 8px 16px; border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.3); animation: ccPulse 1.6s ease-in-out infinite; }
@keyframes ccPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.carousel-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; gap: 7px; justify-content: center; z-index: 3; }
.carousel-dots button { width: 9px; height: 9px; border-radius: 50%; border: 0; background: rgba(255,255,255,.55); cursor: pointer; padding: 0; }
.carousel-dots button.active { background: #fff; }

/* Rich text editor */
.rte { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.rte-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.rte-toolbar button { min-width: 30px; height: 30px; padding: 0 7px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; font-size: .9rem; color: var(--text); line-height: 1; }
.rte-toolbar button:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.rte-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte-area { min-height: 160px; max-height: 460px; overflow-y: auto; padding: 12px 14px; outline: none; font-size: .95rem; line-height: 1.55; }
.rte-area:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }
.rte-area h2 { font-size: 1.3rem; margin: .4em 0 .3em; }
.rte-area h3 { font-size: 1.1rem; margin: .4em 0 .3em; }
.rte-area p { margin: 0 0 .6em; }
.rte-area ul, .rte-area ol { margin: 0 0 .6em 1.4em; }
.rte-area blockquote { margin: 0 0 .6em; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--muted); }
.rte-area a { color: var(--accent); }
.rte-area:empty::before { content: "Start typing…"; color: var(--muted); }
.rte-inline .rte-area { min-height: 0; padding: 8px 12px; }
.rte-inline .rte-area p { margin: 0; }
.rte-color { position: relative; width: 30px; height: 30px; border-radius: 7px; display: inline-grid; place-items: center; cursor: pointer; }
.rte-color:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.rte-color span { font-weight: 700; text-decoration: underline; text-decoration-color: #e0455e; text-decoration-thickness: 3px; pointer-events: none; }
.rte-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Rendered rich lesson body */
.lesson-content h2 { font-size: 1.35rem; margin: .5em 0 .3em; }
.lesson-content h3 { font-size: 1.12rem; margin: .5em 0 .3em; }
.lesson-content p { margin: 0 0 .7em; }
.lesson-content ul, .lesson-content ol { margin: 0 0 .7em 1.4em; }
.lesson-content blockquote { margin: 0 0 .7em; padding-left: 14px; border-left: 3px solid var(--accent); color: var(--muted); }
.lesson-content a { color: var(--accent); text-decoration: underline; }
.lesson-content img { max-width: 100%; border-radius: 10px; }

/* Drag-and-drop reordering */
[data-dnd-item] { cursor: grab; }
[data-dnd-item].dnd-dragging { opacity: .45; cursor: grabbing; }
[data-dnd-item].dnd-over { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 10px; }
.dnd-handle { cursor: grab; user-select: none; opacity: .5; font-size: 1.05rem; }
.dnd-handle:hover { opacity: 1; }

/* Flyer designer */
.flyer-editor { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.flyer-tools { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 10px; }
.flyer-tools .tool-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--surface); }
.flyer-tools .tool-group h4 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
/* Canva-style layout: tool rail + contextual panel + canvas */
.canva { display: grid; grid-template-columns: 76px 260px 1fr; gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 8px; background: var(--surface); }
.canva-rail { display: flex; flex-direction: column; background: var(--bg); border-right: 1px solid var(--line); padding: 8px 0; }
.canva-rail button { background: none; border: 0; cursor: pointer; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: .66rem; }
.canva-rail button .ic { font-size: 1.15rem; font-weight: 800; line-height: 1; }
.canva-rail button:hover { color: var(--text); }
.canva-rail button.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.canva-panel { padding: 14px; border-right: 1px solid var(--line); overflow-y: auto; max-height: 80vh; }
.canva-panel h4 { margin: 0 0 10px; font-size: .9rem; }
.canva-main { display: flex; flex-direction: column; min-width: 0; padding: 12px; }
.grp-label { font-weight: 600; font-size: .78rem; color: var(--muted); margin: 12px 0 6px; }
.el-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.el-chip { display: grid; place-items: center; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 1.3rem; color: var(--text); line-height: 1; }
.el-chip:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pal-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 6px; }
.pal-tile { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; padding: 9px; color: var(--text); display: grid; place-items: center; }
.pal-tile svg { width: 100%; height: 100%; max-height: 100%; }
.pal-tile:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.el-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.el-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: .75rem; color: var(--text); }
.el-tile:hover { border-color: var(--accent); }
.thumb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.thumb { position: relative; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: pointer; aspect-ratio: 1; background: var(--bg); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--accent); }
.thumb-play { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 1.3rem; text-shadow: 0 1px 4px rgba(0,0,0,.6); pointer-events: none; }

.flyer-bar { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.flyer-bar button, .flyer-bar label.mini { min-width: 30px; height: 30px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; display: inline-grid; place-items: center; padding: 0 8px; font-size: .9rem; }
.flyer-bar button:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.flyer-stage { overflow: auto; max-height: 78vh; padding: 20px; background: repeating-conic-gradient(#00000008 0% 25%, transparent 0% 50%) 0 0 / 24px 24px, var(--bg); border-radius: 14px; }
.fl-sizer { margin: 0 auto; }
.fl-canvas { position: relative; margin: 0 auto; overflow: hidden; box-shadow: var(--shadow-lg); background-size: cover; background-position: center; }
.fl-shape { }
.fl-el { position: absolute; box-sizing: border-box; cursor: grab; }
.fl-el:active { cursor: grabbing; }
.fl-text .fl-content { width: 100%; height: 100%; outline: none; overflow: hidden; line-height: 1.25; }
.fl-el.fl-editing { cursor: text; }
.fl-el.fl-editing .fl-content { cursor: text; }
.fl-image img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.fl-video video { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; background: #000; }
.fl-el.fl-selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.fl-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--accent); border: 2px solid #fff; border-radius: 3px; cursor: nwse-resize; display: none; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.fl-el.fl-selected .fl-handle { display: block; }
.fl-badge { position: absolute; top: -10px; left: -10px; font-size: .72rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 0 3px; display: none; }
.fl-el.fl-linked .fl-badge { display: block; }
.fl-canvas.fl-pen { cursor: crosshair; }
.fl-canvas.fl-pen .fl-el { pointer-events: none; }
.fl-guide { position: absolute; z-index: 100000; pointer-events: none; }
.fl-guide-v { left: 50%; top: 0; bottom: 0; width: 1px; background: #e0455e; }
.fl-guide-h { top: 50%; left: 0; right: 0; height: 1px; background: #e0455e; }

/* Flyer element entrance animations (public page) */
@keyframes fvFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fvRise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fvPop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }
@keyframes fvSlide { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
.anim-fade { animation: fvFade .7s ease both; }
.anim-rise { animation: fvRise .7s ease both; }
.anim-pop { animation: fvPop .6s cubic-bezier(.2,1.3,.4,1) both; }
.anim-slide { animation: fvSlide .7s ease both; }
@keyframes fvBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes fvWobble { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes fvGlowPulse { 0%,100% { text-shadow: 0 0 4px currentColor; } 50% { text-shadow: 0 0 16px currentColor, 0 0 30px currentColor; } }
@keyframes fvShimmer { to { background-position: 200% center; } }
@keyframes fvType { from { width: 0; } to { width: 100%; } }
.anim-bounce { animation: fvBounce 1.6s ease-in-out infinite; }
.anim-wobble { animation: fvWobble 1.9s ease-in-out infinite; }
.anim-glow { animation: fvGlowPulse 1.8s ease-in-out infinite; }
.anim-shimmer { background: linear-gradient(90deg, #e0455e, #8e44ad, #e0455e); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: fvShimmer 3s linear infinite; }
.anim-type { overflow: hidden; white-space: nowrap; animation: fvType 2.6s steps(32, end) both; }

.fl-print { position: fixed; right: 18px; bottom: 18px; z-index: 50; }
@media print {
    .fl-print { display: none !important; }
    body { background: #fff; }
}
/* Public flyer render */
.flyer-view { position: relative; margin: 0 auto; overflow: hidden; background-size: cover; background-position: center; }
.flyer-view .fv-el { position: absolute; box-sizing: border-box; }
.flyer-view .fv-el img, .flyer-view .fv-el video { width: 100%; height: 100%; object-fit: cover; display: block; }
.flyer-view a.fv-el { text-decoration: none; }

/* Custom YouTube controls (native ones are hidden to keep the outbound link unreachable) */
.yt-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; align-items: center; gap: 10px; padding: 8px 12px 10px; background: linear-gradient(transparent, rgba(0,0,0,.7)); opacity: 0; transition: opacity .2s; }
.video-frame:hover .yt-controls, .yt-controls:focus-within { opacity: 1; }
.yt-controls .ytc-play { background: none; border: 0; color: #fff; font-size: .95rem; line-height: 1; cursor: pointer; width: 24px; flex-shrink: 0; padding: 0; }
.yt-controls .ytc-track { position: relative; flex: 1; height: 6px; background: rgba(255,255,255,.35); border-radius: 3px; cursor: pointer; touch-action: none; }
.yt-controls .ytc-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent, #E8998D); border-radius: 3px; }
.yt-controls .ytc-knob { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin-left: -6px; transform: translateY(-50%); background: #fff; border-radius: 50%; pointer-events: none; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.yt-controls .ytc-time { color: #fff; font-size: .75rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.side-lesson { display: flex; gap: 10px; padding: 11px; border-radius: 12px; cursor: pointer; align-items: center; font-size: .9rem; transition: background .15s; }
.side-lesson:hover { background: var(--bg); }
.side-lesson.active { background: color-mix(in srgb, var(--accent) 16%, white); font-weight: 600; }
.side-lesson.locked { opacity: .5; cursor: not-allowed; }
.side-lesson .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .78rem; flex-shrink: 0; background: var(--bg); }
.side-toggle, .side-toggle-label { display: none; }

/* ===== Quiz ===== */
.quiz-q { padding: 20px; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 14px; background: var(--surface); }
.quiz-opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; margin-top: 8px; cursor: pointer; transition: .12s; }
.quiz-opt:hover { border-color: var(--accent); transform: translateX(2px); }
.quiz-opt.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, white); }
.quiz-opt.correct { border-color: #227a4b; background: #e6f5ec; }
.quiz-opt.wrong { border-color: #c0392b; background: #fdecea; }
.result-banner { padding: 16px 20px; border-radius: 14px; font-weight: 600; margin: 16px 0; }
.result-pass { background: #e6f5ec; color: #227a4b; }
.result-fail { background: #fdecea; color: #c0392b; }

/* ===== Brand / affiliate ===== */
.brand-banner { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-radius: 16px;
    background: color-mix(in srgb, var(--secondary) 12%, var(--surface)); border: 1px dashed var(--secondary); margin: 22px 0; }
.brand-banner .b-logo { width: 48px; height: 48px; border-radius: 13px; background: var(--surface); display: grid; place-items: center; font-size: 1.4rem; border: 1px solid var(--line); overflow: hidden; }
.brand-banner .b-logo img { width: 100%; height: 100%; object-fit: cover; }
.partner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 22px; }

/* ===== Linktree ===== */
.linktree { max-width: 540px; margin: 50px auto; text-align: center; }
.linktree .avatar { width: 108px; height: 108px; border-radius: 50%; margin: 0 auto 16px; overflow: hidden;
    background: linear-gradient(135deg, var(--accent), var(--secondary)); display: grid; place-items: center; font-size: 2.6rem; color: white;
    box-shadow: 0 0 0 6px white, 0 14px 34px var(--ring); }
.linktree .avatar img { width: 100%; height: 100%; object-fit: cover; object-position: 34% 20%; }
.link-row { display: flex; align-items: center; gap: 12px; padding: 17px 22px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 16px; margin-bottom: 12px; font-weight: 600; transition: transform .15s, box-shadow .15s, border-color .15s; }
.link-row:hover { transform: scale(1.025); box-shadow: var(--shadow); border-color: var(--accent); }
.link-row.featured { background: linear-gradient(135deg, var(--accent), var(--secondary)); color: white; border: none; box-shadow: 0 12px 26px var(--ring); }

/* ===== Tables (admin) ===== */
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.tbl th, .tbl td { text-align: left; padding: 13px 15px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.tbl th { background: color-mix(in srgb, var(--primary) 5%, var(--surface)); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: color-mix(in srgb, var(--accent) 4%, transparent); }

/* ===== Forms ===== */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
input, textarea, select { width: 100%; font-family: var(--font); font-size: .95rem; padding: 11px 13px; border: 1.5px solid var(--line);
    border-radius: 11px; background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
input[type=checkbox], input[type=radio] { width: auto; }
input[type=color] { padding: 4px; height: 44px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ===== Admin layout: collapsible sidebar ===== */
.admin-shell { display: flex; align-items: stretch; min-height: 100vh; background: var(--bg); }
.admin-sidebar {
    width: 250px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--line);
    padding: 18px 14px 24px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 2px;
}
.admin-sidebar-top { padding: 4px 8px 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.admin-sidebar-site { display: block; font-weight: 800; font-size: 1rem; color: var(--text); }
.admin-sidebar-exit { display: block; font-size: .78rem; color: var(--muted); text-decoration: none; margin-top: 2px; }
.admin-sidebar-exit:hover { text-decoration: underline; }

.admin-sidebar-home {
    display: block; padding: 10px 12px; border-radius: 10px; font-weight: 700; font-size: .9rem;
    color: var(--text); text-decoration: none; margin-bottom: 8px;
}
.admin-sidebar-home:hover { background: color-mix(in srgb, var(--accent) 15%, transparent); }
.admin-sidebar-home.active { background: var(--accent); color: white; }

.admin-sidebar-section { display: flex; flex-direction: column; }
.admin-sidebar-section-toggle { display: none; }
.admin-sidebar-section-label {
    display: flex; justify-content: space-between; align-items: center; cursor: pointer;
    padding: 10px 12px; font-weight: 700; font-size: .74rem; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted); border-radius: 8px; user-select: none;
}
.admin-sidebar-section-label:hover { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.admin-sidebar-section-label .chev { transition: transform .15s ease; font-size: .7rem; }
.admin-sidebar-section-toggle:checked ~ .admin-sidebar-section-label .chev { transform: rotate(180deg); }
.admin-sidebar-section-items {
    display: none; flex-direction: column; gap: 1px; padding: 2px 0 8px 6px;
}
.admin-sidebar-section-toggle:checked ~ .admin-sidebar-section-items { display: flex; }
.admin-sidebar-section-items a {
    padding: 8px 12px; border-radius: 8px; font-size: .85rem; color: var(--text);
    text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-sidebar-section-items a:hover { background: color-mix(in srgb, var(--surface) 70%, var(--bg)); }
.admin-sidebar-section-items a.active { background: var(--primary); color: white; }

.admin-sidebar-logout {
    margin-top: auto; align-self: flex-start; background: none; border: none; cursor: pointer;
    color: var(--muted); font-size: .82rem; padding: 10px 12px; text-decoration: underline;
}

.admin-sidebar-toggle { display: none; }
.admin-sidebar-burger { display: none; }

.admin-main { flex: 1; min-width: 0; }

@media (max-width: 900px) {
    .admin-shell { display: block; }
    .admin-sidebar-burger {
        display: flex; align-items: center; justify-content: center; gap: 4px; flex-direction: column;
        position: fixed; top: 14px; left: 14px; z-index: 1100; width: 42px; height: 42px;
        background: var(--surface); border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
    }
    .admin-sidebar-burger span { width: 18px; height: 2px; background: var(--text); border-radius: 2px; }
    .admin-sidebar {
        position: fixed; top: 0; left: 0; z-index: 1090; width: 270px;
        transform: translateX(-100%); transition: transform .25s ease; box-shadow: 14px 0 34px rgba(0,0,0,.18);
        padding-top: 66px;
    }
    .admin-sidebar-toggle:checked ~ .admin-sidebar { transform: translateX(0); }
    .admin-main { padding-top: 60px; }
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; margin-bottom: 28px; }
.stat { background: color-mix(in srgb, var(--surface) 96%, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.stat .n { font-size: 2.1rem; font-weight: 800; color: var(--primary); }
.stat .l { color: var(--muted); font-size: .85rem; }

/* ===== Messaging console ===== */
.msg-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 20px; }
.thread-list { max-height: 60vh; overflow-y: auto; }
.thread-item { padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 8px; cursor: pointer; background: var(--surface); transition: .15s; }
.thread-item:hover { border-color: var(--accent); }
.thread-item.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, white); }
.bubble-msg { max-width: 75%; padding: 11px 15px; border-radius: 18px; margin-bottom: 8px; font-size: .92rem; }
.bubble-msg.out { background: var(--primary); color: white; margin-left: auto; border-bottom-right-radius: 5px; }
.bubble-msg.in { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.bubble-msg .ts { font-size: .68rem; opacity: .7; margin-top: 4px; }

/* ===== Misc ===== */
.section-title { font-size: 1.75rem; color: var(--primary); margin: 12px 0 22px; position: relative; display: inline-block; }
.section-title::after { content: ""; position: absolute; left: 0; bottom: -8px; width: 46px; height: 4px; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--secondary)); }
.muted { color: var(--muted); }
.notes { background: color-mix(in srgb, var(--secondary) 10%, white); border-left: 3px solid var(--secondary); padding: 12px 16px; border-radius: 8px; font-size: .9rem; margin: 8px 0; }
.footer { border-top: 1px solid var(--line); padding: 36px 0; margin-top: 70px; color: var(--muted); font-size: .88rem; text-align: center; background: color-mix(in srgb, var(--surface) 50%, transparent); }
.flex { display: flex; } .between { justify-content: space-between; } .items-center { align-items: center; } .gap { gap: 12px; }
.progress-bar { height: 9px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--secondary)); border-radius: 999px; }

/* ===== Manage account ===== */
.manage-wrap { display: grid; grid-template-columns: 236px 1fr; gap: 24px; align-items: start; }
.manage-menu { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow); }
.manage-link { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; color: var(--text); font-weight: 600; font-size: .92rem; transition: .15s; }
.manage-link:hover { background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent); }
.manage-link.active { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(61,43,61,.2); }
.manage-link.active:hover { color: #fff; }
.manage-form { max-width: 460px; }
.manage-form h3 { color: var(--primary); margin-top: 0; }
.manage-avatar { width: 58px; height: 58px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; font-size: 1.6rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--secondary)); box-shadow: 0 8px 18px var(--ring); }
.qr-box { width: 190px; height: 190px; padding: 10px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-key { display: inline-block; font-family: ui-monospace, monospace; font-weight: 700; letter-spacing: 1px; background: var(--bg); border: 1px dashed var(--line); padding: 8px 12px; border-radius: 10px; word-break: break-all; }
@media (max-width: 760px) { .manage-wrap { grid-template-columns: 1fr; } .manage-menu { flex-direction: row; flex-wrap: wrap; } }

/* ===== Background picker ===== */
.bgpick { display: flex; gap: 18px; align-items: flex-start; }
.bgpick-color { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.bgpick-color input[type=color] { width: 62px; height: 44px; padding: 4px; }

/* Cards/rows carrying a custom image or color get white, legible text. */
.media-bg { color: #fff !important; position: relative; }
.media-bg h3, .media-bg strong, .media-bg .price-tag { color: #fff !important; }
.media-bg .muted { color: rgba(255,255,255,.85) !important; }
.media-bg .chip-included { background: rgba(255,255,255,.92); color: var(--primary); }

/* ===== Image picker ===== */
.imgpick { display: flex; gap: 14px; align-items: flex-start; }
.imgpick-preview { width: 78px; height: 78px; border-radius: 12px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); display: grid; place-items: center; flex-shrink: 0; font-size: 1.5rem; }
.imgpick-preview.round { border-radius: 50%; }
.imgpick-preview img { width: 100%; height: 100%; object-fit: cover; }
.imgpick-controls { flex: 1; min-width: 0; }
.imgpick-url { width: 100%; }

/* ===== Video library drag-and-drop (AdminMedia) ===== */
.media-dropzone { position: relative; border-radius: 14px; }
.media-drop-panel {
    position: relative; display: flex; align-items: center; gap: 14px; cursor: pointer;
    padding: 22px; margin-bottom: 16px; border-radius: 16px; overflow: hidden;
    border: 2px dashed var(--line); background: color-mix(in srgb, var(--surface) 70%, var(--bg));
    transition: border-color .12s ease, background .12s ease;
}
.media-drop-panel:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); }
.media-drop-icon {
    width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; font-size: 1.3rem;
    display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--primary);
}
.media-drop-panel.media-drop-active {
    border-color: var(--accent); border-style: solid;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.media-dropzone tr[data-folder-drop] { transition: background .12s ease, outline-color .12s ease; }
.media-dropzone tr[data-folder-drop].media-drop-active {
    outline: 2px solid var(--accent); outline-offset: -2px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}
/* Breadcrumb crumbs double as drop targets — drag a video onto one to move it up a level. */
.media-crumb {
    display: inline-flex; padding: 3px 9px; border-radius: 8px; border: 1.5px solid transparent;
    transition: background .12s ease, border-color .12s ease;
}
.media-crumb a { text-decoration: none; }
.media-crumb.media-drop-active {
    border-color: var(--accent); border-style: dashed;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
}

/* ===== Image cropper modal (adjust what's shown, used by ImagePicker) ===== */
.cropper-modal { max-width: 420px; }
.cropper-frame { position: relative; width: 100%; max-width: 360px; margin: 14px auto 4px; overflow: hidden;
    border-radius: 16px; background: #111; cursor: grab; touch-action: none; border: 1px solid var(--line); }
.cropper-frame.round { border-radius: 50%; }
.cropper-frame:active { cursor: grabbing; }
.cropper-frame img { position: absolute; }
.cropper-zoom-row { display: flex; align-items: center; gap: 10px; max-width: 360px; margin: 6px auto 0; }
.cropper-zoom-row input[type="range"] { flex: 1; }
.cropper-hint { font-size: .74rem; color: var(--muted); text-align: center; margin-top: 8px; }

/* ===== Auth (login / register) ===== */
.auth-wrap { min-height: calc(100vh - 72px); display: grid; place-items: center; padding: 44px 20px; }
.auth-card { display: grid; grid-template-columns: 1fr 1fr; max-width: 940px; width: 100%; background: var(--surface); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.auth-brand { position: relative; padding: 44px 40px; color: white; display: flex; flex-direction: column; justify-content: space-between; min-height: 560px; overflow: hidden;
    background: linear-gradient(160deg, var(--primary), color-mix(in srgb, var(--accent) 65%, var(--primary))); }
.auth-brand .bphoto { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .30; }
.auth-brand::after { content: ""; position: absolute; inset: 0; background: radial-gradient(24rem 24rem at 110% -10%, rgba(255,255,255,.22), transparent 60%); }
.auth-brand .bcontent { position: relative; z-index: 1; }
.auth-brand .badge-pill { display: inline-flex; align-items: center; gap: 7px; background: rgba(255,255,255,.18); padding: 6px 13px; border-radius: 999px; font-weight: 700; font-size: .78rem; }
.auth-brand h2 { font-size: 2rem; margin: 16px 0 8px; color: white; }
.auth-brand p { opacity: .9; margin: 0; line-height: 1.5; }
.auth-brand ul { list-style: none; padding: 0; margin: 22px 0 0; display: flex; flex-direction: column; gap: 13px; position: relative; z-index: 1; }
.auth-brand li { display: flex; gap: 11px; align-items: center; font-weight: 500; }
.auth-brand li .ic { width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.2); display: grid; place-items: center; flex-shrink: 0; }
.auth-form { padding: 46px 42px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h1 { font-size: 1.85rem; color: var(--primary); margin: 0 0 4px; }
.auth-form .sub { color: var(--muted); margin: 0 0 22px; }
.auth-links { margin-top: 18px; font-size: .9rem; display: flex; flex-direction: column; gap: 7px; }
.auth-demo { margin-top: 20px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--secondary) 12%, white); font-size: .82rem; color: color-mix(in srgb, var(--secondary) 62%, black); }
@media (max-width: 760px) { .auth-card { grid-template-columns: 1fr; } .auth-brand { min-height: auto; order: -1; } }

/* ===== Modal (ch- prefix avoids Bootstrap's .modal collision) ===== */
.ch-modal-backdrop { position: fixed; inset: 0; background: rgba(42, 33, 38, .55); display: grid; place-items: center; z-index: 1100; padding: 20px; }
.ch-modal { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 28px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.ch-modal h2 { margin-top: 0; color: var(--primary); }

@media (max-width: 900px) {
    .hero-grid { grid-template-columns: 1fr; text-align: center; }
    .hero .eyebrow, .hero-cta, .hero-stats { justify-content: center; }
    .hero p.lead { margin-left: auto; margin-right: auto; }
    .hero-portrait { margin-top: 30px; order: -1; }
}
@media (max-width: 800px) {
    .player-wrap { grid-template-columns: 1fr; }
    .player-side { border-right: none; border-bottom: 1px solid var(--line); order: 2; }
    .player-main { padding: 22px; order: -1; }
    .msg-wrap { grid-template-columns: 1fr; }

    .side-toggle { display: none; }
    .side-toggle-label {
        display: flex; align-items: center; justify-content: space-between; gap: 8px;
        font-weight: 700; font-size: .9rem; color: var(--primary); cursor: pointer;
        padding: 10px 12px; margin-top: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    }
    .side-toggle-label .chev { transition: transform .2s ease; color: var(--muted); }
    .side-toggle:checked ~ .side-toggle-label .chev { transform: rotate(180deg); }
    .side-list { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
    .side-toggle:checked ~ .side-list { max-height: 4000px; margin-top: 6px; }
}

/* ===== Mobile / small-screen adjustments (keeps desktop look intact) ===== */
@media (max-width: 760px) {
    .detail-grid { grid-template-columns: 1fr; padding: 24px 0; }
}

@media (max-width: 640px) {
    .container, .container-narrow { padding: 0 16px; }

    /* Collapsing top nav */
    .topnav .inner { height: 62px; position: relative; }
    .brand { font-size: 1.1rem; }
    .brand .logo-dot { width: 32px; height: 32px; border-radius: 10px; }
    .brand img.logo-img { height: 34px; }
    .nav-burger { display: flex; }
    .topnav .links {
        position: absolute; left: 0; right: 0; top: 100%;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: var(--surface); border: 1px solid var(--line); border-top: none;
        border-radius: 0 0 18px 18px; box-shadow: var(--shadow-lg);
        padding: 6px 18px 16px; margin: 0;
        max-height: 0; opacity: 0; overflow: hidden; pointer-events: none;
        transition: max-height .25s ease, opacity .2s ease;
    }
    .nav-toggle:checked ~ .links {
        max-height: 75vh; opacity: 1; overflow-y: auto; pointer-events: auto;
    }
    .topnav .links a, .topnav .links form { width: 100%; }
    .topnav .links a { padding: 12px 2px; border-bottom: 1px solid var(--line); }
    .topnav .links form button { width: 100%; }
    .topnav .links .btn-accent { margin: 8px 0 0; }

    /* Hero */
    .hero { padding: 40px 0 24px; }
    .hero-stats { gap: 18px; }

    /* Niche bubbles */
    .bubbles { gap: 18px; padding: 16px 0 40px; }
    .bubble { width: 160px; height: 160px; padding: 14px; }
    .bubble .emoji { font-size: 2.1rem; }
    .bubble h3 { font-size: 1rem; }

    /* Card grids */
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .partner-grid { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(auto-fill, minmax(140px,1fr)); gap: 10px; }
    .stat { padding: 16px; }
    .stat .n { font-size: 1.6rem; }

    /* Admin tables scroll instead of overflowing */
    .tbl { display: block; overflow-x: auto; white-space: nowrap; }

    /* Two-column form rows stack */
    .row2 { grid-template-columns: 1fr; }

    /* Admin nav & modal */
    .admin-nav { gap: 10px 14px; margin: 16px 0 22px; }
    .admin-nav a { padding: 8px 13px; font-size: .82rem; }
    .ch-modal { padding: 18px; }

    /* Auth pages */
    .auth-form { padding: 30px 22px; }
    .auth-brand { padding: 30px 24px; min-height: auto; }

    /* Manage account */
    .manage-menu { overflow-x: auto; flex-wrap: nowrap; }

    /* Flyer / canva admin designer: allow horizontal scroll instead of crushing columns */
    .canva { grid-template-columns: 64px 220px 1fr; overflow-x: auto; }
    .flyer-editor { grid-template-columns: 1fr; }
    .flyer-tools { position: static; }

    .player-main { padding: 16px; }
    .video-frame { border-radius: 14px; }
}

/* Creator Workbook editor */
.workbook-area {
    width: 100%;
    min-height: 55vh;
    padding: 18px 20px;
    border: 1px solid var(--border, #e5e0dd);
    border-radius: 14px;
    background: var(--card, #fff);
    font: inherit;
    line-height: 1.6;
    resize: vertical;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, .03);
}
.workbook-area:focus {
    outline: none;
    border-color: var(--accent, #E8998D);
    box-shadow: 0 0 0 3px rgba(232, 153, 141, .18);
}

/* Shared editor wrapper (standalone page + slide-in drawer) */
.nb-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

/* Course notebook docked as a third column beside the lesson player.
   Rendered once opened (kept mounted so edits persist); hidden until the
   wrapper gets .nb-open, which also widens the grid to make room. */
.player-wrap.nb-open { grid-template-columns: 340px 1fr 400px; }
.nb-col {
    display: none;
    flex-direction: column;
    background: var(--surface);
    border-left: 1px solid var(--line);
    padding: 22px;
    position: sticky;
    top: 72px;
    align-self: start;
    height: calc(100vh - 72px);
    overflow: hidden;
}
.player-wrap.nb-open .nb-col { display: flex; }
.nb-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.05rem;
}
.nb-col-sub { font-size: .82rem; margin: 2px 0 14px; }
.nb-col .nb-editor { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.nb-col .workbook-area { flex: 1; min-height: 0; }
.nb-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--muted, #8a8180);
    line-height: 1;
    padding: 4px 6px;
    border-radius: 8px;
}
.nb-close:hover { background: var(--bg, #f5f0ed); }

/* On narrow screens there's no room for a side column — slide it in as a full-height panel. */
@media (max-width: 900px) {
    .player-wrap.nb-open { grid-template-columns: 1fr; }
    .player-wrap.nb-open .nb-col {
        position: fixed;
        inset: 0;
        height: 100%;
        width: 100%;
        z-index: 1050;
        box-shadow: -12px 0 40px rgba(0, 0, 0, .16);
    }
}

/* ===== Linked-accounts panel (Dashboard): icon-prefixed pill inputs ===== */
.social-field {
    display: flex; align-items: center; gap: 12px; padding: 9px 14px;
    border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px;
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.social-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.social-icon {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem; color: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .12);
}
.social-icon.ig { background: linear-gradient(135deg, #f58529, #dd2a7b 45%, #8134af 75%, #515bd4); }
.social-icon.tt { background: linear-gradient(135deg, #010101, #25f4ee 55%, #fe2c55); }
.social-icon.fb { background: #1877f2; }
.social-icon.yt { background: #ff0000; }

.social-input { flex: 1; min-width: 0; }
.social-input label {
    display: block; font-size: .66rem; text-transform: uppercase; letter-spacing: .04em;
    font-weight: 700; color: var(--muted); margin-bottom: 1px;
}
.social-input input {
    border: none; padding: 0; background: transparent; width: 100%;
    font-size: .92rem; font-weight: 600; color: var(--text);
}
.social-input input:focus { outline: none; box-shadow: none; }
.social-input input::placeholder { font-weight: 400; color: var(--muted); }

/* Connected-platform stat panel (YouTube card, Meta/TikTok cards) */
.stat-panel {
    margin-top: 16px; padding: 16px; border-radius: 16px;
    background: color-mix(in srgb, var(--bg) 60%, var(--surface));
    border: 1px solid var(--line);
}
.platform-avatar {
    width: 46px; height: 46px; border-radius: 50%; object-fit: cover;
}
.platform-badge {
    display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; font-weight: 700;
    padding: 2px 9px; border-radius: 999px; color: #fff; margin-top: 2px;
}
.platform-badge.yt { background: #ff0000; }

.stat-chip { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; }
.stat-chip .n { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.stat-chip .l { font-size: .68rem; color: var(--muted); margin-top: 1px; }

.growth-badge {
    display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700;
    padding: 3px 10px; border-radius: 999px; margin-top: 8px;
    background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--primary);
}
