/* ============================================================
   ENGINE DEPOT MARKET - Base Stylesheet (Phase 1)
   Theme colors are injected as CSS variables from platform_settings,
   so the admin color panel (Phase 4) re-skins the whole site.
   ============================================================ */

:root {
  --color-primary: #14532D;
  --color-secondary: #0B3A1E;
  --color-accent: #EAB308;
  --color-bg: #F4F6F2;
  --color-surface: #FFFFFF;
  --color-text: #1C2420;
  --color-muted: #5C6B62;
  --color-border: #D9E0D7;
  --color-error: #B42318;
  --color-error-bg: #FDECEA;
  --color-success: #1E7D3E;
  --color-success-bg: #E8F5EC;
  --color-info: #175CD3;
  --color-info-bg: #EAF1FD;
  --radius: 10px;
  --shadow: 0 4px 18px rgba(20, 60, 35, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ---------- Auth layout ---------- */

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(234, 179, 8, 0.12), transparent 60%),
    linear-gradient(160deg, var(--color-secondary), var(--color-primary));
}

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

.auth-card.wide { max-width: 720px; }

.auth-logo {
  text-align: center;
  margin-bottom: 6px;
  font-size: 22px;
  font-weight: 800;
  color: var(--color-primary);
  letter-spacing: 0.3px;
}
.auth-logo .accent { color: var(--color-accent); }

.auth-sub {
  text-align: center;
  color: var(--color-muted);
  margin: 0 0 22px;
  font-size: 14px;
}

