/* ============================================================
   TraderApp Design System
   Tradesman P2P Marketplace
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    /* Structural navy — nav, sidebar, hero backgrounds */
    --color-primary: #0D2137;
    --color-primary-light: #173A5E;
    --color-primary-dark: #060E1A;

    /* Action blue — links, info states, accent UI */
    --color-accent: #2563EB;
    --color-accent-light: #3B82F6;
    --color-accent-dark: #1D4ED8;

    /* CTA amber — sell buttons, prices, key commerce actions */
    --color-cta: #E8940A;
    --color-cta-dark: #C47B05;
    --color-cta-light: #FEF3C7;

    /* Star ratings */
    --color-star: #F59E0B;

    /* Semantic */
    --color-success: #059669;
    --color-success-light: #d1fae5;
    --color-danger: #DC2626;
    --color-danger-light: #fee2e2;
    --color-warning: #f59e0b;
    --color-warning-light: #fef3c7;
    --color-info: #3b82f6;
    --color-info-light: #dbeafe;

    /* Surfaces */
    --color-bg: #F0F4F8;
    --color-surface: #ffffff;
    --color-border: #DDE4ED;
    --color-border-dark: #C1CDD9;

    /* Text */
    --color-text-primary: #0B1929;
    --color-text-secondary: #3E5268;
    --color-text-muted: #7A93AA;

    /* Radii */
    --radius-sm: 5px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    /* Shadows — slightly richer for depth */
    --shadow-sm: 0 1px 3px rgba(13,33,55,.07), 0 1px 2px rgba(13,33,55,.05);
    --shadow-md: 0 4px 12px rgba(13,33,55,.10), 0 1px 4px rgba(13,33,55,.06);
    --shadow-lg: 0 10px 28px rgba(13,33,55,.12), 0 4px 10px rgba(13,33,55,.07);
    --shadow-xl: 0 20px 48px rgba(13,33,55,.16);

    --nav-height: 64px;
    --sidebar-width: 260px;
    --bottom-nav-height: 68px;

    /* Typography */
    --font-family: 'Nunito Sans', 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.01em;
}

/* Apply display font to all headings and key UI titles */
h1, h2, h3,
.hero-title,
.section-title,
.auth-title,
.listing-detail-title,
.profile-name,
.page-title {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); }

img { max-width: 100%; height: auto; display: block; }

/* ---------- Layout ---------- */
.app-wrapper { display: flex; flex-direction: column; min-height: 100vh; }

.main-content {
    flex: 1;
    padding: 0;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.container-sm { max-width: 640px; margin: 0 auto; padding: 0 24px; }
.container-md { max-width: 900px; margin: 0 auto; padding: 0 24px; }

.page-padding { padding: 32px 0; }

/* ---------- Top Navigation ---------- */
.topnav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    min-height: var(--nav-height);
    height: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
    background: #fff;
    display: flex;
    align-items: center;
    padding: env(safe-area-inset-top, 0px) 24px 0;
    gap: 20px;
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.topnav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.topnav-logo-img {
    height: 50px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.topnav-search {
    flex: 1;
    max-width: 520px;
    position: relative;
}

.topnav-search input {
    width: 100%;
    height: 42px;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 0 16px 0 44px;
    font-size: 14px;
    color: var(--color-text-primary);
    outline: none;
    transition: all .2s;
    font-family: var(--font-family);
}

.topnav-search input::placeholder { color: var(--color-text-muted); }
.topnav-search input:focus { background: #fff; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }

.topnav-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.topnav-search-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-full);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all .2s;
    letter-spacing: 0.01em;
}
.topnav-search-btn:hover { background: var(--color-cta); }

.topnav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.topnav-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 18px;
    text-decoration: none;
    transition: background .15s, color .15s;
}
.topnav-icon-btn:hover { background: var(--color-bg); color: var(--color-accent); }

.topnav-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-sell-now {
    background: var(--color-cta);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all .2s;
    letter-spacing: 0.01em;
}
.btn-sell-now:hover { background: var(--color-cta-dark); color: #fff; box-shadow: 0 4px 14px rgba(232,148,10,.40); transform: translateY(-1px); }

/* User menu */
.user-menu { position: relative; padding:5px }

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 6px 12px 6px 8px;
    cursor: pointer;
    color: var(--color-text-primary);
    transition: background .15s, border-color .15s;
}
.user-avatar-btn:hover { background: var(--color-border); border-color: var(--color-border-dark); }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar-chevron { font-size: 11px; opacity: .7; }

.user-avatar-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    z-index: 1001;
    overflow: hidden;
}

.dropdown-header {
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--color-border);
    background: #f8fafc;
}

.dropdown-header-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-primary);
}

.dropdown-header-email {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 16px;
    font-size: 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background .15s;
}
.dropdown-item:hover { background: var(--color-bg); color: var(--color-accent); }
.dropdown-item.danger:hover { background: var(--color-danger-light); color: var(--color-danger); }
.dropdown-item .item-icon { width: 20px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--color-text-muted); }
.dropdown-divider { height: 1px; background: var(--color-border); margin: 4px 0; }

/* Category Nav Bar */
.category-nav {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    margin-top: calc(var(--nav-height) + env(safe-area-inset-top, 0px));
    overflow: hidden;
}

.category-nav-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 24px;
    max-width: 1280px;
    margin: 0 auto;
    overflow-x: auto;
    scrollbar-width: none;
}
.category-nav-inner::-webkit-scrollbar { display: none; }

.category-nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 16px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2.5px solid transparent;
    transition: all .15s;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.category-nav-item:hover { color: var(--color-accent); border-bottom-color: var(--color-accent-light); }
.category-nav-item.active { color: var(--color-cta); border-bottom-color: var(--color-cta); font-weight: 700; }
.category-nav-item .cat-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all .18s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { background: var(--color-accent-dark); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.3); }

/* btn-accent: white/inverted — for use on dark/blue backgrounds */
.btn-accent { background: #fff; color: var(--color-accent); }
.btn-accent:hover { background: #f0f7ff; color: var(--color-accent-dark); box-shadow: 0 4px 14px rgba(0,0,0,.15); }

.btn-outline { background: transparent; color: var(--color-accent); border-color: var(--color-accent); }
.btn-outline:hover { background: var(--color-accent); color: #fff; }

.btn-outline-muted { background: transparent; color: var(--color-text-secondary); border-color: var(--color-border-dark); }
.btn-outline-muted:hover { background: var(--color-bg); border-color: var(--color-text-secondary); }

.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-success { background: var(--color-success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-ghost { background: transparent; color: var(--color-text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--color-bg); color: var(--color-text-primary); }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Cards ---------- */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.card-hover { transition: transform .2s, box-shadow .2s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.card-body { padding: 22px; }
.card-header { padding: 18px 20px; border-bottom: 1px solid var(--color-border); font-weight: 600; font-size: 15px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--color-border); background: #f8fafc; }

/* ---------- Listing Card ---------- */
.listing-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}
.listing-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--color-cta); }

.listing-card-image {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--color-bg);
    overflow: hidden;
}
.listing-card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.listing-card:hover .listing-card-image img { transform: scale(1.04); }

.listing-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e2e8f0, #f1f5f9);
    color: #94a3b8;
}

.listing-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 3px 9px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.listing-card-fav {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    height: 34px;
    background: rgba(255,255,255,.9);
    border-radius: var(--radius-full);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all .2s;
    backdrop-filter: blur(4px);
}
.listing-card-fav:hover { background: white; transform: scale(1.1); }
.listing-card-fav.active { color: var(--color-danger); }

.listing-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }

.listing-card-category {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.listing-card-title-wrap {
    flex: 1;
    min-width: 0;
    padding-bottom: 10px;
}

.listing-card-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0;
}

.listing-card-price {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.2px;
    font-family: var(--font-body);
}
.listing-card-price .price-amount {
    color: var(--color-cta-dark);
    font-weight: 700;
}
.listing-card-price .offers-tag {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-info);
    background: var(--color-info-light);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    letter-spacing: 0;
    line-height: 1.6;
}

.listing-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--color-text-muted);
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}

.listing-card-seller {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* ---------- Condition Badges ---------- */
.badge-condition-new { background: #d1fae5; color: #065f46; }
.badge-condition-likenew { background: #dbeafe; color: #1e40af; }
.badge-condition-good { background: var(--color-warning-light); color: #92400e; }
.badge-condition-fair { background: #fee2e2; color: #991b1b; }
.badge-condition-forparts { background: #f3f4f6; color: #4b5563; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 22px; }

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 6px;
}

.form-label .required { color: var(--color-danger); margin-left: 3px; }

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border: 1.5px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--color-text-primary);
    background: var(--color-surface);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    font-family: var(--font-family);
}

.form-control:focus { border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.form-control::placeholder { color: var(--color-text-muted); }
.form-control.invalid { border-color: var(--color-danger); }
.form-control.invalid:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.12); }

textarea.form-control { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.6; }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--color-danger); margin-top: 5px; display: flex; align-items: center; gap: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Checkbox / Toggle */
.form-check { display: flex; align-items: flex-start; gap: 10px; }
.form-check input[type="checkbox"] {
    width: 18px; height: 18px; border: 2px solid var(--color-border-dark);
    border-radius: 4px; cursor: pointer; accent-color: var(--color-primary);
    flex-shrink: 0; margin-top: 2px;
}
.form-check label { font-size: 14px; color: var(--color-text-secondary); cursor: pointer; line-height: 1.5; }

/* ---------- Hero Section ---------- */
.hero {
    background: linear-gradient(150deg, var(--color-primary-dark) 0%, var(--color-primary) 45%, #0F3460 100%);
    padding: 56px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Subtle dot-grid texture — adds depth without noise */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, rgba(255,255,255,.08) 1px, transparent 1px);
    background-size: 28px 28px;
    pointer-events: none;
}

/* Amber glow accent in the corner */
.hero::after {
    content: '';
    position: absolute;
    top: -80px;
    right: -80px;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(232,148,10,.18) 0%, transparent 65%);
    pointer-events: none;
}

.hero-content { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }
.hero-eyebrow { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; color: rgba(255,255,255,.65); margin-bottom: 16px; }

.hero-title {
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 800;
    color: #fff;
    line-height: 1.15;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.hero-title span { color: var(--color-cta); }

.hero-subtitle { font-size: 16px; color: rgba(255,255,255,.72); margin-bottom: 28px; line-height: 1.65; }

.hero-search-bar {
    display: flex;
    background: rgba(255,255,255,.97);
    border-radius: var(--radius-full);
    padding: 6px 6px 6px 22px;
    box-shadow: 0 12px 40px rgba(6,14,26,.35), 0 4px 12px rgba(6,14,26,.2);
    max-width: 580px;
    margin: 0 auto 32px;
    gap: 8px;
}

.hero-search-bar input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 15px;
    color: var(--color-text-primary);
    background: transparent;
    font-family: var(--font-family);
}

.hero-search-bar input::placeholder { color: var(--color-text-muted); }

.hero-search-bar button {
    background: var(--color-cta);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    padding: 12px 26px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all .2s;
    white-space: nowrap;
    font-family: var(--font-display);
    letter-spacing: 0.01em;
}
.hero-search-bar button:hover { background: var(--color-cta-dark); box-shadow: 0 4px 14px rgba(232,148,10,.4); }
/* Icon hidden on desktop, text hidden on mobile */
.hero-search-btn-icon { display: none; font-size: 18px; line-height: 1; }

@media (max-width: 768px) {
    .hero-search-btn-text { display: none; }
    .hero-search-btn-icon { display: inline; }
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

.hero-stat { color: rgba(255,255,255,.85); }
.hero-stat-number { font-size: 24px; font-weight: 800; color: #fff; display: block; }
.hero-stat-label { font-size: 13px; color: rgba(255,255,255,.6); }

/* ---------- Hero Stats Mobile Carousel ---------- */

/* On desktop the carousel is hidden; on mobile the row is hidden */
.hero-stats-carousel { display: none; }

/* Each slide: hidden by default, flex when active */
.hero-stat-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.hero-stat-slide.active {
    display: flex;
    animation: statFadeIn 0.4s ease forwards;
}

@keyframes statFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Dots */
.hero-stats-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.hero-stats-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,.35);
    transition: background 0.3s ease, transform 0.3s ease;
}

.hero-stats-dot.active {
    background: #fff;
    transform: scale(1.3);
}

