:root { --bg: #eef4fd; --bg-alt: #ffffff; --surface: #ffffff; --surface-2:#eaf2fb; --border: #d7e3f0; --border-soft: #e6eef7; --text: #0f2033; --muted: #5b7086; --muted-2:#3f4041; --blue: #1565d8; --blue-dim: #0d4bab; --blue-light: #3b82f6; --purple: #7c3aed; --teal: #0ea394; --amber: #d97706; --red: #d93a3a; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: radial-gradient(circle at 8% 0%, rgba(21, 101, 216, 0.10), transparent 42%), radial-gradient(circle at 95% 6%, rgba(124, 58, 237, 0.08), transparent 38%), radial-gradient(circle at 50% 100%, rgba(14, 163, 148, 0.06), transparent 40%), var(--bg); color: var(--text); min-height: 100vh; }
::selection { background: var(--blue); color: #ffffff; }
.containerr_layout.over-unset { overflow: unset; }

/* ---------- header ---------- */
header.top { border-bottom: 1px solid var(--border); background: var(--bg-alt); padding: 10px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; box-shadow: 0 1px 0 rgba(21, 101, 216, 0.04); }
header.top .brand { display: flex; align-items: center; gap: 12px; max-width: 100%; margin: 0; border: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; background: linear-gradient(140deg, var(--blue-light), var(--purple)); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #ffffff; font-size: 15px; flex-shrink: 0; box-shadow: 0 4px 12px rgba(21, 101, 216, 0.3); }
.brand-text h1 { font-size: 16px; font-weight: 700; margin: 0; letter-spacing: 0.2px; color: var(--text); padding: 0; }
.brand-text p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.top-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { font-weight: 600; font-size: 13px; padding: 9px 16px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 7px; transition: border-color .15s, transform .15s, background .15s; }
.btn:hover { border-color: var(--blue-light); background: #ffffff; transform: translateY(-1px); }
.btn.primary { background: var(--blue); color: #ffffff; border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-dim); border-color: var(--blue-dim); }

/* ---------- hero strip ---------- */
.hero { padding: 10px; max-width: 1400px; margin: 0 auto; }
.hero .eyebrow { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); margin: 0 0 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.eyebrow .upd { font-size: 10px; color: var(--teal); background: #e4f8f5; border: 1px solid #bfe9e2; padding: 2px 8px; border-radius: 20px; letter-spacing: 0.02em; text-transform: none; }
.hero h2 { font-weight: 700; font-size: clamp(22px, 3.4vw, 32px); line-height: 1.2; margin: 0 0 8px; background: linear-gradient(100deg, var(--text) 30%, var(--blue) 65%, var(--purple) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; text-transform: uppercase; }
.hero p.sub { color: var(--muted); font-size: 14px; margin: 0; line-height: 1.6; }

/* ---------- note ---------- */
.build-notice { position: relative; max-width: 1380px; margin: 0 auto 15px; padding: 16px 46px 16px 18px; background: #fff8e8; border: 1px solid #f1d591; border-left: 4px solid #e6a817; border-radius: 10px; color: #5f4a1b; font-size: 13px; line-height: 1.6; box-shadow: 0 5px 18px rgba(119, 87, 15, 0.08); }
.build-notice.is-hidden { display: none; }
.build-notice-title { display: block; margin-bottom: 5px; color: #8a5c00; font-size: 14px; }
.build-notice p { margin: 3px 0; }
.build-notice ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 10px; padding: 0; list-style: none; }
.build-notice li { padding: 4px 9px; background: #ffffff; border: 1px solid #ecd698; border-radius: 20px; color: #70530c; font-size: 11px; font-weight: 600; }
.build-notice-contact { padding-top: 8px; border-top: 1px dashed #e2c878; }
.build-notice-close { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: #937324; font-size: 22px; line-height: 28px; cursor: pointer; }
.build-notice-close:hover { background: rgba(147, 115, 36, 0.1); color: #5f4500; }
@media (max-width:768px) {
  .build-notice { margin: 0 10px 15px; }
}

/* ---------- layout ---------- */
.wrap { max-width: 1400px; margin: 0 auto; padding: 10px; display: flex; gap: 20px; align-items: flex-start; width: 100%; justify-content: space-between; }
.main-col { width: calc(100% - 360px); }
@media (max-width:980px) {
  .wrap { }
}

/* ---------- tìm kiếm sản phẩm ---------- */
.product-search { position: relative; z-index: 50; margin-bottom: 14px; }
.product-search-box { position: relative; display: flex; align-items: center; }
.product-search-icon { position: absolute; left: 14px; color: var(--muted); font-size: 21px; pointer-events: none; }
.product-search input { width: 100%; height: 44px; padding: 0 42px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text); font-size: 13px; outline: none; box-shadow: 0 3px 12px rgba(21, 101, 216, 0.05); transition: border-color .2s, box-shadow .2s; }
.product-search input:focus { border-color: var(--blue-light); box-shadow: 0 0 0 3px rgba(21, 101, 216, 0.1); }
.product-search-clear { position: absolute; right: 10px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 20px; line-height: 28px; cursor: pointer; opacity: 0; pointer-events: none; }
.product-search.has-value .product-search-clear { opacity: 1; pointer-events: auto; }
.product-search-clear:hover { background: var(--surface-2); color: var(--red); }
.product-search-suggestions { position: absolute; top: calc(100% + 5px); left: 0; right: 0; display: none; max-height: 320px; overflow-y: auto; padding: 5px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(15, 32, 51, 0.14); scrollbar-width: thin; scrollbar-color: rgba(91, 112, 134, .4) transparent; }
.product-search-suggestions.is-open { display: block; }
.product-search-suggestions::-webkit-scrollbar { width: 5px; }
.product-search-suggestions::-webkit-scrollbar-track { background: transparent; }
.product-search-suggestions::-webkit-scrollbar-thumb { background: rgba(91, 112, 134, .35); border-radius: 10px; }
.product-search-suggestion { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 13px; line-height: 1.4; text-align: left; cursor: pointer; }
.product-search-suggestion:hover { background: var(--surface-2); color: var(--blue); }
.product-search-empty { padding: 12px; color: var(--muted); font-size: 12px; text-align: center; }
.card.search-focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21, 101, 216, .14); }

/* ---------- tabs (cố định khi cuộn, nền mềm mại) ---------- */
.tabs { position: sticky; top: 0; z-index: 40; display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; padding: 16px 10px 16px; background: linear-gradient(180deg, rgba(238, 244, 253, 0.97) 0%, rgba(238, 244, 253, 0.94) 75%, rgba(238, 244, 253, 0.8) 100%); backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2); border-bottom: 1px solid transparent; box-shadow: 0 1px 0 rgba(215, 227, 240, 0.9), 0 10px 24px -18px rgba(15, 32, 51, 0.15); transition: box-shadow .25s ease; }
.tabs.is-scrolled { box-shadow: 0 1px 0 rgba(215, 227, 240, 0.9), 0 14px 28px -16px rgba(15, 32, 51, 0.22); }
.tab { --catclr: var(--blue); font-size: 12px; font-weight: 500; padding: 7px 14px 7px 8px; border-radius: 20px; border: 1px solid var(--border); background: #ffffff; color: var(--muted); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all .18s ease; }
.tab:hover { border-color: var(--catclr); transform: translateY(-1px); }
.tab-icon { width: 22px; height: 22px; border-radius: 50%; flex: 0 0 22px; background: color-mix(in srgb, var(--catclr) 14%, white); display: flex; align-items: center; justify-content: center; }
.tab-icon svg { width: 13px; height: 13px; color: var(--catclr); opacity: 0.55; transition: opacity .18s; }
.tab-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 50%; }
.tab .count { font-size: 10px; background: var(--surface-2); color: var(--muted); padding: 1px 6px; border-radius: 10px; }
.tab.active { border-color: var(--catclr); color: var(--catclr); background: color-mix(in srgb, var(--catclr) 10%, white); }
.tab.active .tab-icon svg { opacity: 1; }
.tab.active .tab-icon { background: color-mix(in srgb, var(--catclr) 24%, white); }
.tab.picked:not(.active) { border-color: var(--teal); }
.tab.picked .tab-icon { position: relative; }
.tab.picked .tab-icon::after { content: ''; position: absolute; top: -2px; right: -2px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); border: 1.5px solid #fff; }
.section-label { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-label h3 { font-size: 18px; margin: 0; color: var(--text); }
.subchips { display: flex; flex-direction: column; gap: 8px; margin: -6px 0 16px; }
.subchip-row { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.subchip-row .lvl { font-size: 9.5px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.subchip { --catclr: var(--blue); font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 5px 12px; border-radius: 14px; border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer; transition: all .15s; }
.subchip:hover { border-color: var(--catclr); }
.subchip.active { background: var(--catclr); border-color: var(--catclr); color: #fff; }
.section-label span { font-size: 11px; color: var(--muted-2); }

/* ---------- product grid (dạng hàng ngang) ---------- */
.grid { display: flex; flex-direction: column; gap: 8px; }
.card { --catclr: var(--blue); background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 7px 8px; cursor: pointer; position: relative; display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 2px rgba(19, 37, 56, 0.03); transition: border-color .15s, background .15s, box-shadow .15s; flex-direction: unset; }
.card:hover { border-color: var(--catclr); box-shadow: 0 3px 10px rgba(21, 101, 216, 0.1); }
.card.selected { border-color: var(--teal); background: #effaf8; }
.thumb { width: 48px; height: 48px; flex: 0 0 48px; border-radius: 7px; background: linear-gradient(155deg, color-mix(in srgb, var(--catclr) 10%, white), color-mix(in srgb, var(--catclr) 20%, white)); border: 1px solid color-mix(in srgb, var(--catclr) 25%, white); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.thumb svg { width: 56%; height: 56%; color: var(--catclr); opacity: 0.9; }
.thumb img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.card.selected .thumb { background: linear-gradient(155deg, #e3f8f4, #d6f3ec); border-color: #bfe9e2; }
.card.selected .thumb svg { color: var(--teal); }
.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.card .part-no { font-size: 9.5px; color: var(--catclr); letter-spacing: 0.05em; font-weight: 600; }
.card h4 { font-size: 13px; font-weight: 600; line-height: 1.3; margin: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badges { display: flex; gap: 5px; flex-wrap: wrap; }
.badge { font-size: 9.5px; color: var(--catclr); background: color-mix(in srgb, var(--catclr) 8%, white); border: 1px solid color-mix(in srgb, var(--catclr) 22%, white); padding: 2px 6px; border-radius: 5px; }
.price-col { flex: 0 0 auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; min-width: 88px; }
.price-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: nowrap; justify-content: flex-end; }
.price { font-weight: 700; font-size: 14px; color: var(--blue-dim); white-space: nowrap; }
.price-old { font-size: 10px; color: var(--muted-2); text-decoration: line-through; white-space: nowrap; }
.discount { font-size: 9.5px; color: var(--red); font-weight: 600; }
.sel-check { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; color: transparent; }
.card.selected .sel-check { background: var(--teal); border-color: var(--teal); color: #fff; }
@media (max-width:560px) {
  .badges { display: none; }
  .card h4 { white-space: normal; }
}

/* ---------- summary / receipt ---------- */
.receipt-wrap { position: sticky; top: 10px; width: 340px; max-height: calc(100vh - var(--build-pc-head-height, 0px) - 20px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(91, 112, 134, 0.45) transparent; }
.receipt-wrap::-webkit-scrollbar { width: 5px; }
.receipt-wrap::-webkit-scrollbar-track { background: transparent; }
.receipt-wrap::-webkit-scrollbar-thumb { background: rgba(91, 112, 134, 0.35); border-radius: 999px; }
.receipt-wrap::-webkit-scrollbar-thumb:hover { background: rgba(21, 101, 216, 0.52); }
.receipt { background: var(--bg-alt); border: 1px solid var(--border); border-radius: 12px; padding: 0; overflow: hidden; box-shadow: 0 8px 24px rgba(21, 101, 216, 0.08); }
.receipt-top { background: repeating-linear-gradient(90deg, transparent, transparent 8px, var(--bg) 8px, var(--bg) 14px); height: 10px; background-color: var(--blue); }
.receipt-head { padding: 18px 20px 12px; border-bottom: 1px dashed var(--border); }
.receipt-head .tag { font-size: 10px; letter-spacing: 0.14em; color: var(--blue); text-transform: uppercase; font-weight: 600; }
.receipt-head h3 { font-size: 17px; margin: 6px 0 2px; color: var(--text); }
.receipt-head p { margin: 0; font-size: 11px; color: var(--muted); }
.receipt-lines { padding: 14px 20px; display: flex; flex-direction: column; gap: 0; }
.rline { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-bottom: 1px dotted var(--border-soft); font-size: 12.5px; flex-wrap: wrap; }
.rline:last-child { border-bottom: none; }
.rline .label { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0; width: 100%; padding-top: 2px; }
.rline .val { flex: 1; text-align: left; width: 100%; }
.rline .name { font-weight: 500; line-height: 1.35; color: var(--text); }
.rline .name.empty { color: var(--muted-2); font-style: italic; font-weight: 400; }
.rline .amt { width: 100%; font-size: 14px; white-space: nowrap; padding-top: 1px; color: var(--blue-dim); font-weight: 600; display: flex; align-items: flex-end; gap: 6px; justify-content: flex-end; flex-direction: column; }
.rline .line-price { line-height: 1.2; }
.qty-control { display: inline-flex; align-items: center; gap: 3px; }
.qty-label { margin-right: 2px; color: var(--muted-2); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.qty-btn { width: 20px; height: 20px; padding: 0; border: 1px solid var(--border); border-radius: 5px; background: #fff; color: var(--blue-dim); cursor: pointer; font-size: 13px; line-height: 18px; text-align: center; transition: border-color .15s, background .15s; }
.qty-btn:hover { border-color: var(--blue-light); background: var(--surface-2); }
.qty-input { width: 34px; height: 20px; padding: 0 2px; border: 1px solid var(--border); border-radius: 5px; background: #fff; color: var(--text); font-size: 11px; font-weight: 600; text-align: center; outline: none; -moz-appearance: textfield; }
.qty-input:focus { border-color: var(--blue-light); box-shadow: 0 0 0 2px rgba(21, 101, 216, 0.10); }
.qty-input::-webkit-inner-spin-button, .qty-input::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
.rline button.rm { background: none; border: none; color: var(--muted-2); cursor: pointer; font-size: 14px; padding: 0 0 0 4px; line-height: 1; }
.rline button.rm:hover { color: var(--red); }
.warn-box { margin: 0 20px 14px; padding: 10px 12px; border-radius: 8px; background: #fdeeee; border: 1px solid #f3c6c6; font-size: 11.5px; color: #a52d2d; line-height: 1.5; }
.warn-box strong { color: var(--red); }
.ok-box { margin: 0 20px 14px; padding: 10px 12px; border-radius: 8px; background: #e9f9f6; border: 1px solid #bfe9e2; font-size: 11.5px; color: #0d7d70; }
.receipt-total { padding: 16px 20px; border-top: 1px dashed var(--border); display: flex; justify-content: space-between; align-items: center; background: var(--surface-2); }
.receipt-total .t-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.receipt-total .t-amt { font-size: 22px; font-weight: 700; color: var(--blue); }
.receipt-actions { padding: 0 20px 14px; display: flex; flex-direction: column; gap: 8px; }
.receipt-actions .btn { width: 100%; justify-content: center; padding: 11px; }
.save-block { padding: 0 20px 16px; }
.save-block .btn { width: 100%; justify-content: center; padding: 10px; background: linear-gradient(100deg, var(--blue-light), var(--purple)); color: #fff; border: none; }
.save-block .btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.saved-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.saved-empty { font-size: 11px; color: var(--muted-2); margin: 8px 0 0; text-align: center; }
.saved-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: 7px; padding: 7px 10px; }
.saved-name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-meta { font-size: 9.5px; color: var(--muted-2); }
.saved-actions { display: flex; gap: 6px; flex-shrink: 0; }
.mini-btn { font-size: 11px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); background: #fff; border-radius: 5px; padding: 4px 9px; }
.mini-btn.load { color: var(--blue); border-color: #bcd6f7; }
.mini-btn.load:hover { background: #eaf2fb; }
.mini-btn.del { color: var(--red); border-color: #f3c6c6; }
.mini-btn.del:hover { background: #fdeeee; }
.barcode { height: 34px; margin: 0 20px 18px; background: repeating-linear-gradient(90deg, var(--muted-2) 0px, var(--muted-2) 2px, transparent 2px, transparent 5px); opacity: 0.3; }
.receipt-foot { padding: 0 20px 18px; font-size: 10px; color: var(--muted-2); text-align: center; line-height: 1.6; }
footer.page-foot { border-top: 1px solid var(--border); padding: 24px clamp(16px, 4vw, 48px); text-align: center; font-size: 12px; color: var(--muted-2); background: #ffffff; }
footer.page-foot a { color: var(--blue); text-decoration: none; }
@media (max-width:768px) {
  .wrap { display: block; }
  .main-col { width: 100%; margin-bottom: 1rem; }
  .receipt-wrap { width: 100%; position: relative; top: 0; max-height: none; overflow-y: visible; padding-right: 0; }
  .tabs { gap: 5px; padding: 7px; }
}
@media (max-width:640px) {
  .card h4 { padding-right: 0; }
}
@media (max-width:530px) {
  header.top .brand { width: 100%; margin: 0px auto; justify-content: center; text-align: center; }
  .top-actions { width: 100%; justify-content: center; }
}
@media (max-width:475px) {
  .tab { padding: 5px 8px; font-size: 11px; }
  .tabs.is-scrolled .tab-icon, .tabs.is-scrolled .tab .count { display: none; }
  .tabs.is-scrolled .tab { padding: 5px 8px; }
  .tabs.is-scrolled { gap: 2px; }
  .card-body { padding: 0; }
}
@media (max-width:425px) {
  .card { flex-wrap: wrap; }
  .card-body { order: 1; width: 100%; }
  .price-col { width: calc(100% - 88px); }
}