/*
 * Color identity: deep near-black base with a blue -> teal accent duo
 * (--accent / --accent2), tied together with diagonal gradients wherever
 * a flat fill felt generic (hero, brand wordmark, primary buttons).
 * Dark is the default; [data-theme="light"] overrides for daytime use.
 * Toggled client-side (see layouts/main.php) and persisted in localStorage.
 */
:root, [data-theme="dark"] {
    --bg: #0d0f14;
    --bg-elevated: #14171f;
    --surface: #181c26;
    --surface-hover: #20252f;
    --text: #eef1f7;
    --muted: #9aa3b5;
    --muted-dim: #5c6478;
    --accent: #5b8cff;
    --accent-hover: #7aa1ff;
    --accent-dim: rgba(91, 140, 255, 0.14);
    --accent2: #279489;
    --accent2-hover: #2fb0a3;
    --accent2-dim: rgba(39, 148, 137, 0.16);
    --accent-gradient: linear-gradient(135deg, var(--accent), var(--accent2));
    --success: #3ddc84;
    --success-dim: rgba(61, 220, 132, 0.14);
    --danger: #ff6b6b;
    --danger-dim: rgba(255, 107, 107, 0.14);
    --warning: #e3c14b;
    --warning-dim: rgba(227, 193, 75, 0.14);
    --border: #232732;
    --border-light: #2f3441;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="light"] {
    --bg: #eef0f5;
    --bg-elevated: #e2e6ef;
    --surface: #ffffff;
    --surface-hover: #f4f6fa;
    --text: #191d27;
    --muted: #525c70;
    --muted-dim: #868fa3;
    --accent: #2f5fd0;
    --accent-hover: #244daf;
    --accent-dim: rgba(47, 95, 208, 0.10);
    --accent2: #0f766e;
    --accent2-hover: #0b5d56;
    --accent2-dim: rgba(15, 118, 110, 0.10);
    --accent-gradient: linear-gradient(135deg, var(--accent), var(--accent2));
    --success: #15803d;
    --success-dim: rgba(21, 128, 61, 0.10);
    --danger: #b91c1c;
    --danger-dim: rgba(185, 28, 28, 0.10);
    --warning: #92650a;
    --warning-dim: rgba(146, 101, 10, 0.10);
    --border: #d9dee8;
    --border-light: #c3cbdc;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 2px rgba(25, 29, 39, 0.06), 0 4px 12px rgba(25, 29, 39, 0.07);
    --shadow-lg: 0 8px 28px rgba(25, 29, 39, 0.14);
}

body { transition: background-color 0.15s ease, color 0.15s ease; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; min-height: 100%; overflow-x: hidden; }

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; max-width: 1100px; margin: 0 auto; padding: 40px 32px; width: 100%; }
main.main-full { max-width: 100%; padding: 24px 32px; }

h1, h2, h3 { font-weight: 700; line-height: 1.25; margin: 0 0 12px; }
h1 { font-family: "Archivo Black", "Segoe UI", sans-serif; font-size: 1.7rem; letter-spacing: -0.3px; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 12px; }

a { color: var(--accent); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.9em;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 32px;
    background: rgba(13, 15, 20, 0.88);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.site-header .brand { display: flex; align-items: center; gap: 12px; color: var(--text); }
.site-header .brand:hover { text-decoration: none; }
.site-header .brand-logo { height: 52px; width: 52px; object-fit: contain; }
.site-header .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.site-header .brand-name {
    font-family: "Archivo Black", "Segoe UI", sans-serif;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.site-header .brand-tagline {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--muted);
}

.site-notice {
    flex: 1 1 240px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-elevated);
    color: var(--text);
}
.site-notice-warning { background: var(--warning-dim); border-color: var(--warning); color: var(--warning); }
.site-notice-alert { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }

.nav-search-wrap { position: relative; display: flex; align-items: center; }
.nav-search-wrap.open .nav-icon-link { color: var(--accent); }
.nav-search-input-wrap { position: relative; display: flex; align-items: center; }
.nav-search-input {
    width: 0;
    min-width: 0;
    padding: 0;
    margin: 0;
    border: 1px solid transparent;
    opacity: 0;
    overflow: hidden;
    transition: width 0.2s ease, padding 0.2s ease, margin 0.2s ease, opacity 0.15s ease;
}
.nav-search-wrap.open .nav-search-input {
    width: min(260px, calc(100vw - 220px));
    padding: 7px 28px 7px 12px;
    margin-left: 8px;
    opacity: 1;
}
.nav-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    line-height: 16px;
    text-align: center;
    border-radius: 50%;
    color: var(--text-muted);
    font-size: 1rem;
    padding: 0;
}
.nav-search-clear:hover { background: var(--surface-hover); color: var(--text); }
.nav-search-panel {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    width: 360px;
    max-width: calc(100vw - 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    z-index: 30;
    animation: nav-search-slide 0.15s ease;
}
@keyframes nav-search-slide {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.nav-search-results { max-height: 420px; overflow-y: auto; }
.nav-search-section h4 {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--muted);
    margin: 12px 0 4px;
}
.nav-search-section:first-child h4 { margin-top: 4px; }
.nav-search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 6px;
    border-radius: var(--radius-sm);
    color: var(--text);
}
.nav-search-item:hover { background: var(--surface-hover); text-decoration: none; }
.nav-search-item img, .nav-search-item-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-elevated);
    flex-shrink: 0;
}
.nav-search-item span { display: flex; flex-direction: column; font-size: 0.88rem; min-width: 0; }
.nav-search-item span small { color: var(--muted); font-size: 0.76rem; }
.nav-search-empty { color: var(--muted); font-size: 0.85rem; padding: 8px 6px; margin: 0; }
.nav-search-viewall {
    display: block;
    text-align: center;
    padding: 9px;
    margin-top: 6px;
    border-top: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.85rem;
}