/* ---------- Section Headings ---------- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.section-title { font-size: 20px; font-weight: 700; color: var(--color-text-primary); letter-spacing: -.25px; }
.section-subtitle { font-size: 14px; color: var(--color-text-muted); margin-top: 3px; }

/* ── Map / Location view ─────────────────────────────────────── */
#listing-map {
    height: 520px;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--color-border);
    overflow: hidden;
    z-index: 0;
    margin-bottom: 16px;
}
.map-no-location {
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
}
.browse-view-toggle {
    display: flex;
    gap: 2px;
    background: var(--color-bg);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 3px;
}
.browse-view-btn {
    padding: 5px 12px;
    border: none;
    border-radius: calc(var(--radius-md) - 2px);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-muted);
    transition: all 0.15s;
    white-space: nowrap;
}
.browse-view-btn.active { background: var(--color-accent); color: #fff; }
.browse-view-btn:hover:not(.active) { background: var(--color-bg-secondary); color: var(--color-text-primary); }
.leaflet-popup-content-wrapper { border-radius: 10px !important; box-shadow: 0 4px 20px rgba(0,0,0,.18) !important; }

/* ---------- Listing Grid ---------- */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.listing-grid-4 { grid-template-columns: repeat(4, 1fr); }
.listing-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* ---------- Category Grid ---------- */
.category-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category-card {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    padding: 7px 14px 7px 10px;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    white-space: nowrap;
}
.category-card:hover { border-color: var(--color-accent); background: #eff6ff; transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.category-card-icon { font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.category-card-name { font-size: 13px; font-weight: 600; color: var(--color-text-primary); }
.category-card-count { font-size: 11px; color: var(--color-text-muted); margin-left: 2px; }

@media (max-width: 768px) {
    .category-grid {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        gap: 10px;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .category-grid::-webkit-scrollbar { display: none; }

    .category-card {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 0 0 72px;
        width: 72px;
        height: 76px;
        border-radius: 16px;
        padding: 10px 6px 8px;
        gap: 5px;
        white-space: normal;
        text-align: center;
    }
    .category-card-icon { font-size: 26px; }
    .category-card-name { font-size: 10px; font-weight: 600; line-height: 1.2; color: var(--color-text-primary); }
    .category-card-count { display: none; }
}

/* ---------- How to Buy Card (ListingDetail) ---------- */
.how-to-buy-card {
    background: var(--color-bg-secondary, #f8fafc);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.how-to-buy-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}

.how-to-buy-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.how-to-buy-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--color-text-primary);
}

.how-to-buy-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ---------- Messages Checkout Banner ---------- */
.msg-checkout-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    border-top: 2px solid #22c55e;
    border-bottom: 1px solid #bbf7d0;
    flex-wrap: wrap;
}

.msg-checkout-banner-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.msg-checkout-banner-title {
    font-size: 13px;
    color: var(--color-text-primary);
}

.msg-checkout-banner-sub {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 1px;
}

/* ---------- Image Upload Progress ---------- */
.img-upload-progress {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--color-bg-secondary, #f8fafc);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
}

.img-upload-bar-track {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: 99px;
    overflow: hidden;
}

.img-upload-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), #2563eb);
    border-radius: 99px;
    transition: width 0.3s ease;
}

/* ---------- Browse Search Bar ---------- */
.browse-search-bar {
    margin-bottom: 20px;
}

.browse-search-form {
    width: 100%;
}

.browse-search-inner {
    display: flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    padding: 6px 6px 6px 14px;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(30,58,95,0.07);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.browse-search-inner:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30,58,95,0.12);
}

.browse-search-icon {
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.browse-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    color: var(--color-text-primary);
    padding: 6px 0;
    min-width: 0;
}

.browse-search-input::placeholder {
    color: var(--color-text-muted);
}

.browse-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    padding: 4px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.browse-search-clear:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-secondary);
}

.browse-search-btn {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
    white-space: nowrap;
}

.browse-search-btn:hover {
    background: #16304f;
}

/* ---------- Browse Page Layout ---------- */
.browse-layout { display: flex; gap: 24px; align-items: flex-start; }

.browse-sidebar {
    width: 260px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--nav-height) + 24px);
}

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

.filter-card { background: var(--color-surface); border-radius: var(--radius-lg); border: 1px solid var(--color-border); overflow: hidden; }
.filter-card-header { padding: 14px 18px; font-weight: 700; font-size: 14px; background: var(--color-bg); border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.filter-card-body { padding: 16px 18px; }
.filter-section { margin-bottom: 20px; }
.filter-section:last-child { margin-bottom: 0; }
.filter-section-title { font-size: 13px; font-weight: 600; color: var(--color-text-secondary); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .5px; }
.filter-option { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.filter-option label { font-size: 14px; color: var(--color-text-secondary); cursor: pointer; flex: 1; }
.filter-option .count { font-size: 12px; color: var(--color-text-muted); }
.cat-dropdown { position: relative; width: 100%; }
.cat-dropdown-trigger { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 44px; padding: 0 14px; border: 1.5px solid var(--color-border-dark); border-radius: var(--radius-md); background: var(--color-surface); font-size: 14px; color: var(--color-text-primary); cursor: pointer; gap: 8px; font-family: var(--font-family); transition: border-color .15s, box-shadow .15s; }
.cat-dropdown-trigger:hover, .cat-dropdown.open .cat-dropdown-trigger { border-color: var(--color-accent); }
.cat-dropdown.open .cat-dropdown-trigger { border-bottom-left-radius: 0; border-bottom-right-radius: 0; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.cat-dropdown-trigger-label { display: flex; align-items: center; gap: 7px; min-width: 0; overflow: hidden; }
.cat-dropdown-trigger-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-dropdown-chevron { transition: transform .2s; flex-shrink: 0; opacity: .45; }
.cat-dropdown.open .cat-dropdown-chevron { transform: rotate(180deg); opacity: .7; }
.cat-dropdown-menu { position: absolute; top: 100%; left: 0; right: 0; background: var(--color-surface); border: 1.5px solid var(--color-accent); border-top: none; border-bottom-left-radius: var(--radius-md); border-bottom-right-radius: var(--radius-md); box-shadow: 0 6px 20px rgba(0,0,0,.1); z-index: 200; overflow: hidden; }
.cat-dropdown-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 14px; background: none; border: none; border-bottom: 1px solid var(--color-border); font-size: 14px; font-family: var(--font-family); color: var(--color-text-secondary); cursor: pointer; text-align: left; white-space: nowrap; transition: background .12s, color .12s; }
.cat-dropdown-item:last-child { border-bottom: none; }
.cat-dropdown-item:hover { background: var(--color-bg-secondary); color: var(--color-text-primary); }
.cat-dropdown-item.selected { color: var(--color-primary); font-weight: 600; background: var(--color-action-light, #eff6ff); }
.cat-dropdown-item.selected svg { stroke: var(--color-primary); }

.price-range-inputs { display: flex; gap: 8px; align-items: center; }
.price-range-inputs input { flex: 1; }
.price-range-inputs span { color: var(--color-text-muted); font-size: 14px; }

/* Mobile Filter Toggle */
.filter-mobile-toggle {
    display: none;
    width: 100%;
    padding: 13px 16px;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
}
.filter-mobile-chevron {
    font-size: 11px;
    transition: transform 0.25s ease;
    opacity: 0.8;
}
.filter-mobile-chevron.open { transform: rotate(180deg); }

@media (max-width: 768px) {
    .filter-mobile-toggle { display: flex; }
}

/* Browse Controls */
.browse-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.browse-results-count { font-size: 14px; color: var(--color-text-muted); }
.browse-results-count strong { color: var(--color-text-primary); }

.sort-select {
    padding: 8px 32px 8px 12px;
    border: 1.5px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--color-text-primary);
    background: var(--color-surface);
    outline: none;
    cursor: pointer;
    font-family: var(--font-family);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* ---------- Listing Detail ---------- */
.listing-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    flex-wrap: nowrap;
    overflow: hidden;
}
.listing-breadcrumb a { color: inherit; text-decoration: none; white-space: nowrap; }
.listing-breadcrumb a:hover { color: var(--color-accent); }
.listing-breadcrumb-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--color-text-primary);
    font-weight: 500;
}

@media (max-width: 768px) {
    .listing-breadcrumb-hide-mobile { display: none; }
    .listing-breadcrumb { margin-bottom: 12px; }
    .page-padding { padding-top: 16px; padding-bottom: 16px; }
}

/* Mobile title above image — hidden on desktop */
.listing-detail-mobile-header { display: none; }

@media (max-width: 1024px) {
    .listing-detail-mobile-header {
        display: block;
        margin-bottom: 14px;
    }
    .listing-detail-mobile-title {
        font-size: 18px;
        font-weight: 700;
        line-height: 1.3;
        color: var(--color-text-primary);
        margin-bottom: 8px;
    }
    /* Hide title + badge in sidebar on mobile since they're shown above */
    .listing-detail-sidebar-title,
    .listing-detail-sidebar-badge { display: none !important; }
}

.listing-detail-grid { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: flex-start; }

.listing-detail-images { top: calc(var(--nav-height) + 20px); }

.listing-main-image {
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 4/3;
    background: var(--color-bg);
    margin-bottom: 12px;
    position: relative;
}
.listing-main-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-main-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 80px; background: linear-gradient(135deg, #e2e8f0, #f1f5f9); }

/* Lightbox zoom hint */
.listing-main-clickable { cursor: zoom-in; }
.listing-main-clickable img { transition: transform .25s ease; }
.listing-main-clickable:hover img { transform: scale(1.02); }
.listing-img-zoom-hint {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,.52);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .2s ease;
}
.listing-main-clickable:hover .listing-img-zoom-hint,
.listing-main-clickable:focus .listing-img-zoom-hint { opacity: 1; }
/* Always visible on touch devices (no hover) */
@media (hover: none) {
    .listing-img-zoom-hint { opacity: 1; }
}

/* Clickable chat images */
.msg-media-img-clickable { cursor: zoom-in; transition: opacity .15s; }
.msg-media-img-clickable:hover { opacity: .88; }

.listing-thumbnails { display: flex; gap: 10px; overflow-x: auto; }
.listing-thumb {
    width: 80px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--color-border);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s;
}
.listing-thumb.active { border-color: var(--color-accent); }
.listing-thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-thumb { cursor: zoom-in; }

.listing-detail-sidebar {}

.listing-price-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.listing-detail-price {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.4px;
    font-family: var(--font-body);
}

.listing-detail-original { text-decoration: line-through; color: var(--color-text-muted); font-size: 16px; }
.listing-detail-accepts-offers { font-size: 13px; color: var(--color-accent); font-weight: 600; margin-bottom: 20px; }

.listing-detail-actions { display: flex; flex-direction: column; gap: 10px; }

.listing-detail-meta { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--color-border); }
.listing-meta-item { display: flex; justify-content: space-between; font-size: 13px; }
.listing-meta-label { color: var(--color-text-muted); }
.listing-meta-value { font-weight: 600; color: var(--color-text-primary); }

.seller-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.seller-info { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.seller-avatar-lg { width: 52px; height: 52px; border-radius: var(--radius-full); background: var(--color-primary); color: #fff; font-size: 20px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.seller-name { font-weight: 700; font-size: 15px; color: var(--color-text-primary); }
.seller-trade { font-size: 13px; color: var(--color-text-muted); }
.seller-location { font-size: 13px; color: var(--color-text-muted); }

.star-rating { display: flex; align-items: center; gap: 4px; }
.star { font-size: 14px; color: #d1d5db; }
.star.filled { color: var(--color-star); }
.star.half { color: var(--color-star); }
.rating-count { font-size: 12px; color: var(--color-text-muted); margin-left: 4px; }

/* ---------- Tabs ---------- */
.tabs { border-bottom: 1.5px solid var(--color-border); display: flex; gap: 0; margin-bottom: 24px; }
.tab-item {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -1.5px;
    transition: all .15s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}
.tab-item:hover { color: var(--color-text-primary); }
.tab-item.active { color: var(--color-accent); border-bottom-color: var(--color-accent); font-weight: 600; }

/* ============================================================
   Messages — full redesign
   ============================================================ */

/* Outer shell: edge-to-edge, full viewport height minus nav */
.msg-shell {
    display: flex;
    height: calc(100vh - var(--nav-height) - 32px);
    margin: 0 auto;
    max-width: 1200px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

/* ── LEFT SIDEBAR ── */
.msg-sidebar {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
}

.msg-sidebar-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 18px 10px;
}
.msg-sidebar-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    flex: 1;
}
.msg-total-unread {
    background: var(--color-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

/* Search */
.msg-search-wrap {
    position: relative;
    padding: 0 12px 12px;
}
.msg-search-icon {
    position: absolute;
    left: 24px;
    top: 50%;
    transform: translateY(-60%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
}
.msg-search-input {
    width: 100%;
    padding: 9px 36px 9px 36px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 13px;
    background: var(--color-bg);
    color: var(--color-text-primary);
    font-family: var(--font-family);
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s;
}
.msg-search-input:focus { border-color: var(--color-accent); }
.msg-search-clear {
    position: absolute;
    right: 22px;
    top: 50%;
    transform: translateY(-60%);
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    line-height: 1;
}

/* Conversation list scroll area */
.msg-conv-list {
    flex: 1;
    overflow-y: auto;
}
.msg-empty-sidebar {
    padding: 40px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* Individual conversation row */
.msg-conv-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border);
    transition: background .12s;
    position: relative;
}
.msg-conv-item:hover { background: var(--color-bg); }
.msg-conv-item.active {
    background: #eff6ff;
    border-left: 3px solid var(--color-accent);
}

/* Avatar (initials circle) */
.msg-conv-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: -.5px;
}
.msg-conv-avatar.active { background: var(--color-accent); }

/* Text block */
.msg-conv-body { flex: 1; min-width: 0; }
.msg-conv-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 1px;
}
.msg-conv-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-conv-time {
    font-size: 11px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.msg-conv-listing {
    font-size: 11px;
    color: var(--color-accent);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.msg-conv-preview {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-conv-preview.unread {
    color: var(--color-text-primary);
    font-weight: 600;
}

/* Right side: unread badge + thumbnail */
.msg-conv-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}
.msg-unread-dot {
    background: var(--color-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.msg-conv-thumb {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--color-border);
}
.msg-conv-thumb-placeholder {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* Back button — hidden on desktop, shown on mobile */
.msg-back-btn {
    display: none;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── RIGHT CHAT PANEL ── */
.msg-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #f8faff;
}

.msg-chat-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
}

/* Mobile-only compact header title — hidden on desktop */
.msg-mobile-header-title { display: none; }

/* Chat header */
.msg-chat-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

/* Listing product card within header */
.msg-listing-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}
.msg-listing-img {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 1px solid var(--color-border);
    flex-shrink: 0;
}
.msg-listing-img-placeholder {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.msg-listing-info { min-width: 0; }
.msg-listing-title {
    display: block;
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.msg-listing-title:hover { color: var(--color-accent); text-decoration: underline; }
.msg-listing-price {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-primary);
    margin-bottom: 2px;
    letter-spacing: -0.1px;
}
.msg-listing-link {
    font-size: 12px;
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}
.msg-listing-link:hover { text-decoration: underline; }

/* "Chatting with" user info */
.msg-chat-with {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.msg-chat-avatar-sm {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -.5px;
}
.msg-online-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}
.msg-online-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
}

/* Message bubbles scroll area */
.msg-bubbles {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Date divider */
.msg-date-divider {
    text-align: center;
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    padding: 12px 0 6px;
}

/* Bubble rows */
.msg-bubble-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 2px;
}
.msg-bubble-row.sent { flex-direction: row-reverse; }

.msg-bubble-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-bottom: 16px;
}

.msg-bubble-col {
    display: flex;
    flex-direction: column;
    max-width: 65%;
}
.msg-bubble-row.sent .msg-bubble-col { align-items: flex-end; }

.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}
.msg-bubble-sent {
    background: var(--color-accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.msg-bubble-received {
    background: var(--color-surface);
    color: var(--color-text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--color-border);
}

.msg-bubble-meta {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 3px;
    padding: 0 4px;
}
.msg-bubble-meta.sent { text-align: right; }
.msg-read-tick { color: var(--color-accent); margin-left: 3px; font-size: 11px; }

/* Input bar */
.msg-input-bar {
    background: var(--color-surface);
    padding: 12px 16px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}
.msg-textarea {
    flex: 1;
    border: 1.5px solid var(--color-border);
    border-radius: 22px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: var(--font-family);
    resize: none;
    outline: none;
    min-height: 44px;
    max-height: 120px;
    overflow-y: auto;
    line-height: 1.5;
    background: var(--color-bg);
    transition: border-color .15s;
    /* Auto-grow in browsers that support it (Chrome 123+, Firefox 128+) */
    field-sizing: content;
}
.msg-textarea:focus { border-color: var(--color-accent); background: var(--color-surface); }
.msg-send-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s, transform .1s;
}
.msg-send-btn:hover:not(:disabled) { background: var(--color-action-hover); transform: scale(1.05); }
.msg-send-btn:disabled { background: var(--color-border); cursor: default; }

/* ---------- Messaging: tabs ---------- */
.msg-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 0;
    border-bottom: 1px solid var(--color-border);
}
.msg-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color .15s, border-color .15s;
    margin-bottom: -1px;
}
.msg-tab:hover { color: var(--color-text-primary); }
.msg-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.msg-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    background: var(--color-primary);
    color: #fff;
    border-radius: 20px;
}
.msg-tab-count-muted { background: var(--color-border); color: var(--color-text-muted); }

