:root {
  /* Palette chosen for B2B trust psychology:
     blue = trust & dependability, gold = premium/optimism (CTA pop),
     green = growth & safety, red reserved ONLY for errors. */
  --red: #15568f;        /* primary brand blue (kept var name for compatibility) */
  --red-dark: #0f4170;   /* darker blue (hover) */
  --gold: #f3b730;       /* warm gold accent */
  --danger: #dc2626;     /* errors / destructive only */
  --ink: #1f2937;
  --muted: #64748b;
  --line: #e3e8ef;
  --bg: #f4f7fb;
  --card: #ffffff;
  --green: #16a34a;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 6px 18px rgba(0,0,0,.04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
.container { width: min(1180px, 92%); margin: 0 auto; }
.small { font-size: .82rem; }
.muted { color: var(--muted); }

/* ── Utility bar ── */
.utility-bar { background: #0f2e4d; color: #cfe0f3; font-size: .8rem; }
.util-inner { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; }
.util-right { display: flex; gap: 16px; }
.utility-bar a { color: #cfe0f3; }
.utility-bar a:hover { color: var(--gold); }
@media (max-width: 760px) { .util-left { display: none; } .util-inner { justify-content: center; } }

/* ── Header ── */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 18px; padding: 12px 0; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.35rem; white-space: nowrap; }
.brand-mark { display: inline-block; vertical-align: middle; border-radius: 7px; }
.brand-name strong, .brand strong { color: var(--red); }
.global-search { flex: 1; display: flex; max-width: 1100px; border: 2px solid var(--red); border-radius: 999px; overflow: hidden; }
.global-search input { flex: 1; border: 0; padding: 9px 16px; font-size: .95rem; outline: none; }
.global-search .cam-btn { background: transparent; color: var(--ink); padding: 0 10px; font-size: 1.1rem; }
.global-search .cam-btn:hover { color: var(--red); }
.global-search button[type="submit"] { border: 0; background: var(--red); color: #fff; padding: 0 22px; font-weight: 600; cursor: pointer; }
.global-search button { border: 0; background: var(--red); color: #fff; padding: 0 22px; font-weight: 600; cursor: pointer; }
.global-search button:hover { background: var(--red-dark); }
.nav-row { border-top: 1px solid var(--line); background: #fff; }
.top-nav { display: flex; align-items: center; justify-content: center; gap: 32px; font-size: .92rem; font-weight: 600; padding: 9px 0; flex-wrap: wrap; }
.top-nav a:hover { color: var(--red); }
/* "Post RFQ" sits inline with the nav but reads as a call-to-action pill. */
.top-nav .nav-cta { color: var(--red-dark); background: #fff6e0; border: 1.5px solid var(--gold); border-radius: 999px; padding: 4px 16px; transition: background .15s ease, color .15s ease, box-shadow .15s ease; }
.top-nav .nav-cta::before { content: "+ "; font-weight: 800; }
.top-nav .nav-cta:hover { background: var(--gold); color: #1E293B; box-shadow: 0 3px 10px rgba(243,183,48,.4); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.lang-toggle { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 10px; cursor: pointer; font-weight: 600; font-size: .8rem; color: var(--muted); }
.lang-toggle .sep { margin: 0 3px; opacity: .4; }
/* Language picker dropdown */
.lang-picker { position: relative; }
.lang-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 5px 12px; cursor: pointer; font-weight: 600; font-size: .82rem; color: var(--ink, #1f2d3d); white-space: nowrap; }
.lang-btn:hover { border-color: var(--red); }
.lang-caret { font-size: .7rem; opacity: .6; }
.lang-menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 170px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.14); padding: 6px; display: none; z-index: 200; }
.lang-picker.open .lang-menu { display: block; }
.lang-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 7px; cursor: pointer; font-size: .9rem; color: var(--ink, #1f2d3d); }
.lang-menu button:hover { background: #f1f5fa; }
.lang-menu button.active { background: #eaf2fb; color: var(--red); font-weight: 700; }
html[dir="rtl"] .lang-menu { right: auto; left: 0; text-align: right; }
html[dir="rtl"] .lang-menu button { text-align: right; }
.auth-area { display: flex; align-items: center; gap: 8px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; padding: 9px 16px; font-weight: 600; font-size: .9rem; cursor: pointer; transition: .15s; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }
.btn-gold { background: var(--gold); color: #5a4a00; }
.btn-ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--red); color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Hero ── */
.hero { background: linear-gradient(115deg, var(--red) 0%, #0c3a66 100%); background-size: cover; background-position: center; color: #fff; border-radius: 14px; padding: 48px 40px; margin: 22px 0; position: relative; overflow: hidden; min-height: 300px; transition: background-image .5s ease; }
.hero::after { content: "★"; position: absolute; right: -10px; top: -30px; font-size: 220px; color: rgba(255,205,0,.14); }
.hero-powered { display: inline-block; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.25); color: #fff; font-size: .78rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; margin-bottom: 14px; }
.hero h1 { font-size: 2.1rem; margin: 0 0 10px; max-width: 700px; }
.hero p { max-width: 560px; opacity: .95; margin: 0 0 18px; }
.hero .hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 28px; margin-top: 26px; }
.hero-stats b { font-size: 1.4rem; display: block; }

/* ── Sections ── */
.section { margin: 30px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { font-size: 1.3rem; margin: 0; }
.section-head a { color: var(--red); font-weight: 600; font-size: .88rem; }

/* ── Logistics band ── */
.logistics-band { display: flex; align-items: center; justify-content: space-between; gap: 20px; background: linear-gradient(115deg, #0f4170 0%, #15568f 60%, #0c7e74 100%); color: #fff; border-radius: 14px; padding: 28px 32px; overflow: hidden; }
.logistics-band-text { max-width: 640px; }
.logistics-band-text h2 { margin: 0 0 8px; font-size: 1.4rem; }
.logistics-band-text p { margin: 0 0 14px; opacity: .95; }
.logistics-band-emoji { font-size: 2.4rem; white-space: nowrap; opacity: .9; }
@media (max-width: 760px) { .logistics-band-emoji { display: none; } }
.logi-demo { margin-top: 14px; }
.logi-demo-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.logi-demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; margin-top: 8px; }
.logi-demo-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }

/* ── Home: left category panel + featured products ── */
.home-cols { display: flex; align-items: flex-start; gap: 22px; }
.home-main { flex: 1; min-width: 0; }
.cat-panel { flex: 0 0 264px; align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px 14px; box-shadow: var(--shadow); }
.cat-panel h3 { margin: 0 0 8px; padding: 0 6px; font-size: 1.12rem; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li + li { border-top: 1px solid #eef2f6; }
.cat-list a { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--ink, #243240); font-weight: 600; font-size: .93rem; transition: background .12s ease, color .12s ease; }
.cat-list a:hover { background: #f1f5fa; color: var(--red); }
.cat-list .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-list .cat-chev { color: #b6c2cf; font-size: 1.15rem; flex: 0 0 auto; line-height: 1; }
.cat-list a:hover .cat-chev { color: var(--red); }
html[dir="rtl"] .cat-list .cat-chev { transform: scaleX(-1); }
.cat-more { display: inline-block; margin: 12px 0 2px 6px; color: var(--red); font-weight: 700; font-size: .9rem; }
@media (max-width: 760px) { .home-cols { flex-direction: column; } .cat-panel { flex-basis: auto; width: 100%; } }

/* ── Product grid ── */
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.prod-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.prod-card:hover { box-shadow: 0 12px 28px rgba(20,46,77,.16); transform: translateY(-4px); border-color: var(--red); }
.prod-thumb { position: relative; aspect-ratio: 4/3; background: #eef0f3 center/cover no-repeat; display: grid; place-items: center; color: #b6bcc6; font-size: 2.4rem; transition: transform .35s ease; }
.prod-card:hover .prod-thumb { transform: scale(1.05); }
.thumb-badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.62); color: #fff; font-size: .7rem; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.mini-thumbs { position: absolute; left: 0; right: 0; bottom: 6px; display: flex; gap: 4px; justify-content: center; padding: 0 6px; opacity: .92; transition: opacity .15s; }
.prod-card:hover .mini-thumbs { opacity: 1; }
.mini-thumb { width: 30px; height: 30px; border-radius: 6px; border: 2px solid #fff; overflow: hidden; padding: 0; cursor: pointer; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.mini-thumb.active { border-color: var(--gold); }
.mini-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prod-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.prod-title { font-weight: 600; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.prod-price { color: var(--red); font-weight: 800; font-size: 1.02rem; letter-spacing: .2px; }
/* Product-detail price — eye-catching accent pill */
.pd .prod-price { display: inline-block; background: linear-gradient(135deg, #fff7e0, #ffe7ad); color: #8a5a00; border: 1px solid #f1d488; padding: 8px 16px; border-radius: 12px; font-size: 1.6rem !important; box-shadow: 0 2px 8px rgba(243,183,48,.25); }
.prod-meta { font-size: .78rem; color: var(--muted); margin-top: auto; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .68rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.badge-verified { background: #e7f7ee; color: var(--green); }
.badge-trader { background: #eef1f6; color: var(--muted); }
.badge-vn { background: #fdeceb; color: var(--danger); }
.badge-buy { background: #fff3e0; color: #b06a00; }
.badge-sell { background: #e7f0ff; color: #1d4ed8; }

/* ── Layout helpers ── */
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar select, .toolbar input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; }

/* ── Forms ── */
.form { display: grid; gap: 14px; max-width: 520px; }
.form.wide { max-width: 760px; }
.field { display: grid; gap: 5px; }
.field label { font-weight: 600; font-size: .85rem; }
.field input, .field select, .field textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field .hint { font-size: .76rem; color: var(--muted); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-wrap { max-width: 460px; margin: 40px auto; }
.auth-wrap h1 { margin-top: 0; }

/* Anti-bot slider CAPTCHA — "align the handle into the highlighted zone" */
.cap-track { position: relative; height: 48px; border-radius: 24px; background: linear-gradient(#f1f5fa, #e7edf4); border: 1px solid #d4dde8; box-shadow: inset 0 1px 3px rgba(20,40,70,.08); overflow: hidden; user-select: none; touch-action: none; }
.cap-fill { position: absolute; top: 0; left: 0; height: 100%; width: 0; background: linear-gradient(90deg, rgba(21,86,143,.20), rgba(21,86,143,.32)); transition: width .02s linear; }
.cap-zone { position: absolute; top: 6px; bottom: 6px; border: 2px dashed var(--gold); border-radius: 18px; background: rgba(243,183,48,.16); box-sizing: border-box; }
.cap-zone::after { content: '🎯'; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 16px; opacity: .85; }
.cap-label { position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%); text-align: center; padding-left: 30px; font-size: .85rem; font-weight: 600; letter-spacing: .2px; color: #6b7a8a; pointer-events: none; white-space: nowrap; }
.cap-handle { position: absolute; top: 3px; left: 3px; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; background: #fff; color: var(--red); border-radius: 50%; cursor: grab; box-shadow: 0 2px 6px rgba(20,40,70,.28); touch-action: none; z-index: 2; transition: box-shadow .15s, transform .1s; }
.cap-handle:hover { box-shadow: 0 3px 10px rgba(20,40,70,.34); }
.cap-handle:active { cursor: grabbing; transform: scale(1.04); }
.cap-arrow { font-size: 20px; font-weight: 800; line-height: 1; }
.cap-track.ok { background: linear-gradient(#e7f6ec, #daf0e2); border-color: #a9dcb9; }
.cap-track.ok .cap-fill { background: linear-gradient(90deg, rgba(26,138,74,.22), rgba(26,138,74,.34)); }
.cap-track.ok .cap-zone { opacity: 0; }
.cap-track.ok .cap-handle { background: #1a8a4a; color: #fff; cursor: default; box-shadow: 0 2px 8px rgba(26,138,74,.4); }
.cap-track.ok .cap-label { color: #1a7a44; padding-left: 0; }

/* Terms acceptance checkbox */
.terms-check { display: flex; align-items: flex-start; gap: 8px; margin: 14px 0; font-size: .9rem; line-height: 1.5; }
.terms-check input { margin-top: 3px; }
/* Make agreement links obvious */
.terms-check a { font-weight: 800; color: var(--red); text-decoration: underline; text-underline-offset: 2px; }
.terms-check a:hover { color: var(--gold); }
.req { color: var(--danger); font-weight: 700; }

/* Legal pages (Terms / Privacy) */
.legal-wrap { max-width: 820px; margin: 30px auto; }
.legal-wrap h1 { margin-top: 0; }
.legal-body h2 { font-size: 1.05rem; margin: 22px 0 6px; color: var(--red); }
.legal-body p { margin: 0 0 10px; line-height: 1.6; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; }
.tab { flex: 1; text-align: center; padding: 9px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-weight: 600; background: #fff; }
.tab.active { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Seller storefront ── */
.storefront-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; background: linear-gradient(115deg, var(--red) 0%, #0c3a66 100%); background-size: cover; background-position: center; color: #fff; border-radius: 14px; padding: 28px 30px; margin-top: 18px; min-height: 240px; }
.storefront-hero h1 { color: #fff; }
.store-id { display: flex; align-items: center; gap: 16px; }
.store-avatar { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; border: 3px solid rgba(255,255,255,.85); background: #fff; flex-shrink: 0; }
.store-avatar-ph { display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: var(--red); }
.storefront-hero .pill-row { gap: 10px; align-items: center; }
@media (max-width: 700px) { .storefront-hero { flex-direction: column; align-items: flex-start; } }

/* ── Product detail ── */
.pd { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; }
.pd-gallery { aspect-ratio: 1; background: #eef0f3; border-radius: 12px; display: grid; place-items: center; font-size: 4rem; color: #b6bcc6; background-size: cover; background-position: center; }

/* ── Media carousel ── */
.carousel-viewport { position: relative; aspect-ratio: 1; background: #eef0f3; border-radius: 12px; overflow: hidden; }
.carousel-track { display: flex; height: 100%; transition: transform .3s ease; }
.slide { min-width: 100%; height: 100%; display: grid; place-items: center; background: #eef0f3; }
.slide img, .slide video { width: 100%; height: 100%; object-fit: contain; }
.carousel-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: var(--ink); font-size: 1.5rem; line-height: 1; cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow); }
.carousel-nav.prev { left: 8px; } .carousel-nav.next { right: 8px; }
.carousel-nav:hover { background: #fff; }
.carousel-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.carousel-thumb { width: 56px; height: 56px; border-radius: 8px; border: 2px solid var(--line); overflow: hidden; cursor: pointer; padding: 0; background: #eef0f3; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.carousel-thumb.active { border-color: var(--red); }
.carousel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.desc-gallery { display: grid; gap: 12px; margin-top: 14px; }
.desc-gallery img { width: 100%; border-radius: 10px; display: block; }

/* ── AI assistant box ── */
.ai-box .ai-inner { background: #fff8e6; border: 1px solid #f0d98a; border-radius: 10px; padding: 12px 14px; }
.ai-box .upsell { background: #eef5fc; border-color: #cfe0f3; }

/* ── Rich-text editor + rendered content ── */
.rte-toolbar { display: flex; gap: 4px; align-items: center; border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 6px; background: #fafbfc; }
.rte-btn { min-width: 30px; height: 30px; border: 1px solid transparent; background: #fff; border-radius: 6px; cursor: pointer; font-size: .9rem; line-height: 1; }
.rte-btn:hover { border-color: var(--line); }
.rte-sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.rte { min-height: 120px; border: 1px solid var(--line); border-radius: 0 0 8px 8px; padding: 10px 12px; outline: none; font: inherit; }
.rte:focus { border-color: var(--red); }
.rte:empty:before { content: attr(data-ph); color: var(--muted); }
.rte-content { line-height: 1.65; color: var(--ink); }
.rte-content h3, .rte-content h4, .rte-content h5 { margin: .5em 0; }
.rte-content p { margin: .5em 0; }
.pd h1 { margin: 0 0 8px; }
.spec-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.spec-table td { padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: .9rem; }
.spec-table td:first-child { color: var(--muted); width: 40%; }
.contact-box { margin-top: 16px; padding: 16px; border: 1px dashed var(--red); border-radius: 10px; background: #eef5fc; }
/* Quantity price estimate ("dự toán") — modern, highlighted, hover rows */
.tier-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 6px 0 14px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; font-size: .9rem; box-shadow: 0 1px 3px rgba(20,46,77,.06); }
.tier-table th, .tier-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.tier-table tr:last-child td { border-bottom: none; }
.tier-table th { background: linear-gradient(135deg, var(--red), #1d6fb8); color: #fff; font-weight: 700; letter-spacing: .2px; }
.tier-table td:last-child { font-weight: 800; color: var(--red); }
.tier-table tbody tr:nth-child(even) td, .tier-table tr:nth-child(even) td { background: #f7fafd; }
.tier-table tr:hover td { background: #eef4fb; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.tier-row input { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.tier-del { padding: 6px 10px; }

/* ── Logistics list ── */
.logi-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.logi-row { display: grid; grid-template-columns: 2fr 2.4fr 1.4fr 1fr 1fr; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; color: inherit; }
.logi-row:last-child { border-bottom: 0; }
a.logi-row:hover { background: #fafbfc; }
.logi-head { background: #fafbfc; font-weight: 700; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.logi-price { color: var(--red); font-weight: 700; }
@media (max-width: 760px) { .logi-row { grid-template-columns: 1fr 1fr; } .logi-head { display: none; } }

/* ── RFQ image thumbnails ── */
.rfq-imgs { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.rfq-imgs img { width: 54px; height: 54px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* ── RFQ list ── */
.rfq-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.rfq-card .rfq-top { display: flex; justify-content: space-between; gap: 10px; }
.locked { filter: blur(4px); user-select: none; }

/* ── Admin ── */
.admin-shell { display: grid; grid-template-columns: 210px 1fr; gap: 20px; margin-top: 18px; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; }
.admin-nav button { text-align: left; background: #fff; border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: .88rem; }
.admin-nav button.active { background: var(--red); color: #fff; border-color: var(--red); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.stat b { font-size: 1.7rem; display: block; color: var(--red); }
.stat-alert { border-color: var(--danger); background: #fdeaea; }
.stat-alert b { color: var(--danger); }
.stat-alert::after { content: '● action needed'; display: block; margin-top: 4px; font-size: .68rem; font-weight: 700; color: var(--danger); letter-spacing: .3px; }

/* Admin toolbar (search / filter / export) */
.admin-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.admin-toolbar input[type=search], .admin-toolbar select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.admin-toolbar input[type=search] { min-width: 240px; flex: 1; }
.data-table tr.row-alert td { background: #fdeaea; }
.data-table tr.row-alert td:nth-child(3) { color: var(--danger); font-weight: 600; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; font-size: .86rem; }
.data-table th, .data-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { background: #fafbfc; }
.tag { font-size: .72rem; padding: 2px 7px; border-radius: 999px; background: #eef1f6; }
.tag.green { background: #e7f7ee; color: var(--green); }
.tag.red { background: #fde8e7; color: var(--danger); }
.tag.amber { background: #fff3e0; color: #b06a00; }
.tag.blue { background: #e9f1fa; color: var(--red); }
.tag.gold { background: #fff6df; color: #9a7400; }

/* Admin: clickable attachments, lightbox, draft preview */
.attach-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.admin-thumb { height: 72px; border-radius: 6px; cursor: zoom-in; border: 1px solid var(--line); object-fit: cover; transition: transform .1s; }
.admin-thumb:hover { transform: scale(1.04); }
.doc-chip { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; font-weight: 600; font-size: .82rem; color: var(--red); text-decoration: none; }
.doc-chip:hover { background: #eef3f9; }
.draft-desc { margin: 10px 0; padding: 10px 12px; background: #fafbfc; border: 1px dashed var(--line); border-radius: 8px; font-size: .88rem; max-height: 260px; overflow: auto; }
.draft-desc img { max-width: 100%; border-radius: 6px; }
.lightbox { position: fixed; inset: 0; z-index: 9999; background: rgba(10,18,30,.85); display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5); }
.lb-close { position: fixed; top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%; border: none; background: rgba(255,255,255,.9); font-size: 18px; cursor: pointer; }

/* Register: buy/sell intent chooser */
.intent-row { display: flex; flex-wrap: wrap; gap: 8px; }
.intent-opt { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; }
.intent-opt:has(input:checked) { border-color: var(--red); background: #eef3f9; font-weight: 700; }
.intent-opt input { accent-color: var(--red); }

/* ── Footer ── */
.site-footer { background: #1f2329; color: #cbd1d9; margin-top: 50px; padding: 36px 0 20px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.4fr; gap: 24px; }
.footer-grid h4 { color: #fff; margin: 0 0 10px; font-size: .95rem; }
.footer-grid a { display: block; color: #aab2bd; padding: 3px 0; font-size: .88rem; }
.footer-grid a:hover { color: var(--gold); }
.footer-brand { color: #fff; font-size: 1.15rem; margin-bottom: 8px; }
.footer-bottom { border-top: 1px solid #333a44; margin-top: 22px; padding-top: 14px; font-size: .8rem; color: #8b94a0; }

/* ── Toast ── */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120%); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); transition: .3s; z-index: 100; max-width: 90%; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--green); }

.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

/* ── Unread badge ── */
.unread-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 5px; background: var(--danger); color: #fff; border-radius: 999px; font-size: .7rem; font-weight: 700; box-shadow: 0 0 0 2px #fff; }
#msgLink { position: relative; }
#msgLink .unread-badge { position: absolute; top: -4px; right: -4px; margin: 0; }

/* ── Chat ── */
.chat-shell { display: grid; grid-template-columns: 300px 1fr; gap: 16px; margin-top: 16px; height: 600px; }
.chat-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow-y: auto; }
.conv-item { padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.conv-item:hover { background: #fafbfc; }
.conv-item.active { background: #eef5fc; border-left: 3px solid var(--red); }
.conv-top { display: flex; justify-content: space-between; align-items: center; }
.conv-prev { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.chat-thread > .empty { margin: auto; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #f7f8fa; }
.bubble { max-width: 72%; padding: 9px 12px; border-radius: 12px; font-size: .9rem; }
.bubble-body { white-space: pre-wrap; word-break: break-word; }
.bubble-time { font-size: .68rem; opacity: .6; margin-top: 3px; }
.msg-del { background: none; border: 0; cursor: pointer; opacity: .55; font-size: .72rem; margin-left: 4px; padding: 0; }
.msg-del:hover { opacity: 1; }
.bubble.deleted .bubble-body { opacity: .65; }
.tick { margin-left: 4px; font-size: .72rem; }
.bubble.mine .tick { color: rgba(255,255,255,.7); }
.bubble.mine .tick.read { color: #9be7ff; opacity: 1; }
.bubble.theirs { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 3px; }
.bubble.mine { align-self: flex-end; background: var(--red); color: #fff; border-bottom-right-radius: 3px; }
.chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; outline: none; }
.chat-input input:focus { border-color: var(--red); }
@media (max-width: 900px) { .chat-shell { grid-template-columns: 1fr; height: auto; } .chat-msgs { min-height: 320px; } }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.notice { background: #eef5fc; border: 1px solid #cfe0f3; border-radius: 8px; padding: 12px 14px; font-size: .88rem; }
.otp-box { letter-spacing: .4em; text-align: center; font-size: 1.4rem; font-weight: 700; }

@media (max-width: 900px) {
  .grid-2, .pd, .admin-shell, .footer-grid { grid-template-columns: 1fr; }
  .header-inner { flex-wrap: wrap; }
  .global-search { order: 3; width: 100%; max-width: none; }
}

/* ── Signup popup (delayed / exit-intent) ── */
.signup-pop-overlay { position: fixed; inset: 0; background: rgba(9,30,55,.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; opacity: 0; transition: opacity .25s ease; }
.signup-pop-overlay.show { opacity: 1; }
.signup-pop { background: #fff; width: 100%; max-width: 420px; max-height: 92vh; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.32); transform: translateY(14px) scale(.96); transition: transform .3s cubic-bezier(.2,.8,.25,1); }
.signup-pop-overlay.show .signup-pop { transform: none; }
.signup-pop-head { flex: 0 0 auto; background: linear-gradient(135deg, var(--red), #0c3a66); color: #fff; padding: 20px 24px 16px; position: relative; }
.signup-pop-head h3 { color: #fff; margin: 0 0 4px; font-size: 1.3rem; }
.signup-pop-head p { margin: 0; opacity: .9; font-size: .9rem; }
.signup-pop-close { position: absolute; top: 8px; right: 12px; background: transparent; border: 0; color: #fff; opacity: .85; font-size: 1.4rem; line-height: 1; cursor: pointer; }
.signup-pop-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 24px 20px; }
.signup-pop-benefits-row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 12px; font-size: .82rem; font-weight: 700; color: var(--red-dark); }
.signup-pop-body .form { gap: 12px; }
.signup-pop-body .btn-primary.btn-block { background: var(--gold); color: #1E293B; border-color: var(--gold); font-weight: 800; box-shadow: 0 4px 14px rgba(243,183,48,.45); }
.signup-pop-body .btn-primary.btn-block:hover { background: #ffc23d; }
.signup-pop-later { display: block; width: 100%; text-align: center; margin-top: 10px; color: #6b7a8d; font-size: .85rem; background: none; border: 0; cursor: pointer; }
.signup-pop-trust { text-align: center; margin-top: 10px; font-size: .77rem; color: #8a97a6; }
@media (max-width: 480px) { .signup-pop-overlay { align-items: flex-end; padding: 0; } .signup-pop { max-width: none; max-height: 94vh; border-radius: 16px 16px 0 0; } }
@media (prefers-reduced-motion: reduce) { .signup-pop { transition: none; } }

/* ── Facebook-style seller profile ── */
.fb-profile { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-top: 18px; box-shadow: var(--shadow); }
.fb-cover { height: 280px; background: #e9eef4; }
.fb-headbar { display: flex; align-items: flex-end; gap: 18px; padding: 0 26px 18px; }
.fb-avatar-wrap { margin-top: -56px; flex: 0 0 auto; }
.fb-avatar-wrap .store-avatar { width: 132px; height: 132px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,.2); object-fit: cover; display: grid; place-items: center; background: var(--red); color: #fff; font-size: 2.6rem; font-weight: 800; }
.fb-head-main { flex: 1; min-width: 0; padding-bottom: 6px; }
.fb-head-main h1 { margin: 0 0 6px; font-size: 1.7rem; }
.fb-head-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fb-head-actions { padding-bottom: 8px; display: flex; gap: 8px; align-items: center; }
.fb-body { display: grid; grid-template-columns: 360px 1fr; gap: 16px; align-items: start; margin-top: 16px; }
.fb-card { margin: 0; }
.fb-left .fb-card + .fb-card { margin-top: 16px; }
.fb-card-title { margin: 0 0 12px; font-size: 1.12rem; }
.fb-intro-list { list-style: none; margin: 12px 0 0; padding: 12px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 9px; font-size: .92rem; color: #46586b; }
.fb-thumb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.fb-thumb-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.fb-photos-head { display: flex; justify-content: space-between; align-items: center; }
.fb-count { display: inline-block; background: #eef2f7; color: #46586b; border-radius: 999px; padding: 1px 11px; font-size: .85rem; font-weight: 700; margin-left: 4px; }
@media (max-width: 880px) { .fb-body { grid-template-columns: 1fr; } }
@media (max-width: 680px) { .fb-headbar { flex-direction: column; align-items: center; text-align: center; gap: 10px; } .fb-avatar-wrap { margin-top: -66px; } .fb-head-actions { padding-bottom: 0; } .fb-cover { height: 200px; } }

/* ── Related-products picker (owner) ── */
.related-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.related-opt { display: flex; gap: 9px; align-items: center; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: .9rem; transition: border-color .12s ease, background .12s ease; }
.related-opt:hover { border-color: var(--red); background: #f5f9fd; }
.related-opt input { flex: 0 0 auto; }

/* ── Seller timeline (status feed) ── */
.fb-feed { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; }
.fb-composer { margin: 0 0 14px; }
.fb-composer-top { display: flex; gap: 10px; align-items: flex-start; }
.fb-composer-top textarea { flex: 1; resize: vertical; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font: inherit; }
.fb-composer-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.fb-post { margin: 0; }
.fb-post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.fb-post-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.fb-post-avatar-ph { display: grid; place-items: center; background: var(--red); color: #fff; font-weight: 800; }
.fb-post-meta { flex: 1; min-width: 0; }
.fb-post-author { font-weight: 700; font-size: .98rem; }
.fb-post-del { background: transparent; border: 0; color: #9aa7b4; font-size: 1rem; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.fb-post-del:hover { background: #f3f5f8; color: var(--red); }
.fb-post-body { white-space: pre-wrap; line-height: 1.55; margin-bottom: 10px; }
.fb-post-imgs { display: grid; gap: 4px; border-radius: 10px; overflow: hidden; }
.fb-post-imgs img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16/10; }
.fb-post-imgs.n1 { grid-template-columns: 1fr; }
.fb-post-imgs.n2 { grid-template-columns: 1fr 1fr; }
.fb-post-imgs.n3 { grid-template-columns: 1fr 1fr; }
.fb-post-imgs.n3 img:first-child { grid-column: 1 / -1; aspect-ratio: 16/8; }
.fb-post-imgs.n4 { grid-template-columns: 1fr 1fr; }

/* ── Social login buttons ── */
.oauth-sep{display:flex;align-items:center;gap:10px;margin:16px 0 12px;color:var(--muted);font-size:.85rem}
.oauth-sep::before,.oauth-sep::after{content:"";flex:1;height:1px;background:var(--line)}
.oauth-btns{display:flex;flex-direction:column;gap:8px}
.oauth-btn{display:flex;align-items:center;justify-content:center;gap:8px;text-decoration:none}
.fb-post-stats{display:flex;align-items:center;gap:6px}
.fb-post-video video{display:block}

/* ── Presence (online / last seen) ── */
.presence-dot{display:inline-block;width:9px;height:9px;border-radius:50%;background:#b9c2cc;margin-right:6px;flex:0 0 auto;vertical-align:middle;box-shadow:0 0 0 2px #fff}
.presence-dot.online{background:#31a24c}
.presence-inline{display:inline-flex;align-items:center;gap:2px}
.chat-peer{display:flex;align-items:center;gap:8px}
.chat-peer .presence-dot{width:10px;height:10px}
.conv-top{display:flex;align-items:center;gap:2px}

/* ── TOTP setup ── */
.totp-key{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:1.1rem;letter-spacing:2px;background:#f3f5f7;border:1px solid var(--line);border-radius:8px;padding:10px 12px;margin:8px 0;word-break:break-all;user-select:all}