.site-header nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-header nav a, .site-header nav button {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease;
}
.site-header nav a:hover, .site-header nav button:hover { background: var(--surface); color: var(--text); }

.nav-icon-link {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0 !important;
    border-radius: 50%;
}
.nav-icon-link svg { display: block; }

/* Avatar menu, pinned to the far right */
.avatar-menu-wrap { position: relative; margin-left: 8px; }
.avatar-menu-btn {
    padding: 2px !important; border-radius: 50%; display: flex;
}
.nav-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); display: block; }
.avatar-menu-btn:hover .nav-avatar { border-color: var(--accent); }
.avatar-dropdown {
    position: absolute; right: 0; top: calc(100% + 8px);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    width: 180px; z-index: 100; padding: 6px;
}
.avatar-dropdown a, .avatar-dropdown button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 10px; border-radius: var(--radius-sm);
    color: var(--text); font-size: 0.86rem; font-weight: 600;
    background: none; border: none; text-align: left; cursor: pointer;
}
.avatar-dropdown a:hover, .avatar-dropdown button:hover { background: var(--surface-hover); text-decoration: none; }
.avatar-dropdown form { width: 100%; }
.avatar-dropdown svg { flex-shrink: 0; color: var(--muted); }

/* Notification dropdown */
.notif-wrap { position: relative; }
.notif-btn { position: relative; }
.notif-badge {
    position: absolute; top: 4px; right: 4px;
    background: var(--danger); color: #fff;
    font-size: 0.65rem; font-weight: 700;
    min-width: 16px; height: 16px; line-height: 16px;
    border-radius: 8px; text-align: center; padding: 0 3px;
    pointer-events: none;
}
.notif-dropdown {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-lg);
    width: 300px; max-height: 380px; overflow-y: auto; z-index: 100;
}
.notif-item { display: block; padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.87rem; color: var(--text); }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-hover); }
.notif-unread { background: var(--accent-dim); }
.notif-actor { font-weight: 700; }
.notif-loading, .notif-empty { padding: 16px; color: var(--muted); font-size: 0.87rem; margin: 0; }

/* ---------- Buttons & forms (global, so every plain <button>/<input> looks right) ---------- */

button, input[type="submit"], input[type="button"] {
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--accent-gradient);
    color: #fff;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}
button:hover, input[type="submit"]:hover, input[type="button"]:hover { filter: brightness(1.1); }
button:active, input[type="submit"]:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

input, select, textarea {
    font-family: inherit;
    font-size: 0.92rem;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
label { display: block; margin-bottom: 14px; font-size: 0.88rem; color: var(--muted); }
label input, label select, label textarea { display: block; width: 100%; margin-top: 6px; color: var(--text); font-size: 0.95rem; }

input[type="file"] {
    padding: 8px;
    cursor: pointer;
}
input[type="file"]::file-selector-button {
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 14px;
    margin-right: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
input[type="file"]::file-selector-button:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    color: var(--accent);
}

/* secondary/outline style for de-emphasized actions */
.btn-secondary, .site-header nav button {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text);
}
.btn-secondary:hover { background: var(--surface); }

main {
    max-width: 1100px;
    margin: 0 auto;
}

.hero {
    text-align: center;
    padding: 72px 32px;
    margin: -40px -32px 48px;
    background:
        radial-gradient(ellipse 700px 320px at 50% 0%, var(--accent-dim), transparent 70%),
        radial-gradient(ellipse 600px 280px at 100% 100%, var(--accent2-dim), transparent 70%),
        linear-gradient(180deg, var(--bg-elevated), var(--bg));
    border-bottom: 1px solid var(--border);
}
.hero-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid var(--accent-dim);
    border-radius: 100px;
    padding: 5px 14px;
    margin-bottom: 18px;
}
.hero h1 { font-size: 2.6rem; margin-bottom: 14px; letter-spacing: -0.5px; }
.hero .accent-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero p { color: var(--muted); font-size: 1.12rem; line-height: 1.6; max-width: 620px; margin: 0 auto; }
.hero-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 26px auto 0; max-width: 640px; }
.hero-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 100px; padding: 8px 15px; box-shadow: var(--shadow); }
.hero-pill-icon { font-size: 0.95rem; line-height: 1; }
.hero-actions { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 28px; flex-wrap: wrap; }
.hero-actions button { padding: 13px 28px; font-size: 1rem; }
.hero-secondary-link { color: var(--muted); font-weight: 600; font-size: 0.92rem; }
.hero-secondary-link:hover { color: var(--text); }

.product-section { margin: 40px 0; }
.product-section h2 {
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 0;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.product-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.product-card:hover { transform: translateY(-2px); border-color: var(--border-light); box-shadow: var(--shadow); }
.product-card h3 { margin-bottom: 4px; font-size: 1rem; }
.product-card .seller { color: var(--muted); font-size: 0.82rem; margin-bottom: 0; }
.product-card .price { font-weight: 700; margin-top: 10px; margin-bottom: 0; color: var(--accent); }
.product-card .thumb { width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--bg-elevated); }

.empty-state { color: var(--muted); font-size: 0.9rem; }

