:root {
  --ink: #0e0c0b;
  --ink-2: #1b1715;
  --ink-3: #2a2522;
  --orange: #ff6a00;
  --orange-2: #dc5100;
  --orange-soft: #fff0e5;
  --blue: #ffb478;
  --paper: #f6f4f3;
  --card: #ffffff;
  --line: #e6e2df;
  --muted: #77706c;
  --danger: #dc3545;
  --warning: #f59f00;
  --shadow: 0 16px 42px rgba(17, 27, 20, .09);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}
.demo-banner { position: sticky; z-index: 51; top: 0; min-height: 34px; padding: 6px 18px; display: flex; align-items: center; justify-content: center; gap: 9px; color: #f2ece8; background: #302925; font-size: 11px; text-align: center; }
.demo-banner b { color: var(--orange); }
.demo-topbar { top: 34px; }
.demo-banner ~ .shop-shell .category-sidebar, .demo-banner ~ .shop-shell .cart-panel { top: 124px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  min-height: 78px;
  padding: 10px clamp(16px, 3vw, 44px);
  display: grid;
  grid-template-columns: minmax(230px, 310px) minmax(280px, 720px) auto;
  align-items: center;
  gap: 24px;
  color: white;
  background: linear-gradient(110deg, #070605 0%, #130f0d 72%, #22170f 100%);
  border-bottom: 1px solid rgba(255, 106, 0, .36);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .2);
}
.topbar::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--orange), var(--blue), transparent);
  opacity: .65;
}
.brand { display: flex; align-items: center; min-width: 0; gap: 12px; }
.brand img { width: 68px; height: 54px; object-fit: contain; filter: drop-shadow(0 0 12px rgba(255, 106, 0, .18)); }
.brand span { display: grid; min-width: 0; }
.brand b { overflow: hidden; font-size: 17px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.brand small { color: #c0bab6; font-size: 12px; }
.global-search, .admin-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 15px;
  color: #97908c;
  background: white;
  border: 1px solid transparent;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(11, 14, 12, .03);
}
.global-search:focus-within, .admin-search:focus-within { border-color: var(--orange-2); box-shadow: 0 0 0 3px rgba(255, 106, 0, .18); }
.global-search span, .admin-search span { font-size: 25px; line-height: 1; }
.global-search input, .admin-search input { min-width: 0; width: 100%; color: var(--ink); background: transparent; border: 0; outline: 0; }
.topnav { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.topnav a { padding: 10px 12px; color: #c3bdb9; border-radius: 9px; font-size: 13px; font-weight: 700; }
.topnav a:hover, .topnav a.active { color: var(--orange); background: rgba(255, 106, 0, .09); }
.mobile-cart { display: none; }
.logout-link { justify-self: end; padding: 9px 12px; color: #d4cfcc; border: 1px solid #46403c; border-radius: 9px; font-size: 13px; font-weight: 700; }
.logout-link:hover { color: white; border-color: var(--orange-2); }
.logout-form { justify-self: end; margin: 0; }
.logout-form .logout-link { background: transparent; }

.shop-shell {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 24px clamp(14px, 2vw, 30px) 60px;
  display: grid;
  grid-template-columns: 215px minmax(0, 1fr) 350px;
  align-items: start;
  gap: 20px;
}
.category-sidebar, .cart-panel { position: sticky; top: 102px; }
.category-sidebar {
  overflow: hidden;
  padding: 9px;
  background: #12100e;
  border: 1px solid #292420;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sidebar-title { padding: 11px 12px 8px; color: #a9a29d; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.category-button {
  width: 100%;
  min-height: 45px;
  margin: 2px 0;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #cec9c5;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
}
.category-button:hover { color: white; background: #231e1b; }
.category-button.active { color: #100700; background: linear-gradient(135deg, var(--orange), #ff8a32); box-shadow: 0 7px 20px rgba(255, 106, 0, .18); }
.shop-promo { margin-top: 12px; padding: 16px 13px; color: white; background: radial-gradient(circle at 100% 0, rgba(0, 169, 255, .28), transparent 52%), linear-gradient(145deg, #231d19, #13100e); border: 1px solid #3a332e; border-radius: 12px; }
.shop-promo b { color: var(--orange); }
.shop-promo p { margin: 6px 0 14px; color: #b5aeaa; font-size: 12px; }
.shop-promo span { color: rgba(255, 255, 255, .1); font-size: 30px; font-style: italic; font-weight: 900; letter-spacing: -.08em; }

.catalog-area { min-width: 0; }
.catalog-head { min-height: 78px; margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 3px; color: var(--orange-2); font-size: 10px; font-weight: 900; letter-spacing: .18em; }
.catalog-head h1, .admin-title h1 { margin: 0; font-size: clamp(25px, 2.5vw, 38px); line-height: 1.15; letter-spacing: -.035em; }
.subtle { color: var(--muted); font-size: 12px; }
.catalog-controls { display: flex; gap: 8px; }
.catalog-controls select, .catalog-controls button, .secondary-button {
  min-height: 40px;
  padding: 8px 12px;
  color: #403935;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-weight: 700;
}
.catalog-controls button:hover, .secondary-button:hover { color: var(--ink); border-color: var(--orange-2); }
.status-message { min-height: 0; margin-bottom: 0; padding: 0; color: #524b47; border-radius: 10px; }
.status-message:not(:empty) { margin-bottom: 12px; padding: 11px 13px; background: #fff; border: 1px solid var(--line); }
.status-message.error { color: #8f1f2a; background: #fff1f2; border-color: #ffc7cd; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid #e8e4e2;
  border-radius: 14px;
  box-shadow: 0 3px 14px rgba(20, 34, 23, .04);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.product-card:hover { z-index: 2; transform: translateY(-3px); border-color: #d7b49c; box-shadow: 0 15px 35px rgba(16, 35, 19, .12); }
.product-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: radial-gradient(circle at 50% 50%, #312a26 0, #181513 60%, #0f0d0c 100%);
}
.product-image img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.product-card:hover .product-image img { transform: scale(1.025); }
.product-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--orange); font-size: clamp(25px, 3vw, 48px); font-style: italic; font-weight: 950; letter-spacing: -.08em; }
.stock-badge { position: absolute; right: 9px; top: 9px; padding: 5px 8px; color: #331806; background: rgba(234, 255, 215, .94); border: 1px solid rgba(255, 106, 0, .45); border-radius: 999px; font-size: 10px; font-weight: 850; backdrop-filter: blur(6px); }
.stock-badge.low { color: #6d4200; background: #fff2c8; border-color: #ffd36f; }
.stock-badge.out { color: #8d1c27; background: #ffe1e4; border-color: #ffadb5; }
.product-info { flex: 1; padding: 13px 13px 8px; }
.product-category { color: var(--orange-2); font-size: 10px; font-weight: 850; letter-spacing: .03em; }
.product-info h3 { min-height: 42px; margin: 3px 0 5px; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 14px; line-height: 1.42; }
.product-variant { overflow: hidden; color: #625b57; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.product-sku { overflow: hidden; color: #a19c99; font-family: Consolas, monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.product-desc { min-height: 34px; margin: 8px 0 0; display: -webkit-box; overflow: hidden; color: #857f7b; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 11px; }
.product-buy { padding: 8px 13px 13px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.product-price { display: grid; }
.product-price del { min-height: 15px; color: #9b9692; font-size: 10px; }
.product-price b { color: #161210; font-size: 20px; letter-spacing: -.03em; }
.add-button { min-width: 44px; height: 42px; padding: 0 13px; color: #160c05; background: linear-gradient(135deg, var(--orange), #ff8a32); border: 0; border-radius: 10px; font-size: 20px; font-weight: 900; box-shadow: 0 7px 16px rgba(234, 88, 12, .2); }
.add-button:hover { filter: brightness(.95); transform: translateY(-1px); }
.add-button:disabled { cursor: not-allowed; color: #908b87; background: #e7e5e3; box-shadow: none; }
.empty-products { grid-column: 1 / -1; min-height: 280px; display: grid; place-items: center; align-content: center; gap: 5px; color: var(--muted); background: white; border: 1px dashed #c9c2bd; border-radius: var(--radius); text-align: center; }
.empty-products b { color: var(--ink); font-size: 18px; }

.cart-panel { overflow: hidden; background: white; border: 1px solid #e4dfdc; border-radius: var(--radius); box-shadow: var(--shadow); }
.cart-head { min-height: 58px; padding: 13px 16px; display: flex; align-items: center; justify-content: space-between; background: var(--ink); border-bottom: 2px solid var(--orange); }
.cart-head h2 { margin: 0; color: white; font-size: 17px; }
.cart-head button { color: #b8b2ae; background: transparent; border: 0; font-size: 11px; }
.cart-head button:hover { color: white; }
.cart-items { max-height: 280px; overflow: auto; padding: 7px 14px; scrollbar-width: thin; }
.empty-cart { min-height: 132px; display: grid; place-items: center; align-content: center; gap: 2px; color: var(--muted); text-align: center; }
.empty-cart span { font-size: 32px; filter: grayscale(1); opacity: .45; }
.empty-cart b { color: #504843; font-size: 13px; }
.empty-cart small { font-size: 10px; }
.cart-item { padding: 9px 0; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 9px; border-bottom: 1px solid #f0eeed; }
.cart-item-thumb { width: 42px; height: 42px; overflow: hidden; display: grid; place-items: center; color: var(--orange-2); background: #171412; border-radius: 8px; font-weight: 900; }
.cart-item-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-copy { min-width: 0; display: grid; }
.cart-item-copy b, .cart-item-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item-copy b { font-size: 11px; }
.cart-item-copy small { color: var(--muted); font-size: 9px; }
.cart-item-price { color: var(--ink); font-size: 11px; font-weight: 850; }
.quantity-control { grid-column: 2 / 4; display: flex; align-items: center; justify-content: space-between; }
.quantity-buttons { display: flex; align-items: center; gap: 3px; }
.quantity-buttons button { width: 25px; height: 25px; padding: 0; color: #453e3a; background: #f4f2f1; border: 1px solid #e5e1df; border-radius: 6px; font-weight: 900; }
.quantity-buttons output { min-width: 27px; text-align: center; font-size: 11px; font-weight: 800; }
.remove-item { padding: 3px 0; color: #a44a52; background: transparent; border: 0; font-size: 9px; }
.cart-fields { padding: 9px 14px 11px; display: grid; gap: 7px; background: #faf9f8; border-block: 1px solid #e9e6e4; }
.cart-fields label, .login-card label, .modal-card label { display: grid; gap: 4px; color: #635c58; font-size: 10px; font-weight: 750; }
.cart-fields input, .cart-fields textarea, .login-card input, .modal-card input, .modal-card textarea, .modal-card select {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  color: var(--ink);
  background: white;
  border: 1px solid #e0dcd9;
  border-radius: 8px;
  outline: 0;
}
.cart-fields textarea, .modal-card textarea { resize: vertical; }
.cart-fields input:focus, .cart-fields textarea:focus, .login-card input:focus, .modal-card input:focus, .modal-card textarea:focus, .modal-card select:focus { border-color: var(--orange-2); box-shadow: 0 0 0 3px rgba(255, 106, 0, .14); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.totals { padding: 10px 15px; display: grid; gap: 5px; }
.totals > div, .invoice-summary > div { display: flex; align-items: center; justify-content: space-between; color: #68615d; font-size: 11px; }
.totals b { color: var(--ink); }
.totals .grand-total { margin-top: 3px; padding-top: 8px; border-top: 1px dashed #d5d0cc; font-size: 14px; }
.totals .grand-total b { color: var(--orange-2); font-size: 23px; }
.checkout-button { width: calc(100% - 28px); min-height: 48px; margin: 0 14px; color: #100700; background: linear-gradient(135deg, var(--orange), #ff8a32); border: 0; border-radius: 10px; font-weight: 900; box-shadow: 0 9px 20px rgba(234, 88, 12, .2); }
.checkout-button:hover:not(:disabled) { filter: brightness(.96); transform: translateY(-1px); }
.checkout-button:disabled { cursor: not-allowed; color: #928d89; background: #e4e1df; box-shadow: none; }
.cart-note { margin: 7px 15px 12px; color: #9a9490; font-size: 9px; text-align: center; }

.toast { position: fixed; z-index: 200; right: 22px; bottom: 22px; max-width: min(390px, calc(100vw - 32px)); padding: 12px 16px; color: white; background: #201914; border: 1px solid #3e332c; border-left: 4px solid var(--orange); border-radius: 10px; box-shadow: 0 16px 38px rgba(0,0,0,.24); opacity: 0; pointer-events: none; transform: translateY(12px); transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-left-color: var(--danger); }
.busy-overlay { position: fixed; z-index: 300; inset: 0; display: grid; place-items: center; align-content: center; gap: 12px; color: white; background: rgba(4, 8, 5, .76); backdrop-filter: blur(4px); }
.loader { width: 42px; height: 42px; border: 4px solid rgba(255,255,255,.18); border-top-color: var(--orange); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin */
.admin-page .topbar { grid-template-columns: minmax(230px, 1fr) auto auto; }
.admin-shell { width: min(1500px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 70px; display: grid; gap: 18px; }
.admin-title { min-height: 92px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.admin-title p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); }
.primary-button { min-height: 42px; padding: 9px 15px; color: #100700; background: linear-gradient(135deg, var(--orange), #ff8a32); border: 0; border-radius: 9px; font-weight: 900; box-shadow: 0 8px 19px rgba(234, 88, 12, .17); }
.primary-button:hover { filter: brightness(.95); transform: translateY(-1px); }
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stat-grid article { min-height: 126px; padding: 17px; display: grid; align-content: center; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 5px 18px rgba(17, 27, 20, .04); }
.stat-grid span { color: var(--muted); font-size: 11px; font-weight: 750; }
.stat-grid b { margin: 2px 0; font-size: clamp(25px, 2.2vw, 35px); line-height: 1.1; letter-spacing: -.04em; }
.stat-grid small { color: #9b9591; font-size: 10px; }
.stat-grid .warning { border-left: 4px solid var(--warning); }
.stat-grid .warning b { color: #ad6a00; }
.stat-grid .profit { color: white; background: linear-gradient(145deg, #1a1511, #2d221b); border-color: #362e29; }
.stat-grid .profit span, .stat-grid .profit small { color: #bdb4ae; }
.stat-grid .profit b { color: var(--orange); }
.admin-panel { overflow: hidden; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 7px 24px rgba(17, 27, 20, .05); }
.panel-head { min-height: 70px; padding: 13px 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #ebe8e6; }
.panel-head h2 { margin: 0; font-size: 18px; }
.admin-search { width: min(340px, 42vw); height: 40px; background: #f8f7f6; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.admin-table th { padding: 11px 12px; color: #817b77; background: #f8f7f6; border-bottom: 1px solid #e9e5e3; font-size: 9px; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.admin-table td { padding: 11px 12px; border-bottom: 1px solid #f0eeed; vertical-align: middle; }
.admin-table tbody tr:hover { background: #fdfcfb; }
.admin-table .num { text-align: right; }
.product-cell { display: flex; align-items: center; gap: 10px; min-width: 230px; white-space: normal; }
.product-cell img, .product-cell .mini-placeholder { flex: 0 0 44px; width: 44px; height: 44px; object-fit: cover; display: grid; place-items: center; color: var(--orange); background: #171311; border-radius: 8px; font-size: 10px; font-weight: 900; }
.product-cell span { display: grid; }
.product-cell b { font-size: 12px; }
.product-cell small { color: var(--muted); font-size: 9px; }
.sku-cell { display: grid; }
.sku-cell code { font-size: 10px; }
.sku-cell small { color: var(--muted); font-size: 9px; }
.profit-value { color: var(--orange-2); font-weight: 850; }
.stock-value { font-size: 15px; font-weight: 900; }
.stock-value.low { color: #b66c00; }
.status-pill { display: inline-flex; padding: 4px 8px; color: #a44000; background: var(--orange-soft); border-radius: 99px; font-size: 9px; font-weight: 800; }
.status-pill.off { color: #736d69; background: #eceae8; }
.status-pill.partial { color: #8a5800; background: #fff1bf; }
.status-pill.paid { color: #783100; background: #ffe5d3; }
.status-pill.unpaid { color: #9d2732; background: #ffe3e6; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-actions button, .row-actions a { min-height: 32px; padding: 6px 9px; color: #4b443f; background: white; border: 1px solid #e0dbd8; border-radius: 7px; font-size: 10px; font-weight: 800; }
.row-actions button:hover, .row-actions a:hover { color: var(--ink); border-color: var(--orange-2); }
.loading-cell { height: 130px; color: var(--muted); text-align: center; }
.integration-note { padding: 15px 17px; display: flex; gap: 12px; color: #c8bfb9; background: #171311; border: 1px solid #302b27; border-left: 4px solid var(--orange); border-radius: 11px; }
.integration-note b { color: var(--orange); white-space: nowrap; }
.integration-note span { font-size: 12px; }

/* Modals and forms */
.modal-card { width: min(470px, calc(100% - 24px)); padding: 0; color: var(--ink); background: white; border: 0; border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.32); }
.modal-card::backdrop { background: rgba(4, 8, 5, .7); backdrop-filter: blur(3px); }
.modal-card form { padding: 19px; }
.modal-wide { width: min(760px, calc(100% - 24px)); }
.modal-head { margin-bottom: 15px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.modal-head h2 { margin: 0; font-size: 22px; }
.icon-button { width: 34px; height: 34px; color: #736c68; background: #f3f1f0; border: 0; border-radius: 8px; font-size: 22px; }
.modal-product { margin: -5px 0 13px; color: #504944; font-weight: 800; }
.mode-picker { margin-bottom: 12px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mode-picker label { cursor: pointer; }
.mode-picker input { position: absolute; opacity: 0; }
.mode-picker span { padding: 9px; color: #615a56; background: #f5f3f2; border: 1px solid #e5e2e0; border-radius: 8px; text-align: center; }
.mode-picker input:checked + span { color: #8c3900; background: var(--orange-soft); border-color: var(--orange-2); }
.modal-card form > label { margin-bottom: 11px; }
.modal-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.product-import-tools { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:7px 10px; align-items:end; margin:0 0 14px; padding:12px; background:#fff8f2; border:1px solid #ffe2ca; border-radius:10px; }
.inventory-tools { display:flex; flex-wrap:wrap; align-items:center; justify-content:flex-end; gap:8px; }
.category-filter-buttons { display:flex; gap:7px; overflow-x:auto; padding:0 0 11px; margin-top:-3px; }
.category-filter-buttons button { flex:0 0 auto; padding:7px 11px; border:1px solid #e5e7ec; border-radius:999px; background:#fff; color:#555e6b; font-size:11px; white-space:nowrap; }
.category-filter-buttons button[aria-pressed="true"] { border-color:#ff8d43; background:#fff0e5; color:#c64d00; font-weight:750; }
.category-manager { margin:0 0 14px; border:1px solid #ece5df; border-radius:9px; background:#fffdfa; }
.category-manager > summary { padding:10px 12px; color:#9c480e; font-size:12px; font-weight:750; cursor:pointer; }
.category-add-form { display:flex; align-items:end; gap:8px; padding:0 12px 10px; }
.category-add-form label { flex:1; display:grid; gap:4px; color:var(--muted); font-size:10px; }
.category-add-form input { padding:9px; border:1px solid #e3e5e9; border-radius:7px; }
.category-management-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:7px; padding:0 12px 10px; }
.category-management-row { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:7px 8px; border:1px solid #eceef1; border-radius:7px; background:white; }
.category-management-row span { display:grid; gap:3px; min-width:0; }
.category-management-row b { overflow:hidden; text-overflow:ellipsis; font-size:11px; }
.category-management-row small, .category-manager > small { color:var(--muted); font-size:10px; }
.category-management-row button { padding:5px 8px; border:1px solid #f1c9b3; border-radius:6px; background:#fff8f4; color:#b44713; font-size:10px; white-space:nowrap; }
.category-management-row button:disabled { opacity:.55; cursor:not-allowed; }
.category-manager > small { display:block; padding:0 12px 10px; }
.invoice-settlement { padding:8px 10px; border:1px solid #e2e4e8; border-radius:7px; background:#fff; color:var(--ink); font:inherit; }
.invoice-settlement { max-width:170px; color:#30343b; font-size:11px; }
.product-import-tools label { display:grid; gap:5px; color:#635c58; font-size:10px; font-weight:750; }
.product-import-tools input { min-width:0; padding:10px; border:1px solid #e4e4e7; border-radius:7px; }
.product-import-tools small { grid-column:1/-1; }
.product-image-preview { margin-top:8px; }
.product-image-preview img { display:block; width:132px; height:132px; object-fit:contain; border:1px solid #e8e8eb; border-radius:8px; background:white; }
.product-image-preview:not([hidden]) { color:#6a6d75; font-size:12px; }
.check-row { display: flex !important; grid-template-columns: auto 1fr; align-items: center; }
.check-row input { width: 17px; min-height: 17px; accent-color: var(--orange-2); }
.demo-receipt { padding: 20px; }
.demo-bill-head, .demo-bill-customer { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f7f5f4; border-radius: 8px; }
.demo-bill-head b { color: var(--orange-2); }
.demo-bill-head span, .demo-bill-customer { color: var(--muted); font-size: 11px; }
.demo-bill-lines { margin: 14px 0; display: grid; }
.demo-bill-lines > div { padding: 9px 2px; display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ebe8e6; }
.demo-bill-lines span { min-width: 0; }
.demo-bill-lines b { white-space: nowrap; }
.demo-bill-total { padding: 4px 2px; display: flex; justify-content: space-between; }
.demo-bill-total.balance { margin-top: 6px; padding-top: 10px; border-top: 1px dashed #c4bdb9; font-size: 17px; }
.demo-bill-total.balance b { color: var(--orange-2); font-size: 21px; }
.demo-hint { padding: 9px; color: #735000; background: #fff6d8; border: 1px solid #f2dc93; border-radius: 7px; font-size: 10px; }

/* Login */
.login-page { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: radial-gradient(circle at 20% 0, rgba(0,169,255,.13), transparent 34%), radial-gradient(circle at 90% 90%, rgba(118,240,0,.14), transparent 36%), #0b0908; }
.login-card { width: min(410px, 100%); padding: 30px; display: grid; gap: 13px; background: white; border: 1px solid #342d28; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.4); }
.login-card img { width: 150px; height: 88px; margin: 0 auto; object-fit: contain; }
.login-card h1 { margin: 0 0 8px; font-size: 25px; text-align: center; }
.login-card input { min-height: 43px; }
.login-card textarea { width: 100%; padding: 8px; color: var(--ink); background: #f7f6f5; border: 1px solid #e0dcd9; border-radius: 8px; resize: vertical; }
.login-card button { min-height: 46px; color: #100700; background: var(--orange); border: 0; border-radius: 9px; font-weight: 900; }
.login-card > a { color: var(--muted); font-size: 11px; text-align: center; }
.form-error { margin: 0; padding: 10px; color: #941f2a; background: #fff0f1; border: 1px solid #ffc8cd; border-radius: 8px; font-size: 11px; }

/* Invoice */
.member-banner { margin-bottom: 14px; padding: 12px 16px; display: flex; justify-content: space-between; gap: 12px; color: #ffddc5; background: linear-gradient(110deg,#1a1410,#3b2516); border: 1px solid #c76f33; border-radius: 12px; }
.member-banner span { color: #e9bea0; }
.wholesale-price-badge { position: absolute; left: 8px; bottom: 8px; padding: 4px 7px; color: #170e07; background: var(--orange); border-radius: 6px; font-size: 9px; font-weight: 900; }
.wholesale-value { color: #8b4413; }
.table-sub { margin-top: 4px; display: block; color: var(--muted); font-size: 10px; }
.status-pill.pending { color: #765800; background: #fff2b6; }
.status-pill.confirmed, .status-pill.active, .status-pill.completed { color: #5a3217; background: #f5e4d8; }
.status-pill.cancelled, .status-pill.suspended, .status-pill.rejected { color: #8b2424; background: #ffe0e0; }
.admin-table select { min-width: 110px; padding: 7px; border: 1px solid #d5d0cc; border-radius: 7px; background: white; }
.form-success { padding: 10px 12px; color: #5a3217; background: #f7e8dd; border-radius: 8px; }
.login-links { display: flex; justify-content: space-between; gap: 14px; margin-top: 14px; }
.login-links a { color: #764422; font-weight: 750; }
.register-card { width: min(650px,calc(100% - 24px)); }
.register-note { margin: 0 0 16px; color: var(--muted); }
.account-page { background: var(--surface); }
.account-shell { width: min(1280px,calc(100% - 28px)); margin: auto; padding: 28px 0 60px; }
.member-hero { padding: 24px; display: flex; justify-content: space-between; align-items: center; color: white; background: linear-gradient(120deg,#100b08,#362215); border-radius: 16px; }
.member-hero h1 { margin: 3px 0; }
.member-hero p { margin: 0; color: #c8bfb9; }
.member-tier { padding: 9px 13px; color: #231810; background: #ddd; border-radius: 999px; font-weight: 900; }
.member-tier.wholesale { background: var(--orange); }
.account-grid { margin-top: 18px; display: grid; grid-template-columns: 350px 1fr; gap: 18px; }
.profile-form { display: grid; gap: 13px; }
.profile-form label { display: grid; gap: 5px; font-weight: 750; }
.profile-form input,.profile-form textarea,.profile-form select { width: 100%; padding: 10px; border: 1px solid #d5d0cc; border-radius: 8px; background: white; }
.invoice-order-notice { margin: 16px 0; padding: 13px 16px; color: #654d00; background: #fff4bf; border: 1px solid #e8d36b; border-radius: 9px; }
.invoice-page { padding: 22px; background: #eceae8; }
.invoice-actions { width: min(900px, 100%); margin: 0 auto 12px; display: flex; justify-content: space-between; }
.invoice-actions a, .invoice-actions button { padding: 9px 13px; color: white; background: #201b18; border: 0; border-radius: 8px; font-weight: 750; }
.invoice-actions button { color: #100700; background: var(--orange); }
.invoice-sheet { width: min(900px, 100%); min-height: 1120px; margin: 0 auto; padding: 38px 42px; background: white; box-shadow: 0 12px 40px rgba(0,0,0,.12); }
.invoice-brand { padding-bottom: 23px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 3px solid var(--ink); }
.invoice-brand img { width: 180px; height: 115px; object-fit: contain; }
.invoice-brand div { text-align: right; }
.invoice-brand h1 { margin: 0; font-size: 24px; }
.invoice-brand div > b { color: var(--orange-2); font-size: 18px; }
.invoice-brand p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.invoice-customer { margin: 20px 0; padding: 14px 16px; display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 15px; background: #f7f6f5; border-radius: 10px; }
.invoice-customer div { display: grid; }
.invoice-customer span { color: var(--muted); font-size: 10px; }
.invoice-table-wrap { overflow-x: auto; }
.invoice-table { width: 100%; border-collapse: collapse; }
.invoice-table th { padding: 10px; color: #706965; background: #f3f1f0; font-size: 10px; text-align: left; }
.invoice-table td { padding: 13px 10px; border-bottom: 1px solid #ebe8e6; }
.invoice-table td small { display: block; color: var(--muted); font-size: 9px; }
.invoice-table .num { text-align: right; white-space: nowrap; }
.invoice-summary { width: min(390px, 100%); margin: 20px 0 20px auto; display: grid; gap: 7px; }
.invoice-summary b { color: var(--ink); }
.invoice-summary .invoice-grand { margin-block: 4px; padding-block: 9px; border-block: 1px solid #d7d2ce; font-size: 16px; }
.invoice-summary .invoice-grand b { color: var(--orange-2); font-size: 23px; }
.invoice-note { padding: 13px; background: #f7f6f5; border-radius: 8px; font-size: 11px; }
.invoice-footer { margin-top: 48px; padding-top: 20px; display: grid; justify-items: center; border-top: 1px solid #e5e1df; }
.invoice-footer b { font-size: 17px; }
.invoice-footer span, .invoice-footer small { color: var(--muted); }

@media (max-width: 1350px) {
  .shop-shell { grid-template-columns: 190px minmax(0, 1fr) 330px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1040px) {
  .topbar { grid-template-columns: 220px minmax(220px, 1fr) auto; gap: 12px; }
  .topnav { display: none; }
  .mobile-cart { display: block; justify-self: end; padding: 9px 12px; color: #100700; background: var(--orange); border: 0; border-radius: 9px; font-weight: 900; }
  .mobile-cart b { min-width: 19px; display: inline-block; color: white; background: #201b17; border-radius: 99px; }
  .shop-shell { grid-template-columns: 190px minmax(0, 1fr); }
  .cart-panel { position: fixed; z-index: 100; inset: 78px 0 0 auto; width: min(390px, 100%); border-radius: 0; transform: translateX(105%); transition: transform .24s ease; }
  .cart-panel.open { transform: translateX(0); box-shadow: -20px 20px 55px rgba(0,0,0,.22); }
  .cart-items { max-height: 34vh; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .member-banner,.member-hero { align-items: flex-start; flex-direction: column; }
  .account-grid { grid-template-columns: 1fr; }
  .topbar { min-height: 116px; padding: 8px 12px; grid-template-columns: 1fr auto; grid-template-rows: 48px 44px; }
  .brand img { width: 52px; height: 42px; }
  .brand b { font-size: 14px; }
  .global-search { grid-column: 1 / -1; grid-row: 2; height: 40px; }
  .shop-shell { padding: 14px 10px 45px; display: block; }
  .category-sidebar { position: static; overflow-x: auto; margin-bottom: 14px; padding: 7px; display: flex; border-radius: 12px; scrollbar-width: none; }
  .sidebar-title, .shop-promo { display: none; }
  #categoryList { display: contents; }
  .category-button { flex: 0 0 auto; width: auto; min-height: 38px; padding: 7px 11px; }
  .category-button:first-of-type { margin-right: 3px; }
  .catalog-head { align-items: flex-start; }
  .catalog-controls select { max-width: 154px; }
  .catalog-controls button { display: none; }
  .product-grid { gap: 9px; }
  .product-info { padding: 10px 10px 6px; }
  .product-info h3 { min-height: 39px; margin-top: 2px; font-size: 12px; }
  .product-desc { display: none; }
  .product-buy { padding: 6px 10px 10px; }
  .product-price b { font-size: 17px; }
  .add-button { height: 37px; min-width: 38px; padding: 0 10px; }
  .cart-panel { inset: 116px 0 0 auto; }
  .demo-banner ~ .shop-shell .cart-panel { top: 150px; }
  .admin-page .topbar { min-height: 70px; grid-template-columns: 1fr auto; grid-template-rows: auto; }
  .admin-page .brand { grid-column: 1; }
  .admin-shell { width: min(100% - 20px, 1500px); padding-top: 16px; }
  .admin-title { align-items: flex-start; }
  .admin-title p:not(.eyebrow) { display: none; }
  .admin-title h1 { font-size: 24px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-grid article { min-height: 105px; padding: 13px; }
  .stat-grid .profit { grid-column: 1 / -1; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .admin-search { width: 100%; }
  .integration-note { display: grid; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .product-import-tools { grid-template-columns:1fr; }
  .product-import-tools small { grid-column:auto; }
  .inventory-tools { justify-content:stretch; width:100%; }
  .inventory-tools .admin-search { flex:1 1 170px; }
  .category-add-form { align-items:stretch; flex-direction:column; }
  .invoice-page { padding: 0; }
  .invoice-actions { padding: 10px; margin: 0; }
  .invoice-sheet { min-height: 100vh; padding: 22px 16px; }
  .invoice-brand img { width: 120px; height: 75px; }
  .invoice-brand h1 { font-size: 17px; }
  .invoice-customer { grid-template-columns: 1fr 1fr; }
}
.quick-contact-button { position:fixed; z-index:120; right:18px; bottom:18px; padding:13px 18px; border:0; border-radius:999px; color:white; background:#1877f2; box-shadow:0 8px 24px #15243b38; font-weight:800; cursor:pointer; }
.quick-contact-button::before { content:"f"; display:inline-grid; place-items:center; width:19px; height:19px; margin-right:8px; border-radius:50%; color:#1877f2; background:white; font-family:Arial,sans-serif; font-weight:900; }
.quick-contact-dialog { width:min(370px,calc(100% - 28px)); padding:28px; border:0; border-radius:18px; color:#252a33; box-shadow:0 20px 70px #0004; text-align:center; }
.quick-contact-dialog::backdrop { background:#11192388; backdrop-filter:blur(2px); }
.quick-contact-close { position:absolute; top:10px; right:12px; width:34px; height:34px; border:0; border-radius:50%; background:#f1f2f5; color:#545b66; font-size:23px; cursor:pointer; }
.quick-contact-icon { display:inline-grid; place-items:center; width:48px; height:48px; border-radius:50%; background:#1877f2; color:white; font:bold 32px Arial,sans-serif; }
.quick-contact-dialog h2 { margin:12px 0 6px; font-size:19px; }
.quick-contact-dialog p { color:#69717e; font-size:13px; line-height:1.6; }
.quick-contact-dialog > a { display:inline-block; margin-top:8px; padding:11px 17px; border-radius:8px; background:#1877f2; color:#fff; font-size:13px; font-weight:800; text-decoration:none; }
@media(max-width:720px) { .quick-contact-button { right:12px; bottom:12px; padding:11px 14px; font-size:12px; } }
@media (max-width: 420px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-head h1 { font-size: 23px; }
  .catalog-controls select { width: 130px; font-size: 10px; }
}
@media print {
  @page { size: A4; margin: 10mm; }
  body.invoice-page { padding: 0; background: white; }
  .invoice-actions { display: none; }
  .invoice-sheet { width: 100%; min-height: 0; padding: 0; box-shadow: none; }
}