/* ---------- Messaging: history item style ---------- */
.msg-conv-item-history { opacity: .75; }
.msg-conv-sold-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-success);
    background: rgba(16,185,129,.12);
    border-radius: 6px;
    padding: 1px 7px;
    margin-top: 2px;
}

/* ---------- Messaging: chat header actions ---------- */
.msg-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.msg-report-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
    white-space: nowrap;
}
.msg-report-btn:hover { color: var(--color-danger); border-color: var(--color-danger); background: rgba(239,68,68,.06); }

/* ---------- Messaging: sold banner (seller) ---------- */
.msg-sold-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
}
.msg-sold-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}
.msg-sold-banner-text strong { color: var(--color-text-primary); font-size: 14px; }
.msg-sold-banner-text span { color: var(--color-text-muted); }
.msg-sold-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: #16a34a;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, transform .1s;
    box-shadow: 0 2px 8px rgba(22,163,74,.35);
}
.msg-sold-btn:hover { background: #15803d; transform: translateY(-1px); }

/* ---------- Messaging: item sold to someone else notice ---------- */
.msg-item-sold-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    background: #fef2f2;
    border-bottom: 1px solid #fecaca;
    color: #991b1b;
    font-size: 13px;
    flex-shrink: 0;
}
.msg-item-sold-notice strong { display: block; font-size: 14px; margin-bottom: 2px; }
.msg-item-sold-notice span { color: #b91c1c; }

/* ---------- Messaging: buyer review banner ---------- */
.msg-review-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-bottom: 1px solid #bfdbfe;
    flex-shrink: 0;
}
.msg-review-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 13px;
}
.msg-review-banner-text strong { color: var(--color-text-primary); font-size: 14px; }
.msg-review-banner-text span { color: var(--color-text-muted); }
.msg-review-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
}
.msg-review-btn:hover { background: var(--color-action-hover); }

/* ---------- Messaging: price agreement banner ---------- */
.msg-price-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    background: #f0fdf4;
    border-bottom: 1px solid #bbf7d0;
    flex-shrink: 0;
}
.msg-price-banner-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg-price-banner-label { font-size: 12px; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .5px; }
.msg-price-banner-amount { font-size: 18px; font-weight: 800; color: #16a34a; }
.msg-price-banner-status { font-size: 12px; color: var(--color-text-muted); }
.msg-price-banner-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---------- Messaging: system event messages ---------- */
.msg-system-event {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 12px 0;
    font-size: 13px;
    color: var(--color-text-muted);
}
.msg-system-time { font-size: 11px; color: var(--color-text-muted); opacity: .7; }
.msg-price-agreed-event {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    border-radius: var(--radius-lg);
    padding: 8px 16px;
    font-weight: 600;
}
.msg-price-agreed-event .msg-system-time { color: #16a34a; opacity: .6; }
.msg-sale-event {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    border-radius: var(--radius-lg);
    padding: 8px 16px;
    font-weight: 600;
}

/* ---------- Messaging: price proposal bubble ---------- */
.msg-bubble-price-proposal {
    background: #f0fdf4 !important;
    border: 2px solid #bbf7d0 !important;
    color: var(--color-text-primary) !important;
    padding: 12px 16px !important;
    min-width: 160px;
}
.msg-price-proposal-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #16a34a;
    margin-bottom: 4px;
}
.msg-price-proposal-amount {
    font-size: 22px;
    font-weight: 800;
    color: #16a34a;
    margin-bottom: 4px;
}
.msg-price-proposal-note { font-size: 12px; color: var(--color-text-muted); }

/* ---------- Messaging: media bubbles ---------- */
.msg-bubble-with-media { padding: 6px 6px 8px; }
.msg-media-img {
    display: block;
    max-width: 240px;
    max-height: 320px;
    width: 100%;
    border-radius: 10px;
    cursor: pointer;
    object-fit: cover;
}
.msg-media-video {
    display: block;
    max-width: 260px;
    width: 100%;
    border-radius: 10px;
    background: #000;
}
.msg-media-caption {
    margin-top: 6px;
    font-size: 14px;
    padding: 0 2px;
}

/* ---------- Messaging: attach button + preview strip ---------- */
.msg-attach-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: none;
    border: 1.5px solid var(--color-border);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, color .15s, background .15s;
    /* label resets */
    -webkit-user-select: none;
    user-select: none;
    line-height: 1;
}
.msg-attach-btn:hover:not(.disabled) { border-color: var(--color-accent); color: var(--color-accent); }
.msg-attach-btn.active { border-color: var(--color-accent); color: var(--color-accent); background: rgba(245,158,11,.08); }
.msg-attach-btn.disabled { opacity: .5; cursor: default; pointer-events: none; }

.msg-attach-preview-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}
.msg-attach-preview-thumb {
    width: 52px;
    height: 52px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.msg-attach-preview-thumb img { width: 100%; height: 100%; object-fit: cover; }
.msg-attach-preview-video-thumb { color: var(--color-text-muted); }
.msg-attach-preview-info { flex: 1; min-width: 0; }
.msg-attach-preview-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-attach-preview-size { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.msg-attach-remove-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--color-border);
    border: none;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.msg-attach-remove-btn:hover { background: var(--color-danger); color: #fff; }
.msg-attach-error {
    font-size: 12px;
    color: var(--color-danger);
    padding: 4px 14px 6px;
}

/* ---------- Messaging: input area ---------- */
.msg-input-area { border-top: 1px solid var(--color-border); background: var(--color-surface); flex-shrink: 0; }
.msg-input-actions {
    padding: 8px 16px 0;
}
.msg-price-propose-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #16a34a;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.msg-price-propose-btn:hover { background: #dcfce7; border-color: #86efac; }

/* ---------- Messaging: sold closed bar ---------- */
.msg-sold-closed-bar {
    padding: 16px 20px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-top: 1px solid var(--color-border);
    flex-shrink: 0;
}

/* ---------- Messaging: star rating ---------- */
.msg-rate-section { margin-bottom: 4px; }
.msg-star-row { display: flex; align-items: center; gap: 4px; margin-top: 8px; }
.msg-star {
    font-size: 28px;
    line-height: 1;
    color: var(--color-border);
    background: none;
    border: none;
    cursor: pointer;
    transition: color .1s, transform .1s;
    padding: 0;
}
.msg-star.active { color: var(--color-accent); }
.msg-star:hover { transform: scale(1.15); }
.msg-star-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-left: 6px;
}

/* ---------- Messaging: price input ---------- */
.msg-price-input-wrap { position: relative; display: flex; align-items: center; }
.msg-price-input-prefix {
    position: absolute;
    left: 12px;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-muted);
    pointer-events: none;
}
.msg-price-input { padding-left: 28px !important; }

/* ---------- My Listings Mobile Cards ---------- */
.my-listings-table-wrap { overflow: hidden; }
.my-listings-cards { display: none; }

.my-listing-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.my-listing-card-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.my-listing-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.my-listing-card-info { flex: 1; min-width: 0; }
.my-listing-card-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-text-primary);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.my-listing-card-cat { font-size: 11px; color: var(--color-text-muted); margin-top: 2px; }
.my-listing-card-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: -0.1px;
}

.my-listing-card-badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.my-listing-card-footer {
    border-top: 1px solid var(--color-border);
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.my-listing-card-meta {
    display: flex;
    gap: 14px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.my-listing-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ---------- Offers ---------- */
.offer-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: box-shadow .2s;
}
.offer-card:hover { box-shadow: var(--shadow-md); }

.offer-listing-img {
    width: 80px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.offer-details { flex: 1; }
.offer-listing-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.offer-meta { font-size: 12px; color: var(--color-text-muted); margin-bottom: 12px; }
.offer-amounts { display: flex; gap: 16px; margin-bottom: 12px; }
.offer-amount-item label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--color-text-muted); font-weight: 600; }
.offer-amount-item .amount { font-size: 18px; font-weight: 700; color: var(--color-accent); }
.offer-amount-item .amount.counter { color: var(--color-accent-dark); }
.offer-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.status-pending { background: var(--color-warning-light); color: #92400e; }
.status-accepted { background: var(--color-success-light); color: #065f46; }
.status-rejected { background: var(--color-danger-light); color: #991b1b; }
.status-countered { background: #dbeafe; color: #1e40af; }
.status-expired { background: #f3f4f6; color: #6b7280; }
.status-withdrawn { background: #f3f4f6; color: #6b7280; }
.status-active { background: var(--color-success-light); color: #065f46; }
.status-sold { background: #f3f4f6; color: #6b7280; }
.status-draft { background: var(--color-warning-light); color: #92400e; }

/* ---------- Profile ---------- */
.profile-header {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
    border-radius: var(--radius-xl);
    padding: 32px;
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 24px;
    color: #fff;
}

.profile-avatar-xl {
    width: 90px;
    height: 90px;
    border-radius: var(--radius-full);
    background: var(--color-accent);
    color: #fff;
    font-size: 36px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 4px solid rgba(255,255,255,.3);
}

.profile-header-info { flex: 1; }
.profile-name { font-size: 26px; font-weight: 800; margin-bottom: 4px; }
.profile-trade { font-size: 15px; color: rgba(255,255,255,.8); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.profile-trade svg { opacity: .85; flex-shrink: 0; }
.profile-location { font-size: 14px; color: rgba(255,255,255,.65); display: flex; align-items: center; gap: 6px; }
.profile-location svg { opacity: .75; flex-shrink: 0; }
.profile-verified { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; background: var(--color-success-light); color: #065f46; padding: 3px 9px; border-radius: var(--radius-full); margin-left: 8px; vertical-align: middle; }

.profile-stats { display: flex; gap: 28px; margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.2); }
.profile-stat-number { font-size: 22px; font-weight: 800; }
.profile-stat-label { font-size: 12px; color: rgba(255,255,255,.65); }

.profile-action-btn { display: inline-flex; align-items: center; gap: 7px; }

/* ---------- Auth Pages ---------- */
.auth-page {
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
}

.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 40px;
    width: 100%;
    max-width: 460px;
}

.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo-icon { font-size: 48px; }
.auth-title { font-size: 24px; font-weight: 700; color: var(--color-text-primary); text-align: center; margin-bottom: 6px; letter-spacing: -.3px; }
.auth-subtitle { font-size: 14px; color: var(--color-text-muted); text-align: center; margin-bottom: 28px; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; }
.auth-divider-line { flex: 1; height: 1px; background: var(--color-border); }
.auth-divider-text { font-size: 13px; color: var(--color-text-muted); }

.auth-footer { text-align: center; font-size: 14px; color: var(--color-text-muted); margin-top: 24px; }
.auth-footer a { color: var(--color-primary); font-weight: 600; }

/* ========== Full-screen login ========== */
.login-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
    overflow-y: auto;
}

/* Left hero panel */
.login-hero {
    background: linear-gradient(150deg, var(--color-primary) 0%, #0f2240 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    position: relative;
    overflow: hidden;
}
.login-hero::before {
    content: '';
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: rgba(245,158,11,.08);
    top: -80px;
    right: -100px;
}
.login-hero::after {
    content: '';
    position: absolute;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255,255,255,.04);
    bottom: -60px;
    left: -60px;
}
.login-hero-inner { position: relative; z-index: 1; color: #fff; }
.login-hero-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 48px;
}
.login-hero-brand {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.5px;
}
.login-hero-heading {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 16px;
    color: #fff;
}
.login-hero-sub {
    font-size: 16px;
    color: rgba(255,255,255,.7);
    line-height: 1.7;
    margin-bottom: 48px;
}
.login-hero-stats {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}
.login-hero-stat-num {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-accent);
}
.login-hero-stat-label {
    font-size: 12px;
    color: rgba(255,255,255,.6);
    margin-top: 2px;
}

/* Right form panel */
.login-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 48px;
    overflow-y: auto;
}
.login-form-inner {
    width: 100%;
    max-width: 400px;
}

.login-mobile-logo {
    display: none;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.login-heading {
    font-size: 26px;
    font-weight: 800;
    color: var(--color-text-primary);
    margin-bottom: 16px;
    letter-spacing: -.4px;
}

.login-new-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f5f5f5;
    border-radius: 999px;
    padding: 8px 8px 8px 16px;
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 28px;
}
.login-create-btn {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 6px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    margin-left: auto;
    transition: border-color .15s, box-shadow .15s;
}
.login-create-btn:hover { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(30,58,95,.1); }

.login-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    height: 52px;
    font-size: 15px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--color-border);
    padding: 0 16px;
    transition: border-color .15s, box-shadow .15s;
}
.login-input:focus { border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(30,58,95,.12); }

.login-pw-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color .15s;
}
.login-pw-toggle:hover { color: var(--color-primary); }

.login-forgot {
    font-size: 13px;
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}
.login-forgot:hover { text-decoration: underline; }

.login-logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}
.login-logo-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--color-text-primary);
    letter-spacing: -.4px;
}
.login-logo-tagline {
    display: none;
    font-size: 13px;
    color: rgba(255,255,255,.65);
    font-weight: 400;
    letter-spacing: .1px;
}
.login-field-wrap {
    position: relative;
    display: block;
    width: 100%;
    margin-bottom: 12px;
}
.login-input-pw { padding-right: 48px; }
.login-forgot-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.login-continue-btn {
    width: 100%;
    height: 52px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 999px;
    letter-spacing: .2px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background .15s, opacity .15s;
}
.login-continue-btn:hover:not(:disabled) { background: #16305a; }
.login-continue-btn:disabled { opacity: .6; cursor: default; }

.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0;
}
.login-divider-line { flex: 1; height: 1px; background: var(--color-border); }
.login-divider-text { font-size: 13px; color: var(--color-text-muted); }