.auth-form { max-width: 380px; margin: 0 auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.auth-form h1 { text-align: center; }
.auth-form button, .auth-form input[type="submit"] { width: 100%; padding: 11px; margin-top: 4px; }
.auth-form p { text-align: center; color: var(--muted); font-size: 0.88rem; margin-top: 16px; }

.errors { color: var(--danger); list-style: none; padding: 0; margin: 0 0 16px; font-size: 0.88rem; }
.errors li { padding: 8px 12px; background: var(--danger-dim); border-radius: var(--radius-sm); margin-bottom: 6px; }

.profile-header { text-align: center; }
.cover-wrap { position: relative; }
.profile-header .cover { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius); display: block; }
.avatar-wrap { position: relative; display: inline-block; margin-top: -48px; }
.profile-header .avatar {
    width: 96px; height: 96px; border-radius: 50%; object-fit: cover;
    border: 3px solid var(--bg); background: var(--bg-elevated); display: block;
}
.upload-overlay {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.45); color: #fff; font-size: 1.4rem; cursor: pointer;
    opacity: 0; transition: opacity 0.2s ease; border-radius: inherit;
}
.cover-wrap:hover .upload-overlay { opacity: 1; }
.avatar-wrap:hover .upload-overlay { opacity: 1; border-radius: 50%; }
.avatar-upload-overlay { border-radius: 50%; }
.cover-upload-form { position: absolute; inset: 0; }
.profile-header .username { color: var(--muted); }
.profile-header button { width: auto; }
.profile-header form { display: inline-block; margin: 4px; }
.profile-section { margin-top: 36px; }
.profile-section h2 { margin-bottom: 16px; }
.product-card-body { padding: 8px 0 4px; }
.product-title { font-weight: 600; margin: 0 0 4px; }
.product-price { color: var(--accent); font-weight: 700; margin: 0; font-size: 0.9rem; }

.profile-columns { display: flex; gap: 28px; align-items: flex-start; margin-top: 36px; }
.profile-col-products { flex: 1 1 33%; max-width: 33%; margin-top: 0; }
.profile-col-posts { flex: 1 1 67%; max-width: 67%; margin-top: 0; }
.profile-product-list { display: flex; flex-direction: column; gap: 14px; }
.profile-product-list .product-card { display: flex; gap: 12px; padding: 10px; align-items: center; }
.profile-product-list .thumb { width: 64px; height: 64px; flex-shrink: 0; margin-bottom: 0; }
.thumb-placeholder { background: var(--bg-elevated); }

@media (max-width: 800px) {
    .profile-columns { flex-direction: column; }
    .profile-col-products, .profile-col-posts { max-width: 100%; flex: 1 1 100%; }
}

.flash-success {
    background: var(--success-dim);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.post-composer, .comment-form {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 24px;
}
.post-composer textarea, .comment-form textarea {
    width: 100%;
    margin-bottom: 10px;
    resize: vertical;
}
.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
}
.post-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-elevated); }
.post-author { font-weight: 700; }
.post-time { color: var(--muted-dim); font-size: 0.8rem; margin-left: 8px; }
.post-edited-badge { font-size: .7rem; color: var(--text-muted); background: var(--bg-alt); border-radius: 4px; padding: 1px 5px; margin-left: 5px; }
.post-body { margin: 0; }
.post-image { max-width: 100%; border-radius: var(--radius-sm); margin-top: 10px; }
.post-actions { margin-top: 10px; }
.post-actions button {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 6px 14px;
    font-size: 0.85rem;
}
.post-actions a { margin-left: 12px; color: var(--muted); font-size: 0.85rem; }

.comments { margin-top: 28px; }
.comments h3 { border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.comment { display: flex; align-items: flex-start; gap: 10px; border-top: 1px solid var(--border); padding: 12px 0; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--bg-elevated); }
.comment-body-wrap { flex: 1; }
.comment-body-wrap a { font-weight: 600; }
.comment-body-wrap p { margin: 4px 0 0; }

.notification {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
    margin-bottom: 8px;
    color: var(--text);
}
.notification:hover { background: var(--surface-hover); }
.notification.unread { border-color: var(--accent); background: var(--accent-dim); }

.sales-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 0.9rem; }
.sales-table th {
    text-align: left;
    padding: 10px 12px;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border-light);
}
.sales-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.sales-table tr:hover td { background: var(--surface-hover); }

.owner-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-top: 18px;
}
.owner-panel h3:first-child { margin-top: 0; }
.disabled-panel { opacity: 0.55; }
.disabled-panel button:disabled { cursor: not-allowed; background: var(--surface-hover); color: var(--muted); border-color: var(--border); }

.product-media-gallery { display: flex; gap: 10px; overflow-x: auto; margin-bottom: 18px; padding-bottom: 4px; }
.product-media-gallery img, .product-media-gallery video {
    max-height: 360px;
    border-radius: var(--radius);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.product-description { line-height: 1.6; }
.product-description p { margin: 0 0 12px; }
.product-description h1, .product-description h2, .product-description h3 { margin-top: 18px; }
.product-description ul, .product-description ol { margin: 0 0 12px; padding-left: 22px; }
.product-description li { margin-bottom: 4px; }
.product-description blockquote {
    margin: 0 0 12px;
    padding: 4px 14px;
    border-left: 3px solid var(--accent);
    color: var(--muted);
    background: var(--bg-elevated);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.product-description code {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1px 5px;
    font-size: 0.9em;
}
.product-description a { color: var(--accent); }
.product-description a:hover { color: var(--accent-hover); }

/* ---------- Messages split-pane shell ---------- */
.messages-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - 120px);
    min-height: 500px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}