/* ---------- Forms ---------- */

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--color-text);
}
.field .hint { font-size: 12px; color: var(--color-muted); margin-top: 4px; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"],
input[type="number"], input[type="url"], input[type="file"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
}

input:focus, select:focus, textarea:focus { border-color: var(--color-primary); }

.btn {
  display: inline-block;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
}
.btn:hover { background: var(--color-secondary); text-decoration: none; }
.btn-accent { background: var(--color-accent); color: #201a00; }
.btn-accent:hover { background: #caa006; }

/* ---------- Alerts ---------- */

.alert {
  padding: 11px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid transparent;
}
.alert-error   { background: var(--color-error-bg);   color: var(--color-error);   border-color: #f3c1bb; }
.alert-success { background: var(--color-success-bg); color: var(--color-success); border-color: #bfe3cb; }
.alert-info    { background: var(--color-info-bg);    color: var(--color-info);    border-color: #c3d7f7; }

/* ---------- Small helpers ---------- */

.auth-links { text-align: center; margin-top: 18px; font-size: 14px; color: var(--color-muted); }
.divider { border: 0; border-top: 1px solid var(--color-border); margin: 22px 0; }
.section-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 4px 0 12px;
}
.badge-pending { display:inline-block; padding:4px 10px; border-radius:999px; background:#FEF3C7; color:#92400E; font-size:12px; font-weight:700; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ============ PHASE 2: PUBLIC SITE ============ */

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 28px; height: 64px; }
.brand { display: flex; align-items: center; flex: 0 0 auto; }
.brand .accent { color: var(--color-accent); }
.brand:hover { text-decoration: none; }
.main-nav { display: flex; gap: 20px; flex: 1; }
.main-nav a { font-weight: 600; font-size: 14px; color: var(--color-text); }
.header-actions { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.btn-sm { padding: 7px 14px; border-radius: 8px; background: var(--color-primary); color: #fff; font-weight: 700; font-size: 13px; }
.btn-sm:hover { background: var(--color-secondary); text-decoration: none; }
.btn-sm-accent { background: var(--color-accent); color: #201a00; }
.cart-link { font-weight: 700; }
.cart-count { background: var(--color-accent); color: #201a00; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 800; }
@media (max-width: 860px) { .main-nav { display: none; } }

/* Hero */
.hero { background: linear-gradient(160deg, var(--color-secondary), var(--color-primary)); color: #fff; padding: 72px 0; }
.hero h1 { font-size: 40px; margin: 0 0 14px; line-height: 1.15; max-width: 640px; }
.hero p { font-size: 17px; opacity: .92; max-width: 560px; margin: 0 0 26px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-cta .btn { width: auto; padding: 12px 26px; }
.hero-search { margin-top: 30px; display: flex; max-width: 560px; }
.hero-search input { border: 0; border-radius: 8px 0 0 8px; padding: 13px 16px; font-size: 15px; flex: 1; }
.hero-search button { border: 0; border-radius: 0 8px 8px 0; background: var(--color-accent); color: #201a00; font-weight: 800; padding: 0 22px; cursor: pointer; }
@media (max-width: 640px) { .hero h1 { font-size: 30px; } .hero { padding: 48px 0; } }

/* Sections */
.section { padding: 52px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 22px; }
.section-head h2 { font-size: 24px; margin: 0; color: var(--color-primary); }
.section-head a { font-weight: 700; font-size: 14px; }

/* Category tiles */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.cat-tile { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 26px; transition: box-shadow .15s; }
.cat-tile:hover { box-shadow: var(--shadow); text-decoration: none; }
.cat-tile h3 { margin: 0 0 6px; color: var(--color-primary); font-size: 18px; }
.cat-tile p { margin: 0; color: var(--color-muted); font-size: 14px; }
.cat-tile .tile-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--color-success-bg); color: var(--color-primary); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; font-size: 22px; }
@media (max-width: 800px) { .cat-grid { grid-template-columns: 1fr; } }

/* Listing grid + cards */
.listing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1000px) { .listing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .listing-grid { grid-template-columns: 1fr; } }
.listing-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s; }
.listing-card:hover { box-shadow: var(--shadow); text-decoration: none; }
.card-img { height: 170px; background-size: cover; background-position: center; background-color: #E7ECE6; position: relative; }
.card-badge { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; color: #fff; background: var(--color-primary); }
.card-badge.cond-used { background: #92400E; }
.card-badge.cond-refurbished { background: #175CD3; }
.card-body { padding: 14px 16px 16px; }
.card-cat { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--color-muted); }
.card-title { font-size: 15px; margin: 4px 0 10px; color: var(--color-text); line-height: 1.35; min-height: 40px; }
.card-meta { display: flex; justify-content: space-between; align-items: center; }
.card-price { font-weight: 800; color: var(--color-primary); font-size: 16px; }
.card-seller { font-size: 12px; color: var(--color-muted); }

/* How it works */
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 900px) { .steps-grid { grid-template-columns: repeat(2, 1fr); } }
.step { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 22px; }
.step .step-num { width: 32px; height: 32px; border-radius: 999px; background: var(--color-primary); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.step h3 { font-size: 15px; margin: 0 0 6px; }
.step p { font-size: 13px; color: var(--color-muted); margin: 0; }

/* Trust strip */
.trust-strip { background: var(--color-surface); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }
.trust-inner { display: flex; gap: 34px; justify-content: center; padding: 20px 0; flex-wrap: wrap; font-size: 14px; font-weight: 700; color: var(--color-primary); }

/* Category page */
.page-head { padding: 34px 0 8px; }
.page-head h1 { margin: 0 0 6px; font-size: 28px; color: var(--color-primary); }
.page-head p { margin: 0; color: var(--color-muted); }
.filter-bar { display: flex; gap: 12px; align-items: center; padding: 18px 0; flex-wrap: wrap; }
.filter-bar select, .filter-bar input[type="text"] { width: auto; min-width: 160px; }
.filter-bar .btn { width: auto; padding: 10px 18px; }
.result-count { color: var(--color-muted); font-size: 13px; margin-left: auto; }

/* Pagination */
.pagination { display: flex; gap: 8px; justify-content: center; padding: 30px 0; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--color-border); background: var(--color-surface); font-weight: 700; font-size: 14px; }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* Product page */
.product-layout { display: grid; grid-template-columns: 1.1fr .9fr; gap: 34px; padding: 34px 0; }
@media (max-width: 900px) { .product-layout { grid-template-columns: 1fr; } }
.gallery-main { height: 400px; border-radius: var(--radius); background-size: contain; background-repeat: no-repeat; background-position: center; background-color: #fff; border: 1px solid var(--color-border); }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gallery-thumbs img { width: 74px; height: 74px; object-fit: cover; border-radius: 8px; border: 2px solid var(--color-border); cursor: pointer; }
.gallery-thumbs img.active { border-color: var(--color-primary); }
.product-info h1 { font-size: 26px; margin: 0 0 8px; }
.product-price { font-size: 30px; font-weight: 800; color: var(--color-primary); margin: 12px 0; }
.product-badges { display: flex; gap: 8px; margin-bottom: 8px; }
.pbadge { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--color-success-bg); color: var(--color-success); }
.seller-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 18px; margin: 18px 0; }
.seller-card .sc-name { font-weight: 800; color: var(--color-primary); }
.seller-card .sc-verified { color: var(--color-success); font-size: 12px; font-weight: 800; }
.seller-card p { margin: 6px 0 0; font-size: 13px; color: var(--color-muted); }
.product-actions { display: flex; gap: 12px; margin: 20px 0; }
.product-actions .btn { width: auto; padding: 13px 30px; }
.qty-input { width: 84px !important; text-align: center; }
.product-section { padding: 8px 0 34px; }
.product-section h2 { font-size: 19px; color: var(--color-primary); border-bottom: 2px solid var(--color-border); padding-bottom: 8px; }
.product-desc { white-space: pre-line; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.spec-table td { padding: 9px 12px; border-bottom: 1px solid var(--color-border); }
.spec-table td:first-child { font-weight: 700; width: 220px; color: var(--color-muted); }

/* Footer */
.site-footer { background: var(--color-secondary); color: #DCE7DE; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 26px; padding: 44px 20px 26px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.footer-brand { color: #fff; margin-bottom: 8px; }
.site-footer h4 { color: #fff; font-size: 14px; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .5px; }
.site-footer a { display: block; color: #C4D4C8; font-size: 14px; margin-bottom: 7px; }
.site-footer p { font-size: 13px; color: #A9BFAF; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); padding: 16px 20px; font-size: 13px; color: #A9BFAF; }

/* Chat float buttons */
.chat-float { position: fixed; right: 20px; width: 54px; height: 54px; border-radius: 999px; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(0,0,0,.25); z-index: 90; }
.chat-wa { bottom: 20px; background: #25D366; }
.chat-tg { bottom: 84px; background: #229ED9; }

/* Empty state */
.empty-state { text-align: center; padding: 70px 20px; color: var(--color-muted); }
.empty-state h3 { color: var(--color-text); }

/* ============ PHASE 3: SELLER / PORTAL LAYOUT ============ */
.portal-body { background: var(--color-bg); }
.portal-wrap { display: flex; min-height: 100vh; }
.portal-side { width: 250px; background: var(--color-secondary); color: #DCE7DE; padding: 22px 18px; flex-shrink: 0; }
.portal-brand { color: #fff; display: block; margin-bottom: 20px; font-size: 17px; }
.portal-who { border: 1px solid rgba(255,255,255,.15); border-radius: 10px; padding: 12px 14px; margin-bottom: 20px; font-size: 13px; }
.portal-who strong { display: block; color: #fff; margin-bottom: 3px; }
.portal-who span { color: #A9BFAF; font-size: 12px; }
.portal-nav a { display: block; color: #C4D4C8; padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.portal-nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.portal-main { flex: 1; padding: 28px 34px; min-width: 0; }
.portal-head h1 { margin: 0 0 20px; font-size: 24px; color: var(--color-primary); }
@media (max-width: 800px) {
  .portal-wrap { flex-direction: column; }
  .portal-side { width: auto; }
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 18px 20px; }
.stat-card .stat-num { font-size: 28px; font-weight: 800; color: var(--color-primary); }
.stat-card .stat-label { font-size: 13px; color: var(--color-muted); font-weight: 600; }

.data-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.data-table th { text-align: left; padding: 12px 14px; background: #EEF3EC; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--color-muted); }
.data-table td { padding: 12px 14px; border-top: 1px solid var(--color-border); vertical-align: middle; }
.data-table .row-thumb { width: 54px; height: 40px; object-fit: cover; border-radius: 6px; background: #E7ECE6; }
.status-pill { padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; white-space: nowrap; }
.table-actions a, .table-actions button { font-size: 13px; font-weight: 700; margin-right: 10px; }
.btn-danger-link { background: none; border: 0; color: var(--color-error); cursor: pointer; padding: 0; font-family: inherit; }

.form-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 26px; max-width: 860px; }
.img-manage { display: flex; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.img-manage .img-item { position: relative; }
.img-manage img { width: 110px; height: 82px; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border); }
.img-manage .img-del { position: absolute; top: -8px; right: -8px; background: var(--color-error); color: #fff; border: 0; border-radius: 999px; width: 22px; height: 22px; font-size: 12px; cursor: pointer; line-height: 1; }
.reject-note { background: var(--color-error-bg); border: 1px solid #f3c1bb; color: var(--color-error); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-top: 8px; }

/* ============ PHASE 4: LOGO / CAROUSEL / FLASH SALES ============ */
.brand-logo { height: 46px; display: block; }
.site-footer .brand-logo { height: 38px; }
.portal-brand .brand-logo { height: 36px; }

.carousel { display: flex; gap: 18px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: thin; }
.carousel .listing-card { flex: 0 0 270px; scroll-snap-align: start; }
.carousel-btns { display: flex; gap: 8px; }
.car-btn { width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--color-border); background: var(--color-surface); font-size: 16px; cursor: pointer; color: var(--color-primary); font-weight: 800; }
.car-btn:hover { background: var(--color-primary); color: #fff; }

.flash-section { background: linear-gradient(160deg, #FFF8E6, #FFFDF5); border-top: 1px solid #F3E3B3; border-bottom: 1px solid #F3E3B3; }
.flash-tag { background: var(--color-error); color: #fff; padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge-flash { background: var(--color-error) !important; right: 10px; left: auto !important; }
.card-price.sale { color: var(--color-error); }
.card-price.sale s { color: var(--color-muted); font-weight: 600; font-size: 13px; margin-left: 4px; }
.card-countdown { font-size: 12px; font-weight: 800; color: var(--color-error); padding: 6px 0 0; }
.price-was { color: var(--color-muted); font-size: 18px; font-weight: 600; margin-left: 8px; }
.flash-banner { background: var(--color-error); color: #fff; display: inline-block; padding: 7px 16px; border-radius: 8px; font-weight: 800; font-size: 14px; margin-bottom: 10px; }
.nav-badge { background: var(--color-accent); color: #201a00; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 800; }
.admin-filter { display:flex; gap:10px; margin-bottom:16px; flex-wrap:wrap; }
.admin-filter a { padding:7px 14px; border-radius:8px; border:1px solid var(--color-border); background:var(--color-surface); font-size:13px; font-weight:700; }
.admin-filter a.on { background: var(--color-primary); color:#fff; border-color: var(--color-primary); }
.doc-list a { display:inline-block; margin-right:14px; font-weight:700; }
.inline-form { display:inline; }
.two-col { display:grid; grid-template-columns: 1fr 1fr; gap:22px; }
@media (max-width: 900px){ .two-col { grid-template-columns: 1fr; } }

/* ============ PHASE 5: CART / ORDERS / CHAT ============ */
.cart-table td { vertical-align: middle; }
.cart-qty { width: 74px !important; text-align: center; }
.cart-summary { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 22px; max-width: 380px; margin-left: auto; }
.cart-summary .sum-row { display: flex; justify-content: space-between; font-size: 15px; padding: 6px 0; }
.cart-summary .sum-total { font-size: 20px; font-weight: 800; color: var(--color-primary); border-top: 1px solid var(--color-border); padding-top: 12px; margin-top: 8px; }
.checkout-note { background: var(--color-info-bg); border: 1px solid #c3d7f7; color: var(--color-info); border-radius: 8px; padding: 12px 16px; font-size: 14px; margin: 14px 0; }
.status-trail { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.trail-step { padding: 7px 14px; border-radius: 999px; background: #EEF2F6; color: #475467; font-size: 12px; font-weight: 800; }
.trail-step.done { background: var(--color-success-bg); color: var(--color-success); }
.trail-step.now { background: var(--color-primary); color: #fff; }

.chat-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: 520px; }
.chat-scroll { overflow-y: auto; padding: 18px; flex: 1; min-height: 180px; }
.chat-msg { margin-bottom: 12px; display: flex; flex-direction: column; }
.chat-msg.mine { align-items: flex-end; }
.chat-msg.theirs { align-items: flex-start; }
.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
.chat-msg.mine .chat-bubble { background: var(--color-primary); color: #fff; border-bottom-right-radius: 4px; }
.chat-msg.theirs .chat-bubble { background: #EEF3EC; color: var(--color-text); border-bottom-left-radius: 4px; }
.chat-time { font-size: 11px; color: var(--color-muted); margin-top: 3px; }
.chat-form { display: flex; gap: 10px; border-top: 1px solid var(--color-border); padding: 12px; }
.chat-form textarea { flex: 1; resize: none; height: 46px; }
.chat-form .btn { width: auto; padding: 10px 22px; }
.chat-empty { color: var(--color-muted); text-align: center; }
.contact-reveal { display: flex; gap: 16px; flex-wrap: wrap; font-size: 14px; font-weight: 700; margin: 10px 0; }
.contact-reveal span { background: var(--color-success-bg); color: var(--color-primary); padding: 8px 14px; border-radius: 8px; }
.conv-list a { display: block; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.conv-list a:hover { box-shadow: var(--shadow); text-decoration: none; }
.conv-unread { background: var(--color-accent); color: #201a00; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 800; }

/* ============ PHASE 8: BUILT-IN LIVE CHAT + ADMIN CREATION ============ */
.chat-sys { bottom: 148px; background: var(--color-primary); border: 0; cursor: pointer; }
.chat-sys:hover { background: var(--color-secondary); }
.sys-chat-panel { position: fixed; right: 20px; bottom: 210px; width: 340px; max-width: calc(100vw - 40px); height: 440px; max-height: 70vh; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.22); display: none; flex-direction: column; z-index: 95; overflow: hidden; }
.sys-chat-panel.open { display: flex; }
.sys-chat-head { background: var(--color-primary); color: #fff; font-weight: 800; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; }
.sys-chat-head button { background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; line-height: 1; }

/* ============ PHASE 10: MOBILE POLISH + CHAT ============ */
@media (max-width: 700px) {
  .header-inner { display: flex; flex-wrap: nowrap; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; }
  .brand-logo { height: 46px; }
  .header-actions { display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; margin: 0; }
  .header-actions a { font-size: 12.5px; }
  .header-actions .btn, .header-actions .btn-accent { padding: 8px 11px; font-size: 12.5px; white-space: nowrap; border-radius: 8px; }
  .trust-inner { gap: 12px 20px; font-size: 13px; padding: 14px 0; }
  .section-head { flex-wrap: wrap; gap: 10px; }
  .carousel .listing-card { flex: 0 0 240px; }
  .sys-chat-panel { right: 10px; left: 10px; width: auto; bottom: 170px; }
}
@media (max-width: 420px) {
  .brand-logo { height: 42px; }
}
/* logged-in buyers on small screens: keep only the essentials in the top bar */
@media (max-width: 640px) {
  .header-actions a[href*="user/tickets"], .header-actions a[href*="user/orders"] { display: none; }
}
.carousel { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.chat-box.expanded { max-height: 78vh; height: 78vh; }
.chat-expand-btn { background: none; border: 1px solid var(--color-border); border-radius: 8px; padding: 6px 12px; cursor: pointer; color: var(--color-primary); font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.chat-sending { opacity: .55; }

/* ============ MOBILE HAMBURGER MENU ============ */
.hamburger { display: none; width: 46px; height: 44px; border: 1px solid var(--color-border); border-radius: 10px; background: var(--color-surface); cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 5px; flex: 0 0 auto; }
.hamburger span { display: block; width: 20px; height: 2.5px; background: var(--color-primary); border-radius: 2px; transition: transform .22s ease, opacity .22s ease; }
.hamburger.open span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }
.mobile-menu { display: none; }
@media (max-width: 860px) {
  .hamburger { display: flex; }
  /* everything lives in the hamburger menu on mobile */
  .header-actions { display: none; }
  .mobile-menu { display: block; max-height: 0; overflow: hidden; transition: max-height .28s ease; background: var(--color-surface); border-top: 0 solid var(--color-border); }
  .mobile-menu.open { max-height: 560px; border-top-width: 1px; box-shadow: 0 14px 30px rgba(0,0,0,.12); }
  .mobile-menu-nav { display: flex; flex-direction: column; }
  .mobile-menu-nav a { padding: 13px 18px; border-bottom: 1px solid var(--color-border); font-weight: 700; color: var(--color-primary); }
  .mobile-menu-actions { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px 18px; }
  .mobile-menu-actions a { text-align: center; font-weight: 700; }
  .mobile-menu-actions .btn, .mobile-menu-actions .btn-accent { width: 100%; padding: 12px; }
}

/* ============ RESPONSIVE ADMIN & SELLER PORTAL ============ */
.portal-topbar { display: none; }
.portal-overlay { display: none; }
@media (max-width: 900px) {
  .portal-topbar { display: flex; align-items: center; justify-content: space-between; padding: 9px 16px; background: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 130; }
  .portal-topbar .brand-logo { height: 42px; }
  .portal-burger { display: flex; }
  .portal-wrap { display: block; }
  .portal-side { position: fixed; top: 0; left: 0; bottom: 0; width: 262px; transform: translateX(-105%); transition: transform .26s ease; z-index: 150; overflow-y: auto; box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  .portal-side.open { transform: translateX(0); }
  .portal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 140; opacity: 0; pointer-events: none; transition: opacity .22s ease; display: block; }
  .portal-overlay.open { opacity: 1; pointer-events: auto; }
  .portal-main { padding: 18px 14px; }
  .portal-head h1 { font-size: 20px; }
  /* tables scroll sideways instead of breaking the page */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .two-col { grid-template-columns: 1fr !important; display: grid; gap: 18px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-filter { overflow-x: auto; white-space: nowrap; display: flex; gap: 8px; padding-bottom: 6px; }
}