/* Social buttons */
.login-social-stack { display: flex; flex-direction: column; gap: 10px; }

.login-social-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 52px;
    padding: 0 20px;
    border: 1.5px solid var(--color-border);
    border-radius: 999px;
    background: #fff;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text-primary);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s;
    position: relative;
}
.login-social-btn:hover {
    border-color: #999;
    background: #fafafa;
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
}

.login-faceid-badge {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    background: #f3f4f6;
    border-radius: 999px;
    padding: 3px 10px 3px 6px;
}

/* Demo banner */
.login-demo-banner {
    margin-top: 28px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
}
.login-demo-title { font-weight: 700; font-size: 13px; color: #92400e; margin-bottom: 4px; }
.login-demo-sub { font-size: 12px; color: #a16207; margin-bottom: 12px; line-height: 1.5; }
.login-demo-btns { display: flex; gap: 8px; }
.login-demo-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: var(--radius-md);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.login-demo-btn:hover { opacity: .85; }
.login-demo-user  { background: #92400e; color: #fff; }
.login-demo-admin { background: var(--color-primary); color: #fff; }

/* ---- Responsive ---- */
/* ============================================================
   MOBILE LOGIN — Dark Industrial Redesign (≤860px)
   ============================================================ */
@media (max-width: 860px) {

    /* ── Outer shell: full-screen dark canvas ── */
    .login-fullscreen {
        grid-template-columns: 1fr;
        background: #0c1a2e;
        overflow-y: auto;
        min-height: 100dvh;
    }
    .login-hero        { display: none; }
    .login-mobile-logo { display: none; }

    .login-form-panel {
        padding: 0;
        align-items: stretch;
        justify-content: flex-start;
        min-height: 100dvh;
        overflow-y: visible;
        background: transparent;
    }

    .login-form-inner {
        max-width: 100%;
        width: 100%;
        padding: 0 24px 64px;
        display: flex;
        flex-direction: column;
    }

    /* ── Brand header ── */
    .login-logo-row {
        margin: 0 -24px 32px;
        padding: 48px 24px 40px;
        background:
            radial-gradient(ellipse 90% 55% at 50% -5%, rgba(245,158,11,.16) 0%, transparent 65%),
            #0c1a2e;
        border-bottom: 1px solid rgba(255,255,255,.06);
        justify-content: center;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0;
        position: relative;
        overflow: visible;
    }

    /* Subtle diagonal crosshatch texture */
    .login-logo-row::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: repeating-linear-gradient(
            -45deg,
            transparent, transparent 22px,
            rgba(255,255,255,.018) 22px, rgba(255,255,255,.018) 23px
        );
        pointer-events: none;
    }

    .login-logo-row > span:first-child {
        font-size: 52px;
        line-height: 1;
        margin-bottom: 12px;
        display: block;
        position: relative;
        z-index: 1;
        animation: loginIconPulse 3.5s ease-in-out infinite;
    }

    @keyframes loginIconPulse {
        0%, 100% { filter: drop-shadow(0 0 16px rgba(245,158,11,.4)); }
        50%       { filter: drop-shadow(0 0 30px rgba(245,158,11,.72)); }
    }

    .login-logo-text {
        color: #fff;
        font-size: 32px;
        letter-spacing: -1.5px;
        line-height: 1;
        position: relative;
        z-index: 1;
    }

    .login-logo-tagline {
        display: block;
        color: rgba(255,255,255,.35);
        font-size: 11px;
        font-weight: 500;
        letter-spacing: 1.4px;
        text-transform: uppercase;
        margin-top: 10px;
        position: relative;
        z-index: 1;
    }

    /* ── Heading ── */
    .login-heading {
        font-size: 20px;
        font-weight: 800;
        color: #fff;
        margin-bottom: 14px;
        letter-spacing: -.3px;
        text-align: center;
    }

    /* ── New-user row — plain text link, no pill ── */
    .login-new-row {
        background: transparent;
        border: none;
        border-radius: 0;
        padding: 0;
        justify-content: center;
        color: rgba(255,255,255,.45);
        font-size: 13px;
        margin-bottom: 28px;
    }
    .login-create-btn {
        background: transparent;
        border: none;
        padding: 0;
        font-size: 13px;
        font-weight: 600;
        color: #f59e0b;
        text-decoration: underline;
        text-underline-offset: 2px;
    }
    .login-create-btn:hover { background: transparent; box-shadow: none; opacity: .8; }

    /* ── Inputs ── */
    .login-input {
        background: rgba(255,255,255,.07);
        border-color: rgba(255,255,255,.11);
        color: #fff;
    }
    .login-input::placeholder { color: rgba(255,255,255,.3); }
    .login-input:focus {
        border-color: #f59e0b;
        box-shadow: 0 0 0 3px rgba(245,158,11,.14);
        background: rgba(255,255,255,.1);
    }
    .login-field-wrap { margin-bottom: 14px; }

    /* ── Password toggle ── */
    .login-pw-toggle       { color: rgba(255,255,255,.3); }
    .login-pw-toggle:hover { color: #f59e0b; }

    /* ── Forgot link ── */
    .login-forgot      { color: rgba(255,255,255,.4); font-size: 13px; }
    .login-forgot-row  { margin-bottom: 24px; }

    /* ── Continue button — amber primary ── */
    .login-continue-btn {
        background: #f59e0b;
        color: #0c1a2e;
        font-weight: 800;
        border: none;
        box-shadow: 0 4px 20px rgba(245,158,11,.35);
        transition: background .15s, box-shadow .15s, transform .1s;
        margin-bottom: 0;
    }
    .login-continue-btn:hover:not(:disabled) {
        background: #fbbf24;
        box-shadow: 0 6px 28px rgba(245,158,11,.5);
    }
    .login-continue-btn:active:not(:disabled) {
        transform: scale(.98);
        box-shadow: 0 2px 10px rgba(245,158,11,.25);
    }
    .login-continue-btn:disabled { background: rgba(245,158,11,.4); color: rgba(12,26,46,.6); }

    /* ── Divider ── */
    .login-divider-line { background: rgba(255,255,255,.09); }
    .login-divider-text { color: rgba(255,255,255,.3); }

    /* ── Social buttons ── */
    .login-social-btn {
        background: rgba(255,255,255,.05);
        border-color: rgba(255,255,255,.11);
        color: #fff;
    }
    .login-social-btn:hover {
        background: rgba(255,255,255,.1);
        border-color: rgba(255,255,255,.22);
        box-shadow: none;
    }
    .login-faceid-badge {
        background: rgba(255,255,255,.09);
        color: rgba(255,255,255,.45);
    }

    /* ── Demo banner — compact, low-key ── */
    .login-demo-banner {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
        margin-top: 28px;
        padding: 10px 14px;
        background: rgba(255,255,255,.04);
        border-color: rgba(255,255,255,.09);
        border-radius: var(--radius-md);
    }
    .login-demo-title {
        color: rgba(255,255,255,.35);
        font-size: 11px;
        font-weight: 500;
        margin-bottom: 0;
    }
    .login-demo-sub { display: none; }
    .login-demo-btns {
        display: flex;
        gap: 6px;
        margin-left: auto;
    }
    .login-demo-btn {
        padding: 5px 12px;
        font-size: 12px;
        border-radius: var(--radius-md);
    }
    .login-demo-user  { background: rgba(255,255,255,.12); color: rgba(255,255,255,.7); }
    .login-demo-admin { background: rgba(255,255,255,.12); color: rgba(255,255,255,.7); border: none; }

    /* ── Alert messages ── */
    .alert-danger {
        background: rgba(239,68,68,.12);
        border-color: rgba(239,68,68,.3);
        color: #fca5a5;
    }
    .alert-info {
        background: rgba(245,158,11,.1);
        border-color: rgba(245,158,11,.25);
        color: #fcd34d;
    }
}

@media (max-width: 480px) {
    .login-form-inner { padding: 0 20px 56px; }
    .login-logo-row   { margin: 0 -20px 32px; padding: 50px 20px 40px; }
    .login-heading    { font-size: 19px; }
}

/* ---------- Admin ---------- */
.admin-layout { display: grid; grid-template-columns: 240px 1fr; gap: 0; min-height: calc(100vh - var(--nav-height)); }

.admin-sidebar {
    background: var(--color-primary-dark);
    position: sticky;
    top: var(--nav-height);
    height: calc(100vh - var(--nav-height));
    display: flex;
    flex-direction: column;
}

/* The scrollable nav body (desktop always visible) */
.admin-sidebar-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

/* Mobile toggle bar — hidden on desktop */
.admin-sidebar-mobilebar { display: none; }
.admin-sidebar-chevron { transition: transform .2s ease; }

.admin-sidebar-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,.4); padding: 0 20px; margin-bottom: 8px; }

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    font-size: 14px;
    color: rgba(255,255,255,.65);
    cursor: pointer;
    text-decoration: none;
    transition: all .15s;
    border-left: 3px solid transparent;
}
.admin-nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav-item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: var(--color-accent); }
.admin-nav-item .nav-icon { display: flex; align-items: center; justify-content: center; width: 20px; flex-shrink: 0; }

.admin-main { padding: 32px; background: var(--color-bg); }

/* --- Admin secondary stat cards (4-up row) --- */
.admin-secondary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

/* --- Admin bottom panels (side-by-side on desktop, stacked on mobile) --- */
.admin-bottom-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 900px) {
    .admin-secondary-stats { grid-template-columns: repeat(2, 1fr); }
    .admin-bottom-panels { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* Stack sidebar above main content */
    .admin-layout { grid-template-columns: 1fr; }

    .admin-sidebar {
        position: static;
        height: auto;
        overflow: visible;
    }

    /* Show mobile toggle bar */
    .admin-sidebar-mobilebar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 13px 16px;
        cursor: pointer;
        user-select: none;
        color: #fff;
        border-bottom: 1px solid rgba(255,255,255,.1);
        position: sticky;
        top: var(--nav-height);
        z-index: 200;
        background: var(--color-primary-dark);
    }
    .admin-sidebar-mobilebar:hover { background: var(--color-primary-light); }

    /* Nav body collapses on mobile by default */
    .admin-sidebar-body { display: none; }
    .admin-sidebar.mobile-open .admin-sidebar-body {
        display: flex;
        max-height: 60vh;
        overflow-y: auto;
    }
    .admin-sidebar.mobile-open .admin-sidebar-chevron {
        transform: rotate(180deg);
    }

    .admin-main { padding: 20px 14px 24px; }

    .admin-secondary-stats { grid-template-columns: repeat(2, 1fr); }
    .admin-bottom-panels { grid-template-columns: 1fr; }
}

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }

.stat-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 22px;
    border: 1px solid var(--color-border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.stat-card-icon { font-size: 28px; width: 52px; height: 52px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-card-icon.blue { background: #dbeafe; }
.stat-card-icon.green { background: var(--color-success-light); }
.stat-card-icon.amber { background: var(--color-warning-light); }
.stat-card-icon.red { background: var(--color-danger-light); }

.stat-card-info {}
.stat-card-value { font-size: 28px; font-weight: 800; color: var(--color-text-primary); line-height: 1; margin-bottom: 4px; }
.stat-card-label { font-size: 13px; color: var(--color-text-muted); }
.stat-card-change { font-size: 12px; font-weight: 600; margin-top: 6px; }
.stat-change-up { color: var(--color-success); }
.stat-change-down { color: var(--color-danger); }

/* ---------- Table ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 12px 16px; background: var(--color-bg); border-bottom: 2px solid var(--color-border); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: var(--color-text-muted); text-align: left; white-space: nowrap; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.data-table tr:hover td { background: #f8fafc; }
.data-table tr:last-child td { border-bottom: none; }

/* ---------- Alert / Toast ---------- */
.alert { padding: 14px 18px; border-radius: var(--radius-md); font-size: 14px; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px; }
.alert-icon { font-size: 18px; flex-shrink: 0; }
.alert-info { background: var(--color-info-light); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: var(--color-success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-warning { background: var(--color-warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: var(--color-danger-light); color: #991b1b; border: 1px solid #fecaca; }

/* ---------- Empty State ---------- */
.empty-state { text-align: center; padding: 64px 24px; color: var(--color-text-muted); }
.empty-state-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state-title { font-size: 18px; font-weight: 700; color: var(--color-text-primary); margin-bottom: 8px; }
.empty-state-text { font-size: 15px; margin-bottom: 24px; line-height: 1.6; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 24px 0; }
.page-btn { width: 38px; height: 38px; border-radius: var(--radius-md); border: 1.5px solid var(--color-border-dark); background: var(--color-surface); color: var(--color-text-secondary); font-size: 14px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.page-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }
.page-btn.active { background: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Checkout ---------- */
.checkout-layout { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: flex-start; }
.checkout-steps { display: flex; gap: 0; margin-bottom: 28px; }
.checkout-step { flex: 1; text-align: center; position: relative; }
.checkout-step::after { content: ''; position: absolute; top: 18px; left: 50%; width: 100%; height: 2px; background: var(--color-border); z-index: 0; }
.checkout-step:last-child::after { display: none; }
.step-circle { width: 36px; height: 36px; border-radius: var(--radius-full); background: var(--color-border); color: var(--color-text-muted); font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; position: relative; z-index: 1; }
.checkout-step.active .step-circle { background: var(--color-accent); color: #fff; }
.checkout-step.done .step-circle { background: var(--color-success); color: #fff; }
.step-label { font-size: 12px; font-weight: 500; color: var(--color-text-muted); }
.checkout-step.active .step-label { color: var(--color-accent); font-weight: 600; }

/* ---------- Modal / Overlay ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--color-border); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { width: 30px; height: 30px; border-radius: var(--radius-full); border: none; background: var(--color-bg); cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; color: var(--color-text-muted); transition: background .15s; }
.modal-close:hover { background: var(--color-border); }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--color-border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Not Found ---------- */
.not-found-container { min-height: calc(100vh - var(--nav-height)); display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.not-found-content { text-align: center; }
.not-found-icon { font-size: 72px; display: block; margin-bottom: 20px; }

/* ---------- Loading Spinner ---------- */
.spinner { width: 40px; height: 40px; border: 4px solid var(--color-border); border-top-color: var(--color-primary); border-radius: var(--radius-full); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; justify-content: center; align-items: center; padding: 60px; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.w-full { width: 100%; }

/* Blazor error UI — hidden; auto-reload handled by MutationObserver in _Layout.cshtml */
#blazor-error-ui { display: none !important; }

/* Hide Blazor's default reconnect modal — we handle it ourselves */
#components-reconnect-modal { display: none !important; }

/* Full-screen reconnect overlay */
#reconnect-banner {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 20, 40, 0.60);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    animation: reconnect-fade-in 0.25s ease;
}
@keyframes reconnect-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.reconnect-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 40px 48px;
    max-width: 360px;
    width: 88%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.22), 0 0 0 1px rgba(0,0,0,0.06);
    text-align: center;
}
.reconnect-logo-text {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 17px;
    color: #1e3a5f;
    letter-spacing: -0.2px;
    margin-bottom: 4px;
}
.reconnect-spinner-lg {
    width: 56px;
    height: 56px;
    border: 4px solid rgba(30, 58, 95, 0.10);
    border-top-color: #f59e0b;
    border-right-color: #1e3a5f;
    border-radius: 50%;
    animation: reconnect-spin 0.9s linear infinite;
    margin: 6px 0;
}
@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}
.reconnect-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
}
.reconnect-sub {
    font-size: 13px;
    color: #64748b;
    line-height: 1.55;
    margin: 0;
}
.reconnect-attempts {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    letter-spacing: 0.3px;
}
.reconnect-reload-btn {
    margin-top: 6px;
    padding: 11px 28px;
    background: #1e3a5f;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.reconnect-reload-btn:hover {
    background: #2d5185;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    .listing-detail-grid { grid-template-columns: 1fr; }
    .listing-detail-images { position: static; }
    .checkout-layout { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .topnav-search { display: none; }
    /* Nav: hide low-priority items to fit in 390px */
    .topnav-mobile-hide { display: none !important; }
    /* Compact the sell button */
    .btn-sell-now { padding: 8px 12px; font-size: 13px; gap: 4px; }
    /* Tighten logo */
    .topnav-logo-img { height: 40px; }
    .topnav-logo { gap: 0; }
    /* Tighten action gap and nav padding */
    .topnav-actions { gap: 4px; }
    .topnav { padding-left: 12px; padding-right: 12px; gap: 10px; }
    /* User avatar button: just the circle, no border/bg */
    .user-avatar-btn { padding: 0; background: none; border: none; gap: 0; }
    .user-avatar-btn:hover { background: none; border: none; }
    .browse-layout { flex-direction: column; }
    .browse-sidebar { width: 100%; position: static; }
    .browse-search-btn { padding: 9px 16px; }
    .browse-search-input { font-size: 16px; /* prevent iOS zoom */ }
    .messages-layout { flex-direction: column; height: auto; }
    .conversation-list { width: 100%; border-right: none; border-bottom: 1px solid var(--color-border); max-height: 250px; overflow-y: auto; }
    .btn-sell-now { display: none;}
    
    /* ── Messages page mobile ── */
    .msg-shell {
        flex-direction: column;
        height: calc(100dvh - 115px);
        border-radius: 0;
        margin: 0;
        max-width: 100%;
        box-shadow: none;
        border-left: none;
        border-right: none;
        border-top: none;
    }
    .msg-sidebar { width: 100%; }
    /* Default: show sidebar only */
    .msg-chat { display: none !important; }
    /* When a conversation is selected: swap panels */
    .msg-shell.mobile-chat-open .msg-sidebar { display: none !important; }
    .msg-shell.mobile-chat-open .msg-chat { display: flex !important; height: 100%; overflow: hidden; }
    /* Back button */
    .msg-back-btn { display: flex; margin-bottom: 0; flex-shrink: 0; }
    /* Compact single-row header on mobile */
    .msg-chat-header {
        flex-direction: row;
        align-items: center;
        gap: 10px;
        padding: 8px 12px;
        flex-shrink: 0;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    /* Hide verbose listing card & user-info block on mobile */
    .msg-listing-card { display: none !important; }
    .msg-chat-with { display: none !important; }
    /* Compact header actions */
    .msg-chat-header-actions { margin-left: auto; flex-shrink: 0; }
    .msg-report-btn { padding: 4px 8px; font-size: 12px; }
    /* Mobile compact title — must set display here; base rule is display:none */
    .msg-mobile-header-title {
        display: flex;
        align-items: center;
        gap: 10px;
        flex: 1;
        min-width: 0;
        overflow: hidden;
    }
    .msg-item-sold-notice { padding: 8px 12px; font-size: 12px; }
    .msg-sold-banner { flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; }
    .msg-sold-banner-text strong { font-size: 12px; }
    .msg-sold-banner-text span { display: none; }
    .msg-sold-btn { padding: 6px 12px; font-size: 12px; white-space: nowrap; flex-shrink: 0; box-shadow: none; }
    .msg-review-banner { flex-direction: row; align-items: center; gap: 8px; padding: 8px 12px; }
    .msg-review-banner .msg-review-btn { padding: 6px 12px; font-size: 12px; flex-shrink: 0; }
    .msg-price-banner { flex-direction: column; align-items: flex-start; gap: 8px; padding: 10px 12px; }
    /* Bubbles must scroll — min-height:0 is critical for nested flex containers */
    .msg-bubbles { padding: 10px 12px; flex: 1; min-height: 0; overflow-y: auto; }
    /* Input bar pinned to bottom, never squeezed */
    .msg-input-area { flex-shrink: 0; }
    .msg-input-bar { padding: 8px 10px; }
    /* 16px minimum prevents iOS Safari from zooming in when the textarea is focused */
    .msg-textarea { font-size: 16px; }
    .listing-grid { grid-template-columns: repeat(2, 1fr); }
    #listing-map { height: 340px; }
    .form-row { grid-template-columns: 1fr; }
    .form-row-3 { grid-template-columns: 1fr; }
    .hero { padding: 44px 20px 52px; }
    .hero-title { font-size: clamp(28px, 7vw, 36px); letter-spacing: -0.03em; }
    .profile-header { flex-direction: column; text-align: center; }
    .profile-stats { justify-content: center; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    /* Category nav: tighter on mobile */
    .category-nav-item { padding: 9px 10px; font-size: 12.5px; }
    /* Allow titles to show up to 3 lines on mobile before truncating with ellipsis */
    .listing-card-title { -webkit-line-clamp: 3; font-size: 13.5px; overflow: hidden; }
    /* My Listings: swap table → cards */
    .my-listings-table-wrap { display: none; }
    .my-listings-cards { display: flex; flex-direction: column; gap: 10px; }
    /* My Listings stats bar: 2×2 grid */
    .my-listings-stats { grid-template-columns: repeat(2, 1fr) !important; }
    /* Hero stats: swap row → carousel on mobile */
    .hero-stats-desktop { display: none !important; }
    .hero-stats-carousel { display: block; text-align: center; padding-bottom: 18px; }
    /* Push page content up above the bottom nav */
    .main-content { padding-bottom: var(--bottom-nav-height); }
    .main-content.no-bottom-nav { padding-bottom: 0; }
}

@media (max-width: 480px) {
    .listing-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .auth-card { padding: 28px 20px; }
    /* Hide Join Free button — user can register via the Login page */
    .topnav-join-btn { display: none !important; }
    /* Shrink login button to fit */
    .topnav-actions .btn-outline.btn-sm { padding: 7px 10px; font-size: 12px; }
    /* Tighten nav padding further */
    .topnav { padding-left: 10px; padding-right: 10px; gap: 8px; }
}

/* ============================================================
   Vinted-style: fullscreen conversation on mobile
   When body.msg-chat-mode is active, hide both navs and give
   the message shell the full viewport height.
   ============================================================ */
@media (max-width: 768px) {
    body.msg-chat-mode .topnav            { display: none !important; }
    body.msg-chat-mode .category-nav      { display: none !important; }
    body.msg-chat-mode .mobile-bottom-nav { display: none !important; }
    body.msg-chat-mode .main-content      { padding-bottom: 0 !important; }

    /* Take the shell out of document flow so iOS document-scroll (triggered when
       the keyboard opens) can't push it off-screen. position:fixed + top/height
       are updated by the visualViewport JS listener on every keyboard resize. */
    body.msg-chat-mode .msg-shell {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 100dvh;   /* default; JS overrides when keyboard opens */
        overflow: hidden;
        z-index: 500;
    }

    /* Prevent iOS from scrolling the document when the textarea is focused */
    body.msg-chat-mode { overflow: hidden; }

    /* Push the Back button + username below the device status bar */
    body.msg-chat-mode .msg-chat-header {
        padding-top: calc(env(safe-area-inset-top, 0px) + 14px);
    }
}

/* Mobile chat header: avatar circle + username */
.msg-mobile-header-avatar {
    display: none;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
}
.msg-mobile-header-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--color-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-mobile-header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    overflow: hidden;
}
.msg-mobile-listing-line {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
}
.msg-mobile-listing-thumb {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}
.msg-mobile-listing-name {
    font-size: 11px;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
@media (max-width: 768px) {
    .msg-mobile-header-avatar { display: flex; }
}

/* ============================================================
   Value Props Banner
   ============================================================ */
.value-props-banner {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 0;
}

/* Desktop: four items in a row */
.value-props-desktop {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}
.vp-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.vp-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; }
.vp-title { font-weight: 700; font-size: 14px; }
.vp-sub   { font-size: 12px; color: var(--color-text-muted); }

/* Mobile ticker: hidden on desktop */
.value-props-mobile { display: none; }

@media (max-width: 768px) {
    .value-props-banner { padding: 0; }
    .value-props-desktop { display: none; }
    .value-props-mobile {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        padding: 10px 16px 12px;
    }
    .vp-ticker {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    .vp-ticker.vp-in  { opacity: 1; transform: translateY(0); }
    .vp-ticker.vp-out { opacity: 0; transform: translateY(4px); }
    .vp-ticker-title { font-weight: 700; color: var(--color-text); }
    .vp-ticker-dot   { color: var(--color-text-muted); margin: 0 2px; }
    .vp-ticker-sub   { color: var(--color-text-muted); }
}

/* ============================================================
   Mobile Bottom Navigation
   ============================================================ */
.mobile-bottom-nav {
    display: none; /* shown only on mobile via media query below */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 950;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    box-shadow: 0 -4px 20px rgba(13,33,55,.10);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px));
}

.mobile-bottom-nav-inner {
    display: flex;
    height: var(--bottom-nav-height);
    align-items: stretch;
}

.mbn-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: color .15s;
    padding: 8px 4px;
    position: relative;
}

.mbn-item:hover, .mbn-item.active {
    color: var(--color-accent);
}

.mbn-item svg {
    transition: transform .15s;
}

.mbn-item:hover svg {
    transform: translateY(-1px);
}

/* Active indicator dot above icon */
.mbn-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--color-accent);
    border-radius: 0 0 3px 3px;
}

/* Sell button — amber pill in the centre */
.mbn-item.mbn-sell {
    color: #fff;
    background: var(--color-cta);
    border-radius: var(--radius-lg);
    margin: 10px 6px;
    padding: 6px 4px;
    box-shadow: 0 4px 14px rgba(232,148,10,.40);
    flex: 1.1;
}

.mbn-item.mbn-sell:hover {
    color: #fff;
    background: var(--color-cta-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(232,148,10,.50);
}

.mbn-item.mbn-sell::before { display: none; }

.mbn-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    background: var(--color-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    min-width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid var(--color-surface);
}

@media (max-width: 768px) {
    .mobile-bottom-nav { display: flex; flex-direction: column; }
}

/* ============================================================
   Monetisation Feature Styles
   ============================================================ */

/* --- Listing Card: Sponsored / Featured badge --- */
.listing-card-sponsored {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: #1e3a5f;
    color: #f59e0b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

/* --- Listing Card: Verified seller tick --- */
.verified-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--color-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Profile badges --- */
.profile-business-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #1e3a5f;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    margin-left: 8px;
    vertical-align: middle;
}
.profile-badge-pro { background: #7c3aed; }

/* --- Admin filter panel --- */
.admin-filter-card { overflow: visible; }

.admin-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    cursor: default;
    user-select: none;
}

.admin-filter-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.admin-filter-chevron {
    color: var(--color-text-muted);
    transition: transform .2s ease;
    display: none; /* hidden on desktop */
}
.admin-filter-chevron.expanded { transform: rotate(180deg); }

.admin-filter-body {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    padding: 0 18px 14px;
}

@media (max-width: 768px) {
    .admin-filter-header { cursor: pointer; }
    .admin-filter-chevron { display: block; }
    .admin-filter-body { flex-direction: column; align-items: stretch; }
    .admin-filter-body .form-control { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
    .admin-filter-body.collapsed { display: none; }
}

/* --- Sponsored slot in browse grid --- */
.sponsored-slot {
    background: #fffbeb;
    border: 1.5px solid #fde68a;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.sponsored-slot-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #92400e;
}
.sponsored-slot-body {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sponsored-slot-logo { font-size: 28px; flex-shrink: 0; }
.sponsored-slot-photo { height: 44px; width: auto; max-width: 100px; object-fit: contain; border-radius: 6px; flex-shrink: 0; }
.sponsored-slot-name { font-weight: 700; font-size: 14px; color: var(--color-text-primary); margin-bottom: 2px; }
.sponsored-slot-desc { font-size: 12px; color: var(--color-text-secondary); }
.sponsored-slot-btn { margin-left: auto; flex-shrink: 0; white-space: nowrap; }

/* Full-bleed sponsored ad card — sits in the listing grid, image fills the entire slot */
.sponsored-ad-card { display: block; position: relative; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--color-border); cursor: pointer; text-decoration: none; aspect-ratio: 3/4; transition: transform .2s, box-shadow .2s; }
.sponsored-ad-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.sponsored-ad-card-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sponsored-ad-card-label { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: .5px; padding: 3px 8px; border-radius: 4px; text-transform: uppercase; }

/* --- Shipping carrier options in checkout --- */
.shipping-carrier-option {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.shipping-carrier-option:hover { border-color: var(--color-accent); background: #f8faff; }
.shipping-carrier-option.selected { border-color: var(--color-accent); background: #eff6ff; }

/* --- Escrow upsell box --- */
.escrow-upsell {
    background: #f0fdf4;
    border: 1.5px solid #86efac;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-top: 16px;
}

/* --- Subscription plan cards --- */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 48px;
}

.plan-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    position: relative;
}

.plan-card-popular {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(37,99,235,.08);
}

.plan-card-pro {
    border-color: #7c3aed;
}

.plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 14px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.plan-header { margin-bottom: 20px; }
.plan-name { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.plan-price { font-size: 32px; font-weight: 800; color: var(--color-accent); margin-bottom: 6px; }
.plan-price .plan-period { font-size: 15px; font-weight: 400; color: var(--color-text-muted); }
.plan-desc { font-size: 13px; color: var(--color-text-muted); }

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* --- Feature comparison table --- */
.compare-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.compare-table th {
    background: var(--color-bg);
    padding: 12px 16px;
    text-align: center;
    font-weight: 700;
    border-bottom: 2px solid var(--color-border);
}
.compare-table th:first-child { text-align: left; }
.compare-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--color-border);
    text-align: center;
    color: var(--color-text-secondary);
}
.compare-table td:first-child { text-align: left; font-weight: 500; color: var(--color-text-primary); }

/* --- Promote listing tier cards --- */
.promo-tiers { display: flex; flex-direction: column; gap: 14px; }

.promo-tier-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    cursor: pointer;
    transition: border-color .15s;
    position: relative;
}
.promo-tier-card:hover { border-color: var(--color-accent); }
.promo-tier-card.selected { border-color: var(--color-accent); background: #eff6ff; }
.promo-tier-card.popular { border-color: var(--color-accent); }

.promo-tier-badge {
    position: absolute;
    top: -10px;
    right: 20px;
    background: var(--color-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 12px;
    border-radius: var(--radius-full);
}

/* --- Browse ranking explainer bar --- */
.ranking-explainer {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    margin-bottom: 16px;
}
.ranking-explainer-label { font-weight: 600; color: var(--color-text-secondary); margin-right: 4px; }
.ranking-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 11px;
}
.ranking-pill-featured { background: #fef3c7; color: #92400e; }
.ranking-pill-verified { background: #d1fae5; color: #065f46; }
.ranking-pill-standard { background: var(--color-bg); color: var(--color-text-muted); }
.ranking-pill-sep { color: var(--color-text-muted); font-size: 11px; }
.ranking-explainer-link { margin-left: auto; color: var(--color-accent); font-weight: 600; text-decoration: none; font-size: 11px; white-space: nowrap; }
.ranking-explainer-link:hover { text-decoration: underline; }

/* --- Promote page ranking rows --- */
.rank-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
}
.rank-row-1 { background: #fffbeb; }
.rank-row-2 { background: #f0fdf4; }
.rank-row-3 { background: var(--color-bg); }
.rank-pos { font-weight: 800; font-size: 18px; color: var(--color-text-muted); min-width: 28px; }
.rank-row-divider { text-align: center; color: var(--color-text-muted); font-size: 18px; padding: 2px 0; }
.rank-tag {
    display: inline-block;
    background: var(--color-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    margin-left: 6px;
    vertical-align: middle;
}

/* --- Subscription plans ranking explainer columns --- */
.rank-explain-col {
    flex: 1;
    min-width: 160px;
    text-align: center;
    padding: 16px 14px;
    border-radius: var(--radius-md);
}
.rank-col-1 { background: #fffbeb; }
.rank-col-2 { background: #f0fdf4; }
.rank-col-3 { background: var(--color-bg); }
.rank-explain-num {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 13px; font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 10px;
}
.rank-explain-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    font-size: 20px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

/* ============================================================
   Stock Management Styles
   ============================================================ */

/* --- Listing card badges --- */
.listing-card-oos {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}
.listing-card-lowstock {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #f59e0b;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}
.listing-card-held {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #1e3a5f;
    color: #f59e0b;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    letter-spacing: .02em;
}

/* --- Inline stock badges (table / edit page) --- */
.stock-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}
.stock-badge-in  { background: #d1fae5; color: #065f46; }
.stock-badge-low { background: #fef3c7; color: #92400e; }
.stock-badge-out { background: #fee2e2; color: #991b1b; }

/* --- Listing detail stock banners --- */
.stock-detail-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
    gap: 8px;
}
.stock-detail-ok  { background: #d1fae5; color: #065f46; }
.stock-detail-low { background: #fef3c7; color: #92400e; }
.stock-detail-out { background: #fee2e2; color: #991b1b; }

/* --- Notify confirmation --- */
.stock-notify-confirm {
    text-align: center;
    padding: 14px;
    background: #d1fae5;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: #065f46;
}

/* --- Stock stepper in Edit Listing --- */
.stock-stepper {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    width: fit-content;
}
.stock-step-btn {
    width: 36px;
    height: 40px;
    background: var(--color-bg);
    border: none;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    color: var(--color-text-primary);
    transition: background .1s;
}
.stock-step-btn:hover:not(:disabled) { background: var(--color-border); }
.stock-step-btn:disabled { opacity: .4; cursor: default; }
.stock-step-input {
    width: 64px;
    height: 40px;
    border: none;
    border-left: 1.5px solid var(--color-border);
    border-right: 1.5px solid var(--color-border);
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-primary);
    background: var(--color-surface);
}
.stock-step-input:focus { outline: none; }

/* --- Modal --- */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-box {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    padding: 28px;
    max-width: 440px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}

/* ---- Forum notification dropdown ---- */
.notif-dropdown {
    width: 360px;
    right: 0;
    left: auto;
    max-height: 480px;
    overflow-y: auto;
    padding: 0;
}
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 10px;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-surface);
    z-index: 1;
}
.notif-mark-all {
    background: none;
    border: none;
    font-size: 12px;
    color: var(--color-accent);
    cursor: pointer;
    padding: 0;
    font-weight: 600;
}
.notif-mark-all:hover { text-decoration: underline; }
.notif-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.6;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 16px;
    text-decoration: none;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    transition: background 0.1s;
    position: relative;
}
.notif-item:hover { background: var(--color-bg); }
.notif-item.unread { background: #eff6ff; }
.notif-item.unread:hover { background: #dbeafe; }
.notif-item-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex-shrink: 0; background: var(--color-bg); border-radius: var(--radius-sm); color: var(--color-text-secondary); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-msg {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.notif-item-title {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.notif-item-time {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 3px;
}
.notif-unread-dot {
    width: 8px;
    height: 8px;
    background: var(--color-accent);
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}
.notif-footer {
    display: block;
    text-align: center;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-accent);
    text-decoration: none;
    border-top: 1px solid var(--color-border);
}
.notif-footer:hover { background: var(--color-bg); }
.topnav-badge-notif { background: var(--color-danger) !important; }

/* ---- Forum category row with subscribe bell ---- */
.forum-cat-row {
    display: flex;
    align-items: center;
    gap: 2px;
}
.forum-cat-row .forum-cat-btn { flex: 1; }
.forum-sub-bell {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 4px;
    border-radius: var(--radius-sm);
    opacity: 0.4;
    transition: opacity 0.15s;
    flex-shrink: 0;
}
.forum-sub-bell:hover { opacity: 1; }
.forum-sub-bell.subscribed { opacity: 1; }

/* ---- Keyword alerts in sidebar ---- */
.forum-keyword-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    line-height: 1.4;
}
.forum-keyword-input-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.forum-keyword-input-row .forum-form-input {
    flex: 1;
    padding: 7px 10px;
    font-size: 13px;
}
.forum-keyword-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}
.forum-keyword-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--color-info-light);
    color: var(--color-primary);
    border-radius: 999px;
    padding: 3px 10px 3px 8px;
    font-size: 12px;
    font-weight: 600;
}
.forum-keyword-tag button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    color: var(--color-text-muted);
    padding: 0;
    line-height: 1;
    opacity: 0.7;
}
.forum-keyword-tag button:hover { opacity: 1; color: var(--color-danger); }

@media (max-width: 768px) {
    .notif-dropdown { width: calc(100vw - 16px); position: fixed; top: var(--nav-height); right: 8px; left: 8px; }
}

/* ---- Promote listing — forum discount banner ---- */
.promo-forum-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1.5px solid #86efac;
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.promo-forum-badge {
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ---- Subscription plans — forum reward banners ---- */
.sub-forum-reward-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1.5px solid #86efac;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin: 0 auto 32px;
    max-width: 680px;
    flex-wrap: wrap;
}
.sub-forum-reward-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 220px;
    flex-wrap: wrap;
}
.sub-forum-earn-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--color-info-light);
    border: 1.5px solid #bfdbfe;
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    margin: 0 auto 32px;
    max-width: 680px;
    flex-wrap: wrap;
}
.sub-forum-tier-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* ---- Forum progress bar ---- */
.forum-progress-wrap {
    margin: 12px 0 8px;
}
.forum-progress-label {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 5px;
    line-height: 1.4;
}
.forum-progress-label strong { color: var(--color-text); }
.forum-progress-track {
    width: 100%;
    height: 8px;
    background: var(--color-border);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 4px;
}
.forum-progress-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
    background: var(--color-accent);
}
.forum-progress-fill.forum-badge-helper  { background: #3b82f6; }
.forum-progress-fill.forum-badge-trusted { background: #7c3aed; }
.forum-progress-fill.forum-badge-expert  { background: #d97706; }
.forum-progress-hint {
    font-size: 10px;
    color: var(--color-text-muted);
    font-style: italic;
}

/* ---- Forum toolbar button ---- */
.topnav-forum-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}
.topnav-forum-btn:hover,
.topnav-forum-btn.active {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-info-light);
}

/* ============================================================
   Forum
   ============================================================ */

.forum-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

/* Hero */
.forum-hero {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    border-radius: var(--radius-xl);
    margin: 20px 0 24px;
    padding: 36px 32px;
    color: #fff;
}
.forum-hero-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 6px;
}
.forum-hero-subtitle {
    font-size: 15px;
    opacity: 0.85;
    margin: 0 0 20px;
}
.forum-ask-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fff;
    color: var(--color-primary);
    font-weight: 600;
    padding: 10px 20px;
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-size: 14px;
    transition: opacity 0.15s;
}
.forum-ask-btn:hover { opacity: 0.9; }

/* Layout */
.forum-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
}

/* Sidebar */
.forum-sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.forum-sidebar-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 14px;
}
.forum-sidebar-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 10px;
}
.forum-cat-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 7px 10px;
    border-radius: var(--radius-md);
    border: none;
    background: none;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.1s;
}
.forum-cat-btn:hover { background: var(--color-bg); }
.forum-cat-btn.active {
    background: var(--color-accent);
    color: #fff;
    font-weight: 600;
}
.forum-my-stats { }
.forum-stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    margin-bottom: 6px;
    color: var(--color-text-muted);
}
.forum-stat-row strong { color: var(--color-text); }
.forum-my-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}
.forum-discount-pill {
    margin-top: 8px;
    background: var(--color-success-light);
    color: var(--color-success);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
}
.forum-discount-hint {
    margin-top: 8px;
    font-size: 11px;
    color: var(--color-text-muted);
    line-height: 1.4;
}
.forum-badge-legend { }
.forum-badge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 8px;
    color: var(--color-text-muted);
}
.forum-badge-row span:first-child {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
}