/* Sidebar */
.messages-sidebar {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg);
    overflow: hidden;
}
.messages-sidebar-header {
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.messages-sidebar-header h2 { margin: 0; font-size: 1.1rem; }
.messages-sidebar-list { overflow-y: auto; flex: 1; }
.messages-empty-sidebar { padding: 16px; color: var(--text-muted); font-size: 0.88rem; }

.messages-convo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    transition: background 0.1s;
}
.messages-convo-row:hover { background: var(--surface-hover); text-decoration: none; }
.messages-convo-row.active { background: var(--accent-dim); border-left: 3px solid var(--accent); }
.messages-convo-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.messages-convo-body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 2px; }
.messages-convo-name { font-weight: 600; font-size: 0.9rem; }
.messages-convo-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.messages-convo-time { font-size: 0.75rem; color: var(--text-muted); flex-shrink: 0; }

/* Right pane */
.messages-pane {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
}
.messages-pane-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.messages-pane-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.conversation-header-name { font-weight: 600; color: var(--text); }
.conversation-header-name:hover { color: var(--accent); }
.conversation-avatar { border-radius: 50%; object-fit: cover; }

.messages-pane-thread {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

/* Bubbles */
.message {
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px 14px 14px 4px;
    padding: 8px 12px;
    max-width: 68%;
    align-self: flex-start;
}
.message.mine {
    align-self: flex-end;
    background: var(--accent-dim);
    border-color: var(--accent);
    border-radius: 14px 14px 4px 14px;
}
.message-body { white-space: pre-wrap; word-break: break-word; font-size: 0.92rem; }
.message-time { font-size: 0.68rem; color: var(--text-muted); margin-top: 3px; align-self: flex-end; }
.message-attachment { max-width: 240px; max-height: 240px; border-radius: 8px; display: block; margin-bottom: 4px; }

/* GIF picker */
.gif-picker {
    border-top: 1px solid var(--border);
    padding: 10px 12px;
    background: var(--bg);
    flex-shrink: 0;
}
.gif-picker input { width: 100%; margin-bottom: 8px; }
.gif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; max-height: 180px; overflow-y: auto; }
.gif-result { width: 100%; height: 80px; object-fit: cover; border-radius: 4px; cursor: pointer; }
.gif-result:hover { opacity: 0.8; }

/* Composer */
.messages-composer {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}
.messages-composer-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}
.messages-composer-input textarea {
    resize: none;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    min-height: 38px;
    max-height: 120px;
    overflow-y: auto;
}

.message-attach-btn {
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
}
.message-attach-btn:hover { color: var(--text); }
.message-gif-btn {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 7px;
    border-radius: 4px;
    flex-shrink: 0;
    cursor: pointer;
    line-height: 1;
}
.message-gif-btn:hover { border-color: var(--accent); color: var(--accent); }

.attachment-preview-wrap { position: relative; display: inline-block; }
.attachment-preview-wrap img { max-width: 110px; max-height: 110px; border-radius: 6px; display: block; }
.attachment-clear-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 0.85rem;
    line-height: 20px;
    text-align: center;
    padding: 0;
    border: none;
    cursor: pointer;
}

.message-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    padding: 0;
}
.message-send-btn:hover { background: var(--accent-hover); }
.message-send-btn:disabled { opacity: 0.6; cursor: default; }

@media (max-width: 640px) {
    .messages-shell { grid-template-columns: 1fr; }
    .messages-sidebar { display: none; }
    .messages-shell:not(:has(.messages-pane-header)) .messages-sidebar { display: flex; }
}

.vote-buttons { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.vote-buttons button {
    background: var(--surface);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 7px 14px;
    font-size: 0.85rem;
}
.vote-buttons button.active-up { border-color: var(--success); color: var(--success); background: var(--success-dim); }
.vote-buttons button.active-down { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }
.vote-score { font-weight: 700; }

.vote-buttons-inline { display: flex; align-items: center; gap: 6px; }
.vote-buttons-inline button {
    background: var(--surface);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 2px 8px;
    font-size: 0.8rem;
    line-height: 1;
}
.vote-buttons-inline button.active-up { border-color: var(--success); color: var(--success); background: var(--success-dim); }
.vote-buttons-inline button.active-down { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }
.vote-buttons-inline .vote-score { font-weight: 700; font-size: 0.85rem; }

.heart-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border-light);
    color: var(--text);
    padding: 7px 14px;
    font-size: 0.85rem;
    margin: 14px 0 0;
}
.heart-btn .heart-icon { color: var(--text-muted); }
.heart-btn.active { border-color: #e0245e; color: #e0245e; background: rgba(224, 36, 94, 0.1); }
.heart-btn.active .heart-icon { color: #e0245e; }

/* ---------- Status badges ---------- */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0.2px;
    background: var(--bg-elevated);
    color: var(--muted);
}
.badge-admin, .badge-owner { background: var(--accent-dim); color: var(--accent); }
.badge-active, .badge-completed, .badge-clean, .badge-pro { background: var(--success-dim); color: var(--success); }
.badge-pending, .badge-pending_verification, .badge-past_due { background: var(--warning-dim); color: var(--warning); }
.badge-suspended, .badge-deleted, .badge-canceled, .badge-infected, .badge-error { background: var(--danger-dim); color: var(--danger); }
.badge-free, .badge-draft { background: var(--bg-elevated); color: var(--muted); }

.ad-slot-wrap { margin: 18px 0; }
.ad-slot { display: block; }
.ad-slot-product, .ad-slot-user {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
    background: var(--surface); border: 1px dashed var(--border-light);
    border-radius: var(--radius); text-decoration: none; color: var(--text);
}
.ad-slot-product:hover, .ad-slot-user:hover { border-color: var(--accent); text-decoration: none; }
.ad-slot-product img, .ad-slot-user img { width: 48px; height: 48px; border-radius: var(--radius-sm); object-fit: cover; }
.ad-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-right: 8px; }
.ad-price { margin-left: auto; color: var(--accent); font-weight: 700; }
.ad-slot-custom { padding: 14px; background: var(--surface); border-radius: var(--radius); }
.ad-slot-form [data-mode] { margin: 12px 0; }
.ad-create-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 24px; }
.ad-create-form label { flex: 1; min-width: 200px; }
.ad-list-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

