/* ===== CSS Variables ===== */
:root {
    --primary: #002f6c;
    --primary-dark: #001f4a;
    --accent: #ff6b00;
    --accent-dark: #e05e00;
    --bg: #f5f5f5;
    --white: #fff;
    --text: #333;
    --text-light: #666;
    --border: #e0e0e0;
    --gold: #f0a500;
    --success: #28a745;
    --danger: #dc3545;
    --shadow: 0 2px 8px rgba(0,0,0,.08);
    --radius: 8px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.main-content { min-height: calc(100vh - 140px); }

/* ===== Header ===== */
.site-header { background: var(--primary); position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.header-inner { display: flex; align-items: center; gap: 1rem; padding: .75rem 0; }

.logo { font-size: 1.4rem; font-weight: 700; white-space: nowrap; }
.logo-find { color: var(--white); }
.logo-in { color: #a8c0e8; }
.logo-market { color: var(--accent); }

.header-search { flex: 1; display: flex; max-width: 500px; }
.header-search input { flex: 1; padding: .6rem 1rem; border: none; border-radius: var(--radius) 0 0 var(--radius); font-size: .95rem; outline: none; }
.header-search button { padding: .6rem 1.2rem; background: var(--accent); color: var(--white); border: none; border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-weight: 600; white-space: nowrap; transition: background .2s; }
.header-search button:hover { background: var(--accent-dark); }

.header-nav { display: flex; align-items: center; gap: .75rem; margin-left: auto; white-space: nowrap; }
.header-nav a { color: #a8c0e8; font-size: .9rem; font-weight: 500; transition: color .2s; }
.header-nav a:hover { color: var(--white); }
.btn-post-ad { background: var(--accent); color: var(--white) !important; padding: .5rem 1rem; border-radius: var(--radius); font-weight: 600; transition: background .2s; }
.btn-post-ad:hover { background: var(--accent-dark) !important; }

.category-bar { background: var(--primary-dark); }
.category-bar .container { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .3rem; padding: .5rem 1rem; }
.category-bar a { color: #a8c0e8; font-size: .82rem; padding: .35rem .7rem; border-radius: 4px; white-space: nowrap; transition: .2s; }
.category-bar a:hover { background: var(--accent); color: var(--white); }

/* ===== Buttons ===== */
.btn-primary { display: inline-block; padding: .65rem 1.4rem; background: var(--accent); color: var(--white); border: none; border-radius: var(--radius); font-weight: 600; cursor: pointer; transition: background .2s; text-align: center; }
.btn-primary:hover { background: var(--accent-dark); color: var(--white); }
.btn-secondary { display: inline-block; padding: .65rem 1.4rem; background: var(--white); color: var(--primary); border: 2px solid var(--primary); border-radius: var(--radius); font-weight: 600; cursor: pointer; transition: .2s; text-align: center; }
.btn-secondary:hover { background: var(--primary); color: var(--white); }
.btn-large { padding: .85rem 2rem; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; margin-bottom: .5rem; }
.btn-link-danger { background: none; border: none; color: var(--danger); cursor: pointer; font-size: .85rem; padding: 0; text-decoration: underline; }
.text-gold { color: var(--gold) !important; font-weight: 600; }

/* ===== Alerts ===== */
.alert { padding: .85rem 1.2rem; border-radius: var(--radius); margin-bottom: 1.25rem; font-size: .9rem; }
.alert-error { background: #fff2f2; color: #c0392b; border: 1px solid #fccaca; }
.alert-success { background: #f0fff4; color: #155724; border: 1px solid #c3e6cb; }

/* ===== Hero ===== */
.hero { background: linear-gradient(135deg, var(--primary) 0%, #0050aa 100%); padding: 3.5rem 0; text-align: center; }
.hero h1 { color: var(--white); font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; margin-bottom: .75rem; }
.hero p { color: #a8c0e8; font-size: 1.1rem; margin-bottom: 2rem; }
.hero-search { display: flex; gap: .5rem; max-width: 600px; margin: 0 auto; flex-wrap: wrap; }
.hero-search input { flex: 1; min-width: 160px; padding: .85rem 1.2rem; border: none; border-radius: var(--radius); font-size: 1rem; outline: none; }
.hero-search button { padding: .85rem 2rem; background: var(--accent); color: var(--white); border: none; border-radius: var(--radius); font-size: 1rem; font-weight: 700; cursor: pointer; transition: background .2s; }
.hero-search button:hover { background: var(--accent-dark); }

/* ===== Section Headers ===== */
section { padding: 2.5rem 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.section-header h2 { font-size: 1.35rem; color: var(--primary); }
.section-header a { color: var(--accent); font-size: .9rem; font-weight: 500; }

/* ===== Categories Grid ===== */
.categories-section { background: var(--white); }
.categories-section h2 { font-size: 1.35rem; color: var(--primary); margin-bottom: 1.25rem; }
.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1rem; }
.category-card { display: flex; flex-direction: column; align-items: center; padding: 1.2rem .75rem; background: var(--bg); border-radius: var(--radius); border: 1px solid var(--border); transition: .2s; }
.category-card:hover { border-color: var(--accent); background: #fff8f4; transform: translateY(-2px); box-shadow: var(--shadow); }
.cat-icon { font-size: 2rem; margin-bottom: .5rem; }
.cat-name { font-size: .82rem; font-weight: 500; text-align: center; color: var(--text); }

/* ===== Listings Grid ===== */
.listings-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.listing-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; transition: .2s; position: relative; }
.listing-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); transform: translateY(-2px); }
.listing-card.is-featured { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.featured-badge { position: absolute; top: .5rem; left: .5rem; background: var(--gold); color: var(--white); font-size: .72rem; font-weight: 700; padding: .2rem .5rem; border-radius: 4px; z-index: 1; }
.card-image { height: 170px; overflow: hidden; background: #f0f0f0; }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.listing-card:hover .card-image img { transform: scale(1.03); }
.card-body { padding: .85rem; }
.card-title { font-size: .9rem; font-weight: 600; color: var(--text); margin-bottom: .4rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-price { font-size: 1.05rem; font-weight: 700; color: var(--primary); margin-bottom: .4rem; }
.price-free { color: var(--success); }
.price-contact { color: var(--text-light); font-size: .9rem; }
.card-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--text-light); margin-bottom: .35rem; }
.card-category { font-size: .75rem; color: var(--accent); font-weight: 500; }

/* ===== Featured Section ===== */
.featured-section { background: #fffbf5; }

/* ===== Sell CTA ===== */
.sell-cta { background: linear-gradient(135deg, var(--accent) 0%, #ff9100 100%); text-align: center; padding: 3rem 0; }
.sell-cta h2 { color: var(--white); font-size: 1.8rem; margin-bottom: .5rem; }
.sell-cta p { color: rgba(255,255,255,.9); margin-bottom: 1.5rem; }
.sell-cta .btn-primary { background: var(--white); color: var(--accent); font-size: 1.1rem; }
.sell-cta .btn-primary:hover { background: var(--primary); color: var(--white); }

/* ===== Browse Page ===== */
.browse-page { padding: 2rem 0; }
.browse-header { margin-bottom: 1.5rem; }
.browse-header h1 { font-size: 1.5rem; color: var(--primary); }
.browse-header p { color: var(--text-light); }
.browse-layout { display: grid; grid-template-columns: 260px 1fr; gap: 1.5rem; align-items: start; }
.browse-filters { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.25rem; position: sticky; top: 80px; }
.browse-filters h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--primary); }
.browse-filters label { display: block; font-size: .82rem; font-weight: 500; color: var(--text-light); margin-bottom: .3rem; margin-top: .75rem; }
.browse-filters input, .browse-filters select { width: 100%; padding: .55rem .85rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; }
.browse-filters .btn-primary { width: 100%; margin-top: 1rem; }
.browse-filters .btn-secondary { width: 100%; margin-top: .5rem; }
.no-results { text-align: center; padding: 4rem 1rem; }
.no-results h2 { color: var(--text-light); margin-bottom: .5rem; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: .5rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination a { display: inline-block; padding: .45rem .85rem; border: 1px solid var(--border); border-radius: 6px; font-size: .9rem; color: var(--primary); transition: .2s; }
.pagination a:hover, .pagination a.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ===== Listing Detail Page ===== */
.listing-page { padding: 1.5rem 0 3rem; }
.breadcrumb { font-size: .85rem; color: var(--text-light); margin-bottom: 1.5rem; }
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--accent); }
.listing-layout { display: grid; grid-template-columns: 1fr 320px; gap: 2rem; align-items: start; }
.listing-main { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.featured-ribbon { background: var(--gold); color: var(--white); padding: .5rem 1rem; font-weight: 600; font-size: .9rem; }
.listing-gallery { padding: 1.5rem; border-bottom: 1px solid var(--border); }
.main-image { width: 100%; height: 380px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.thumb-row { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.thumb { width: 72px; height: 56px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: border-color .2s; }
.thumb:hover { border-color: var(--accent); }
.listing-info { padding: 1.5rem; }
.listing-info h1 { font-size: 1.4rem; margin-bottom: .75rem; }
.listing-price { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-bottom: 1rem; }
.listing-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-light); margin-bottom: 1.5rem; }
.ad-type-badge { background: var(--bg); padding: .2rem .6rem; border-radius: 4px; font-weight: 600; color: var(--primary); font-size: .8rem; }
.listing-description h3 { font-size: 1rem; color: var(--primary); margin-bottom: .75rem; }
.listing-description p { color: var(--text); line-height: 1.7; white-space: pre-line; }
.seller-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.5rem; margin-bottom: 1.25rem; }
.seller-card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--primary); border-bottom: 1px solid var(--border); padding-bottom: .75rem; }
.seller-name { font-weight: 600; margin-bottom: .35rem; }
.seller-location { color: var(--text-light); font-size: .9rem; margin-bottom: .35rem; }
.member-since { color: var(--text-light); font-size: .82rem; margin-bottom: 1rem; }
.safety-tips { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.25rem; }
.safety-tips h4 { font-size: .95rem; margin-bottom: .75rem; color: var(--primary); }
.safety-tips li { font-size: .85rem; color: var(--text-light); padding: .3rem 0; border-bottom: 1px solid var(--border); }
.safety-tips li:last-child { border: none; }

/* ===== Forms ===== */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .875rem; font-weight: 500; color: var(--text-light); margin-bottom: .4rem; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: .7rem 1rem; border: 1px solid var(--border); border-radius: 6px; font-size: .95rem; color: var(--text); transition: border-color .2s; background: var(--white); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(0,47,108,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.hint { font-size: .8rem; color: var(--text-light); margin-top: .4rem; }
.file-input { width: 100%; padding: .7rem; border: 2px dashed var(--border); border-radius: 6px; background: var(--bg); cursor: pointer; }
.file-input:hover { border-color: var(--accent); }
.image-preview-grid { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.preview-thumb { width: 80px; height: 64px; object-fit: cover; border-radius: 4px; border: 2px solid var(--border); }
.existing-images { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.form-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.5rem; }

/* ===== Post Ad Page ===== */
.post-ad-page { max-width: 760px; margin: 0 auto; padding: 2rem 0; }
.post-ad-page h1 { font-size: 1.5rem; margin-bottom: 1.5rem; color: var(--primary); }
.post-ad-form { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); }
.form-section { padding: 1.5rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; }
.form-section h2 { font-size: 1rem; color: var(--primary); margin-bottom: 1rem; font-weight: 600; }
.post-ad-form > .btn-primary { margin: 1.25rem 1.5rem 1.5rem; }

/* ===== Auth Pages ===== */
.auth-page { display: flex; justify-content: center; align-items: center; min-height: 60vh; padding: 2rem 0; }
.auth-box { background: var(--white); border-radius: 10px; border: 1px solid var(--border); padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.auth-box h1 { font-size: 1.4rem; color: var(--primary); margin-bottom: 1.5rem; text-align: center; }
.auth-switch { text-align: center; margin-top: 1.25rem; font-size: .9rem; color: var(--text-light); }

/* ===== Dashboard ===== */
.dashboard-page { padding: 2rem 0; }
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.75rem; }
.dashboard-header h1 { font-size: 1.5rem; color: var(--primary); }
.dashboard-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.25rem; text-align: center; box-shadow: var(--shadow); }
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .82rem; color: var(--text-light); }
.my-ads h2 { font-size: 1.1rem; color: var(--primary); margin-bottom: 1rem; }
.ads-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; box-shadow: var(--shadow); }
.ads-table th { background: var(--bg); padding: .75rem 1rem; text-align: left; font-size: .85rem; font-weight: 600; color: var(--text-light); border-bottom: 1px solid var(--border); }
.ads-table td { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; vertical-align: middle; }
.ads-table tr:last-child td { border-bottom: none; }
.action-links { display: flex; gap: .75rem; align-items: center; }
.action-links a { font-size: .85rem; font-weight: 500; }
.empty-state { text-align: center; padding: 3rem 1rem; background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); }
.empty-state p { color: var(--text-light); margin-bottom: 1rem; }

/* ===== Status Badges ===== */
.status-badge { display: inline-block; padding: .25rem .6rem; border-radius: 4px; font-size: .75rem; font-weight: 600; text-transform: uppercase; }
.status-active { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-rejected { background: #f8d7da; color: #721c24; }
.status-inactive { background: #e2e3e5; color: #383d41; }
.status-sold { background: #cce5ff; color: #004085; }

/* ===== Upgrade / Plans ===== */
.upgrade-page { max-width: 900px; margin: 0 auto; padding: 2.5rem 0; }
.upgrade-page h1 { font-size: 1.7rem; text-align: center; color: var(--primary); margin-bottom: .5rem; }
.upgrade-subtitle { text-align: center; color: var(--text-light); margin-bottom: 2rem; font-size: 1.05rem; }
.listing-preview-mini { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1rem 1.5rem; margin-bottom: 2rem; display: flex; align-items: center; gap: 1rem; }
.plans-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-bottom: 2rem; }
.plan-card { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.75rem; text-align: center; position: relative; transition: .2s; }
.plan-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.1); transform: translateY(-4px); }
.plan-card.popular { border-color: var(--accent); border-width: 2px; }
.popular-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--white); font-size: .75rem; font-weight: 700; padding: .25rem .85rem; border-radius: 20px; white-space: nowrap; }
.plan-duration { font-size: 1.1rem; font-weight: 700; color: var(--primary); margin-bottom: .5rem; }
.plan-price { font-size: 2.2rem; font-weight: 700; color: var(--accent); margin-bottom: 1.25rem; }
.plan-card ul { margin-bottom: 1.5rem; }
.plan-card li { padding: .4rem 0; font-size: .9rem; color: var(--text-light); border-bottom: 1px solid var(--border); text-align: left; }
.plan-card li:last-child { border: none; }
.payment-note { background: var(--white); border-radius: var(--radius); border: 1px solid var(--border); padding: 1.5rem; text-align: center; }
.payment-note p { color: var(--text-light); margin-bottom: .5rem; }

/* ===== Footer ===== */
.site-footer { background: #1a1a2e; color: #a8c0e8; padding: 3rem 0 0; margin-top: 3rem; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; margin-bottom: 2rem; }
.footer-col h4 { color: var(--white); font-size: .95rem; margin-bottom: 1rem; }
.footer-col p { font-size: .85rem; line-height: 1.6; }
.footer-col a { display: block; color: #a8c0e8; font-size: .85rem; margin-bottom: .4rem; transition: color .2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 1.25rem 0; text-align: center; font-size: .85rem; }

/* ===== Responsive ===== */

/* Prevent horizontal overflow globally */
html, body { overflow-x: hidden; }
img, video, iframe { max-width: 100%; }

/* --- Tablet landscape ≤1024px --- */
@media (max-width: 1024px) {
    .listings-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Tablet portrait ≤768px --- */
@media (max-width: 768px) {
    /* Header */
    .header-inner { flex-wrap: wrap; gap: .5rem; padding: .6rem 0; }
    .header-search { order: 3; width: 100%; max-width: 100%; }
    .header-nav { margin-left: auto; }
    .header-nav a:not(.btn-post-ad) { display: none; }

    /* Category bar: wrap to rows */
    .category-bar .container { gap: .25rem; }

    /* Listings grid */
    .listings-grid { grid-template-columns: repeat(2, 1fr); gap: 1rem; }

    /* Browse */
    .browse-layout { grid-template-columns: 1fr; }
    .browse-filters { position: static; }

    /* Listing detail */
    .listing-layout { grid-template-columns: 1fr; }
    .listing-sidebar { display: flex; gap: 1rem; flex-wrap: wrap; }
    .seller-card, .safety-tips { flex: 1; min-width: 260px; }
    .main-image { height: 260px; }

    /* Dashboard */
    .dashboard-header { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .ads-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }

    /* Forms */
    .form-row { grid-template-columns: 1fr; }

    /* Upgrade */
    .plans-grid { grid-template-columns: 1fr; max-width: 380px; margin: 0 auto 2rem; }

    /* Footer: keep 2 columns at tablet */
    .footer-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}

/* --- Phone landscape / small tablet ≤640px --- */
@media (max-width: 640px) {
    /* Category bar: single row horizontal scroll */
    .category-bar { overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(168,192,232,.4) transparent; }
    .category-bar::-webkit-scrollbar { height: 3px; }
    .category-bar::-webkit-scrollbar-thumb { background: rgba(168,192,232,.4); border-radius: 3px; }
    .category-bar .container { flex-wrap: nowrap; padding-bottom: .6rem; }

    /* Hero */
    .hero { padding: 2rem 0; }
    .hero h1 { font-size: 1.5rem; }
    .hero p { font-size: .95rem; margin-bottom: 1.25rem; }

    /* Footer: single column */
    .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; }

    /* Upgrade */
    .upgrade-page { padding: 1.5rem 0; }
    .listing-preview-mini { flex-direction: column; gap: .5rem; }
}

/* --- Phone portrait ≤480px --- */
@media (max-width: 480px) {
    /* Logo */
    .logo { font-size: 1.2rem; }
    .btn-post-ad { padding: .45rem .85rem; font-size: .85rem; }

    /* Hero */
    .hero { padding: 1.5rem 0; }
    .hero-search { flex-direction: column; gap: .5rem; }
    .hero-search input, .hero-search button { width: 100%; }

    /* Listings: 2 col */
    .listings-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .card-image { height: 120px; }
    .card-body { padding: .6rem; }
    .card-title { font-size: .82rem; }
    .card-price { font-size: .88rem; }
    .card-meta { font-size: .72rem; }

    /* Categories grid */
    .categories-grid { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
    .category-card { padding: .9rem .5rem; }
    .cat-icon { font-size: 1.6rem; }
    .cat-name { font-size: .72rem; }

    /* Sections */
    .section-header h2 { font-size: 1.05rem; }
    section { padding: 1.75rem 0; }

    /* Dashboard */
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .ads-table { font-size: .8rem; min-width: 480px; }
    .ads-table th, .ads-table td { padding: .5rem .5rem; white-space: nowrap; }

    /* Auth */
    .auth-box { padding: 1.75rem 1.25rem; }

    /* Listing detail */
    .listing-info h1 { font-size: 1.15rem; }
    .listing-price { font-size: 1.3rem; }
    .listing-meta { gap: .6rem; }
    .seller-card, .safety-tips { min-width: 100%; }

    /* Post ad form */
    .post-ad-page { padding: 1rem 0; }
    .form-section { padding: 1.1rem; }

    /* Browse */
    .browse-page { padding: 1rem 0; }
}

/* --- Small phones ≤360px --- */
@media (max-width: 360px) {
    .logo { font-size: 1.05rem; }
    .btn-post-ad { padding: .4rem .65rem; font-size: .8rem; }
    .listings-grid { grid-template-columns: 1fr; }
    .card-image { height: 170px; }
    .categories-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
    .stat-number { font-size: 1.5rem; }
}