/* Badge styles */
.forum-badge-expert  { background: #fef3c7; color: #92400e; }
.forum-badge-trusted { background: #ede9fe; color: #5b21b6; }
.forum-badge-helper  { background: #dbeafe; color: #1e40af; }
.forum-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

/* Filters */
.forum-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.forum-search-wrap {
    flex: 1;
    min-width: 180px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 8px 14px;
}
.forum-search-wrap svg { color: var(--color-text-muted); flex-shrink: 0; }
.forum-search {
    border: none;
    outline: none;
    background: none;
    font-size: 14px;
    width: 100%;
    color: var(--color-text);
}
.forum-sort-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.forum-sort-tab {
    padding: 7px 13px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    font-size: 13px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.15s;
    white-space: nowrap;
}
.forum-sort-tab:hover { border-color: var(--color-accent); color: var(--color-accent); }
.forum-sort-tab.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
    font-weight: 600;
}

/* Active filter chip */
.forum-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
}
.forum-active-filter button {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    opacity: 0.8;
}
.forum-active-filter button:hover { opacity: 1; }

/* Post list */
.forum-post-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.forum-post-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.forum-post-card:hover {
    border-color: var(--color-accent);
    box-shadow: var(--shadow-md);
}

.forum-post-stats {
    display: flex;
    flex-direction: row;
    gap: 6px;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .forum-post-stats { flex-direction: column; }
}

.forum-post-votes, .forum-post-answers {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
    padding: 6px 8px;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background: var(--color-bg);
}
.forum-post-vote-count, .forum-post-answer-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}
.forum-post-vote-label, .forum-post-answer-label {
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
}
.forum-post-answers.solved {
    border-color: var(--color-success);
    background: var(--color-success-light);
}
.forum-post-answers.solved .forum-post-answer-count { color: var(--color-success); }
.forum-post-answers.solved .forum-post-answer-label { color: var(--color-success); }
.forum-post-answers.has-answers {
    border-color: var(--color-accent);
}
.forum-post-answers.has-answers .forum-post-answer-count { color: var(--color-accent); }