.post-tags { font-size: 0.85rem; color: var(--muted); margin: 4px 0 8px; }
.post-tags a { font-weight: 600; }
.btn-untag {
    background: none; border: none; color: var(--muted); padding: 0 2px;
    font-size: 0.95rem; line-height: 1; cursor: pointer; display: inline;
}
.btn-untag:hover { color: var(--danger); background: none; }

.feed-product-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.feed-product-label { color: var(--muted); font-size: 0.85rem; margin: 0 0 10px; }
.feed-product-card .product-card { display: flex; gap: 12px; align-items: center; padding: 0; }
.feed-product-card .thumb { width: 72px; height: 72px; flex-shrink: 0; margin-bottom: 0; }

/* ---------- Legal pages ---------- */
.legal-page { max-width: 700px; margin: 0 auto; }
.legal-page h2 { margin-top: 28px; }
.legal-page p { color: var(--text); line-height: 1.6; }
.footer-links { margin-top: 6px; font-size: 0.85rem; }
.footer-links a { color: var(--muted); }

/* ---------- Search ---------- */
.search-form { display: flex; gap: 10px; margin-bottom: 24px; max-width: 520px; }
.search-form input { flex: 1; }
.search-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.search-tab {
    background: none; border: none; border-bottom: 2px solid transparent;
    color: var(--muted); padding: 10px 16px; border-radius: 0;
    font-weight: 600; font-size: 0.9rem;
}
.search-tab:hover { background: none; color: var(--text); }
.search-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.search-user-list { display: flex; flex-direction: column; gap: 4px; }
.search-user-row {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    border-radius: var(--radius-sm); text-decoration: none; color: var(--text);
}
.search-user-row:hover { background: var(--surface); text-decoration: none; }
.search-user-row img { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; background: var(--bg-elevated); }
.search-user-name { font-weight: 700; margin: 0; }
.search-user-handle { color: var(--muted); margin: 0; font-size: 0.85rem; }

/* ---------- Settings page ---------- */
.settings-page { max-width: 640px; }
.settings-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-top: 24px; }
.settings-section h2 { margin-top: 0; margin-bottom: 18px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #ff5252; }
.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-light); }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--accent); color: var(--accent); }
.totp-qr-wrap { margin: 16px 0; background: #fff; display: inline-block; padding: 8px; border-radius: var(--radius-sm); }
.flash-error { background: var(--danger-dim); border: 1px solid var(--danger); color: var(--danger); padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; }

/* ---------- Upload modal ---------- */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    z-index: 200; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); width: 100%; max-width: 660px;
    max-height: 90vh; overflow-y: auto; padding: 28px;
    box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { margin: 0; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.4rem; cursor: pointer; padding: 4px 8px; }
.modal-close:hover { color: var(--text); }

/* ---------- Footer ---------- */

.site-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 28px;
    color: var(--muted-dim);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    main { padding: 24px 18px; }
    .site-header { padding: 12px 18px; }
    .hero { margin: -24px -18px 32px; padding: 48px 20px; }
    .hero h1 { font-size: 1.7rem; }
    .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ---------- Message attachments & GIF picker ---------- */
.message-attachment { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; margin-bottom: 4px; }
.message-attach-btn {
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.message-attach-btn:hover { color: var(--text); }
.message-gif-btn {
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 7px;
    border-radius: 4px;
    flex-shrink: 0;
    cursor: pointer;
}
.message-gif-btn:hover { border-color: var(--accent); color: var(--accent); }
.message-input-wrap { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.attachment-preview { position: relative; display: inline-block; max-width: 120px; }
.attachment-preview img { max-width: 120px; max-height: 120px; border-radius: 6px; display: block; }
.attachment-preview #attachment-clear {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 0.9rem;
    line-height: 18px;
    text-align: center;
    padding: 0;
    border: none;
    cursor: pointer;
}
.message-send-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
}
.message-send-btn:hover { background: var(--accent-hover); }
.gif-picker {
    border-top: 1px solid var(--border);
    padding: 10px 12px;
    background: var(--surface);
    flex-shrink: 0;
}
.gif-picker input { width: 100%; margin-bottom: 8px; }
.gif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 6px; max-height: 200px; overflow-y: auto; }
.gif-result { width: 100%; height: 80px; object-fit: cover; border-radius: 4px; cursor: pointer; }
.gif-result:hover { opacity: 0.85; }

