:root {
  --bg: #f3f6f9;
  --card: #ffffff;
  --text: #10213a;
  --muted: #5c6b80;
  --surface-2: #e9eef7;
  --border: #dbe3ef;
  --row-border: #eef2f7;
  --nav-bg: #ffffff;
  --bg-grad-start: #f5f8fc;
  --bg-grad-end: #edf2f8;
  --primary: #1d6ef2;
  --danger: #d83a56;
  --warning: #e49b1f;
  --success: #1f9d63;
  --radius: 14px;
}
[data-theme="dark"] {
  --bg: #0f1624;
  --card: #1a2538;
  --text: #e7edf9;
  --muted: #9fb0ca;
  --surface-2: #27344a;
  --border: #30415b;
  --row-border: #2b3a53;
  --nav-bg: #152033;
  --bg-grad-start: #0d1421;
  --bg-grad-end: #111b2b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-end) 100%);
  color: var(--text);
}
.container { max-width: 1100px; margin: 0 auto; padding: 12px; }
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
}
.brand { font-weight: 800; letter-spacing: .4px; }
.nav a { color: var(--text); text-decoration: none; margin-left: 10px; }
.notif-wrap {
  position: relative;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.notif-btn {
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  min-height: 36px;
  min-width: 40px;
  padding: 4px 8px;
  cursor: pointer;
  position: relative;
}
.notif-icon {
  font-size: 18px;
  line-height: 1;
}
.notif-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  border-radius: 999px;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}
.notif-count.is-hidden { display: none; }
.notif-panel {
  position: absolute;
  right: 0;
  top: 44px;
  width: min(92vw, 360px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(0,0,0,.2);
  display: none;
  z-index: 80;
}
.notif-panel.show { display: block; }
.notif-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
}
.notif-list {
  max-height: 280px;
  overflow: auto;
  padding: 8px;
}
.notif-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
  background: var(--surface-2);
  font-size: 13px;
}
.notif-item small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.role-nav {
  position: sticky;
  top: 52px;
  z-index: 19;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}
.role-nav-scroll {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.role-nav-scroll a {
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 13px;
}
.role-nav-scroll a.is-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 8px 20px rgba(16, 33, 58, 0.06);
}
.kpi { font-size: 24px; font-weight: 800; }
.muted { color: var(--muted); font-size: 13px; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
.table th, .table td { padding: 10px; border-bottom: 1px solid var(--row-border); text-align: left; }
.table { background: var(--card); }
.badge { border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 700; color: #fff; }
.PENDING { background: var(--warning); }
.CONFIRMED { background: #2f66f3; }
.PICKING { background: #6b4de3; }
.READY { background: var(--success); }
.DELIVERED { background: #2d3748; }
.CANCELLED { background: var(--danger); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  min-height: 44px;
  padding: 9px 10px;
}
label { display: block; font-size: 13px; margin: 8px 0 4px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.order-card { border-left: 5px solid #d9e2f0; }
.product-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.product-admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.product-admin-card.product-inactive {
  opacity: .72;
}
.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill-ok {
  background: #daf5e9;
  color: #11603d;
}
.pill-off {
  background: #f2e8eb;
  color: #7a3140;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 60;
}
.modal.is-open {
  display: block;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 16, 28, 0.58);
}
.modal-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 14px;
  border-top: 1px solid var(--border);
}
[data-theme="dark"] .pill-ok {
  background: #1e3f33;
  color: #9be3bf;
}
[data-theme="dark"] .pill-off {
  background: #4a2a33;
  color: #f2b7c7;
}
.fixed-bottom {
  position: sticky;
  bottom: 8px;
  background: var(--card);
  border-radius: 12px;
  padding: 10px;
  border: 1px solid var(--border);
}
.cart-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}
.quick-print-bar {
  position: sticky;
  top: 104px;
  z-index: 17;
  border: 1px solid var(--border);
}
.alert {
  padding: 10px;
  border-radius: 10px;
  background: #ffeff3;
  color: #9f1f3c;
  margin: 8px 0;
}
.mobile-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nav-bg);
  display: flex;
  border-top: 1px solid var(--border);
}
.mobile-tabs a {
  flex: 1;
  text-align: center;
  padding: 12px 6px;
  color: #233047;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.spacer-bottom { height: 64px; }
.toast-container {
  position: fixed;
  right: 12px;
  bottom: 78px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  min-width: 220px;
  max-width: min(88vw, 360px);
  background: #1d2b43;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
  opacity: 0;
  transform: translateY(8px);
  transition: all .2s ease;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}
[data-theme="dark"] .toast {
  background: #304462;
}
@media (min-width: 900px) {
  .mobile-tabs { position: static; border: 0; background: transparent; }
  .mobile-tabs a { max-width: 160px; background: var(--surface-2); margin-right: 8px; border-radius: 10px; }
  .spacer-bottom { height: 0; }
  .role-nav {
    top: 56px;
  }
  .product-admin-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
  .modal-panel {
    width: min(900px, 94vw);
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    border-radius: 14px;
    border: 1px solid var(--border);
  }
  .toast-container {
    bottom: 14px;
  }
}
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .container { max-width: 100%; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}

.product-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.catalog-search-wrap {
  position: sticky;
  top: 96px;
  z-index: 18;
  margin-top: 10px;
  border: 1px solid var(--border);
}
.product-card-mobile {
  padding: 12px;
  border: 1px solid var(--border);
}
.product-head {
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 10px;
  align-items: center;
}
.product-thumb {
  width: 62px;
  height: 62px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid #dde6f3;
  background: #f3f7fd;
}
.product-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: #3a527a;
}
.qty-stepper {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  gap: 8px;
  align-items: center;
}
.step-btn {
  min-height: 44px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
}
@media (min-width: 900px) {
  .product-list {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
  .catalog-search-wrap {
    top: 104px;
  }
  .quick-print-bar {
    top: 112px;
  }
}