.forum-post-body { flex: 1; min-width: 0; }
.forum-post-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
    line-height: 1.4;
}
.forum-post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}
.forum-post-category {
    background: var(--color-primary);
    color: #fff;
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}
.forum-post-tag {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 2px 7px;
    font-size: 11px;
    color: var(--color-text-muted);
}
.forum-solved-badge {
    background: var(--color-success-light);
    color: var(--color-success);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
    margin-right: 6px;
}
.forum-post-time, .forum-post-author, .forum-post-views {
    color: var(--color-text-muted);
}

/* Empty state */
.forum-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--color-text-muted);
}
.forum-empty-icon { font-size: 40px; margin-bottom: 12px; }
.forum-empty a { color: var(--color-accent); }

/* Thread wrap */
.forum-thread-wrap {
    max-width: 860px;
    margin: 20px auto 0;
}

/* Breadcrumb */
.forum-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.forum-breadcrumb a { color: var(--color-accent); text-decoration: none; }
.forum-breadcrumb a:hover { text-decoration: underline; }
.forum-breadcrumb-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

/* Question card */
.forum-question-card {
    display: flex;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
}

/* Vote column */
.forum-vote-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 40px;
}
.forum-vote-btn {
    background: none;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.15s;
}
.forum-vote-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}
.forum-vote-btn.voted {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: var(--color-info-light);
}
.forum-vote-count {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text);
}
.forum-solved-tick {
    font-size: 18px;
    color: var(--color-success);
    font-weight: 700;
}

/* Question content */
.forum-question-content { flex: 1; min-width: 0; }
.forum-question-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 14px;
    line-height: 1.35;
}
.forum-question-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-text);
    white-space: pre-wrap;
    margin-bottom: 16px;
}
.forum-question-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Answers */
.forum-answers-heading {
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}
.forum-answers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}
.forum-answer-card {
    display: flex;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px;
}
.forum-answer-card.accepted {
    border-color: var(--color-success);
    background: #f0fdf4;
}
.forum-answer-content { flex: 1; min-width: 0; }
.forum-answer-body {
    font-size: 14px;
    line-height: 1.7;
    color: var(--color-text);
    white-space: pre-wrap;
    margin-bottom: 14px;
}
.forum-answer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.forum-answer-author {
    display: flex;
    align-items: center;
    gap: 10px;
}
.forum-author-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.forum-author-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}
.forum-trade-pill {
    display: inline-flex;
    align-items: center;
    background: var(--color-info-light);
    color: var(--color-info);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}
.forum-accepted-tick {
    font-size: 18px;
    color: var(--color-success);
    font-weight: 700;
}
.forum-accept-btn {
    background: none;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: all 0.15s;
}
.forum-accept-btn:hover {
    border-color: var(--color-success);
    color: var(--color-success);
}

/* Reply section */
.forum-reply-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 24px;
}
.forum-login-prompt {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}
.forum-login-prompt a { color: var(--color-accent); }
.forum-reply-form { display: flex; flex-direction: column; gap: 12px; }
.forum-reply-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
    resize: vertical;
    transition: border-color 0.15s;
    line-height: 1.6;
}
.forum-reply-textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.forum-anon-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
}
.forum-reply-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.forum-error {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 13px;
}

/* New post form */
.forum-new-post-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 28px;
}
.forum-new-post-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 6px;
}
.forum-new-post-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0 0 24px;
}
.forum-form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.forum-form-label { font-size: 14px; font-weight: 600; color: var(--color-text); }
.forum-form-hint { font-weight: 400; color: var(--color-text-muted); font-size: 12px; margin-left: 4px; }
.forum-form-label .required { color: var(--color-danger); }
.forum-form-input {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color 0.15s;
}
.forum-form-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.forum-form-select {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-bg);
    transition: border-color 0.15s;
}
.forum-form-select:focus {
    outline: none;
    border-color: var(--color-accent);
}
.forum-char-count { font-size: 11px; color: var(--color-text-muted); text-align: right; }
.forum-not-found { padding: 48px 16px; text-align: center; color: var(--color-text-muted); }
.forum-not-found a { color: var(--color-accent); }

/* Auth gate — shown when user isn't logged in and tries to reply */
.forum-auth-gate {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-bg);
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    flex-wrap: wrap;
}
.forum-auth-gate-icon { font-size: 28px; flex-shrink: 0; }
.forum-auth-gate-text { flex: 1; min-width: 200px; }
.forum-auth-gate-text strong { display: block; font-size: 15px; color: var(--color-text); margin-bottom: 4px; }
.forum-auth-gate-text p { margin: 0; font-size: 13px; color: var(--color-text-muted); line-height: 1.5; }
.forum-auth-gate-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- Forum mobile toolbar ---- */
.forum-mobile-toolbar { display: none; }
.forum-sheet-backdrop { display: none; }
.forum-sheet { display: none; }

/* Sheet animations — must live outside @media to avoid parser issues */
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ---- Forum mobile ---- */
@media (max-width: 768px) {
    .forum-layout { grid-template-columns: 1fr; }
    .forum-sidebar { display: none; }
    .forum-hero { padding: 24px 18px; }
    .forum-hero-title { font-size: 22px; }
    .forum-question-card { flex-direction: row; padding: 16px; gap: 10px; }
    .forum-question-title { font-size: 18px; }
    .forum-answer-card { flex-direction: row; gap: 10px; }
    .forum-filters { flex-direction: column; align-items: stretch; }
    .forum-sort-tabs { justify-content: flex-start; }
    .forum-post-card { padding: 12px; gap: 8px; }
    .forum-post-votes, .forum-post-answers { min-width: 38px; padding: 4px 6px; }
    .forum-breadcrumb-title { max-width: 160px; }
    .topnav-forum-label { display: none; }
    .topnav-forum-btn { padding: 7px 9px; }
    .forum-auth-gate { flex-direction: column; align-items: flex-start; gap: 12px; }

    /* Mobile toolbar */
    .forum-mobile-toolbar {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 14px;
    }
    .forum-mobile-cat-wrap {
        flex: 1;
        display: flex;
        align-items: center;
        gap: 8px;
        background: var(--color-surface);
        border: 1.5px solid var(--color-border);
        border-radius: var(--radius-full);
        padding: 8px 12px;
        color: var(--color-text-muted);
    }
    .forum-mobile-cat-select {
        flex: 1;
        border: none;
        background: transparent;
        font-size: 13px;
        font-weight: 600;
        color: var(--color-text-primary);
        appearance: none;
        -webkit-appearance: none;
        outline: none;
        cursor: pointer;
    }
    .forum-mobile-cat-chevron { flex-shrink: 0; color: var(--color-text-muted); }
    .forum-mobile-settings-btn {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 8px 14px;
        background: var(--color-surface);
        border: 1.5px solid var(--color-border);
        border-radius: var(--radius-full);
        font-size: 13px;
        font-weight: 600;
        color: var(--color-text-primary);
        cursor: pointer;
        white-space: nowrap;
        transition: border-color 0.15s, color 0.15s;
    }
    .forum-mobile-settings-btn:hover {
        border-color: var(--color-accent);
        color: var(--color-accent);
    }

    /* Bottom sheet backdrop */
    .forum-sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 200;
        animation: backdropIn 0.2s ease;
    }

    /* Bottom sheet */
    .forum-sheet {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: var(--bottom-nav-height);
        left: 0;
        right: 0;
        height: calc(100vh - var(--bottom-nav-height) - 60px);
        background: var(--color-surface);
        border-radius: 20px 20px 0 0;
        z-index: 201;
        box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
        animation: sheetUp 0.28s cubic-bezier(0.32,0.72,0,1);
    }

    .forum-sheet-handle {
        width: 36px;
        height: 4px;
        background: var(--color-border);
        border-radius: 2px;
        margin: 12px auto 0;
        flex-shrink: 0;
    }
    .forum-sheet-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 14px 18px 10px;
        border-bottom: 1px solid var(--color-border);
        flex-shrink: 0;
    }
    .forum-sheet-title { font-weight: 700; font-size: 16px; }
    .forum-sheet-close {
        background: var(--color-bg);
        border: 1px solid var(--color-border);
        border-radius: 50%;
        width: 28px;
        height: 28px;
        font-size: 13px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--color-text-muted);
    }
    .forum-sheet-body {
        flex: 1;
        overflow-y: auto;
        padding: 12px 18px 16px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .forum-sheet-section {
        background: var(--color-bg);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        padding: 14px;
        margin-bottom: 10px;
    }
    .forum-sheet-section-title {
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: var(--color-text-muted);
        margin-bottom: 10px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   PAYMENT / ESCROW SYSTEM
   ═══════════════════════════════════════════════════════════════ */

/* Checkout page two-column grid */
.checkout-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 28px;
    align-items: start;
}
@media (max-width: 768px) {
    .checkout-grid {
        grid-template-columns: 1fr;
    }
}

/* Payment / fulfilment option row */
.checkout-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    font-size: 14px;
}
.checkout-option:hover       { border-color: var(--color-primary); }
.checkout-option.selected    { border-color: var(--color-primary); background: #eff6ff; }
.checkout-option input[type=radio] { flex-shrink: 0; accent-color: var(--color-primary); }

/* Escrow step-by-step explainer */
.escrow-explainer {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-md);
    padding: 16px 18px;
}
.escrow-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}
.escrow-steps li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.escrow-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Transaction status banner */
.tx-status-banner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    color: #fff;
}
.tx-banner-primary { background: linear-gradient(135deg, var(--color-primary), #2563eb); }
.tx-banner-success { background: linear-gradient(135deg, #059669, #10b981); }
.tx-banner-warning { background: linear-gradient(135deg, #d97706, #f59e0b); }
.tx-banner-info    { background: linear-gradient(135deg, #2563eb, #7c3aed); }
.tx-banner-muted   { background: linear-gradient(135deg, #6b7280, #9ca3af); }

/* Transaction timeline */
.tx-timeline {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
}
.tx-timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 12px;
    bottom: 12px;
    width: 2px;
    background: var(--color-border);
}
.tx-timeline-item {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 8px 0;
    position: relative;
}
.tx-timeline-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-border);
    border: 3px solid #fff;
    outline: 2px solid var(--color-border);
    flex-shrink: 0;
    margin-top: 2px;
    position: relative;
    z-index: 1;
}
.tx-timeline-item.done .tx-timeline-dot {
    background: var(--color-success);
    outline-color: var(--color-success);
}
.tx-timeline-item.pending .tx-timeline-dot {
    background: var(--color-border);
}

/* ── Typing indicator ─────────────────────────────────────────── */
.msg-typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    color: var(--color-text-muted);
    font-style: italic;
}
.msg-typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.msg-typing-dots span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-text-muted);
    animation: typing-bounce 1.2s infinite ease-in-out;
}
.msg-typing-dots span:nth-child(1) { animation-delay: 0s; }
.msg-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.msg-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .4; }
    30%            { transform: translateY(-4px); opacity: 1; }
}

/* ── Admin Settings Toggle ────────────────────────────────────────────────── */
.settings-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.settings-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.settings-toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--color-border);
    border-radius: 24px;
    transition: background .2s;
}
.settings-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.settings-toggle input:checked + .settings-toggle-slider { background: #16a34a; }
.settings-toggle input:checked + .settings-toggle-slider::before { transform: translateX(20px); }

/* ── Listing Analytics ────────────────────────────────────────────────────── */
.analytics-stat-card {
    background: var(--color-card);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 18px 16px;
    text-align: center;
}
.analytics-stat-icon { font-size: 22px; margin-bottom: 6px; }
.analytics-stat-value { font-size: 26px; font-weight: 800; color: var(--color-text-primary); line-height: 1; }
.analytics-stat-label { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }

.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.analytics-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
    border-bottom: 1.5px solid var(--color-border);
    white-space: nowrap;
}
.analytics-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.analytics-table tr:last-child td { border-bottom: none; }
.analytics-table tr:hover td { background: var(--color-bg); }