/* ---------- Inline comments ---------- */
.post-action-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0;
}
.post-action-btn:hover { color: var(--text); text-decoration: none; }
.post-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.post-vote-group { display: flex; align-items: center; gap: 4px; }
.post-vote-score { font-weight: 700; font-size: .88rem; min-width: 1.5ch; text-align: center; }
.vote-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 2px 4px; font-size: .85rem; line-height: 1; }
.vote-btn:hover { color: var(--text); }
.vote-up-btn.active { color: var(--success); }
.vote-down-btn.active { color: var(--danger); }
.save-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0; font-size: .88rem; }
.save-btn:hover { color: #e0245e; }
.save-btn.active { color: #e0245e; }
.post-view-link { font-size: .8rem; color: var(--text-muted); background: none; border: none; cursor: pointer; padding: 0; }
.post-view-link:hover { color: var(--text); text-decoration: none; }
.post-vote-static { font-size: .88rem; }
.inline-comments {
    border-top: 1px solid var(--border);
    padding: 10px 0 4px;
    margin-top: 8px;
}
.inline-comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.inline-comment-form { display: flex; gap: 8px; align-items: flex-end; }
.inline-comment-form textarea {
    flex: 1;
    resize: none;
    border-radius: 14px;
    padding: 7px 12px;
    font-size: 0.88rem;
}
.inline-comment-form button { border-radius: 14px; padding: 7px 14px; font-size: 0.85rem; }

/* The .notification block on /notifications is an <a> tag */
a.notification { color: var(--text); }


/* ── Product page v2 — community/group layout ─────────────────────────────
 * Cover banner + overlapping header card + sticky sidebar buy box.
 * Uses only theme variables so all themes (dark/light/aero) inherit it. */

.pp2 { margin-top: -16px; }

.pp2-removed { margin-bottom: 20px; }

.pp2-cover {
    position: relative;
    height: 300px;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--accent-gradient);
    box-shadow: var(--shadow);
}
.pp2-cover img#pp2-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pp2-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pp2-cover-placeholder span {
    font-family: "Archivo Black", "Segoe UI", sans-serif;
    font-size: 7rem;
    color: rgba(255, 255, 255, 0.35);
    user-select: none;
}

.pp2-header {
    position: relative;
    z-index: 2;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin: -56px 24px 0;
    padding: 18px 24px 0;
    box-shadow: var(--shadow);
}

.pp2-media-strip {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    overflow-x: auto;
    padding-bottom: 2px;
}
.pp2-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.75;
    transition: opacity 0.15s, border-color 0.15s;
}
.pp2-thumb:hover { opacity: 1; }
.pp2-thumb-active { border-color: var(--accent); opacity: 1; }
.pp2-thumb-video {
    background: var(--bg-elevated);
    color: var(--accent);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--border);
    padding: 0;
}
#pp2-video-wrap { margin-bottom: 14px; }
#pp2-video-wrap video { width: 100%; max-height: 420px; border-radius: var(--radius-sm); background: #000; }

.pp2-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.pp2-title-block h1 { margin-bottom: 4px; font-size: 1.9rem; }
.pp2-byline { margin: 0 0 4px; color: var(--muted); font-size: 0.95rem; }
.pp2-byline a { font-weight: 600; }
.pp2-dot { margin: 0 6px; color: var(--muted-dim); }
.pp2-stars-inline { color: var(--accent); font-weight: 600; }
.pp2-muted { color: var(--muted); }

.pp2-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.pp2-votes { margin: 0; }

.pp2-tabs {
    display: flex;
    gap: 4px;
    margin-top: 14px;
    border-top: 1px solid var(--border);
    overflow-x: auto;
}
.pp2-tab {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--muted);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.pp2-tab:hover { color: var(--text); text-decoration: none; }
.pp2-tab-active { color: var(--accent); border-bottom-color: var(--accent); }
.pp2-tab-count {
    background: var(--accent-dim);
    color: var(--accent);
    border-radius: 10px;
    padding: 1px 8px;
    font-size: 0.78rem;
    margin-left: 2px;
}

.pp2-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 24px;
    margin-top: 24px;
    align-items: start;
}
.pp2-main { min-width: 0; }

.pp2-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
    scroll-margin-top: 16px;
}
.pp2-card-title { font-size: 1.15rem; margin-bottom: 14px; }
.pp2-card-title-sm { font-size: 0.95rem; margin: 0 0 10px; }

.pp2-side { min-width: 0; }
.pp2-side-inner { position: sticky; top: 16px; }

.pp2-buy-card { border-color: var(--border-light); }
.pp2-price {
    font-size: 1.9rem;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.2;
}
.pp2-price-suffix {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--muted);
    margin-left: 4px;
}
.pp2-meta-line { margin: 0 0 8px; font-size: 0.86rem; }

.pp2-buy-btn {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    font-weight: 700;
}
.pp2-buy-btn-alt {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-light);
}
.pp2-owned-badge {
    background: var(--success-dim);
    color: var(--success);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-weight: 600;
    text-align: center;
    margin: 0;
}

.pp2-file-list { margin: 0 0 12px; padding-left: 18px; }
.pp2-file-list li { margin-bottom: 6px; font-size: 0.9rem; }

.pp2-seller-row {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
}
.pp2-seller-row:hover { text-decoration: none; }
.pp2-seller-row span { display: flex; flex-direction: column; line-height: 1.3; }
.pp2-seller-row small { color: var(--muted); }
.pp2-seller-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
}
.pp2-message-btn {
    width: 100%;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border-light);
    font-size: 0.88rem;
}

@media (max-width: 900px) {
    .pp2-body { grid-template-columns: 1fr; }
    .pp2-side { order: -1; }
    .pp2-side-inner { position: static; }
    .pp2-cover { height: 200px; }
    .pp2-header { margin: -40px 12px 0; padding: 14px 16px 0; }
    .pp2-title-block h1 { font-size: 1.4rem; }
}


/* ── Product page v2.1: lightbox, image count, tab panels, vote alignment ── */

.pp2-votes { display: flex; align-items: center; gap: 8px; margin: 0; }
.pp2-votes form { display: flex !important; margin: 0; }
.pp2-votes .vote-score { line-height: 1; }
.pp2-header-actions { align-items: center; }

