/* ============================================================
   KABALON Order Portal — Stylesheet
   ============================================================ */

/* 1. Variables & Reset
   ---------------------------------------------------------- */
:root {
  --primary:       #0f172a;
  --primary-light: #1e293b;
  --accent:        #2563eb;
  --accent-h:      #1d4ed8;
  --accent-light:  #eff6ff;
  --success:       #16a34a;
  --success-bg:    #f0fdf4;
  --warning:       #d97706;
  --warning-bg:    #fffbeb;
  --danger:        #dc2626;
  --danger-bg:     #fef2f2;
  --gray-50:       #f8fafc;
  --gray-100:      #f1f5f9;
  --gray-200:      #e2e8f0;
  --gray-300:      #cbd5e1;
  --gray-400:      #94a3b8;
  --gray-500:      #64748b;
  --gray-600:      #475569;
  --gray-700:      #334155;
  --gray-800:      #1e293b;
  --gray-900:      #0f172a;
  --white:         #ffffff;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow:    0 1px 4px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.1);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.12);
  --trans:     0.18s ease;

  --header-h: 60px;
  --cart-w:   360px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.55;
  min-height: 100vh;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* 2. Layout
   ---------------------------------------------------------- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* 3. Header & Navigation
   ---------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--primary);
  height: var(--header-h);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.logo-mark {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: -0.5px;
}
.logo-name {
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.logo-sub {
  color: var(--gray-400);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
}
.nav-link {
  color: var(--gray-300);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color var(--trans), background var(--trans);
  text-decoration: none;
}
.nav-link:hover  { color: #fff; background: rgba(255,255,255,.08); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.12); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

/* 4. Page Title Strip
   ---------------------------------------------------------- */
.page-strip {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 18px 0;
}
.page-strip-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.page-meta  { display: flex; align-items: center; gap: 10px; }
.synced-at  { font-size: 13px; color: var(--gray-500); }

/* 5. Search
   ---------------------------------------------------------- */
.search-section {
  padding: 16px 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
}
.search-wrap {
  position: relative;
  max-width: 480px;
}
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--gray-400); pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 40px 10px 42px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--gray-50);
  color: var(--gray-800);
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}
.search-input::placeholder { color: var(--gray-400); }
.search-clear {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none;
  color: var(--gray-400); font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
}
.search-clear:hover { color: var(--gray-700); background: var(--gray-100); }

/* 6. Product Grid & Cards
   ---------------------------------------------------------- */
.products-section { padding: 24px 0 80px; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--trans), transform var(--trans);
}
.product-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.product-card.oos { opacity: .7; }
.product-card.oos:hover { transform: none; box-shadow: var(--shadow); }

.product-thumb {
  position: relative;
  background: var(--gray-100);
  height: 160px;
  overflow: hidden;
}
.product-img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}
.product-card:hover .product-img { transform: scale(1.04); }
.product-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-300);
}
.badge-oos {
  position: absolute; top: 10px; right: 10px;
  background: rgba(220,38,38,.88);
  color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .3px;
}

.product-body {
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; flex: 1; gap: 8px;
}
.product-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag-ref  { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-light); padding: 2px 7px; border-radius: 4px; }
.tag-code { font-size: 11px; color: var(--gray-500); background: var(--gray-100); padding: 2px 7px; border-radius: 4px; }
.product-name {
  font-size: 14px; font-weight: 600;
  color: var(--gray-900); line-height: 1.4;
  flex: 1;
}
.product-foot {
  display: flex; align-items: center;
  justify-content: space-between; gap: 8px;
  margin-top: 4px;
}
.stock-info {
  font-size: 12px; color: var(--gray-500);
  display: flex; align-items: center; gap: 4px;
}
.stock-info strong { color: var(--success); }
.stock-info.zero strong { color: var(--danger); }

.btn-add {
  display: flex; align-items: center; gap: 5px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
  transition: background var(--trans);
  flex-shrink: 0;
}
.btn-add:hover:not(:disabled)  { background: var(--accent-h); }
.btn-add.disabled, .btn-add:disabled {
  background: var(--gray-300);
  color: var(--gray-500);
  cursor: not-allowed;
}

/* 7. Loading / Empty / Error
   ---------------------------------------------------------- */