.analytics-num {
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    color: var(--color-text-primary);
}

.analytics-rate {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
}
.rate-good  { background: #dcfce7; color: #15803d; }
.rate-ok    { background: #fef9c3; color: #854d0e; }
.rate-low   { background: #fee2e2; color: #b91c1c; }
.rate-none  { color: var(--color-text-muted); }

.analytics-score-bar {
    width: 70px;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    overflow: hidden;
}

.listing-status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: capitalize;
}
.status-active   { background: #dcfce7; color: #15803d; }
.status-sold     { background: #e0e7ff; color: #3730a3; }
.status-draft    { background: #f3f4f6; color: #6b7280; }
.status-removed  { background: #fee2e2; color: #b91c1c; }

/* ============================================================
   Product Tour
   ============================================================ */

.tour-overlay {
    position: fixed;
    inset: 0;
    background: rgba(6, 14, 26, 0.72);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(3px);
    animation: tour-fade-in 0.22s ease;
}

@keyframes tour-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.tour-modal {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    overflow: hidden;
    animation: tour-slide-up 0.26s cubic-bezier(.22,1,.36,1);
    display: flex;
    flex-direction: column;
}

@keyframes tour-slide-up {
    from { transform: translateY(28px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.tour-progress-bar {
    height: 4px;
    background: var(--color-border);
    border-radius: 0;
}

.tour-progress-fill {
    height: 100%;
    background: var(--color-cta);
    border-radius: 0;
    transition: width 0.3s ease;
}

.tour-illustration {
    background: var(--color-bg);
    padding: 0;
    line-height: 0;
}

.tour-illustration svg {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
}

.tour-step-counter {
    font-size: 11px;
    color: var(--color-text-muted);
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 16px 24px 0;
}

.tour-content {
    padding: 10px 24px 0;
}

.tour-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
    margin: 0 0 8px;
    line-height: 1.3;
}

.tour-desc {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin: 0;
}

.tour-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    padding: 16px 24px 0;
}

.tour-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-border-dark);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s, transform 0.2s, width 0.2s;
    flex-shrink: 0;
}

.tour-dot.active {
    background: var(--color-cta);
    width: 22px;
    border-radius: 4px;
    transform: none;
}

.tour-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px 24px;
    gap: 12px;
}

.tour-btn-skip {
    background: none;
    border: none;
    font-size: 13px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 6px 0;
    font-family: inherit;
    transition: color 0.15s;
}

.tour-btn-skip:hover { color: var(--color-text-secondary); }

.tour-nav {
    display: flex;
    gap: 8px;
    align-items: center;
}

.tour-btn-back {
    background: none;
    border: 1.5px solid var(--color-border-dark);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 9px 18px;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

.tour-btn-back:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.tour-btn-next {
    background: var(--color-cta);
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    padding: 9px 22px;
    font-family: inherit;
    transition: background 0.15s, transform 0.1s;
}

.tour-btn-next:hover { background: var(--color-cta-dark); }
.tour-btn-next:active { transform: scale(0.97); }

/* Mobile */
@media (max-width: 540px) {
    .tour-modal { border-radius: var(--radius-lg); max-width: 100%; }
    .tour-illustration svg { max-height: 160px; }
    .tour-title { font-size: 17px; }
    .tour-desc  { font-size: 13px; }
    .tour-content, .tour-actions, .tour-dots, .tour-step-counter { padding-left: 18px; padding-right: 18px; }
    .tour-actions { padding-bottom: 20px; }
    .tour-btn-next, .tour-btn-back { padding: 8px 16px; font-size: 13px; }
}
.status-reserved { background: #fef9c3; color: #854d0e; }

/* ============================================================
   Feedback Widget
   ============================================================ */

/* Side tab — quiet, unobtrusive */
.fw-tab {
    position: fixed;
    bottom: 130px;
    left: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--color-primary);
    color: rgba(255,255,255,0.82);
    border: none;
    border-radius: 0 5px 5px 0;
    padding: 8px 11px 8px 9px;
    font-size: 11.5px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s, color 0.15s, transform 0.15s;
    opacity: 0.78;
}
.fw-tab:hover {
    background: var(--color-primary-light);
    color: #fff;
    opacity: 1;
    transform: translateX(2px);
}

/* Floating panel */
.fw-panel {
    position: fixed;
    bottom: 20px;
    left: 16px;
    z-index: 1200;
    width: 308px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(13,33,55,.14), 0 1px 6px rgba(13,33,55,.08);
    border: 1px solid var(--color-border);
    overflow: hidden;
    opacity: 0;
    transform: translateY(8px) scale(0.97);
    transition: opacity 0.18s ease, transform 0.18s ease;
    pointer-events: none;
}
.fw-panel--in {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Header */
.fw-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--color-primary);
    padding: 11px 14px;
}
.fw-head-inner {
    display: flex;
    align-items: center;
    gap: 7px;
    color: rgba(255,255,255,0.7);
}
.fw-head-icon { display: flex; align-items: center; }
.fw-head-title {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    font-family: var(--font-family);
}
.fw-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    padding: 3px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.12s;
    margin-right: -2px;
}
.fw-close:hover { color: #fff; }

/* Body */
.fw-body { padding: 16px 16px 18px; }

.fw-question {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

/* ── SVG Face Scale ───────────────────────────────────────── */
.fw-faces {
    display: flex;
    gap: 5px;
    justify-content: space-between;
}
.fw-face {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 8px 3px 7px;
    cursor: pointer;
    font-family: var(--font-family);
    transition: border-color 0.13s, background 0.13s, transform 0.12s;
}
.fw-face:hover {
    background: #f0f4f8;
    border-color: var(--color-primary);
    transform: translateY(-2px);
}
.fw-face--active {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* SVG face icon */
.fw-face-svg { width: 32px; height: 32px; display: block; }

/* Default face colours */
.fw-fc  { fill: transparent; stroke: var(--color-text-secondary); stroke-width: 1.5; }
.fw-fe  { fill: var(--color-text-secondary); }
.fw-fm  { fill: none; stroke: var(--color-text-secondary); stroke-width: 1.6; stroke-linecap: round; }

/* Hover state (sibling approach via parent) */
.fw-face:hover .fw-fc  { stroke: var(--color-primary); }
.fw-face:hover .fw-fe  { fill: var(--color-primary); }
.fw-face:hover .fw-fm  { stroke: var(--color-primary); }

/* Active/selected — inverted (white on navy) */
.fw-face--active .fw-fc { fill: var(--color-primary); stroke: var(--color-primary); }
.fw-face--active .fw-fe { fill: #fff; }
.fw-face--active .fw-fm { stroke: #fff; }

/* Active label colour */
.fw-face-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
}
.fw-face--active .fw-face-label { color: rgba(255,255,255,0.75); }

/* ── Step 2 ───────────────────────────────────────────────── */
.fw-rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f7f9fb;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    padding: 7px 10px;
    margin-bottom: 0;
}
.fw-rating-mini {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}
/* mini face in selected state — always shown as navy-filled */
.fw-fc--sel  { fill: var(--color-primary); stroke: var(--color-primary); stroke-width: 1.5; }
.fw-fe--sel  { fill: #fff; }
.fw-fm--sel  { fill: none; stroke: #fff; stroke-width: 1.6; stroke-linecap: round; }

.fw-rating-text {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-primary);
    flex: 1;
}
.fw-rating-change {
    background: none;
    border: none;
    font-size: 11px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    font-family: var(--font-family);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.12s;
}
.fw-rating-change:hover { color: var(--color-primary); }

.fw-textarea {
    display: block;
    width: 100%;
    resize: none;
    border: 1px solid var(--color-border);
    border-radius: 7px;
    padding: 9px 11px;
    font-family: var(--font-family);
    font-size: 13px;
    color: var(--color-text-primary);
    background: #f7f9fb;
    line-height: 1.5;
    transition: border-color 0.15s, background 0.15s;
}
.fw-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: #fff;
}
.fw-textarea::placeholder { color: var(--color-text-muted); }

.fw-meta {
    display: flex;
    justify-content: flex-end;
    margin-top: 4px;
    margin-bottom: 12px;
}
.fw-chars {
    font-size: 10.5px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
}
.fw-error {
    font-size: 12px;
    color: var(--color-danger);
    background: var(--color-danger-light);
    border-radius: 5px;
    padding: 7px 10px;
    margin-bottom: 10px;
}

.fw-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}
.fw-back {
    background: none;
    border: none;
    font-size: 12px;
    font-family: var(--font-family);
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.12s;
}
.fw-back:hover { color: var(--color-primary); }

.fw-send {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 9px 18px;
    font-size: 12.5px;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: background 0.15s;
}
.fw-send:hover:not(:disabled) { background: var(--color-primary-light); }
.fw-send:disabled { opacity: 0.55; cursor: default; }

/* ── Thanks step ──────────────────────────────────────────── */
.fw-thanks {
    text-align: center;
    padding: 24px 16px 22px;
}
.fw-thanks-check {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    animation: fw-pop 0.35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes fw-pop {
    from { transform: scale(0.4); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}
.fw-thanks-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 6px;
    font-family: var(--font-family);
}
.fw-thanks-sub {
    font-size: 12.5px;
    color: var(--color-text-muted);
    line-height: 1.55;
    margin-bottom: 16px;
}
.fw-done {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 7px 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: border-color 0.13s, color 0.13s;
}
.fw-done:hover { border-color: var(--color-primary); color: var(--color-primary); }

/* Mobile */
@media (max-width: 480px) {
    .fw-panel {
        width: calc(100vw - 32px);
        left: 16px;
        bottom: 84px;
    }
    .fw-tab { bottom: 150px; }
}

/* ============================================================
   AI Section — photo upload, badges, notices, generate button
   ============================================================ */

/* Drop zone */
.photo-dropzone {
    border: 2px dashed var(--color-primary);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color .18s, background .18s;
    background: var(--color-bg);
    display: block;
}
.photo-dropzone:hover {
    border-color: var(--color-accent);
    background: #fffbf0;
}
.photo-dropzone:hover svg { opacity: .75 !important; color: var(--color-accent) !important; }

/* Remove button on thumbnail */
.photo-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,.55);
    border: none;
    color: #fff;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    backdrop-filter: blur(2px);
    transition: background .15s;
}
.photo-remove-btn:hover { background: rgba(220,38,38,.85); }

/* AI verdict badge strip at bottom of thumbnail */
.ai-badge {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 2px 4px;
    font-size: 8.5px;
    font-weight: 700;
    color: #fff;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    letter-spacing: .3px;
    text-transform: uppercase;
    backdrop-filter: blur(1px);
}
.ai-badge-pending {
    background: rgba(30,58,95,.75);
}

/* Pulsing dot for "Reviewing" state */
.ai-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #fff;
    animation: ai-pulse 1.2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes ai-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}

/* Notice banners (weak signal / quality tips / AI warning) */
.ai-notice {
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 11px;
    font-size: 12px;
}
.ai-notice-muted {
    background: #f8f9fa;
    border: 1.5px solid #dee2e6;
    color: #495057;
}
.ai-notice-warning {
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
    color: #92400e;
}
.ai-notice-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-top: 1px;
    opacity: .8;
}
.ai-notice-title {
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 2px;
}
.ai-notice-body {
    font-size: 12px;
    line-height: 1.5;
}

/* Quality tips panel — always stacked vertically (no flex-row) */
.ai-quality-panel {
    background: #fffbeb;
    border: 1.5px solid #fcd34d;
    border-radius: var(--radius-md);
    padding: 12px 14px;
}
.ai-quality-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    font-size: 12px;
    color: #92400e;
    margin-bottom: 8px;
}
.ai-quality-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: #78350f;
    margin-bottom: 5px;
    line-height: 1.45;
}
.ai-quality-label {
    background: #fef3c7;
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 700;
    font-size: 10px;
    flex-shrink: 0;
    margin-top: 2px;
    white-space: nowrap;
}
.ai-quality-footer {
    font-size: 11px;
    color: #92400e;
    margin-top: 7px;
    padding-top: 7px;
    border-top: 1px solid #fcd34d;
}

/* Subtle hint shown while AI reviews run in background */
.ai-running-hint {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: var(--color-text-muted);
    font-style: italic;
}

/* Auto-generate description button */
.ai-generate-btn {
    font-size: 12px;
    padding: 4px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Spinner used inside the generate button */
.ai-spin {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