.pp2-img-count {
    position: absolute;
    right: 14px;
    bottom: 12px;
    background: rgba(10, 12, 18, 0.62);
    color: #fff;
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 600;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#pp2-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(6, 8, 13, 0.93);
    display: flex;
    align-items: center;
    justify-content: center;
}
#pp2-lb-img {
    max-width: 92vw;
    max-height: 88vh;
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    user-select: none;
}
.pp2-lb-close {
    position: absolute;
    top: 14px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 2.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
}
.pp2-lb-close:hover { opacity: 1; background: none; }
.pp2-lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.10);
    color: #fff;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 4px;
}
.pp2-lb-nav:hover { background: rgba(255, 255, 255, 0.22); }
.pp2-lb-prev { left: 18px; }
.pp2-lb-next { right: 18px; }
.pp2-lb-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(10, 12, 18, 0.55);
    padding: 4px 14px;
    border-radius: 14px;
}


/* ── Batch 9: checkbox alignment, wide settings, cards ─────────────────── */

input[type="checkbox"], input[type="radio"] { width: auto; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
}
label:has(> input[type="checkbox"]) > input[type="checkbox"],
label:has(> input[type="radio"]) > input[type="radio"] {
    flex-shrink: 0;
    margin: 3px 0 0;
}

/* Account settings — responsive card grid */
.settings-page {
    max-width: 1100px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
    align-items: start;
    margin: 0 auto;
}
.settings-page > h1, .settings-page > .flash { grid-column: 1 / -1; margin-bottom: 0; }
.settings-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin: 0;
}

/* Admin settings pages */
.admin-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
    align-items: start;
    max-width: 1100px;
    margin: 0 auto;
}
.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 26px;
}
.admin-card-wide { max-width: 1000px; margin: 0 auto; }
.stripe-keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }

/* Edit listing — 2-col */
.edit-page { max-width: 1200px; margin: 0 auto; }
.edit-page > h1 + p { margin-top: -6px; }
.edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 40px; align-items: start; }
.edit-grid .edit-full { grid-column: 1 / -1; }

/* Purchases — cards */
.pur-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 20px; }
.pur-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.pur-title { font-weight: 700; font-size: 1.05rem; }
.pur-meta { display: flex; gap: 14px; color: var(--muted); font-size: 0.85rem; flex-wrap: wrap; margin: 0; }
.pur-lic { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.pur-lic-btns { display: flex; gap: 14px; margin-top: 8px; align-items: center; }
.pur-lic-btns form { margin: 0; }
.pur-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.pur-actions form { margin: 0; }
.pur-downloads { display: flex; flex-direction: column; gap: 4px; }

/* Dashboard card/list toggle */
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 16px; }
.view-toggle button { background: var(--surface); color: var(--muted); border: none; border-radius: 0; padding: 6px 14px; font-size: 0.85rem; cursor: pointer; }
.view-toggle button.active { background: var(--accent-dim); color: var(--accent); font-weight: 600; }
.dash-prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.dash-prod-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.dash-prod-thumb { display: block; height: 130px; background: var(--bg-elevated); }
.dash-prod-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dash-prod-thumb-ph { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 2.4rem; font-weight: 800; color: var(--muted-dim); }
.dash-prod-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dash-prod-title { font-weight: 600; }
.dash-prod-meta { display: flex; gap: 10px; align-items: center; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; }
.dash-prod-actions { display: flex; gap: 8px; margin-top: auto; }
.dash-prod-actions form { margin: 0; }

/* Product community: comment attachments */
.comment-image { max-width: 280px; max-height: 280px; border-radius: 8px; margin-top: 8px; display: block; }
.pc-toolbar { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.pc-attach-btn { display: inline-flex; align-items: center; cursor: pointer; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--muted); background: var(--surface); margin: 0; }
.pc-gif-btn { font-size: 0.8rem; font-weight: 700; padding: 6px 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.pc-preview { position: relative; display: inline-block; margin-top: 8px; }
.pc-preview img { max-width: 140px; max-height: 140px; border-radius: 6px; display: block; }
.pc-preview button { position: absolute; top: -8px; right: -8px; background: var(--danger); color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px; line-height: 1; cursor: pointer; padding: 0; }
.pc-gif-picker { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; background: var(--bg-elevated); }
.pc-gif-picker input { width: 100%; margin-bottom: 8px; }

@media (max-width: 900px) {
    .settings-page, .admin-settings-grid { grid-template-columns: 1fr; }
    .stripe-keys-grid { grid-template-columns: 1fr; }
    .edit-grid { grid-template-columns: 1fr; }
    .pur-grid { grid-template-columns: 1fr; }
}


/* ── Batch B: file inputs, nav active state, upgrade link ─────────────────── */

/* Custom file input button (the native one is ugly & unstyleable-ish) */
input[type="file"] {
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--muted);
    background: var(--bg-elevated);
    border: 1px dashed var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    width: 100%;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
input[type="file"]:hover { border-color: var(--accent); background: var(--surface-hover); }
input[type="file"]::file-selector-button {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    background: var(--accent-gradient);
    border: none;
    border-radius: var(--radius-sm);
    padding: 7px 14px;
    margin-right: 12px;
    cursor: pointer;
    transition: filter .15s;
}
input[type="file"]::file-selector-button:hover { filter: brightness(1.1); }

/* Nav active-page indicator */
.nav-icon-link.nav-active {
    color: var(--accent);
    position: relative;
}
.nav-icon-link.nav-active::after {
    content: '';
    position: absolute;
    left: 50%; bottom: -6px;
    transform: translateX(-50%);
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--accent);
}