.loading-block {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center;
  padding: 64px 20px; gap: 16px; color: var(--gray-500);
}
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.spinner-sm {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .65s linear infinite;
  vertical-align: -3px;
  margin-right: 2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state, .error-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--gray-500);
}
.empty-icon, .error-icon {
  margin: 0 auto 16px;
  width: 64px; height: 64px;
  background: var(--gray-100);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-400);
}
.empty-state h3, .error-state h3 { font-size: 16px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p, .error-state p   { font-size: 14px; }
.error-state p { color: var(--danger); }

/* 8. Buttons
   ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; border: none;
  transition: background var(--trans), opacity var(--trans);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-h); }
.btn-success  { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; }
.btn-ghost {
  background: transparent; color: var(--gray-600); border: 1px solid var(--gray-300);
}
.btn-ghost:hover { background: var(--gray-100); }
.btn-icon {
  background: none; border: none;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  transition: background var(--trans), color var(--trans);
}
.btn-icon:hover { background: var(--gray-100); color: var(--gray-700); }
.btn-full { width: 100%; justify-content: center; }

/* Refresh button (white for dark header context) */
.btn-icon-header {
  background: rgba(255,255,255,.08); border: none;
  width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-300);
  transition: background var(--trans), color var(--trans);
}
.btn-icon-header:hover { background: rgba(255,255,255,.16); color: #fff; }

/* 9. Cart Toggle Button
   ---------------------------------------------------------- */
.cart-fab {
  position: fixed;
  bottom: 28px; right: 28px;
  z-index: 800;
  background: var(--primary);
  color: #fff;
  width: 56px; height: 56px;
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.28);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--trans), transform var(--trans);
}
.cart-fab:hover { background: var(--accent); transform: scale(1.06); }
.cart-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--white);
  line-height: 1;
}

/* 10. Cart Panel
   ---------------------------------------------------------- */
.cart-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 850;
  backdrop-filter: blur(2px);
}
.cart-overlay.active { display: block; }

.cart-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--cart-w);
  max-width: 100vw;
  background: var(--white);
  z-index: 860;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.cart-panel.open { transform: translateX(0); }

.cart-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  background: var(--white);
  flex-shrink: 0;
}
.cart-head h2 { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.cart-close {
  background: none; border: none;
  color: var(--gray-400);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1;
  transition: background var(--trans), color var(--trans);
}
.cart-close:hover { background: var(--gray-100); color: var(--gray-700); }

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}
.cart-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%;
  color: var(--gray-400); font-size: 14px;
}

.cart-item {
  padding: 12px 20px;
  display: flex; align-items: flex-start; gap: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.cart-item:last-child { border-bottom: none; }
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-size: 13px; font-weight: 600; color: var(--gray-800); line-height: 1.4; }
.ci-code { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
.ci-controls {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0; margin-top: 2px;
}
.qty-btn {
  width: 28px; height: 28px;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  border-radius: 6px; font-size: 16px; line-height: 1;
  color: var(--gray-700);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--trans);
}
.qty-btn:hover { background: var(--gray-200); }
.qty-input {
  width: 44px; height: 28px;
  border: 1px solid var(--gray-200); border-radius: 6px;
  text-align: center; font-size: 13px; font-weight: 600;
  color: var(--gray-800);
  outline: none;
  -moz-appearance: textfield;
}
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.qty-input:focus { border-color: var(--accent); }
.ci-remove {
  width: 28px; height: 28px;
  background: none; border: none;
  color: var(--gray-300);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--trans), color var(--trans);
}
.ci-remove:hover { background: var(--danger-bg); color: var(--danger); }

.cart-foot {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.cart-summary { font-size: 13px; color: var(--gray-500); }
#goToOrder {
  padding: 12px 20px;
  font-size: 15px;
}

/* 11. Forms
   ---------------------------------------------------------- */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 13px; font-weight: 600; color: var(--gray-700);
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-input, .form-select, .form-textarea {
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--gray-800);
  background: var(--white);
  outline: none;
  width: 100%;
  transition: border-color var(--trans), box-shadow var(--trans);
  font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--gray-400); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 8px; }

/* 12. Tables
   ---------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  background: var(--gray-50);
  padding: 11px 14px;
  text-align: left;
  font-size: 12px; font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }
.td-center { text-align: center; }
.td-num    { text-align: right; font-variant-numeric: tabular-nums; }
.td-name   { min-width: 180px; }
.empty-row { text-align: center; color: var(--gray-400); padding: 40px 20px !important; }

/* Row states */
.row-zero td { opacity: .45; }
.text-in   { color: var(--success); font-weight: 600; }
.text-out  { color: var(--danger); font-weight: 600; }
.text-muted { color: var(--gray-400); }
.fw-bold    { font-weight: 700; }

/* Order table qty input */
.qty-input-order {
  width: 72px; height: 32px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  text-align: center; font-size: 14px;
  outline: none;
  -moz-appearance: textfield;
}
.qty-input-order::-webkit-inner-spin-button,
.qty-input-order::-webkit-outer-spin-button { -webkit-appearance: none; }
.qty-input-order:focus { border-color: var(--accent); }

.btn-remove-row {
  background: none; border: none;
  color: var(--gray-300);
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--trans), color var(--trans);
}
.btn-remove-row:hover { background: var(--danger-bg); color: var(--danger); }

/* 13. Cards / Panels
   ---------------------------------------------------------- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h2 { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.card-body { padding: 24px; }

/* 14. Order Page Layout
   ---------------------------------------------------------- */
