/* Catalog โกดังบ้านวัสดุ — CI: Navy #212739 / Red #FF0000 / Kanit + Sarabun */
:root {
  --shadow: 0 8px 30px rgba(33,39,57,.08);
  --shadow-lg: 0 18px 44px rgba(33,39,57,.14);
  --navy: #212739;
  --mid-navy: #2D3A5F;
  --red: #FF0000;
  --red-light: #FF3B47;
  --off-white: #F8F9FB;
  --gray: #6B7280;
  --border: #E5E7EB;
  --green: #22C55E;
  --font-heading: 'Kanit', sans-serif;
  --font-body: 'Sarabun', sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); color: var(--navy); background: var(--off-white); line-height: 1.7; }
h1, h2, h3 { font-family: var(--font-heading); line-height: 1.3; }
a { color: inherit; }
img { max-width: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Topbar + header + footer (ร่วมกับหน้าแรก) */
.topbar { background: var(--navy); color: #fff; font-size: 14px; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; padding: 8px 20px; }
.topbar a { color: #fff; text-decoration: none; font-weight: 500; }
.site-header { background: #fff; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; padding-bottom: 12px; }
.site-header .logo img { height: 48px; display: block; }
.site-header nav { display: flex; gap: 24px; font-family: var(--font-heading); font-weight: 600; font-size: 15px; }
.site-header nav a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.site-header nav a:hover, .site-header nav a.active { color: var(--red); border-color: var(--red); }
.site-footer { background: var(--navy); color: #9CA3AF; padding: 36px 0; text-align: center; font-size: 14px; margin-top: 64px; }
.site-footer img { height: 60px; margin-bottom: 12px; }
.site-footer .slogan { font-family: var(--font-heading); color: var(--red-light); font-size: 18px; margin-bottom: 6px; }

/* Buttons */
.btn { font-family: var(--font-heading); font-weight: 600; font-size: 16px; padding: 12px 26px; border-radius: 999px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border: none; cursor: pointer; }
.btn-red { background: var(--red); color: #fff; }
.btn-red:hover { background: #D90000; }
.btn-outline-navy { border: 2px solid var(--navy); color: var(--navy); }

/* Catalog hero */
.catalog-hero { background: linear-gradient(135deg, var(--navy) 0%, var(--mid-navy) 100%); color: #fff; padding: 36px 0; }
.catalog-hero h1 { font-size: clamp(26px, 4vw, 38px); font-weight: 900; }
.catalog-hero p { color: #C7CCDA; }

/* Layout */
.catalog-layout { display: grid; grid-template-columns: 250px 1fr; gap: 32px; padding-top: 32px; }

/* Filters */
.filters { position: sticky; top: 90px; align-self: start; }
.filter-block { margin-bottom: 24px; }
.filter-label { font-family: var(--font-heading); font-weight: 700; font-size: 15px; margin-bottom: 8px; display: block; }
.search-row { display: flex; gap: 6px; }
.search-row input { flex: 1; padding: 9px 14px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font-body); font-size: 15px; }
.search-row input:focus { outline: 2px solid var(--red-light); border-color: transparent; }
.btn-search { background: var(--red); border: none; border-radius: 8px; padding: 0 14px; cursor: pointer; font-size: 16px; }
.filter-list { list-style: none; }
.filter-list li a { display: flex; justify-content: space-between; text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 15px; }
.filter-list li a:hover { background: var(--off-white); }
.filter-list li a.active { background: var(--navy); color: #fff; font-weight: 700; }
.filter-list .count { color: var(--gray); font-size: 13px; }
.filter-list li a.active .count { color: #C7CCDA; }
.brand-list { max-height: 320px; overflow-y: auto; }

/* Product grid */
.active-filters { background: #fff; border: none; box-shadow: var(--shadow); border-radius: 12px; padding: 10px 16px; margin-bottom: 18px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.active-filters .clear { color: var(--red); font-weight: 700; text-decoration: none; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.product-card { border: none; box-shadow: var(--shadow); border-radius: 18px; overflow: hidden; text-decoration: none; background: #fff; transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column; }
.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.card-image { position: relative; aspect-ratio: 1; background: #fff; border-bottom: 1px solid var(--off-white); display: flex; align-items: center; justify-content: center; }
.card-image > img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.no-image { opacity: .18; width: 44%; }
.no-image.big { opacity: .15; width: 38%; margin: 0 auto; }
.flag { position: static; font-family: var(--font-heading); font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: #FEF9C3; color: #854D0E; display: inline-block; }
.card-image .flag { position: absolute; top: 8px; left: 8px; }
.card-image .flag + .flag { top: 34px; }
.flag-net { background: #FEF08A; color: #713F12; }
.flag-no-vat { background: #DBEAFE; color: #1E40AF; }
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.card-brand { font-size: 12px; font-weight: 700; color: var(--gray); letter-spacing: .5px; }
.card-name { font-family: var(--font-heading); font-weight: 600; font-size: 15px; line-height: 1.4; flex: 1; }
.card-price { color: var(--red); font-family: var(--font-heading); font-weight: 700; font-size: 17px; margin-top: 4px; }
.card-price .baht { font-size: 12px; color: var(--gray); font-weight: 400; }
.card-meta { font-size: 12px; color: var(--gray); }

.empty-state { text-align: center; padding: 64px 0; color: var(--gray); }
.empty-state .btn { margin-top: 16px; }
.pagination-wrap { margin-top: 28px; display: flex; justify-content: center; }

/* Product detail */
.product-page { padding-top: 24px; }
.breadcrumb { font-size: 14px; color: var(--gray); margin-bottom: 20px; }
.breadcrumb a { color: var(--gray); text-decoration: none; }
.breadcrumb a:hover { color: var(--red); }
.product-detail { display: grid; grid-template-columns: 1fr 1.3fr; gap: 36px; align-items: start; }
.detail-image { border: none; box-shadow: var(--shadow); border-radius: 18px; background: var(--off-white); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.detail-image img { width: 100%; height: 100%; object-fit: contain; padding: 20px; }
.detail-brand { font-weight: 700; color: var(--gray); letter-spacing: 1px; font-size: 14px; }
.detail-info h1 { font-size: clamp(24px, 3vw, 34px); font-weight: 700; margin: 4px 0 10px; }
.detail-flags { display: flex; gap: 8px; margin-bottom: 14px; }
.detail-desc { color: var(--gray); margin-bottom: 18px; }
.variant-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.variant-table th { font-family: var(--font-heading); background: var(--navy); color: #fff; text-align: left; padding: 10px 14px; font-weight: 600; }
.variant-table th.special { background: var(--red); }
.variant-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.variant-table tr:nth-child(even) td { background: var(--off-white); }
.variant-table .price { color: var(--red); font-weight: 700; font-family: var(--font-heading); white-space: nowrap; }
.variant-table .price-note { font-size: 12px; color: var(--gray); font-weight: 400; font-family: var(--font-body); }
.detail-source { font-size: 13px; color: var(--gray); margin-top: 10px; }
.detail-cta { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }
.related { margin-top: 56px; }
.related h2 { font-size: 24px; margin-bottom: 18px; }

@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .product-detail { grid-template-columns: 1fr; }
  .site-header nav { gap: 14px; font-size: 13px; }
  .site-header .logo img { height: 38px; }
}

/* Lucide icons */
svg.lucide { width: 1em; height: 1em; stroke-width: 2; vertical-align: -0.12em; }
.btn-search svg.lucide { color: #fff; }

/* Pagination */
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; font-family: var(--font-heading); }
.pager-btn { min-width: 40px; height: 40px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; background: #fff; border-radius: 12px; box-shadow: var(--shadow); text-decoration: none; font-weight: 600; font-size: 15px; transition: transform .12s, box-shadow .12s; }
.pager-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); color: var(--red); }
.pager-btn.current { background: var(--navy); color: #fff; }
.pager-btn.disabled { opacity: .35; pointer-events: none; }
.pager-dots { color: var(--gray); padding: 0 4px; }

/* Footer แบบเว็บเดิม: ข้อมูลบริษัท + DBD */
.footer-grid { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 32px; text-align: left; align-items: start; }
.footer-col h4 { color: #fff; font-family: var(--font-heading); font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.footer-brand { text-align: center; }
.footer-brand .f-logo { height: 84px; margin-bottom: 10px; }
.footer-info { list-style: none; }
.footer-info li { display: flex; gap: 9px; align-items: baseline; padding: 5px 0; font-size: 14px; line-height: 1.6; }
.footer-info svg.lucide { color: var(--red-light); flex-shrink: 0; transform: translateY(2px); }
.footer-info a { color: #fff; text-decoration: none; font-weight: 600; }
.footer-info a:hover { color: var(--red-light); }
.footer-trust { text-align: center; }
.dbd-card { background: #fff; border-radius: 12px; padding: 10px 16px; display: inline-block; }
.dbd-card img { height: 58px; display: block; }
.f-channels { font-size: 12.5px; margin-top: 12px; line-height: 1.6; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 18px; text-align: center; font-size: 13px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr; text-align: center; } .footer-info li { justify-content: center; text-align: left; } }

/* Header เหมือนหน้าแรก */
.announce { background: var(--navy); color: #fff; font-family: var(--font-heading); font-size: 13px; }
.announce .container { display: flex; justify-content: center; gap: 34px; padding: 8px 20px; flex-wrap: wrap; }
.announce span { display: flex; align-items: center; gap: 6px; }
.announce .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red-light); display: inline-block; }
.site-header { box-shadow: 0 1px 0 var(--border); border-bottom: none; }
.site-header .container { padding-top: 14px; padding-bottom: 14px; gap: 20px; }
.site-header .logo img { height: 46px; }
.site-header nav { gap: 26px; font-weight: 500; align-items: center; }
.site-header nav a { border-bottom: none; position: relative; }
.site-header nav a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 3px; border-radius: 2px; background: var(--red); }
.site-header nav a:hover, .site-header nav a.active { color: var(--red); }
.nav-cta { background: var(--red); color: #fff !important; padding: 9px 22px; border-radius: 999px; font-weight: 600; }
.nav-cta:hover { background: #D90000; }
.nav-cta::after { display: none !important; }
@media (max-width: 900px) { .site-header nav { gap: 12px; } .nav-cta { padding: 7px 14px; } }

/* Gallery admin */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, 110px); gap: 10px; }
.g-item { position: relative; width: 110px; height: 110px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; cursor: grab; }
.g-item img { width: 100%; height: 100%; object-fit: contain; }
.g-item.dragging { opacity: .4; }
.g-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border: none; border-radius: 50%; background: rgba(33,39,57,.75); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.g-cover { display: none; position: absolute; left: 4px; bottom: 4px; background: var(--red); color: #fff; font-family: var(--font-heading); font-size: 10.5px; padding: 1px 8px; border-radius: 999px; }
.g-item.is-cover .g-cover { display: block; }
.g-drop { width: 110px; height: 110px; border: 2px dashed var(--border); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--gray); font-size: 11.5px; text-align: center; cursor: pointer; }
.g-drop.over { border-color: var(--red); color: var(--red); background: #FFF1F2; }
.g-drop svg.lucide { width: 22px; height: 22px; }
.variant-table .vi { padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; }

/* Gallery หน้าลูกค้า */
.gallery-strip { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.gs-thumb { width: 64px; height: 64px; border: 2px solid var(--border); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; padding: 0; }
.gs-thumb.active { border-color: var(--red); }
.gs-thumb img { width: 100%; height: 100%; object-fit: contain; }

/* ราคาตั้งขีดฆ่า */
.list-price { text-decoration: line-through; color: var(--gray); font-weight: 400; font-size: 13px; }

/* Page loader: กันฟอนต์/เลย์เอาต์กระพริบตอนโหลด */
#page-loader { position: fixed; inset: 0; background: #fff; z-index: 999; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center; transition: opacity .35s; }
#page-loader.done { opacity: 0; pointer-events: none; }
#page-loader img { width: 150px; animation: loaderPulse 1.1s ease-in-out infinite; }
#page-loader .bar { width: 120px; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
#page-loader .bar::after { content: ""; display: block; width: 40%; height: 100%; background: var(--red); border-radius: 999px; animation: loaderBar 1s ease-in-out infinite; }
@keyframes loaderPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes loaderBar { 0% { transform: translateX(-120%); } 100% { transform: translateX(320%); } }
.card-image { background: linear-gradient(100deg, #F1F3F7 40%, #E9ECF2 50%, #F1F3F7 60%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.card-image:has(img[data-loaded]), .card-image:not(:has(img)) { animation: none; background: #fff; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Footer v2: LINE + social */
.footer-grid { display: grid; grid-template-columns: 1fr 1.5fr .85fr .85fr; gap: 30px; text-align: left; align-items: start; }
.footer-col h4 { color: #fff; font-family: var(--font-heading); font-size: 15.5px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 7px; }
.footer-col h4 svg.lucide { color: var(--red-light); }
.footer-brand { text-align: center; }
.footer-brand .f-logo { height: 76px; margin-bottom: 8px; }
footer .slogan { font-family: var(--font-script); color: var(--red-light); font-size: 19px; margin-bottom: 14px; line-height: 1.5; }
.f-social { display: flex; gap: 10px; justify-content: center; }
.f-social a { width: 38px; height: 38px; border-radius: 50%; background: rgba(255,255,255,.08); display: flex; align-items: center; justify-content: center; color: #fff; text-decoration: none; transition: background .15s, transform .15s; }
.f-social a:hover { background: var(--red); transform: translateY(-2px); }
.f-social svg.lucide { width: 17px; height: 17px; }
.footer-info { list-style: none; }
.footer-info li { display: flex; gap: 9px; align-items: baseline; padding: 4px 0; font-size: 14px; line-height: 1.6; }
.footer-info svg.lucide { color: var(--red-light); flex-shrink: 0; transform: translateY(2px); }
.footer-info a { color: #fff; text-decoration: none; font-weight: 600; }
.footer-info a:hover { color: var(--red-light); }
.f-channels { font-size: 12.5px; margin-top: 10px; line-height: 1.6; color: var(--gray-light); }
.f-channels span { color: #fff; font-family: var(--font-heading); }
.footer-line, .footer-trust { text-align: center; }
.footer-line h4, .footer-trust h4 { justify-content: center; }
.line-card, .dbd-card { background: #fff; border-radius: 14px; padding: 10px; display: inline-block; }
.line-card img { width: 128px; display: block; border-radius: 6px; }
.dbd-card img { height: 54px; display: block; }
.f-hint { font-size: 12.5px; margin-top: 10px; line-height: 1.6; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 28px; padding-top: 18px; text-align: center; font-size: 13px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-col:first-child { grid-column: 1 / -1; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } .footer-info li { justify-content: flex-start; } }

/* Admin panel */
.admin-body { display: flex; min-height: 100vh; background: var(--off-white); }
.admin-side { width: 232px; background: var(--navy); color: #C7CCDA; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.admin-logo { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 22px 16px 18px; text-decoration: none; color: #fff; font-family: var(--font-heading); font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-logo img { height: 58px; }
.admin-nav { display: flex; flex-direction: column; padding: 12px 10px; gap: 2px; flex: 1; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 10px; color: #C7CCDA; text-decoration: none; font-family: var(--font-heading); font-size: 14.5px; }
.admin-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-nav a.active { background: var(--red); color: #fff; }
.admin-nav svg.lucide { width: 17px; height: 17px; }
.admin-side-foot { padding: 12px 14px 18px; border-top: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.admin-side-foot a, .admin-side-foot button { color: #9CA3AF; text-decoration: none; background: none; border: none; cursor: pointer; font-family: var(--font-heading); font-size: 13.5px; display: flex; align-items: center; gap: 8px; padding: 0; }
.admin-side-foot a:hover, .admin-side-foot button:hover { color: #fff; }
.admin-main { flex: 1; min-width: 0; }
.admin-top { background: #fff; box-shadow: 0 1px 0 var(--border); padding: 14px 26px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 40; }
.admin-top-title { font-family: var(--font-heading); font-weight: 700; font-size: 19px; }
.admin-top-user { color: var(--gray); font-size: 14px; display: flex; gap: 7px; align-items: center; }
.admin-content { padding: 24px 26px 48px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.stat-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 18px 20px; text-decoration: none; display: block; }
.stat-card .stat-num { font-family: var(--font-heading); font-weight: 900; font-size: 28px; color: var(--navy); }
.stat-card .stat-label { font-size: 13px; color: var(--gray); }
a.stat-card:hover { box-shadow: var(--shadow-lg); }
.admin-content .variant-table { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
/* Admin form building blocks (shared desktop + used by mobile collapse) */
.admin-panel { background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 14px 18px; }
.admin-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font-body); font-size: 15px; }
.admin-input:focus { outline: 2px solid var(--red-light); border-color: transparent; }
.edit-top-grid { display: grid; grid-template-columns: 1fr 260px; gap: 20px; }
.admin-panel summary, .row-edit summary { list-style: none; cursor: pointer; }
.admin-panel summary::-webkit-details-marker, .row-edit summary::-webkit-details-marker { display: none; }
.row-edit { display: inline-block; }
.row-edit > summary { display: inline-flex; }
.row-edit-form { display: flex; flex-direction: column; gap: 5px; width: 280px; max-width: 100%; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.row-edit-form .filter-label { margin: 4px 0 0; }
@media (max-width: 800px) { .admin-side { position: fixed; left: -240px; } .admin-main { margin-left: 0; } }
.v-del { border: none; background: #FEF2F2; color: #B91C1C; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.v-del:hover { background: #FEE2E2; }

/* ===== Mobile app-style (≤900px) ===== */
.hamburger { display: none; border: none; background: none; cursor: pointer; color: var(--navy); padding: 6px; }
.hamburger svg.lucide { width: 26px; height: 26px; }

/* Drawer */
.drawer-overlay { position: fixed; inset: 0; background: rgba(15,18,28,.5); opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 90; }
.drawer-overlay.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; left: -300px; width: 288px; background: #fff; z-index: 95; transition: left .28s cubic-bezier(.4,0,.2,1); display: flex; flex-direction: column; box-shadow: 4px 0 24px rgba(33,39,57,.18); }
.drawer.open { left: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.drawer-head img { height: 40px; }
.drawer-head button { border: none; background: var(--off-white); border-radius: 50%; width: 34px; height: 34px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.drawer-nav { flex: 1; overflow-y: auto; padding: 10px 12px; }
.drawer-nav a, .drawer-nav button { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; text-decoration: none; font-family: var(--font-heading); font-weight: 500; font-size: 15px; color: var(--navy); border: none; background: none; width: 100%; cursor: pointer; }
.drawer-nav a:active, .drawer-nav a:hover { background: var(--off-white); color: var(--red); }
.drawer-nav svg.lucide { width: 18px; height: 18px; color: var(--gray); }
.drawer-label { font-size: 12px; color: var(--gray-light, #9CA3AF); font-family: var(--font-heading); letter-spacing: 1px; padding: 12px 12px 4px; }
.drawer-sub { font-size: 14px !important; padding: 8px 12px 8px 18px !important; font-weight: 400 !important; }
.drawer-sub svg.lucide { width: 14px !important; height: 14px !important; }
.drawer-call { margin: 12px 16px calc(16px + env(safe-area-inset-bottom)); justify-content: center; }

/* Bottom nav */
.bottom-nav { display: none; position: fixed; left: 0; right: 0; bottom: 0; background: #fff; box-shadow: 0 -4px 20px rgba(33,39,57,.1); z-index: 80; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px 7px; text-decoration: none; color: var(--gray); font-family: var(--font-heading); font-size: 11px; }
.bottom-nav a.active { color: var(--red); }
.bottom-nav a.active svg.lucide { color: var(--red); }
.bottom-nav svg.lucide { width: 21px; height: 21px; }

@media (max-width: 900px) {
  .hamburger { display: inline-flex; }
  .bottom-nav { display: flex; }
  body { padding-bottom: 64px; }
  .site-header nav { display: none; }
  .site-header .container { justify-content: flex-start; gap: 12px; }
  .site-header .logo { margin-right: auto; }
  .site-header .logo img { height: 38px; }
  .announce { display: none; }

  /* Catalog มือถือ: การ์ด 2 คอลัมน์ + filter เป็น bottom sheet */
  .catalog-layout { grid-template-columns: 1fr; padding-top: 16px; gap: 0; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-name { font-size: 13.5px; }
  .card-price { font-size: 15px; }
  .catalog-hero { padding: 22px 0; }
  .catalog-hero h1 { font-size: 24px; }

  .filters { position: fixed; left: 0; right: 0; bottom: -100%; top: auto; max-height: 78vh; overflow-y: auto; background: #fff; z-index: 95; border-radius: 20px 20px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 30px rgba(33,39,57,.2); transition: bottom .3s cubic-bezier(.4,0,.2,1); }
  .filters.open { bottom: 0; }
  .filter-fab { display: inline-flex !important; }

  /* หน้า detail */
  .product-detail { grid-template-columns: 1fr; gap: 20px; }
  .variant-table { font-size: 13.5px; }
  .variant-table th, .variant-table td { padding: 8px 10px; }
  .detail-cta .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }
}
.filter-fab { display: none; align-items: center; gap: 8px; font-family: var(--font-heading); font-weight: 600; background: var(--navy); color: #fff; border: none; border-radius: 999px; padding: 10px 22px; margin-bottom: 14px; cursor: pointer; }
.filter-fab svg.lucide { width: 16px; height: 16px; }
.filter-sheet-head { display: none; }
@media (max-width: 900px) {
  .filter-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-family: var(--font-heading); font-weight: 700; font-size: 17px; }
  .filter-sheet-head button { border: none; background: var(--off-white); border-radius: 50%; width: 32px; height: 32px; cursor: pointer; }
}

/* Admin มือถือ: sidebar เป็น drawer */
.admin-burger { color: var(--navy); }
@media (min-width: 801px) { .admin-burger { display: none; } }
@media (max-width: 800px) {
  .admin-side { position: fixed; left: -260px; z-index: 95; transition: left .28s; height: 100vh; }
  .admin-side.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,.3); }
  .admin-burger { display: inline-flex; }
  .admin-content { padding: 16px 14px 40px; }
  .admin-top { padding: 12px 14px; gap: 10px; }
  .admin-content .variant-table { display: block; overflow-x: auto; white-space: nowrap; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  /* ฟอร์ม grid 2 คอลัมน์ → 1 คอลัมน์ */
  .admin-form-grid, .edit-top-grid { grid-template-columns: 1fr; }
  /* ปุ่ม/อินพุตขนาดนิ้วกด */
  .admin-content .btn, .admin-content .btn-search, .admin-content .admin-input,
  .admin-content .search-row input, .admin-content .search-row select,
  .admin-content details.admin-panel > summary { min-height: 42px; }
  .admin-content .btn-search { min-width: 46px; }
}

/* Admin: ตาราง list → การ์ดบนมือถือ (≤560px) — scope แคบที่ .admin-cards เท่านั้น
   (variant-table หน้าบ้าน + ตารางราคาในหน้าแก้ไขสินค้าไม่โดน) */
@media (max-width: 560px) {
  .admin-content .admin-cards { display: block; background: transparent; box-shadow: none; border-radius: 0; overflow: visible; }
  .admin-content .admin-cards thead { display: none; }
  .admin-content .admin-cards tbody { display: block; }
  .admin-content .admin-cards tr { display: block; background: #fff; border-radius: 12px; box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 12px; }
  .admin-content .admin-cards td { display: block; border: none; padding: 6px 0; white-space: normal; }
  .admin-content .admin-cards tr:nth-child(even) td { background: transparent; }
  .admin-content .admin-cards td::before { content: attr(data-label); display: block; font-family: var(--font-heading); font-weight: 600; font-size: 11.5px; letter-spacing: .3px; color: var(--gray); margin-bottom: 3px; }
  .admin-content .admin-cards td[data-label=""]::before,
  .admin-content .admin-cards td:not([data-label])::before { content: none; }
  .row-edit, .row-edit > summary { display: block; }
  .row-edit > summary { width: 100%; justify-content: center; }
  .row-edit-form { width: 100%; }
  /* กันปุ่มล้นขวาในฟอร์มแถวเดียว (add/search/in-card): input เต็มแถว ปุ่มตกบรรทัดถัดไป */
  .admin-content .search-row { flex-wrap: wrap; }
  .admin-content .search-row > input { flex: 1 1 100% !important; min-width: 0 !important; }
  .admin-content .admin-cards td form { flex-wrap: wrap; }
  .admin-content .admin-cards td form > input { flex: 1 1 100% !important; min-width: 0 !important; }
  .admin-content .detail-cta { flex-wrap: wrap; }
  .admin-content .detail-cta > .btn { flex: 1 1 auto; justify-content: center; }
}

/* Footer v3: กล่องขาว LINE/DBD จัดกลางจริง (รูป crop ขอบขาวแล้ว) + มือถือกระชับกลางจอ */
@media (min-width: 901px) { .footer-grid { grid-template-columns: 1.15fr 1.45fr .85fr .85fr; } }
footer .slogan { font-size: 15px; white-space: nowrap; letter-spacing: 0; }
.line-card { width: 148px; height: 148px; display: flex; align-items: center; justify-content: center; margin: 0 auto; padding: 0; }
.line-card img { width: 120px; height: 120px; object-fit: contain; border-radius: 0; }
.dbd-card { width: auto; height: auto; display: inline-flex; align-items: center; justify-content: center; padding: 14px 18px; margin: 0 auto; }
.dbd-card img { height: 50px; width: auto; max-width: none; display: block; }
.f-channels .ch { display: inline-block; background: rgba(255,255,255,.08); border-radius: 999px; padding: 2px 11px; margin: 2px 1px; color: #E5E7EB; font-size: 12px; }
.f-line-btn { display: none; align-items: center; justify-content: center; gap: 9px; background: #06C755; color: #fff; font-family: var(--font-heading); font-weight: 700; font-size: 16px; border-radius: 999px; padding: 13px 22px; max-width: 300px; margin: 0 auto; text-decoration: none; }
.f-line-btn svg.lucide { width: 20px; height: 20px; }
.footer-info .nb { white-space: nowrap; }
html, body { overflow-x: hidden; max-width: 100vw; }

/* มือถือ: เรียงกลางจอ กระชับ + ปุ่ม LINE แทน QR (สแกนจอตัวเองไม่ได้) */
@media (max-width: 560px) {
  .site-footer { padding: 28px 0 24px; }
  .footer-grid { gap: 22px; }
  footer .slogan { white-space: normal; font-size: 19px; line-height: 1.45; }
  .footer-brand .f-logo { height: 62px; }
  .footer-col { text-align: center; }
  .footer-col h4 { justify-content: center; }
  .footer-info { display: inline-block; text-align: left; }
  .line-card { display: none; }
  .f-line-btn { display: flex; }
  .f-hint-add { display: none; }
  .footer-bottom { margin-top: 20px; padding-top: 14px; font-size: 12.5px; }
}

/* Lightbox ดูรูปสินค้าเต็มจอ */
.lightbox { position: fixed; inset: 0; background: rgba(15,18,28,.94); z-index: 200; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 86vh; object-fit: contain; border-radius: 10px; background: #fff; }
.lb-btn { position: absolute; width: 46px; height: 46px; border-radius: 50%; border: none; background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s; }
.lb-btn:hover { background: rgba(255,255,255,.28); }
.lb-btn svg.lucide { width: 24px; height: 24px; }
.lb-close { top: calc(14px + env(safe-area-inset-top)); right: 14px; }
.lb-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 10px; top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: #fff; font-family: var(--font-heading); font-size: 14px; background: rgba(255,255,255,.12); padding: 3px 14px; border-radius: 999px; }
.detail-image { cursor: zoom-in; }

/* Admin มือถือ v2: การ์ดกระชับ (สินค้า/หมวดหมู่/แบรนด์) */
@media (max-width: 560px) {
  .admin-content { padding: 12px 12px 36px; }
  .admin-content h1 { font-size: 22px; }

  /* หมวดหมู่ + แบรนด์: ชื่อ+บันทึกบรรทัดบน · slug · N สินค้า · ปุ่มลบ บรรทัดล่าง */
  .admin-content .ac-line tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 10px 12px; margin-bottom: 8px; }
  .admin-content .ac-line td { display: block; padding: 0; }
  .admin-content .ac-line td::before { content: none; }
  .admin-content .ac-line td:first-child { flex: 1 1 100%; }
  .admin-content .ac-line td:first-child form { flex-wrap: nowrap; }
  .admin-content .ac-line td:first-child form > input { flex: 1 1 auto !important; }
  .admin-content .ac-line td[data-label="slug"] { font-size: 12px; color: var(--gray); }
  .admin-content .ac-line td[data-label="จำนวนสินค้า"] { font-size: 12px; color: var(--gray); }
  .admin-content .ac-line td[data-label="จำนวนสินค้า"]::after { content: " สินค้า"; }
  .admin-content .ac-line td:last-child { margin-left: auto; }
  .admin-content .ac-line td:last-child > div { flex-wrap: nowrap !important; gap: 8px !important; }

  /* สินค้า: รูปซ้าย + ชื่อ · meta เทาบรรทัดเดียว · ปุ่มแถวล่าง */
  .admin-content .ac-products tr { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; padding: 10px 12px; margin-bottom: 8px; }
  .admin-content .ac-products td { display: block; padding: 0; }
  .admin-content .ac-products td::before { content: none; }
  .admin-content .ac-products td[data-label="รูป"] { order: 1; }
  .admin-content .ac-products td[data-label="สินค้า"] { order: 2; flex: 1 1 calc(100% - 66px); font-family: var(--font-heading); font-weight: 600; font-size: 14.5px; line-height: 1.35; }
  .admin-content .ac-products td[data-label="หน้า"] { order: 3; font-size: 12px; color: var(--gray); }
  .admin-content .ac-products td[data-label="หน้า"]::before { content: "หน้า "; display: inline; font-family: inherit; font-size: inherit; font-weight: inherit; color: inherit; letter-spacing: 0; margin: 0; }
  .admin-content .ac-products td[data-label="แบรนด์"] { order: 4; font-size: 12px; color: var(--gray); }
  .admin-content .ac-products td[data-label="ขนาด/ราคา"] { order: 5; font-size: 12px; color: var(--gray); flex: 1 1 auto; }
  .admin-content .ac-products td[data-label="ข้อมูล"] { order: 6; }
  .admin-content .ac-products td[data-label="แสดงบนเว็บ"] { order: 7; }
  .admin-content .ac-products td[data-label="จัดการ"] { order: 8; margin-left: auto; }
}

/* ============================================================
   ตะกร้าสินค้า (Phase 1) — badge / stepper / cart page / toast
   ============================================================ */

/* Badge ตัวเลขบนไอคอนตะกร้า (header desktop + bottom nav) */
.cart-badge { position: absolute; top: -7px; right: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--red); color: #fff; font-family: var(--font-heading); font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.cart-badge[hidden] { display: none; }

/* ไอคอนตะกร้าใน header (เฉพาะ desktop nav) */
.header-cart { position: relative; display: inline-flex; align-items: center; color: var(--navy); }
.header-cart:hover { color: var(--red); }
.header-cart svg.lucide { width: 22px; height: 22px; }

/* Account dropdown (เมนูบัญชี — desktop; มือถือ nav ถูกซ่อน) */
.acct-menu { position: relative; display: inline-flex; }
.acct-btn { display: inline-flex; align-items: center; gap: 2px; background: none; border: none; cursor: pointer; color: var(--navy); font-family: var(--font-heading); font-weight: 500; font-size: 15px; padding: 4px 2px; }
.acct-btn:hover { color: var(--red); }
.acct-btn svg.lucide { width: 21px; height: 21px; }
.acct-btn .acct-caret { width: 15px; height: 15px; transition: transform .18s ease; }
.acct-menu.open .acct-btn .acct-caret { transform: rotate(180deg); }
.acct-menu.open .acct-btn { color: var(--red); }
.acct-dropdown { position: absolute; top: calc(100% + 12px); right: 0; min-width: 200px; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 34px rgba(33,39,57,.16); padding: 6px; z-index: 60; }
.acct-dropdown[hidden] { display: none; }
.acct-menu .acct-dropdown a, .acct-menu .acct-dropdown button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--navy); font-family: var(--font-heading); font-weight: 500; font-size: 14.5px; background: none; border: none; cursor: pointer; text-align: left; white-space: nowrap; }
.acct-menu .acct-dropdown a:hover, .acct-menu .acct-dropdown button:hover { background: var(--off-white); color: var(--red); }
.acct-dropdown svg.lucide { width: 17px; height: 17px; flex-shrink: 0; }
.acct-name { display: block; padding: 8px 12px 6px; font-family: var(--font-heading); font-weight: 700; font-size: 14px; color: var(--navy); overflow: hidden; text-overflow: ellipsis; }
.acct-divider { height: 1px; background: var(--border); margin: 5px 4px; }

/* wrap ไอคอน bottom nav ให้ badge เกาะมุม */
.bn-icon { position: relative; display: inline-flex; }

/* Stepper −/+ (ใช้ทั้งหน้าตะกร้าและตารางสินค้า) */
.qty-stepper { display: inline-flex; align-items: center; border: 1.5px solid var(--border); border-radius: 999px; overflow: hidden; background: #fff; }
.qty-stepper .qty-btn { width: 34px; height: 34px; border: none; background: #fff; color: var(--navy); font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.qty-stepper .qty-btn:hover { background: var(--off-white); color: var(--red); }
.qty-stepper .qty-input { width: 40px; height: 34px; border: none; border-left: 1.5px solid var(--border); border-right: 1.5px solid var(--border); text-align: center; font-family: var(--font-heading); font-weight: 600; font-size: 15px; color: var(--navy); background: #fff; -moz-appearance: textfield; }
.qty-stepper .qty-input::-webkit-outer-spin-button, .qty-stepper .qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-stepper.sm .qty-btn { width: 28px; height: 28px; font-size: 16px; }
.qty-stepper.sm .qty-input { width: 32px; height: 28px; font-size: 13.5px; }

/* คอลัมน์ "สั่งซื้อ" ในตารางสินค้า */
.vt-order-cell { white-space: nowrap; }
.vt-order-form { display: inline-flex; align-items: center; gap: 6px; }
.vt-cart-btn { width: 34px; height: 34px; border: none; border-radius: 10px; background: var(--red); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.vt-cart-btn:hover { background: #D90000; }
.vt-cart-btn svg.lucide { width: 17px; height: 17px; }

/* หน้าตะกร้า */
.cart-page { padding: 30px 0 56px; }
.cart-page h1 { font-size: 26px; margin-bottom: 6px; }
.cart-page .cart-sub { color: var(--gray); font-size: 14.5px; margin-bottom: 20px; }
.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 26px; align-items: start; }
.cart-items { display: flex; flex-direction: column; gap: 12px; }
.cart-item { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: center; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.cart-item-img { width: 84px; height: 84px; border-radius: 12px; background: var(--off-white); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-img .no-img { width: 46px; opacity: .5; }
.cart-item-name { font-family: var(--font-heading); font-weight: 600; font-size: 15.5px; color: var(--navy); line-height: 1.35; }
.cart-item-variant { font-size: 13px; color: var(--gray); margin-top: 2px; }
.cart-item-unit { font-size: 13px; color: var(--gray); margin-top: 4px; }
.cart-item-controls { display: flex; align-items: center; gap: 14px; }
.cart-item-line { font-family: var(--font-heading); font-weight: 700; color: var(--red); font-size: 16px; white-space: nowrap; min-width: 78px; text-align: right; }
.cart-remove { border: none; background: none; color: var(--gray); cursor: pointer; padding: 6px; display: inline-flex; border-radius: 8px; }
.cart-remove:hover { color: var(--red); background: #FFF1F2; }
.cart-remove svg.lucide { width: 18px; height: 18px; }

.cart-summary { background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 20px; box-shadow: var(--shadow); position: sticky; top: 20px; }
.cart-summary h2 { font-size: 18px; margin-bottom: 14px; }
.cart-summary-row { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; padding: 6px 0; color: var(--navy); }
.cart-summary-row.muted { color: var(--gray); font-size: 14px; }
.cart-summary-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px dashed var(--border); margin-top: 10px; padding-top: 12px; font-family: var(--font-heading); font-weight: 700; }
.cart-summary-total .amt { color: var(--red); font-size: 22px; }
.cart-summary .btn { width: 100%; justify-content: center; margin-top: 16px; }
.cart-summary-note { font-size: 12.5px; color: var(--gray); text-align: center; margin-top: 10px; line-height: 1.5; }
.cart-continue { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; color: var(--gray); font-size: 14px; text-decoration: none; }
.cart-continue:hover { color: var(--red); }

/* ตะกร้าว่าง */
.cart-empty { text-align: center; background: #fff; border: 1px solid var(--border); border-radius: 18px; padding: 54px 24px; box-shadow: var(--shadow); }
.cart-empty .ce-icon { width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%; background: var(--off-white); display: flex; align-items: center; justify-content: center; color: var(--gray); }
.cart-empty .ce-icon svg.lucide { width: 36px; height: 36px; }
.cart-empty h2 { font-size: 21px; margin-bottom: 6px; }
.cart-empty p { color: var(--gray); font-size: 15px; margin-bottom: 20px; }

/* Toast แจ้งเตือน "เพิ่มลงตะกร้าแล้ว" */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--navy); color: #fff; font-family: var(--font-heading); font-weight: 500; font-size: 14.5px; padding: 11px 20px; border-radius: 999px; box-shadow: var(--shadow-lg); display: inline-flex; align-items: center; gap: 8px; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s ease, transform .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast svg.lucide { width: 18px; height: 18px; color: var(--green); }

@media (max-width: 900px) {
  .cart-layout { grid-template-columns: 1fr; }
  .cart-summary { position: static; }
}
@media (max-width: 560px) {
  /* ตารางตัวเลือกสินค้าเลื่อนแนวนอนได้ (เฉพาะหน้าบ้าน) */
  .vt-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .vt-scroll .variant-table { min-width: 520px; }
  .cart-item { grid-template-columns: 68px 1fr; gap: 12px; }
  .cart-item-img { width: 68px; height: 68px; }
  .cart-item-controls { grid-column: 1 / -1; justify-content: space-between; }
  .cart-page h1 { font-size: 22px; }
  .toast { bottom: 76px; }
}

/* =====================================================================
   Phase 2 — Checkout / ออเดอร์ / Admin orders
   mobile-first; กฎ desktop อยู่ใน @media (min-width:901px) ท้ายบล็อก
   ===================================================================== */

/* --- Checkout --- */
.checkout-page { padding: 28px 0 60px; }
.checkout-page > h1 { font-size: 24px; display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.checkout-page > h1 svg.lucide { color: var(--red); }
.checkout-errors { display: flex; gap: 10px; background: #FEF2F2; border: 1px solid #FCA5A5; color: #991B1B; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.checkout-errors svg.lucide { flex-shrink: 0; margin-top: 2px; }
.checkout-layout { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
.checkout-form { display: flex; flex-direction: column; gap: 16px; }
.co-card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; }
.co-card h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; margin: 0 0 14px; }
.co-card h2 svg.lucide { color: var(--red); width: 19px; height: 19px; }
.co-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.co-field { display: flex; flex-direction: column; gap: 5px; }
.co-field > span { font-size: 13.5px; font-weight: 600; color: var(--navy); }
.co-field > span b { color: var(--red); }
.co-field > span em { font-weight: 400; font-style: normal; color: var(--gray); font-size: 12.5px; }
.co-field input, .co-field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--font-body); font-size: 15px; background: #fff; }
.co-field input:focus, .co-field textarea:focus { outline: 2px solid var(--red-light); border-color: transparent; }
.co-field textarea { resize: vertical; }
.co-account { border: 1.5px dashed #FCA5A5; }
.co-account-note { font-size: 13px; color: var(--gray); margin: -4px 0 12px; }
.co-login-link { font-size: 13.5px; color: var(--gray); margin-top: 10px; }
.co-login-link a { color: var(--red); font-weight: 700; }
.co-account--in { border-style: solid; border-color: #BBF7D0; background: #F0FDF4; }
.co-loggedin { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #15803D; }
.co-loggedin svg.lucide { color: #15803D; }
.co-member-tag { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-left: 4px; }

/* dropdown ที่อยู่ไทย */
.addr-field { position: relative; }
.addr-suggest { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); margin-top: 4px; max-height: 320px; overflow-y: auto; }
.addr-suggest-item { padding: 9px 13px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--off-white); }
.addr-suggest-item:last-child { border-bottom: none; }
.addr-suggest-item.active, .addr-suggest-item:hover { background: var(--off-white); }
.addr-suggest-item strong { color: var(--navy); font-weight: 700; }
.addr-suggest-path { color: var(--gray); font-size: 12.5px; }

/* สรุป checkout */
.checkout-summary { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; }
.checkout-summary h2 { font-size: 17px; margin: 0 0 14px; }
.co-sum-items { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.co-sum-line { display: grid; grid-template-columns: 46px 1fr auto; gap: 10px; align-items: center; }
.co-sum-thumb { position: relative; width: 46px; height: 46px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: #fff; }
.co-sum-thumb img { width: 100%; height: 100%; object-fit: contain; }
.co-sum-qty { position: absolute; top: -6px; right: -6px; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.co-sum-name { font-size: 13.5px; font-weight: 600; line-height: 1.35; }
.co-sum-variant { font-size: 12px; color: var(--gray); }
.co-sum-amt { font-family: var(--font-heading); font-weight: 700; font-size: 14px; }
.co-sum-rows { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.co-sum-row { display: flex; justify-content: space-between; font-size: 14px; }
.co-sum-row.muted { color: var(--gray); }
.co-sum-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; font-weight: 700; }
.co-sum-total .amt { font-family: var(--font-heading); font-weight: 900; font-size: 20px; color: var(--red); }
.co-submit { width: 100%; margin-top: 14px; justify-content: center; }
.co-submit-note { display: flex; gap: 6px; font-size: 12.5px; color: var(--gray); margin-top: 10px; }
.co-submit-note svg.lucide { flex-shrink: 0; width: 15px; height: 15px; margin-top: 1px; }
.co-back { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; color: var(--gray); text-decoration: none; font-size: 14px; }
.cart-myorders { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; color: var(--navy); font-weight: 600; text-decoration: none; font-size: 14px; }

/* --- status pill (ใช้ทั้ง tracking / admin) --- */
.status-pill { display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 700; padding: 4px 12px; border-radius: 999px; white-space: nowrap; }
.status-new { background: #FEF3C7; color: #92400E; }
.status-awaiting_payment { background: #FEE2E2; color: #B91C1C; }
.status-payment_review { background: #E0E7FF; color: #3730A3; }
.status-paid { background: #DCFCE7; color: #15803D; }
.status-shipped { background: #DBEAFE; color: #1D4ED8; }
.status-done { background: #D1FAE5; color: #065F46; }
.status-payment_rejected { background: #FEF2F2; color: #991B1B; }
.status-cancelled { background: #F3F4F6; color: #6B7280; }

/* --- Order tracking --- */
.track-page { padding: 28px 0 60px; }
.track-flash { display: flex; align-items: center; gap: 8px; background: #F0FDF4; border: 1px solid #BBF7D0; color: #15803D; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.track-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.track-label { font-size: 12.5px; color: var(--gray); }
.track-head h1 { font-size: 26px; margin: 2px 0 0; }
.track-cancel { display: flex; align-items: center; gap: 8px; background: #F9FAFB; border: 1px solid var(--border); color: var(--gray); border-radius: 12px; padding: 14px 18px; margin-bottom: 20px; font-weight: 600; }

.order-timeline { display: flex; justify-content: space-between; position: relative; margin: 0 0 26px; padding: 6px 0; }
.order-timeline::before { content: ""; position: absolute; top: 24px; left: 24px; right: 24px; height: 3px; background: var(--border); z-index: 0; }
.ot-step { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; flex: 1; text-align: center; }
.ot-dot { width: 38px; height: 38px; border-radius: 50%; background: #fff; border: 3px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--gray); }
.ot-dot svg.lucide { width: 18px; height: 18px; }
.ot-text { font-size: 11.5px; color: var(--gray); font-weight: 600; line-height: 1.25; }
.ot-step.done .ot-dot { border-color: var(--green); background: var(--green); color: #fff; }
.ot-step.done .ot-text { color: #15803D; }
.ot-step.current .ot-dot { border-color: var(--red); background: var(--red); color: #fff; box-shadow: 0 0 0 5px rgba(255,0,0,.14); }
.ot-step.current .ot-text { color: var(--red); font-weight: 700; }

.track-layout { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
.track-main { display: flex; flex-direction: column; gap: 18px; }
.track-main h2, .track-side h2 { font-size: 16px; display: flex; align-items: center; gap: 7px; margin: 0 0 12px; }
.track-main h2 svg.lucide, .track-side h2 svg.lucide { color: var(--red); width: 18px; height: 18px; }
.pay-card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; border: 1.5px solid #FCA5A5; }
.pay-placeholder { display: flex; gap: 12px; align-items: flex-start; }
.pay-placeholder > svg.lucide { color: var(--green); flex-shrink: 0; margin-top: 2px; }
.pay-placeholder p { font-size: 13.5px; color: var(--gray); margin: 4px 0 12px; }
.track-items, .track-info-card { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 18px 20px; }
.track-item { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--off-white); }
.track-item-name { font-size: 14.5px; font-weight: 600; }
.track-item-variant { font-size: 12.5px; color: var(--gray); }
.track-item-amt { font-family: var(--font-heading); font-weight: 700; white-space: nowrap; }
.track-totals { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.tt-row { display: flex; justify-content: space-between; font-size: 14px; }
.tt-total { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--border); margin-top: 8px; padding-top: 10px; font-weight: 700; }
.tt-total .amt { font-family: var(--font-heading); font-weight: 900; font-size: 20px; color: var(--red); }
.track-addr { font-size: 14px; line-height: 1.7; }
.track-carrier, .track-note { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--gray); margin-top: 10px; }
.track-carrier svg.lucide, .track-note svg.lucide { width: 15px; height: 15px; color: var(--red); }
.track-help { font-size: 13.5px; color: var(--gray); text-align: center; margin-top: 4px; }
.track-help a { color: var(--red); font-weight: 700; }

/* --- ออเดอร์ของฉัน --- */
.mine-page { padding: 28px 0 60px; }
.mine-page > h1 { font-size: 24px; display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.mine-list { display: flex; flex-direction: column; gap: 12px; }
.mine-card { display: block; background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; text-decoration: none; color: var(--navy); position: relative; }
.mine-card:hover { box-shadow: var(--shadow-lg); }
.mine-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mine-no { font-family: var(--font-heading); font-weight: 700; }
.mine-card-mid { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--gray); }
.mine-total { font-family: var(--font-heading); font-weight: 700; color: var(--navy); }
.mine-card-go { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--border); }

/* --- Admin: order list --- */
.order-filter-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ofp { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; background: #fff; box-shadow: var(--shadow); text-decoration: none; color: var(--navy); font-size: 13.5px; font-weight: 600; }
.ofp span { background: var(--off-white); color: var(--gray); font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.ofp.active { background: var(--navy); color: #fff; }
.ofp.active span { background: rgba(255,255,255,.2); color: #fff; }
.admin-badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-left: 4px; }

/* --- Admin: order detail --- */
.admin-back { display: inline-flex; align-items: center; gap: 6px; color: var(--gray); text-decoration: none; font-size: 14px; margin-bottom: 14px; }
.admin-back:hover { color: var(--red); }
.od-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.od-layout { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
.od-main { display: flex; flex-direction: column; gap: 16px; }
.od-side { display: flex; flex-direction: column; gap: 16px; }
.od-card { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: 16px 18px; }
.od-card h3 { font-size: 15px; display: flex; align-items: center; gap: 7px; margin: 0 0 12px; }
.od-card h3 svg.lucide { color: var(--red); width: 17px; height: 17px; }
.od-cust { font-size: 14px; line-height: 1.7; }
.od-note { color: var(--gray); font-size: 13px; margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.od-carrier { margin-top: 12px; padding: 10px 12px; background: #FFF7ED; border: 1px solid #FED7AA; border-radius: 10px; font-size: 13.5px; display: flex; align-items: center; gap: 7px; }
.od-carrier svg.lucide { color: #C2410C; width: 16px; height: 16px; }
.od-carrier--none { background: var(--off-white); border-color: var(--border); color: var(--gray); }
.od-carrier--none svg.lucide { color: var(--gray); }
.od-totals { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.odt-row { display: flex; justify-content: space-between; font-size: 14px; }
.odt-total { display: flex; justify-content: space-between; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-family: var(--font-heading); font-weight: 700; }
.od-ship-form { display: flex; gap: 8px; }
.od-ship-form input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; }
.od-ship-form input:focus { outline: 2px solid var(--red-light); border-color: transparent; }
.od-hint { font-size: 12.5px; color: var(--gray); margin: 8px 0 0; }
.od-copy { display: flex; gap: 8px; }
.od-copy input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; color: var(--gray); background: var(--off-white); }

/* --- Phase 3: กล่องชำระเงิน (tracking) --- */
.pay-amount { font-size: 14px; color: var(--navy); margin-bottom: 14px; }
.pay-amount b { font-family: var(--font-heading); font-weight: 900; color: var(--red); font-size: 18px; margin-left: 4px; }
.pay-channel { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.pay-channel:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.pay-channel-head { font-size: 13.5px; font-weight: 700; color: var(--navy); display: flex; align-items: center; gap: 7px; margin-bottom: 12px; }
.pay-channel-head svg.lucide { width: 17px; height: 17px; color: var(--red); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; background: var(--off-white); border: 1px solid var(--border); border-radius: 14px; padding: 18px; }
.qr-render { width: 240px; max-width: 100%; line-height: 0; }
.qr-render img { width: 100%; height: auto; image-rendering: pixelated; border-radius: 6px; background: #fff; }
.qr-amount { font-family: var(--font-heading); font-weight: 900; font-size: 22px; color: var(--navy); }
.qr-name { font-size: 13.5px; color: var(--gray); text-align: center; margin-top: -4px; }
.pay-slip { margin-top: 14px; }
.pay-slip-head { font-size: 13px; color: var(--gray); margin-bottom: 8px; }
.slip-form { display: flex; flex-direction: column; gap: 10px; }
.slip-input { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border: 1.5px dashed var(--border); border-radius: 10px; cursor: pointer; font-size: 13.5px; color: var(--gray); background: #fff; }
.slip-input:hover { border-color: var(--red); color: var(--navy); }
.slip-input svg.lucide { width: 18px; height: 18px; flex-shrink: 0; }
.slip-input input[type=file] { display: none; }
.slip-input-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slip-err, .od-err { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #B91C1C; background: #FEF2F2; border: 1px solid #FCA5A5; border-radius: 8px; padding: 8px 12px; }
.slip-err svg.lucide, .od-err svg.lucide { width: 15px; height: 15px; }
.slip-preview { display: block; text-decoration: none; }
.slip-preview img { width: 100%; max-width: 320px; border-radius: 12px; border: 1px solid var(--border); }
.slip-preview span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--red); font-weight: 600; margin-top: 8px; }
.slip-preview span svg.lucide { width: 15px; height: 15px; }
.slip-reupload { margin-top: 14px; }
.slip-reupload summary { font-size: 13px; color: var(--gray); cursor: pointer; }
.slip-reupload[open] summary { margin-bottom: 10px; }
.reject-note { display: flex; gap: 10px; align-items: flex-start; background: #FEF2F2; border: 1.5px solid #FCA5A5; color: #991B1B; border-radius: 14px; padding: 14px 16px; font-size: 13.5px; line-height: 1.6; }
.reject-note svg.lucide { flex-shrink: 0; margin-top: 2px; width: 18px; height: 18px; }
.pay-omise-wait { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--gray); background: var(--off-white); border-radius: 10px; padding: 12px 14px; }
.pay-omise-wait svg.lucide { width: 17px; height: 17px; color: #C2410C; }
.pay-line-box { display: flex; gap: 12px; align-items: flex-start; }
.pay-line-box > svg.lucide { color: var(--green); flex-shrink: 0; margin-top: 2px; }
.pay-line-box p { font-size: 13.5px; color: var(--gray); margin: 4px 0 12px; }

/* --- Phase 3: admin สลิป + payment-settings --- */
.od-slip { display: block; }
.od-slip img { width: 100%; max-width: 260px; border-radius: 10px; border: 1px solid var(--border); }
.od-reject-form { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px; }
.od-reject-form input { padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; }
.od-reject-form input:focus { outline: 2px solid var(--red-light); border-color: transparent; }
.pay-settings { display: flex; flex-direction: column; gap: 18px; max-width: 640px; }
.ps-card { background: #fff; border-radius: 16px; box-shadow: var(--shadow); padding: 18px 20px; }
.ps-toggle { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.ps-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ps-switch { flex-shrink: 0; width: 46px; height: 26px; border-radius: 999px; background: var(--border); position: relative; transition: background .18s; margin-top: 2px; }
.ps-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ps-toggle input:checked + .ps-switch { background: var(--green); }
.ps-toggle input:checked + .ps-switch::after { transform: translateX(20px); }
.ps-toggle input:focus-visible + .ps-switch { outline: 2px solid var(--red); outline-offset: 2px; }
.ps-toggle-label b { display: block; font-size: 15px; color: var(--navy); }
.ps-toggle-label small { display: block; font-size: 12.5px; color: var(--gray); margin-top: 2px; line-height: 1.5; }
.ps-fields { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.ps-field span { display: block; font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.ps-field input { width: 100%; padding: 10px 13px; border: 1px solid var(--border); border-radius: 9px; font-size: 15px; }
.ps-field input:focus { outline: 2px solid var(--red-light); border-color: transparent; }
.ps-err { display: block; color: #B91C1C; font-size: 12.5px; margin-top: 5px; font-style: normal; }
.ps-note { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--gray); margin: 12px 0 0; line-height: 1.5; }
.ps-note svg.lucide { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
.ps-note code { background: var(--off-white); padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.ps-omise-status { margin-top: 14px; }
.ps-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.ps-badge svg.lucide { width: 15px; height: 15px; }
.ps-badge--ok { background: #DCFCE7; color: #15803D; }
.ps-badge--warn { background: #FEF3C7; color: #92400E; }

@media (min-width: 901px) {
  .checkout-layout { grid-template-columns: 1.6fr 1fr; }
  .checkout-summary { position: sticky; top: 90px; }
  .co-grid { grid-template-columns: 1fr 1fr; }
  .co-col-2 { grid-column: 1 / -1; }
  .track-layout { grid-template-columns: 1.7fr 1fr; }
  .od-layout { grid-template-columns: 1.7fr 1fr; }
}

@media (max-width: 560px) {
  .track-head h1 { font-size: 22px; }
  .ot-dot { width: 32px; height: 32px; }
  .order-timeline::before { top: 21px; left: 18px; right: 18px; }
  .ot-text { font-size: 10.5px; }
  .co-sum-items { max-height: none; }
}

/* --- คูปองส่วนลด (Phase 4) --- */
.coupon-box { margin: 12px 0; padding-top: 12px; border-top: 1px dashed var(--border); }
.coupon-form { display: flex; gap: 8px; }
.coupon-form input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-family: inherit; font-size: 14px; text-transform: uppercase; }
.coupon-form input::placeholder { text-transform: none; }
.coupon-form .btn { white-space: nowrap; padding: 9px 16px; }
.coupon-applied { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #F0FDF4; border: 1px solid #BBF7D0; border-radius: 12px; padding: 10px 12px; }
.coupon-applied-info { display: flex; align-items: center; gap: 10px; min-width: 0; }
.coupon-applied-info > svg.lucide { color: var(--green); flex-shrink: 0; }
.coupon-applied-code { font-family: var(--font-heading); font-weight: 700; color: #15803D; letter-spacing: .5px; }
.coupon-applied-amt { font-size: 13px; color: #15803D; }
.coupon-remove { background: none; border: none; cursor: pointer; color: #6B7280; padding: 4px; display: flex; }
.coupon-remove:hover { color: var(--red); }
.coupon-error { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: #B91C1C; }
.coupon-error > svg.lucide { width: 16px; height: 16px; flex-shrink: 0; }

/* --- admin: pill สถานะคูปอง (ปุ่ม toggle) + หมายเหตุ --- */
.status-pill.pill-on { background: #DCFCE7; color: #15803D; border: 1px solid #BBF7D0; cursor: pointer; gap: 5px; }
.status-pill.pill-off { background: #F3F4F6; color: #6B7280; border: 1px solid var(--border); cursor: pointer; gap: 5px; }
.status-pill.pill-on > svg.lucide, .status-pill.pill-off > svg.lucide { width: 14px; height: 14px; }
.pill-note { font-size: 11.5px; color: #B45309; margin-top: 4px; }