/* Upgrade link in nav */
.nav-upgrade-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #fff !important;
    background: var(--accent-gradient);
    padding: 7px 12px !important;
    border-radius: 999px;
    text-decoration: none;
    white-space: nowrap;
}
.nav-upgrade-link:hover { filter: brightness(1.1); text-decoration: none; }


/* ── Batch E: YouTube embeds + link preview cards ─────────────────────────── */
.yt-embed { position: relative; width: 100%; max-width: 560px; aspect-ratio: 16 / 9; margin: 10px 0; border-radius: var(--radius); overflow: hidden; background: #000; }
.yt-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.post-body { line-height: 1.55; }
.post-body a { color: var(--accent); word-break: break-word; }

.link-preview { margin: 10px 0; }
.lp-card { display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--text); background: var(--bg-elevated); max-width: 520px; }
.lp-card:hover { background: var(--surface-hover); text-decoration: none; }
.lp-img { width: 120px; height: 120px; object-fit: cover; flex-shrink: 0; }
.lp-body { padding: 10px 14px; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lp-title { font-weight: 600; font-size: 0.92rem; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lp-desc { font-size: 0.82rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lp-site { font-size: 0.75rem; color: var(--muted-dim); text-transform: uppercase; letter-spacing: 0.03em; margin-top: auto; }
@media (max-width: 480px) { .lp-img { width: 84px; height: 84px; } }


/* ── Batch E2: threaded comments + reply forms ────────────────────────────── */
.cmt-indent-1 { margin-left: 28px; }
.cmt-indent-2 { margin-left: 56px; }
.cmt-indent-3 { margin-left: 84px; }
.comment[data-depth]:not(.cmt-indent-0) { border-left: 2px solid var(--border); padding-left: 12px; }
.comment .comment-text { line-height: 1.5; }
.comment .comment-text a { color: var(--accent); word-break: break-word; }
.cmt-reply-btn {
    background: none; border: none; color: var(--muted); padding: 2px 0; margin-top: 2px;
    font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.cmt-reply-btn:hover { color: var(--accent); background: none; }
.cmt-reply-form { display: flex; gap: 8px; margin-top: 8px; align-items: flex-start; }
.cmt-reply-form textarea { flex: 1; min-height: 36px; resize: vertical; }
.cmt-reply-form button { font-size: 0.82rem; padding: 7px 12px; }
@media (max-width: 480px) {
    .cmt-indent-1 { margin-left: 16px; }
    .cmt-indent-2 { margin-left: 32px; }
    .cmt-indent-3 { margin-left: 48px; }
}


/* ── Marketplace page ─────────────────────────────────────────────────────── */
.market-head { margin-bottom: 20px; }
.market-head h1 { margin-bottom: 4px; }
.market-sub { color: var(--muted); margin: 0; max-width: 640px; }

.market-bar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.market-search { position: relative; flex: 1; min-width: 220px; display: flex; align-items: center; }
.market-search svg { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.market-search input { width: 100%; padding-left: 38px; }
.market-bar select { min-width: 180px; }

.market-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.market-tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.85rem; font-weight: 600; text-decoration: none;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 100px; padding: 6px 13px;
}
.market-tag:hover { border-color: var(--accent); text-decoration: none; }
.market-tag.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.market-tag-count { font-size: 0.75rem; color: var(--muted-dim); font-weight: 500; }
.market-tag.active .market-tag-count { color: var(--accent); }

.market-count { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; }

.product-card-link { text-decoration: none; color: var(--text); display: block; }
.product-card-link:hover { text-decoration: none; }
.product-card-link:hover h3 { color: var(--accent); }
.thumb-placeholder {
    display: flex; align-items: center; justify-content: center;
    height: 150px; font-size: 2.6rem; font-weight: 800;
    color: var(--muted-dim); background: var(--bg-elevated);
    border-radius: var(--radius-sm);
}
.price-suffix { font-size: 0.82rem; font-weight: 400; color: var(--muted); }
.price-badge { font-size: 0.72rem; font-weight: 600; color: var(--muted); margin-left: 6px; }

.market-pager { display: flex; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.market-page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 38px; padding: 8px 12px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9rem;
}
.market-page-btn:hover { border-color: var(--accent); text-decoration: none; }
.market-page-btn.active { background: var(--accent-gradient); color: #fff; border-color: transparent; }


/* ── Seller reply to a review ─────────────────────────────────────────────── */
.review-seller-reply { margin: 8px 0 0 20px; padding: 10px 14px; background: var(--accent-dim); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); }
.review-seller-reply-head { margin: 0 0 4px; font-size: 0.85rem; color: var(--accent); }
.review-reply-form textarea { width: 100%; resize: vertical; }


/* ── Comment head/actions/edit + notification avatar ──────────────────────── */
.cmt-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cmt-head .cmt-time { font-size: 0.78rem; }
.cmt-edited { font-size: 0.75rem; color: var(--muted-dim); }
.cmt-actions { display: flex; gap: 14px; margin-top: 4px; }
.cmt-actions button { background: none; border: none; color: var(--muted); padding: 0; font-size: 0.78rem; font-weight: 600; cursor: pointer; }
.cmt-actions button:hover { color: var(--accent); background: none; }
.cmt-del-btn:hover { color: var(--danger) !important; }
.cmt-edit-form { margin-top: 6px; }
.cmt-edit-form textarea { width: 100%; resize: vertical; }
.notif-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.notif-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-time { font-size: 0.75rem; color: var(--muted); }
.notif-item { display: flex !important; gap: 10px; align-items: center; }
.notification { display: flex; gap: 12px; align-items: center; }