.order-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
  padding: 24px 0 60px;
}
.order-summary-sticky { position: sticky; top: calc(var(--header-h) + 20px); }
.order-total-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-100);
  font-size: 13px; font-weight: 600;
  color: var(--gray-600);
}
#submitBtn { font-size: 15px; padding: 13px 24px; }

/* 15. Report Page Layout
   ---------------------------------------------------------- */
.report-layout { padding: 24px 0 60px; display: flex; flex-direction: column; gap: 20px; }
.filter-bar {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}
.filter-bar-inner {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
}
.filter-bar .form-group { flex: 1; min-width: 150px; }
.report-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.report-meta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.report-count { font-size: 13px; color: var(--gray-500); }
.synced-label { font-size: 12px; color: var(--gray-400); font-style: italic; }

/* 16. Modals
   ---------------------------------------------------------- */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  align-items: center; justify-content: center;
  backdrop-filter: blur(3px);
}
.modal-backdrop.active { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 440px;
  padding: 36px 32px 32px;
  text-align: center;
  animation: modal-in .25s ease;
}
@keyframes modal-in {
  from { transform: scale(.92) translateY(12px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-icon {
  width: 72px; height: 72px;
  background: var(--success-bg);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  color: var(--success);
}
.modal h2 { font-size: 20px; font-weight: 700; color: var(--gray-900); margin-bottom: 10px; }
.modal p  { font-size: 14px; color: var(--gray-500); margin-bottom: 6px; }
.modal .so-code {
  font-size: 22px; font-weight: 800;
  color: var(--accent);
  letter-spacing: 1px;
  margin: 12px 0 24px;
  background: var(--accent-light);
  padding: 10px 20px; border-radius: var(--radius);
  display: inline-block;
}
.modal-actions { display: flex; gap: 12px; }
.modal-actions .btn { flex: 1; justify-content: center; }

/* 17. Toast Notifications
   ---------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex; flex-direction: column-reverse; align-items: center; gap: 8px;
  width: min(480px, 92vw);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-md);
  opacity: 0; transform: translateY(12px) scale(.97);
  transition: opacity .25s, transform .25s;
  pointer-events: auto;
  width: 100%;
  background: var(--gray-900);
  color: #fff;
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast-icon { flex-shrink: 0; }
.toast-success { background: #14532d; }
.toast-warning { background: #78350f; }
.toast-error   { background: #7f1d1d; }

/* 18. Back to top / Empty cart notice
   ---------------------------------------------------------- */
.notice-box {
  text-align: center;
  padding: 64px 20px;
  color: var(--gray-500);
}
.notice-box h3 { font-size: 18px; font-weight: 700; color: var(--gray-700); margin-bottom: 8px; }
.notice-box p  { font-size: 14px; margin-bottom: 20px; }

/* 19. Utility
   ---------------------------------------------------------- */
.hidden { display: none !important; }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }

/* 20. Responsive
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .order-layout { grid-template-columns: 1fr; }
  .order-summary-sticky { position: static; }
}

@media (max-width: 768px) {
  :root { --cart-w: 100vw; }

  .header-inner { gap: 16px; }
  .main-nav { gap: 2px; }
  .nav-link { padding: 5px 10px; font-size: 13px; }

  .product-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .product-thumb { height: 130px; }
  .product-body { padding: 10px 12px 12px; }

  .form-grid-2 { grid-template-columns: 1fr; }

  .filter-bar-inner { flex-direction: column; }
  .filter-bar .btn { width: 100%; justify-content: center; }

  .cart-fab { bottom: 20px; right: 16px; }

  .modal { padding: 28px 20px 24px; margin: 0 16px; }
}

@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr 1fr; }
  .product-thumb { height: 110px; }

  .page-title { font-size: 17px; }
}

/* 21. Inbound PO Styles
   ---------------------------------------------------------- */
.sub-tab-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 4px;
}
.sub-tab-btn {
  background: none;
  border: none;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 3px solid transparent;
  margin-bottom: -6px;
  transition: all var(--trans);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sub-tab-btn:hover { color: var(--accent); }
.sub-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.inbound-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}
@media (max-width: 992px) {
  .inbound-layout { grid-template-columns: 1fr; }
}

.inbound-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}
.inbound-card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-search-rel {
  position: relative;
}
.product-picker-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}
.picker-item {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--trans);
}
.picker-item:hover {
  background: var(--accent-light);
}
.picker-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.picker-item-title { font-weight: 600; font-size: 14px; color: var(--gray-800); }
.picker-item-meta { font-size: 12px; color: var(--gray-500); }

.inbound-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}
.inbound-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.inbound-table th {
  background: var(--gray-100);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  border-bottom: 1px solid var(--gray-200);
}
.inbound-table td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

.qty-input-sm {
  width: 70px;
  padding: 6px 8px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  text-align: center;
}
.qty-input-sm:focus {
  border-color: var(--accent);
  outline: none;
}

.badge-po {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #e0f2fe;
  color: #0369a1;
}
.badge-po-success {
  background: var(--success-bg);
  color: var(--success);
}
