/* ============================================================
   Ali Pharmacy POS — Light SaaS Theme
   Purple #827BF2 | Pink #F66CAC | Yellow #F2CC00
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
  --ph-purple:        #827BF2;
  --ph-purple-dark:   #6B63E0;
  --ph-purple-light:  #A59FF7;
  --ph-purple-bg:     rgba(130, 123, 242, 0.10);
  --ph-purple-glow:   rgba(130, 123, 242, 0.25);

  --ph-pink:          #F66CAC;
  --ph-yellow:        #F2CC00;

  --ph-success:       #21AE5A;
  --ph-warning:       #F89C34;
  --ph-danger:        #E40127;

  --ph-bg:            #F4F6FA;
  --ph-bg-white:      #FFFFFF;
  --ph-bg-hover:      #F8F9FB;

  --ph-text:          #1E293B;
  --ph-text-secondary:#64748B;
  --ph-text-muted:    #94A3B8;
  --ph-navy:          #0F172A;

  --ph-border:        #E8ECF2;
  --ph-border-light:  #F1F3F7;

  --ph-sidebar-w:     260px;
  --ph-header-h:      72px;
  --ph-radius:        12px;
  --ph-radius-sm:     8px;
  --ph-radius-pill:   50px;
  --ph-shadow-sm:     0 1px 3px rgba(15, 23, 42, 0.06);
  --ph-shadow:        0 4px 20px rgba(15, 23, 42, 0.08);
  --ph-shadow-lg:     0 8px 32px rgba(15, 23, 42, 0.10);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Poppins', 'Segoe UI', sans-serif !important;
  background: var(--ph-bg) !important;
  color: var(--ph-text) !important;
  padding: var(--ph-header-h) 0 0 var(--ph-sidebar-w) !important;
  min-height: 100vh;
  margin: 0;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

/* Hide legacy bootstrap navbar */
.navbar.navbar-inverse.navbar-fixed-top { display: none !important; }

/* ── Sidebar ── */
#sidebar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
  width: var(--ph-sidebar-w) !important;
  height: 100vh !important;
  background: var(--ph-bg-white) !important;
  border-right: 1px solid var(--ph-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  overflow-y: auto;
  z-index: 1040;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
}

.ph-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 24px 20px;
  text-decoration: none !important;
  border-bottom: 1px solid var(--ph-border-light);
}

.ph-sidebar-logo {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--ph-purple) 0%, var(--ph-pink) 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.ph-sidebar-brand-text {
  font-weight: 700;
  font-size: 15px;
  color: var(--ph-navy);
  line-height: 1.2;
}

.ph-sidebar-brand-text small {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--ph-text-muted);
}

.ph-nav-section {
  padding: 16px 16px 4px;
}

.ph-nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ph-text-muted);
  padding: 0 12px 8px;
}

#sidebar a {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  padding: 10px 16px !important;
  margin: 2px 8px !important;
  color: var(--ph-text-secondary) !important;
  font-weight: 500 !important;
  font-size: 14px !important;
  text-decoration: none !important;
  border-radius: var(--ph-radius-pill) !important;
  width: auto !important;
  max-width: none !important;
  border-left: none !important;
  transition: all 0.2s ease !important;
}

#sidebar a i {
  font-size: 16px !important;
  width: 20px !important;
  text-align: center !important;
  color: var(--ph-text-muted) !important;
}

#sidebar a:hover {
  background: var(--ph-bg-hover) !important;
  color: var(--ph-text) !important;
  transform: none !important;
}

#sidebar a:hover i { color: var(--ph-purple) !important; }

#sidebar a.active {
  background: var(--ph-purple) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px var(--ph-purple-glow) !important;
  transform: none !important;
}

#sidebar a.active i { color: #fff !important; }

.ph-sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--ph-border-light);
  font-size: 11px;
  color: var(--ph-text-muted);
  text-align: center;
}
.ph-brand-footer {
  line-height: 1.5;
}
.ph-brand-footer a {
  color: var(--ph-primary, #1a7a5e);
  text-decoration: none;
  font-weight: 600;
}
.ph-brand-footer a:hover { text-decoration: underline; }
.ph-login-footer a {
  color: #1a7a5e;
  text-decoration: none;
  font-weight: 600;
}
.ph-login-footer a:hover { text-decoration: underline; }

/* ── Top Header ── */
.ph-topbar {
  position: fixed;
  top: 0;
  left: var(--ph-sidebar-w);
  right: 0;
  height: var(--ph-header-h);
  z-index: 1050;
  background: var(--ph-bg-white);
  border-bottom: 1px solid var(--ph-border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 20px;
}

.ph-search-wrap {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.ph-search-wrap i {
  position: absolute;
  left: 14px;
  top: 39%;
  transform: translateY(-50%);
  color: var(--ph-text-muted);
  font-size: 14px;
}

.ph-search-wrap input {
  width: 100%;
  padding: 10px 16px 10px 40px !important;
  background: var(--ph-bg) !important;
  border: 1px solid var(--ph-border) !important;
  border-radius: var(--ph-radius-pill) !important;
  font-size: 13px !important;
  color: var(--ph-text) !important;
  box-shadow: none !important;
}

.ph-search-wrap input:focus {
  border-color: var(--ph-purple-light) !important;
  box-shadow: 0 0 0 3px var(--ph-purple-bg) !important;
}

.ph-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.ph-topbar-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ph-bg);
  border: 1px solid var(--ph-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ph-text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none !important;
}

.ph-topbar-icon:hover {
  background: var(--ph-purple-bg);
  color: var(--ph-purple);
  border-color: var(--ph-purple-light);
}

.ph-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--ph-bg);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-pill);
  cursor: default;
}

.ph-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--ph-purple) 0%, #0088cc 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
}

.ph-user-info { line-height: 1.2; }

.ph-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ph-text);
}

.ph-user-role {
  font-size: 11px;
  color: var(--ph-text-muted);
}


/* ── Main Content ── */
.span10,
.content-area,
.ph-content {
  margin-left: 0 !important;
  padding: 28px 32px 40px !important;
  max-width: 100%;
  width: 100% !important;
  box-sizing: border-box;
}

.span10{
  padding: 0 !important;
}

.container-fluid,
.row-fluid {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

.row-fluid .span10 {
  width: 100% !important;
  max-width: 100%;
  float: none;
}

/* ── Page Header ── */
.ph-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.contentheader,
.ph-page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ph-navy);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

.contentheader i,
.ph-page-title i {
  color: var(--ph-purple);
  font-size: 22px;
}

.ph-badge {
  align-items: center;
  padding: 4px 12px;
  background: var(--ph-bg);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--ph-text-secondary);
}

.ph-badge-purple {
  background: var(--ph-purple-bg);
  border-color: rgba(130,123,242,0.3);
  color: var(--ph-purple-dark);
}

/* ── Breadcrumb ── */
.breadcrumb,
ul.breadcrumb {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  margin: 0 0 20px !important;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ph-text-muted);
}

.breadcrumb a,
.breadcrumb a li { color: var(--ph-purple) !important; text-decoration: none; }
.breadcrumb li.active { color: var(--ph-text-secondary); }

/* ── Cards ── */
.ph-card {
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius);
  padding: 24px;
  box-shadow: var(--ph-shadow-sm);
}

.ph-card-header {
  font-size: 15px;
  font-weight: 600;
  color: var(--ph-navy);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ph-border-light);
}

/* ── Dashboard Stats ── */
.ph-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.ph-stat-card {
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius);
  padding: 20px;
  box-shadow: var(--ph-shadow-sm);
}

.ph-stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ph-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.ph-stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--ph-navy);
}

.ph-stat-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--ph-text-muted);
}

.ph-stat-value.purple { color: var(--ph-purple); }
.ph-stat-value.green  { color: var(--ph-success); }
.ph-stat-value.orange { color: var(--ph-warning); }

/* ── Dashboard Module Grid ── */
#mainmain {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)) !important;
  gap: 16px !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  text-align: center !important;
}

#mainmain a {
  text-align: center !important;
  width: auto !important;
  height: auto !important;
  min-height: 120px !important;
  padding: 22px 14px !important;
  text-decoration: none !important;
  color: var(--ph-text) !important;
  border-radius: var(--ph-radius) !important;
  background: var(--ph-bg-white) !important;
  border: 1px solid var(--ph-border) !important;
  box-shadow: var(--ph-shadow-sm) !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
  align-items: center !important;
  transition: all 0.2s ease !important;
  margin: 0 !important;
  font-size: inherit !important;
}

#mainmain a:hover {
  transform: translateY(-3px) !important;
  box-shadow: var(--ph-shadow) !important;
  border-color: var(--ph-purple-light) !important;
}

#mainmain i {
  background: var(--ph-purple-bg) !important;
  color: var(--ph-purple) !important;
  font-size: 22px !important;
  border-radius: 12px !important;
  width: 50px !important;
  height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
  transition: all 0.2s !important;
}

#mainmain a:hover i {
  background: var(--ph-purple) !important;
  color: #fff !important;
  transform: none !important;
}

#mainmain a.ph-tile-danger i {
  background: rgba(228, 1, 39, 0.08) !important;
  color: var(--ph-danger) !important;
}

#mainmain a.ph-tile-danger:hover i {
  background: var(--ph-danger) !important;
  color: #fff !important;
}

#mainmain span {
  margin-top: 10px !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  color: var(--ph-text-secondary) !important;
}

.ph-invoice-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 380px);
  gap: 14px;
  align-items: start;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.ph-invoice-layout > * {
  min-width: 0;
  max-width: 100%;
}

@media (max-width: 1100px) {
  .ph-invoice-layout { grid-template-columns: minmax(0, 1fr); }
  /* Invoice preview is desktop-only — hide on tablets/phones */
  .ph-invoice-preview {
    display: none !important;
  }
}

@media (min-width: 1101px) and (max-width: 1400px) {
  .ph-invoice-layout {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  }
}

/* Compact smart toolbar + quick-add dock */
.ph-sale-compact {
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border);
  border-radius: 12px;
  margin-bottom: 10px;
  box-shadow: var(--ph-shadow-sm);
  /* overflow: hidden; */
}

.ph-sale-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
}

.ph-sale-toolbar .ph-barcode-input {
  flex: 0 1 160px;
  min-width: 120px;
  margin: 0 !important;
  padding: 7px 10px !important;
  font-size: 12px !important;
  border-width: 1px !important;
}

.ph-sale-toolbar select,
.ph-sale-toolbar input[type="number"],
.ph-sale-toolbar input[type="text"] {
  height: 34px !important;
  font-size: 12px !important;
  padding: 5px 8px !important;
  margin: 2px;
}

.ph-sale-toolbar .chzn-container { flex: 1; min-width: 180px; }

.ph-barcode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 6px 10px;
  height: 34px;
  box-sizing: border-box;
  border: 1px solid var(--ph-border);
  border-radius: 8px;
  background: var(--ph-bg-soft, #f8fafc);
  color: var(--ph-text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.ph-barcode-toggle input {
  margin: 0 !important;
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.ph-barcode-toggle.is-on {
  border-color: var(--ph-purple);
  background: #f3eefc;
  color: var(--ph-purple);
}

.ph-barcode-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 150px;
  min-width: 120px;
  color: var(--ph-purple);
}

.ph-barcode-wrap[hidden] {
  display: none !important;
}

.ph-product-search-wrap {
  position: relative;
  flex: 1;
  min-width: 100px;
}

.ph-product-search-input {
  width: 100% !important;
  margin: 0 !important;
}

.ph-search-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 520px;
  overflow-y: auto;
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-sm);
  box-shadow: var(--ph-shadow-lg);
  z-index: 100;
}

.ph-search-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  cursor: pointer;
  border-bottom: 1px solid var(--ph-border-light);
}

.ph-search-item:hover,
.ph-search-item.active {
  background: var(--ph-purple-bg);
}

.ph-search-item-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ph-text);
}

.ph-search-item-meta {
  display: block;
  font-size: 10px;
  color: var(--ph-text-muted);
}

.ph-search-item.is-stockout {
  opacity: 0.65;
  background: rgba(220, 38, 38, 0.05);
}

.ph-search-item.is-stockout .ph-search-item-name {
  color: #b91c1c;
}

.ph-search-empty {
  padding: 10px;
  font-size: 12px;
  color: var(--ph-text-muted);
}

.ph-add-qty {
  width: 58px !important;
  text-align: center;
}

.ph-btn-add {
  height: 34px !important;
  padding: 0 14px !important;
  white-space: nowrap;
}

.ph-scan-message {
  width: 100%;
  font-size: 11px;
  font-weight: 600;
  display: none;
}

.ph-scan-message.is-ok { color: var(--ph-success); }
.ph-scan-message.is-error { color: var(--ph-danger); }

/* Sounds / animations */
.ph-flash-success {
  animation: phFlashGreen 0.6s ease;
}

.ph-flash-error {
  animation: phFlashRed 0.6s ease;
}

.ph-pulse {
  animation: phPulse 0.7s ease;
}

@keyframes phFlashGreen {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.45); }
  100% { box-shadow: 0 0 0 12px rgba(22, 163, 74, 0); }
}

@keyframes phFlashRed {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
  100% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
}

@keyframes phPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* DataTables search visible */
.dataTables_wrapper .dataTables_filter {
  float: right;
  text-align: right;
  margin-bottom: 10px;
}

.dataTables_wrapper .dataTables_filter label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ph-text-muted);
}

.dataTables_wrapper .dataTables_length {
  float: left;
  margin-bottom: 10px;
}

/* Batch form (facebox) */
.ph-batch-form {
  padding: 2px 6px 0;
  max-width: 560px;
}

.ph-batch-form-header {
  margin-bottom: 16px;
}

.ph-batch-form-header h4 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ph-navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ph-batch-form-header h4 i {
  color: var(--ph-purple);
}

.ph-batch-form-header p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ph-text-muted);
}

.ph-batch-product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--ph-purple-bg) 0%, rgba(130, 123, 242, 0.04) 100%);
  border-radius: 10px;
  border: 1px solid rgba(130, 123, 242, 0.18);
}

.ph-batch-product-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ph-purple);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.ph-batch-product-sub {
  font-size: 11px;
  color: var(--ph-text-muted);
  margin-top: 2px;
}

.ph-batch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 14px;
}

.ph-batch-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ph-batch-grid .ph-batch-field-full {
  grid-column: 1 / -1;
}

.ph-batch-form > .ph-batch-field-full {
  margin-top: 12px;
}

.ph-batch-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ph-text-secondary);
  margin: 0;
  line-height: 1.3;
}

.ph-batch-field label .req {
  color: var(--ph-danger);
  margin-left: 2px;
}

.ph-batch-field input:not([type="checkbox"]):not([type="radio"]),
.ph-batch-field select,
.ph-batch-field textarea {
  width: 100% !important;
  margin: 0 !important;
  padding: 9px 12px !important;
  font-size: 13px !important;
  line-height: 1.35;
  color: var(--ph-text) !important;
  background: var(--ph-bg-white) !important;
  border: 1px solid var(--ph-border) !important;
  border-radius: 9px !important;
  box-sizing: border-box !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.ph-batch-field input:not([type="checkbox"]):not([type="radio"]),
.ph-batch-field select {
  height: 40px !important;
}

.ph-batch-field select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 12px center !important;
  padding-right: 34px !important;
}

.ph-batch-field textarea {
  min-height: 76px !important;
  height: auto !important;
  resize: vertical;
}

.ph-batch-field input:not([type="checkbox"]):not([type="radio"]):focus,
.ph-batch-field select:focus,
.ph-batch-field textarea:focus {
  outline: none !important;
  border-color: var(--ph-purple-light) !important;
  box-shadow: 0 0 0 3px var(--ph-purple-glow) !important;
}

.ph-batch-field input[readonly] {
  background: var(--ph-bg-hover) !important;
  color: var(--ph-text-secondary) !important;
  cursor: default;
}

.ph-batch-field input::placeholder,
.ph-batch-field textarea::placeholder {
  color: var(--ph-text-muted);
  opacity: 0.85;
}

/* Full-width toggle / checkbox rows */
.ph-batch-field-check {
  gap: 0;
}

.ph-batch-check-label {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--ph-border-light);
  border-radius: 10px;
  background: var(--ph-bg-hover);
  cursor: pointer;
  text-transform: none !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  color: var(--ph-text) !important;
  line-height: 1.45 !important;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ph-batch-check-label:hover {
  border-color: var(--ph-purple-light);
  background: var(--ph-purple-bg);
}

.ph-batch-check-label:has(input:checked) {
  border-color: rgba(130, 123, 242, 0.45);
  background: var(--ph-purple-bg);
  box-shadow: 0 0 0 1px rgba(130, 123, 242, 0.12);
}

.ph-batch-check-label input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  margin: 2px 0 0 !important;
  padding: 0 !important;
  flex-shrink: 0;
  accent-color: var(--ph-purple);
  cursor: pointer;
  box-shadow: none !important;
  border-radius: 4px !important;
}

.ph-batch-check-text strong {
  color: var(--ph-purple);
  font-weight: 600;
}

.ph-batch-form-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--ph-border-light);
  text-align: right;
}

/* Roles & permissions */
.ph-role-perm-group {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ph-border-light);
}

.ph-role-perm-group h4 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--ph-purple);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.ph-role-perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.ph-role-perm-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--ph-border-light);
  border-radius: var(--ph-radius-sm);
  background: var(--ph-bg-white);
  cursor: pointer;
  font-weight: 500;
  font-size: 12px;
}

.ph-role-perm-item input {
  margin-right: 6px;
}

.ph-role-perm-item small {
  color: var(--ph-text-muted);
  font-size: 10px;
  font-weight: 400;
}

.ph-meta-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  font-size: 12px;
}

/* Meta strip inside lines card footer */
.ph-lines-card-footer {
  border-top: 1px solid var(--ph-border);
  background: var(--ph-bg-hover);
}

.ph-lines-card-footer .ph-meta-strip {
  margin: 0;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--ph-border-light);
}
#barcodeScanForm{
  max-resolution: 0px !important;
}
.ph-lines-card-footer .ph-invoice-footer {
  margin: 0;
  padding: 10px 12px;
  border-top: none;
  background: var(--ph-bg-white);
}

.ph-lines-card-footer .ph-footer-total {
  font-size: 12px;
  color: var(--ph-text-muted);
}

.ph-lines-card-footer .ph-footer-total strong {
  color: var(--ph-purple);
  font-size: 16px;
}

.ph-meta-strip .ph-meta-customer {
  flex: 2;
  min-width: 140px;
  position: relative;
}

.ph-meta-strip .ph-meta-pay {
  flex: 0 1 100px;
  max-width: 110px;
}

.ph-meta-strip .ph-disc-inline {
  flex: 0 1 150px;
}

.ph-meta-strip label {
  font-size: 10px;
  font-weight: 600;
  color: var(--ph-text-muted);
  text-transform: uppercase;
  margin: 0 0 4px;
  display: block;
  letter-spacing: 0.3px;
}

.ph-meta-strip .ph-meta-item { flex: 1; min-width: 90px; }

.ph-meta-strip input,
.ph-meta-strip select {
  width: 100% !important;
  height: 30px !important;
  font-size: 12px !important;
  padding: 4px 8px !important;
  background: var(--ph-bg-white) !important;
}

.ph-meta-strip .ph-disc-inline .ph-discount-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ph-meta-strip .ph-disc-inline input[type="number"] {
  width: 56px !important;
}

.ph-meta-strip .ph-pct-badge {
  padding: 4px 8px;
  font-size: 11px;
  background: var(--ph-purple-bg);
  color: var(--ph-purple);
  border-radius: 6px;
  font-weight: 600;
}

.ph-invoice-form-card {
  margin-bottom: 10px;
  padding: 0;
  border: none;
  box-shadow: none;
  background: transparent;
}

.ph-invoice-meta-grid,
.ph-meta-row-2 { display: none; }

.ph-card.ph-lines-card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 10px;
  max-width: 100%;
}

.ph-lines-card .ph-line-table-wrap,
.ph-lines-card {
  max-width: 100%;
}

.ph-line-table {
  width: 100%;
  max-width: 100%;
  table-layout: auto;
}

.ph-lines-card .ph-empty-cart {
  border-top: none;
}

/* Quick-add dock (below scan toolbar) */
.ph-fast-add-dock {
  display: block;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--ph-border-light);
  background: linear-gradient(180deg, rgba(130, 123, 242, 0.07) 0%, rgba(130, 123, 242, 0.02) 100%);
}

.ph-fast-add-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 12px 6px;
}

.ph-fast-add-dock__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ph-purple-dark);
}

.ph-fast-add-dock__icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--ph-purple);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(130, 123, 242, 0.35);
}

.ph-fast-add-dock__hint {
  font-size: 10px;
  font-weight: 500;
  color: var(--ph-text-muted);
}

.ph-fast-add-dock .ph-fast-grid-wrap {
  display: none;
  width: 100%;
  margin: 0;
  padding: 0 10px 8px;
  border: none;
  overflow: visible;
}

.ph-fast-add-dock .ph-fast-grid-wrap.is-visible {
  display: block;
}

/* ── Fast-add product grid (POS) ── */
.ph-line-table th.ph-th-item {
  white-space: nowrap;
}

.ph-line-table th.ph-th-item .ph-line-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  margin-left: 6px;
  padding: 0 6px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
  line-height: 1;
}

.ph-lines-card .ph-line-table thead th {
  background: var(--ph-bg-hover);
  border-bottom: 1px solid var(--ph-border);
}

.ph-fast-hint {
  font-size: 10px;
  color: var(--ph-text-muted);
  font-weight: 500;
}

.ph-fast-grid-wrap.is-visible {
  display: block;
}

.ph-fast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}

.ph-fast-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 8px 7px;
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-sm);
  background: var(--ph-surface);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  min-height: 78px;
}

.ph-fast-tile:hover:not(.is-stockout) {
  border-color: var(--ph-purple-light);
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.12);
}

.ph-fast-tile.is-selected {
  border-color: var(--ph-purple);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ph-fast-tile.is-stockout {
  opacity: 0.55;
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.35);
  cursor: not-allowed;
}

.ph-fast-tile.ph-stockout-flash {
  animation: ph-stockout-pulse 0.55s ease 2;
  opacity: 1;
}

@keyframes ph-stockout-pulse {
  0%, 100% { background: rgba(220, 38, 38, 0.08); transform: scale(1); }
  50% { background: rgba(220, 38, 38, 0.22); transform: scale(0.97); }
}

.ph-fast-key {
  position: absolute;
  top: 5px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--ph-purple);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.ph-fast-tile.is-stockout .ph-fast-key {
  background: #b91c1c;
}

.ph-fast-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--ph-text-primary);
  line-height: 1.2;
  padding-right: 22px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-fast-meta {
  font-size: 9px;
  color: var(--ph-text-muted);
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ph-fast-price {
  font-size: 10px;
  font-weight: 600;
  color: var(--ph-purple);
  margin-top: auto;
}

.ph-fast-stock {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ph-fast-tile.is-stockout .ph-fast-stock {
  color: #b91c1c;
}

.ph-fast-grid-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding: 8px 10px;
  background: var(--ph-surface-2);
  border-radius: var(--ph-radius-sm);
  border: 1px solid var(--ph-border-light);
}

.ph-fast-grid-label {
  font-size: 11px;
  color: var(--ph-text-muted);
  flex: 1;
  min-width: 140px;
}

.ph-fast-grid-label strong {
  color: var(--ph-text-primary);
}

.ph-fast-grid-qty-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ph-fast-grid-qty-row label {
  font-size: 11px;
  font-weight: 600;
  margin: 0;
  color: var(--ph-text-muted);
}

.ph-fast-grid-qty {
  width: 64px !important;
  height: 30px !important;
  padding: 4px 8px !important;
  text-align: center;
  font-size: 13px !important;
  font-weight: 700;
  border-radius: 6px !important;
  border: 1px solid var(--ph-border) !important;
  margin: 0 !important;
}

.ph-fast-grid-wrap.is-visible + .ph-empty-cart,
.ph-fast-grid-wrap.is-visible ~ .ph-empty-cart {
  display: none;
}

.ph-line-table th {
  padding: 6px 8px !important;
  font-size: 10px !important;
}

.ph-line-table td {
  padding: 6px 8px !important;
  font-size: 12px !important;
}

.ph-product-icon {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-radius: 6px;
}

.ph-product-name { font-size: 12px !important; }
.ph-product-desc { font-size: 10px !important; }

.ph-qty-wrap input,
.ph-disc-wrap input,
.js-line-qty,
.js-line-discount {
  width: 48px !important;
  padding: 4px !important;
  text-align: center !important;
  font-size: 12px !important;
}

.ph-invoice-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ph-invoice-preview {
  top: calc(var(--ph-header-h) + 10px);
  max-width: 100%;
  min-width: 0;
}

.ph-preview-body { padding: 14px; }

.ph-preview-toolbar { padding: 8px 10px; }

.ph-preview-toolbar .btn {
  padding: 5px 8px !important;
  font-size: 11px !important;
  min-width: 0;
}

.ph-preview-total { font-size: 22px; margin: 6px 0 12px; }

.ph-preview-items { font-size: 11px; margin: 10px 0; }
.ph-preview-items th, .ph-preview-items td { padding: 5px 4px !important; }

.ph-preview-row { padding: 4px 0; font-size: 12px; }

.ph-page-header { margin-bottom: 12px; }

.ph-saving-toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--ph-navy);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.ph-saving-toast.show { opacity: 1; }

.ph-empty-cart {
  padding: 20px;
  text-align: center;
  color: var(--ph-text-muted);
  font-size: 12px;
}

.ph-invoice-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 700px) {
  .ph-invoice-meta-grid { grid-template-columns: 1fr; }
}

.ph-meta-card {
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-sm);
  padding: 14px 16px;
  background: var(--ph-bg-hover);
}

.ph-meta-card label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ph-text-muted);
  margin-bottom: 8px;
}

.ph-meta-card .ph-meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--ph-navy);
}

.ph-meta-card .ph-meta-sub {
  font-size: 12px;
  color: var(--ph-text-muted);
  margin-top: 4px;
}

.ph-customer-input-wrap {
  position: relative;
}

.ph-customer-input-wrap input {
  width: 100% !important;
  border: none !important;
  background: transparent !important;
  padding: 0 !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  box-shadow: none !important;
}

.ph-customer-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius-sm);
  box-shadow: var(--ph-shadow);
  z-index: 100;
  display: none;
  max-height: 180px;
  overflow-y: auto;
}

.ph-customer-suggestions ul { list-style: none; margin: 0; padding: 4px 0; }
.ph-customer-suggestions li {
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.ph-customer-suggestions li:hover { background: var(--ph-purple-bg); color: var(--ph-purple); }

.ph-meta-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.ph-meta-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ph-text-muted);
  margin-bottom: 6px;
}

.ph-services-header.ph-fast-add-dock {
  margin-bottom: 0;
}

.ph-line-table { width: 100%; border-collapse: collapse; }
.ph-line-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ph-text-muted);
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--ph-border);
  background: var(--ph-bg-hover);
}
.ph-line-table td {
  padding: 12px;
  border-bottom: 1px solid var(--ph-border-light);
  vertical-align: middle;
  font-size: 13px;
}
.ph-line-table tr:last-child td { border-bottom: none; }

.ph-product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ph-product-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--ph-purple-bg);
  color: var(--ph-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.ph-product-name { font-weight: 600; color: var(--ph-navy); font-size: 13px; }
.ph-product-desc { font-size: 11px; color: var(--ph-text-muted); margin-top: 2px; }

.ph-qty-wrap, .ph-disc-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ph-qty-wrap input, .ph-disc-wrap input {
  width: 56px !important;
  text-align: center !important;
  padding: 6px !important;
}

.ph-btn-icon {
  width: 32px;
  height: 32px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 8px !important;
}

.ph-btn-delete {
  background: rgba(228, 1, 39, 0.08) !important;
  border: none !important;
  color: var(--ph-danger) !important;
}

.ph-btn-delete:hover { background: var(--ph-danger) !important; color: #fff !important; }

.ph-add-line-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--ph-purple-bg);
  border: 1px dashed var(--ph-purple-light);
  border-radius: var(--ph-radius-sm);
  color: var(--ph-purple);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.ph-discount-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.ph-discount-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ph-text-secondary);
  cursor: pointer;
  margin: 0;
}

.ph-discount-input-wrap {
  display: none;
  align-items: center;
  gap: 4px;
}

.ph-discount-input-wrap.active { display: flex !important; }

.ph-discount-input-wrap input {
  width: 70px !important;
  text-align: center !important;
}

.ph-discount-input-wrap .ph-pct-badge {
  background: var(--ph-purple-bg);
  color: var(--ph-purple);
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
}

.ph-footer-actions { display: flex; gap: 10px; }

.ph-invoice-preview {
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border);
  border-radius: var(--ph-radius);
  box-shadow: var(--ph-shadow);
  position: sticky;
  top: calc(var(--ph-header-h) + 16px);
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.ph-preview-toolbar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ph-border-light);
  background: var(--ph-bg-hover);
  flex-wrap: wrap;
}

.ph-preview-toolbar .btn {
  flex: 1;
  min-width: 80px;
  font-size: 12px !important;
  padding: 8px 10px !important;
}

.ph-preview-body { padding: 24px; }

.ph-preview-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.ph-preview-logo-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ph-purple), var(--ph-pink));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.ph-preview-brand { font-weight: 700; font-size: 15px; color: var(--ph-navy); }
.ph-preview-brand-sub { font-size: 11px; color: var(--ph-text-muted); }

.ph-preview-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 12px;
}

.ph-preview-meta-grid .lbl { color: var(--ph-text-muted); font-size: 11px; }
.ph-preview-meta-grid .val { font-weight: 600; color: var(--ph-navy); }

.ph-preview-items {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 12px;
}

.ph-preview-items th {
  text-align: left;
  padding: 8px 6px;
  border-bottom: 2px solid var(--ph-border);
  color: var(--ph-text-muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
}

.ph-preview-items td {
  padding: 10px 6px;
  border-bottom: 1px solid var(--ph-border-light);
  color: var(--ph-text);
}

.ph-preview-items .item-name { font-weight: 600; }
.ph-preview-items .item-sub { font-size: 10px; color: var(--ph-text-muted); }
.ph-preview-items .col-serial {
  width: 22px;
  text-align: center;
  color: var(--ph-text-muted);
  font-size: 10px;
  font-weight: 600;
}

.ph-preview-totals { margin-top: 16px; padding-top: 12px; border-top: 2px solid var(--ph-border); }

.ph-preview-total {
  font-size: 26px;
  font-weight: 700;
  color: var(--ph-purple);
  margin: 8px 0 16px;
}

.ph-preview-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  color: var(--ph-text-secondary);
}

.ph-preview-row.total {
  font-weight: 700;
  font-size: 16px;
  color: var(--ph-navy);
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--ph-border-light);
}

.ph-payment-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
}

.ph-payment-badge.cash { background: rgba(33,174,90,0.12); color: var(--ph-success); }
.ph-payment-badge.credit { background: rgba(248,156,52,0.12); color: var(--ph-warning); }

.ph-barcode-input {
  width: 100% !important;
  max-width: 100%;
  padding: 10px 14px !important;
  border: 2px solid var(--ph-success) !important;
  border-radius: var(--ph-radius-sm) !important;
  font-size: 14px !important;
  margin-bottom: 8px;
}

.ph-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

/* ── Tables ── */
#resultTable,
.table,
table.table {
  background: var(--ph-bg-white) !important;
  border: 1px solid var(--ph-border) !important;
  border-radius: var(--ph-radius) !important;
  overflow: hidden;
  color: var(--ph-text) !important;
  box-shadow: var(--ph-shadow-sm) !important;
  text-shadow: none !important;
  width: 100%;
}

#resultTable thead tr th,
.table thead tr th,
.table-bordered thead tr th {
  background: var(--ph-bg-hover) !important;
  color: var(--ph-text-secondary) !important;
  font-weight: 600 !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 12px 14px !important;
  border-color: var(--ph-border) !important;
  border-top: none !important;
  text-shadow: none !important;
}

#resultTable tbody tr td,
.table tbody tr td,
.table-bordered tbody tr td {
  padding: 11px 14px !important;
  border-color: var(--ph-border-light) !important;
  color: var(--ph-text) !important;
  font-size: 13px !important;
  font-weight: 400 !important;
  background: transparent !important;
  vertical-align: middle !important;
}

#resultTable tr,
.table tr { background: transparent !important; }

#resultTable tbody tr:hover,
.table tbody tr:hover {
  background: var(--ph-bg-hover) !important;
}

#resultTable tr.totals-row td,
#resultTable tr.totals-row th {
  background: var(--ph-bg-hover) !important;
  font-weight: 600 !important;
}

#resultTable tbody tr td strong,
.table tbody tr td strong {
  color: var(--ph-purple-dark) !important;
}

td a { color: var(--ph-purple) !important; }
/* td a:hover { color: var(--ph-purple-dark) !important; } */

/* ── Forms & Inputs ── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="search"],
select,
textarea,
.chzn-container-single .chzn-single {
  background: var(--ph-bg-white) !important;
  border: 1px solid var(--ph-border) !important;
  color: var(--ph-text) !important;
  border-radius: var(--ph-radius-sm) !important;
  padding: 5px 6px !important;
  box-shadow: none !important;
  font-family: 'Poppins', sans-serif !important;
  font-size: 13px !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
  height: 35px !important;
  min-width: 100px !important;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--ph-purple) !important;
  box-shadow: 0 0 0 3px var(--ph-purple-bg) !important;
  outline: none !important;
}

input::placeholder { color: var(--ph-text-muted) !important; }

.chzn-container .chzn-drop {
  background: var(--ph-bg-white) !important;
  border-color: var(--ph-border) !important;
  border-radius: var(--ph-radius-sm) !important;
  box-shadow: var(--ph-shadow) !important;
}

.chzn-container .chzn-results li { color: var(--ph-text) !important; }
.chzn-container .chzn-results .highlighted { background: var(--ph-purple) !important; }

/* ── Buttons ── */
.btn {
  border-radius: var(--ph-radius-sm) !important;
  font-weight: 600 !important;
  font-size: 13px !important;
  font-family: 'Poppins', sans-serif !important;
  transition: all 0.2s !important;
  text-shadow: none !important;
}

.btn-info, .btn-primary {
  background: var(--ph-purple) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 4px 12px var(--ph-purple-glow) !important;
}

.btn-info:hover, .btn-primary:hover {
  background: var(--ph-purple-dark) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--ph-purple-glow) !important;
}

.btn-success {
  background: var(--ph-success) !important;
  border: none !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(33, 174, 90, 0.25) !important;
}

.btn-success:hover {
  background: #1a9650 !important;
  transform: translateY(-1px);
}

.btn-default, .btn-large.btn-default {
  background: var(--ph-bg-white) !important;
  border: 1px solid var(--ph-border) !important;
  color: var(--ph-text-secondary) !important;
}

.btn-default:hover {
  background: var(--ph-bg-hover) !important;
  color: var(--ph-purple) !important;
  border-color: var(--ph-purple-light) !important;
}

.btn-warning {
  background: var(--ph-warning) !important;
  border: none !important;
  color: #fff !important;
}

.btn-danger {
  background: var(--ph-danger) !important;
  border: none !important;
  color: #fff !important;
}

.btn-outline {
  background: transparent !important;
  border: 1px solid var(--ph-border) !important;
  color: var(--ph-text-secondary) !important;
}

#btn {
  background: var(--ph-success) !important;
  border: none !important;
  color: #fff !important;
  border-radius: var(--ph-radius-sm) !important;
}

#addd, #cccc {
  background: var(--ph-bg-white) !important;
  border: 1px solid var(--ph-border) !important;
  color: var(--ph-text) !important;
  border-radius: var(--ph-radius-sm) !important;
}

#addd:hover, #cccc:hover {
  background: var(--ph-purple-bg) !important;
  color: var(--ph-purple) !important;
}

/* ── Counter badge ── */
#totalProductsBox {
  background: var(--ph-bg-white) !important;
  color: var(--ph-text) !important;
  border: 1px solid var(--ph-border) !important;
  border-radius: var(--ph-radius) !important;
  box-shadow: var(--ph-shadow) !important;
  top: calc(var(--ph-header-h) + 12px) !important;
  right: 24px !important;
  font-size: 14px !important;
}

#totalProductsBox span {
  color: var(--ph-purple) !important;
  font-weight: 700;
}

/* ── Alerts / Status rows ── */
tr.alert-warning,
td.td_set.odd {
  background: rgba(248, 156, 52, 0.12) !important;
  color: var(--ph-warning) !important;
}

td.td_set {
  background: rgba(228, 1, 39, 0.08) !important;
  color: var(--ph-danger) !important;
}

/* ── Facebox modal (modern) ── */
#facebox .popup {
  border: 1px solid var(--ph-border) !important;
}

#facebox .content {
  background: var(--ph-bg-white) !important;
  border: none !important;
  border-radius: var(--ph-radius, 14px) !important;
  color: var(--ph-text) !important;
  box-shadow: var(--ph-shadow-lg, 0 24px 48px rgba(15, 23, 42, 0.18)) !important;
}

#facebox .body { background: var(--ph-bg-white) !important; }

#facebox .content form,
#facebox .content .ph-batch-form,
#facebox .content .ph-facebox-checkout {
  padding: 20px 22px 18px;
}

#facebox .content h4,
#facebox .content .ph-batch-form-header h4 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ph-navy);
}

#facebox .content hr {
  border: none;
  border-top: 1px solid var(--ph-border-light);
  margin: 12px 0 16px;
}

#facebox .content input[type="text"],
#facebox .content input[type="number"],
#facebox .content input[type="date"],
#facebox .content input[type="email"],
#facebox .content input[type="password"],
#facebox .content select,
#facebox .content textarea {
  width: 100% !important;
  max-width: 100% !important;
  height: 38px !important;
  margin: 0 0 10px !important;
  padding: 8px 12px !important;
  font-size: 13px !important;
  border: 1px solid var(--ph-border) !important;
  border-radius: var(--ph-radius-sm, 8px) !important;
  background: var(--ph-bg-white) !important;
  color: var(--ph-text) !important;
  box-sizing: border-box !important;
  box-shadow: none !important;
}

#facebox .content .ph-batch-field input[type="checkbox"],
#facebox .content .ph-batch-field input[type="radio"] {
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: 0 !important;
}

#facebox .content .ph-batch-field textarea {
  height: auto !important;
  min-height: 76px;
}

#facebox .content input:focus,
#facebox .content select:focus,
#facebox .content textarea:focus {
  outline: none !important;
  border-color: var(--ph-purple-light) !important;
  box-shadow: 0 0 0 3px var(--ph-purple-glow) !important;
}

#facebox .content label,
#facebox .content span {
  font-size: 12px;
  color: var(--ph-text-secondary);
}

#facebox .content .btn {
  border-radius: var(--ph-radius-sm, 8px) !important;
  font-weight: 600;
  padding: 8px 16px !important;
}

#facebox .content center {
  text-align: left;
}

#facebox .ph-facebox-checkout #totalBox,
#facebox #totalBox {
  background: var(--ph-purple-bg) !important;
  border: 1px solid var(--ph-border-light) !important;
  border-radius: var(--ph-radius-sm, 8px) !important;
  padding: 12px 14px !important;
  margin: 0 0 14px !important;
  width: 100% !important;
  text-align: left !important;
  font-size: 14px;
}

#facebox .ph-facebox-checkout h4 {
  text-align: center;
}

#facebox .ph-facebox-checkout #changeDisplay {
  font-size: 14px !important;
  margin-bottom: 12px !important;
}

#facebox .suggestionsBox {
  position: relative !important;
  left: 0 !important;
  top: 0 !important;
  width: 100% !important;
  margin-top: -6px;
  margin-bottom: 10px;
  background: var(--ph-navy) !important;
  border-radius: var(--ph-radius-sm, 8px);
  overflow: hidden;
}

#facebox #cashError {
  font-size: 12px !important;
  margin-bottom: 10px !important;
}

#facebox .close {
  background: var(--ph-bg-hover) !important;
  color: var(--ph-text-muted) !important;
}

#facebox .close:hover {
  background: rgba(228, 1, 39, 0.1) !important;
  color: var(--ph-danger) !important;
}

/* ── DataTables ── */
.dataTables_wrapper { color: var(--ph-text-secondary); }
.dataTables_filter input,
.dataTables_length select {
  background: var(--ph-bg-white) !important;
  color: var(--ph-text) !important;
  border: 1px solid var(--ph-border) !important;
  border-radius: var(--ph-radius-sm) !important;
  padding: 6px 10px !important;
  height: auto !important;
}

.ph-invoice-list-toolbar {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.ph-date-filter-form .ph-date-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.ph-date-filter-form .ph-date-field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ph-text-muted);
  margin: 0 0 4px;
}

.ph-date-filter-form .ph-date-field input {
  width: 140px !important;
  height: 34px !important;
  margin: 0 !important;
  padding: 6px 10px !important;
}

.ph-date-filter-form .ph-btn-filter {
  height: 34px;
  margin: 0;
}

.ph-date-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--ph-text-muted);
}

.ph-date-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--ph-purple-bg);
  color: var(--ph-purple);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.ph-date-pill:hover {
  background: var(--ph-purple);
  color: #fff;
  text-decoration: none;
}

.ph-invoice-list-card {
  padding: 0;
  overflow: hidden;
}

.ph-invoice-list-summary {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ph-border-light);
  font-size: 13px;
}

.ph-invoice-table {
  margin: 0 !important;
  border: none !important;
}

.ph-invoice-table thead th {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--ph-text-muted);
  background: var(--ph-bg-hover);
}

.ph-invoice-table tbody td {
  font-size: 12px;
  vertical-align: middle !important;
}

.ph-invoice-row-active td {
  background: var(--ph-purple-bg) !important;
}

.ph-invoice-list-card .dataTables_wrapper {
  padding: 12px 14px 14px;
}

.ph-invoice-detail-card {
  margin-top: 14px;
  padding: 0;
  overflow: hidden;
}

.ph-invoice-detail-card .ph-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--ph-border-light);
}

.ph-invoice-detail-card .ph-card-header h3 {
  margin: 0;
  font-size: 15px;
}

.ph-invoice-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ph-text-secondary);
  border-bottom: 1px solid var(--ph-border-light);
  background: var(--ph-bg-hover);
}

.ph-invoice-detail-footer {
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.ph-invoice-grand-total {
  font-size: 14px;
  color: var(--ph-purple);
}

/* ── Sales Report ── */
.ph-sales-report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.ph-sales-report-stats {
  margin-bottom: 14px;
}

.ph-sales-report-stats .ph-stat-card {
  padding: 14px 16px;
}

.ph-sales-report-stats .ph-stat-value {
  font-size: 22px;
}

.ph-sales-report-summary {
  gap: 16px;
}

.ph-sales-report-summary span {
  font-size: 13px;
}

.ph-sales-report-table tfoot .ph-sales-report-totals th {
  background: var(--ph-bg-hover);
  font-size: 12px;
  color: var(--ph-text);
  border-top: 2px solid var(--ph-border);
}

.ph-sales-report-card .dataTables_wrapper {
  padding: 12px 14px 14px;
}

.ph-report-row-return {
  background: #fffbf0;
}

.ph-report-row-return td {
  color: #9a3412;
}

.ph-report-return-note {
  font-size: 10px;
  color: var(--ph-text-muted, #64748b);
  margin-top: 2px;
  font-weight: 500;
}

.ph-sales-report-totals .ph-report-return-note {
  font-weight: 500;
}

/* ── Expiry register (batch-wise) ── */
.ph-expiry-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ph-expiry-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.ph-expiry-pill.ph-expiry-ok {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a;
}

.ph-expiry-pill.ph-expiry-warning {
  background: rgba(217, 119, 6, 0.15);
  color: #d97706;
}

.ph-expiry-pill.ph-expiry-expired {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}

.ph-expiry-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ph-expiry-badge-ok {
  background: rgba(22, 163, 74, 0.15);
  color: #15803d;
}

.ph-expiry-badge-warning {
  background: rgba(217, 119, 6, 0.18);
  color: #b45309;
}

.ph-expiry-badge-expired {
  background: rgba(220, 38, 38, 0.15);
  color: #b91c1c;
}

.ph-expiry-date {
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-block;
}

.ph-expiry-date-ok {
  background: rgba(22, 163, 74, 0.12);
  color: #16a34a !important;
}

.ph-expiry-date-warning {
  background: rgba(217, 119, 6, 0.15);
  color: #d97706 !important;
}

.ph-expiry-date-expired {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626 !important;
}

.ph-expiry-row-expired td {
  background: rgba(220, 38, 38, 0.04) !important;
}

.ph-expiry-row-warning td {
  background: rgba(217, 119, 6, 0.04) !important;
}


.ph-fifo-badge {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  border: 1px solid transparent;
}

.ph-fifo-badge-ok {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.25);
  color: #15803d;
}

.ph-fifo-badge-warning {
  background: rgba(217, 119, 6, 0.14);
  border-color: rgba(217, 119, 6, 0.3);
  color: #b45309;
}

.ph-fifo-badge-expired {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.28);
  color: #b91c1c;
}

.ph-fifo-badge-empty {
  background: rgba(100, 116, 139, 0.1);
  color: #64748b;
}

.ph-fifo-batch-no {
  font-weight: 800;
  letter-spacing: 0.02em;
}

.ph-fifo-exp {
  opacity: 0.9;
}

.ph-fifo-days,
.ph-fifo-qty {
  font-weight: 500;
  opacity: 0.85;
}

.ph-fifo-active-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.ph-fifo-queue-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
  color: #64748b;
  font-size: 10px;
  font-weight: 700;
}

.ph-fifo-summary-card {
  margin-bottom: 16px;
}

.ph-fifo-summary-card > .ph-fifo-summary-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 0;
  padding: 12px 14px;
  border-bottom: none;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.ph-fifo-summary-card > .ph-fifo-summary-toggle::-webkit-details-marker {
  display: none;
}

.ph-fifo-summary-toggle-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ph-fifo-summary-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(37, 99, 235, 0.12);
  color: #1d4ed8;
}

.ph-fifo-summary-caret {
  margin-left: auto;
  font-size: 12px;
  color: #64748b;
  transition: transform 0.18s ease;
}

.ph-fifo-summary-card[open] > .ph-fifo-summary-toggle {
  margin-bottom: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--ph-border-light);
}

.ph-fifo-summary-card[open] > .ph-fifo-summary-toggle .ph-fifo-summary-caret {
  transform: rotate(180deg);
}

.ph-fifo-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  padding: 12px 14px 16px;
}

.ph-fifo-summary-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(248, 250, 252, 0.8);
}

.ph-fifo-summary-product strong {
  display: block;
  font-size: 13px;
}

.ph-fifo-summary-product span {
  font-size: 11px;
  color: #64748b;
}

.ph-qty-low {
  color: #d97706;
  font-weight: 700;
}

.ph-alert {
  padding: 10px 14px;
  border-radius: var(--ph-radius-sm);
  margin-bottom: 12px;
  font-size: 13px;
}

.ph-alert-success {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.ph-alert-danger {
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.ph-batch-action {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.ph-batch-action-purchase { background: rgba(22, 163, 74, 0.15); color: #15803d; }
.ph-batch-action-sale { background: rgba(220, 38, 38, 0.12); color: #b91c1c; }
.ph-batch-action-return { background: rgba(59, 130, 246, 0.12); color: #1d4ed8; }

.ph-batch-summary-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.ph-batch-stat {
  background: var(--ph-surface, #fff);
  border: 1px solid var(--ph-border, #e2e8f0);
  border-radius: var(--ph-radius, 10px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ph-batch-stat-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ph-text-muted, #64748b);
}

.ph-batch-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--ph-text-primary, #0f172a);
  line-height: 1.1;
}

.ph-batch-stat-in .ph-batch-stat-value { color: #15803d; }
.ph-batch-stat-out .ph-batch-stat-value { color: #b91c1c; }
.ph-batch-stat-ret .ph-batch-stat-value { color: #1d4ed8; }
.ph-batch-stat-left .ph-batch-stat-value { color: #0f766e; }

.ph-batch-qty-sold { color: #b91c1c; font-weight: 600; }
.ph-batch-qty-ok { color: #15803d; font-weight: 700; }
.ph-batch-qty-low { color: #b45309; font-weight: 700; }
.ph-batch-qty-zero { color: #94a3b8; font-weight: 600; }

.ph-batch-totals-foot th {
  background: var(--ph-surface-2, #f8fafc) !important;
  font-weight: 800 !important;
  border-top: 2px solid var(--ph-border, #e2e8f0) !important;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .ph-batch-summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .ph-batch-summary-stats {
    grid-template-columns: 1fr 1fr;
  }
  .ph-batch-stat-value {
    font-size: 18px;
  }
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ph-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--ph-purple-light); }

/* ── Login page overrides ── */
body.ph-login-page {
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--ph-bg) !important;
}

/* ── Page layout helpers ── */
.ph-page-subtitle {
  color: var(--ph-text-muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.ph-breadcrumb {
  margin-bottom: 14px;
}

.ph-page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.ph-products-stats {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ph-stat-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--ph-surface-2);
  border: 1px solid var(--ph-border);
}

.ph-stat-pill.green { color: #15803d; background: rgba(22, 163, 74, 0.1); border-color: rgba(22, 163, 74, 0.2); }
.ph-stat-pill.warn { color: #b45309; background: rgba(217, 119, 6, 0.12); border-color: rgba(217, 119, 6, 0.25); }

.ph-products-table-card,
.ph-invoice-print-card {
  padding: 0;
  overflow: hidden;
}

.ph-products-table-card .dataTables_wrapper,
.ph-products-table-card table {
  margin: 0 !important;
}

/* ── Invoice print document ── */
.ph-print-invoice {
  padding: 24px;
  background: #fff;
  color: #1e1b4b;
  font-size: 13px;
}

.ph-print-invoice-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--ph-purple-light);
}

.ph-print-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.ph-print-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ph-purple), #7c3aed);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
}

.ph-print-brand h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ph-print-tagline {
  margin: 2px 0 0;
  color: #64748b;
  font-size: 12px;
}

.ph-print-meta table {
  font-size: 12px;
}

.ph-print-meta th {
  text-align: left;
  padding: 3px 10px 3px 0;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}

.ph-print-meta td {
  padding: 3px 0;
  font-weight: 500;
}

.ph-print-barcode-block {
  text-align: center;
  min-width: 120px;
}

.ph-invoice-barcode-svg {
  max-width: 180px;
  height: auto;
}

.ph-invoice-qr {
  display: inline-block;
  margin-top: 6px;
}

/* qrcodejs outputs canvas + img; keep a single visible QR */
.ph-invoice-qr canvas {
  display: none !important;
}

.ph-invoice-qr img {
  display: block;
}

.ph-print-scan-hint {
  margin: 6px 0 0;
  font-size: 10px;
  color: #94a3b8;
}

.ph-print-lines {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ph-print-lines th,
.ph-print-lines td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.ph-print-lines thead th {
  background: #f8fafc;
  font-weight: 700;
  color: #475569;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ph-print-lines tfoot td {
  font-weight: 600;
  border-bottom: none;
  padding-top: 4px;
  padding-bottom: 4px;
}

.ph-print-lines tr.ph-print-grand td {
  font-size: 14px;
  padding-top: 10px;
  color: var(--ph-purple);
}

.ph-print-footer-note {
  margin-top: 18px;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
}

.ph-preview-barcode-mini {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--ph-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ph-preview-barcode-mini .ph-invoice-barcode-svg {
  max-width: 140px;
}

.ph-preview-barcode-mini .ph-invoice-qr img {
  width: 56px !important;
  height: 56px !important;
}

.ph-print-invoice-compact {
  font-size: 11px;
  padding: 12px;
}

body.ph-print-page {
  background: #fff !important;
  margin: 0;
  padding: 12px;
}

.ph-fast-grid--pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 5px 6px;
  max-height: none;
  overflow: visible;
  padding: 0 0 2px;
}

.ph-fast-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 3px 8px 3px 4px;
  border: 1px solid var(--ph-border);
  border-radius: 999px;
  background: var(--ph-bg-white);
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.ph-fast-pill:hover:not(.is-stockout) {
  border-color: var(--ph-purple-light);
  background: var(--ph-purple-bg);
  box-shadow: 0 2px 8px rgba(130, 123, 242, 0.15);
  transform: translateY(-1px);
}

.ph-fast-pill:active:not(.is-stockout) {
  transform: translateY(0);
}

.ph-fast-pill.is-stockout {
  opacity: 0.72;
  background: rgba(228, 1, 39, 0.06);
  border-color: rgba(228, 1, 39, 0.28);
  cursor: not-allowed;
}

.ph-fast-pill.ph-stockout-flash {
  animation: ph-stockout-pulse 0.55s ease 2;
  opacity: 1;
}

.ph-fast-pill-key {
  flex-shrink: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--ph-purple);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.ph-fast-pill.is-stockout .ph-fast-pill-key {
  background: var(--ph-danger);
}

.ph-fast-pill-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--ph-text-primary);
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ph-fast-pill-badge {
  flex-shrink: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ph-bg-hover);
  border: 1px solid var(--ph-border-light);
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  color: var(--ph-text-secondary);
}

.ph-fast-pill-badge.is-out {
  background: rgba(228, 1, 39, 0.1);
  border-color: rgba(228, 1, 39, 0.25);
  color: var(--ph-danger);
}

.ph-fast-grid-empty {
  flex: 0 0 auto;
  width: 100%;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--ph-text-muted);
  text-align: center;
  border: 1px dashed rgba(130, 123, 242, 0.25);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.65);
}

/* ── Global search (Ctrl+K) ── */
.ph-search-kbd {
  position: absolute;
  right: 12px;
  top: 39%;
  transform: translateY(-50%);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--ph-border);
  background: var(--ph-surface);
  color: var(--ph-text-muted);
  pointer-events: none;
}

#globalSearch {
  cursor: pointer;
  padding-right: 72px !important;
  padding-left: 40px !important;
}

.ph-global-search-modal {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 20px 20px;
}

.ph-global-search-modal.is-open {
  display: flex;
}

.ph-global-search-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.ph-global-search-panel {
  position: relative;
  width: 100%;
  max-width: 620px;
  background: var(--ph-surface, #fff);
  border-radius: 12px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--ph-border);
  overflow: hidden;
}

.ph-global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--ph-border-light);
}

.ph-global-search-input-wrap i {
  color: var(--ph-text-muted);
}

.ph-global-search-input-wrap input {
  flex: 1;
  border: none !important;
  box-shadow: none !important;
  font-size: 15px !important;
  padding: 8px 0 !important;
  background: transparent !important;
}

.ph-global-search-input-wrap kbd {
  font-size: 10px;
  padding: 3px 6px;
  border-radius: 4px;
  border: 1px solid var(--ph-border);
  color: var(--ph-text-muted);
}

.ph-global-search-results {
  max-height: 360px;
  overflow-y: auto;
}

.ph-global-search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ph-border-light);
  cursor: pointer;
}

.ph-global-search-item:hover,
.ph-global-search-item.is-active {
  background: rgba(99, 102, 241, 0.08);
}

.ph-global-search-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ph-purple-bg);
  color: var(--ph-purple);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ph-global-search-text {
  flex: 1;
  min-width: 0;
}

.ph-global-search-title {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ph-text-primary);
}

.ph-global-search-sub {
  display: block;
  font-size: 11px;
  color: var(--ph-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ph-global-search-meta {
  font-size: 10px;
  font-weight: 600;
  color: var(--ph-purple);
  text-transform: uppercase;
}

.ph-global-search-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--ph-text-muted);
}

.ph-global-search-footer {
  display: flex;
  gap: 14px;
  padding: 10px 16px;
  font-size: 10px;
  color: var(--ph-text-muted);
  background: var(--ph-surface-2);
  border-top: 1px solid var(--ph-border-light);
}

.ph-global-search-footer kbd {
  font-size: 9px;
  padding: 1px 4px;
  border: 1px solid var(--ph-border);
  border-radius: 3px;
  margin-right: 4px;
}

body.ph-global-search-open {
  overflow: hidden;
}

/* Alt-key quick-add awareness */
.ph-fast-add-dock__head.is-alt-active {
  background: linear-gradient(180deg, rgba(130, 123, 242, 0.22) 0%, rgba(130, 123, 242, 0.1) 100%) !important;
  box-shadow: inset 0 0 0 2px var(--ph-purple);
  animation: ph-alt-pulse 0.9s ease infinite;
}

@keyframes ph-alt-pulse {
  0%, 100% { box-shadow: inset 0 0 0 2px var(--ph-purple); }
  50% { box-shadow: inset 0 0 0 2px var(--ph-purple), 0 0 12px rgba(130, 123, 242, 0.45); }
}

.ph-fast-add-dock__head.is-alt-active .ph-fast-add-dock__hint {
  color: var(--ph-purple-dark);
  font-weight: 700;
}

/* Checkout modal */
.ph-checkout-form { max-width: max(75vw, 350px);  }
.ph-checkout-total-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--ph-purple-bg);
  border: 1px solid rgba(130, 123, 242, 0.2);
}
.ph-checkout-total-card strong { font-size: 22px; color: var(--ph-navy); }
.ph-checkout-total-card small { color: var(--ph-text-muted); font-size: 11px; }
.ph-checkout-customer-row { display: flex; gap: 8px; align-items: center; }
.ph-checkout-customer-row input { flex: 1; }
.ph-checkout-suggestions {
  position: relative;
  margin-top: 4px;
}
.ph-checkout-suggestions ul {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--ph-navy);
  border-radius: 8px;
  overflow: hidden;
  max-height: 160px;
  overflow-y: auto;
}
.ph-checkout-suggestions li {
  padding: 8px 10px;
  color: #fff;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 12px;
}
.ph-checkout-suggestions li:hover { background: var(--ph-purple); }
.ph-checkout-suggestions li small { opacity: 0.75; margin-left: 6px; }
.ph-checkout-instant {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ph-bg-hover);
  border: 1px dashed var(--ph-border);
}
.ph-checkout-instant .ph-batch-field { flex: 1; min-width: 140px; margin: 0; }
.ph-checkout-walkin-hint { font-weight: 400; text-transform: none; font-size: 10px; color: var(--ph-text-muted); }
.ph-checkout-credit-note { font-size: 12px; color: var(--ph-purple-dark); margin: 0 0 12px; }
.ph-checkout-credit-block {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px dashed rgba(217, 119, 6, 0.45);
  background: rgba(217, 119, 6, 0.06);
}
.ph-checkout-credit-divider {
  text-align: center;
  margin: 4px 0 14px;
  font-size: 11px;
  color: var(--ph-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ph-checkout-credit-divider span {
  display: inline-block;
  padding: 0 10px;
  background: rgba(217, 119, 6, 0.06);
  position: relative;
}
.ph-checkout-credit-btn { width: 100%; margin-top: 4px; }

.ph-checkout-ledger-panel {
  margin: 12px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.22);
  background: rgba(124, 58, 237, 0.05);
}
.ph-checkout-ledger-head {
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--ph-purple-dark);
}
.ph-checkout-ledger-balances {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.ph-checkout-ledger-balances > div {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border-light);
  font-size: 11px;
}
.ph-checkout-ledger-balances span { display: block; color: var(--ph-text-muted); margin-bottom: 2px; }
.ph-checkout-ledger-balances strong { font-size: 13px; color: var(--ph-navy); }
.ph-checkout-ledger-after strong { color: #b45309; }
.ph-checkout-credit-warn {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  font-size: 12px;
  line-height: 1.4;
}
.ph-checkout-credit-analytics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(124, 58, 237, 0.15);
}
.ph-checkout-credit-analytics > div {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--ph-border-light);
  font-size: 11px;
}
.ph-checkout-credit-analytics span { display: block; color: var(--ph-text-muted); margin-bottom: 2px; }
.ph-checkout-credit-analytics strong { font-size: 12px; color: var(--ph-navy); }

.ph-checkout-error { color: var(--ph-danger); font-size: 12px; }
.ph-checkout-change-row { font-size: 14px; margin-bottom: 12px; }
.ph-checkout-short { color: var(--ph-danger); }
.ph-checkout-change { color: var(--ph-success); }

/* Customer profiles */
.ph-customer-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--ph-border-light);
}
.ph-customer-profile-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}
@media (max-width: 900px) {
  .ph-customer-profile-grid { grid-template-columns: 1fr; }
}
.ph-customer-profile-card {
  text-align: center;
  padding: 20px 16px !important;
}
.ph-customer-profile-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--ph-purple-bg);
  margin-bottom: 12px;
}
.ph-customer-profile-dl {
  text-align: left;
  margin: 14px 0 0;
  font-size: 12px;
}
.ph-customer-profile-dl dt {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--ph-text-muted);
  margin-top: 8px;
}
.ph-customer-profile-dl dd { margin: 2px 0 0; font-weight: 500; }
.ph-customer-credit-box {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--ph-purple-bg);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 6px 12px;
  font-size: 12px;
}
.ph-customer-credit-box small {
  flex: 1 1 100%;
  display: block;
}
.ph-customer-credit-due { background: #fff4e5; border: 1px solid #f0c36d; }
.ph-customer-credit-advance { background: #e8f5e9; border: 1px solid #81c784; }

.ph-ledger-table-wrap {
  overflow-x: auto;
  max-height: 520px;
  overflow-y: auto;
}
.ph-ledger-table { margin-bottom: 0; font-size: 12px; }
.ph-ledger-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--ph-bg-white, #fff);
  box-shadow: 0 1px 0 var(--ph-border, #ddd);
}
.ph-ledger-seq { color: var(--ph-text-muted); width: 36px; text-align: center; }
.ph-ledger-detail { font-size: 11px; color: var(--ph-text-muted); max-width: 200px; }
.ph-ledger-inv-return { display: block; font-weight: 600; }
.ph-ledger-inv-ref { display: block; color: var(--ph-text-muted); font-size: 11px; }
.ph-ledger-row-return { background: #fffbf0; }
.ph-ledger-row-wapsi { background: #fffbf0; }
.ph-ledger-row-return .ph-ledger-baqi { font-weight: 600; }
.ph-ledger-foot td { background: var(--ph-purple-bg, #f3e8ff); font-size: 12px; }
.ph-ledger-summary-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 10px 0 0;
  padding: 0;
  font-size: 11px;
}
.ph-ledger-summary-dl div { display: flex; justify-content: space-between; gap: 8px; }
.ph-ledger-summary-dl dt { margin: 0; color: var(--ph-text-muted); font-weight: 500; }
.ph-ledger-summary-dl dd { margin: 0; font-weight: 600; }
.ph-badge-muted { background: #eceff1; color: #546e7a; }
.ph-customer-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 50;
  background: var(--ph-bg-white);
  border: 1px solid var(--ph-border);
  border-radius: 8px;
  box-shadow: var(--ph-shadow-lg);
  max-height: 180px;
  overflow-y: auto;
  display: none;
}
.ph-meta-customer { position: relative; }
.ph-customer-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ph-border-light);
  cursor: pointer;
}
.ph-customer-suggest-item:hover { background: var(--ph-purple-bg); }
.ph-customer-suggest-item.active,
.ph-customer-suggest-item.active:hover {
  background: var(--ph-purple);
  color: #fff;
}
.ph-customer-suggest-item.active span { color: rgba(255,255,255,0.85); }
.ph-customer-suggest-item strong { display: block; font-size: 12px; }
.ph-customer-suggest-item span { font-size: 10px; color: var(--ph-text-muted); }

.ph-checkout-kbd-hint {
  margin: 6px 0 0;
  font-size: 11px;
  color: var(--ph-text-muted);
}
.ph-checkout-kbd-hint kbd {
  display: inline-block;
  padding: 1px 5px;
  margin: 0 2px;
  border-radius: 4px;
  border: 1px solid var(--ph-border);
  background: var(--ph-bg-white);
  font-size: 10px;
  font-family: inherit;
}
.ph-checkout-customer-wrap { position: relative; }

.ph-return-summary-card { margin-bottom: 14px; }
.ph-return-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px 16px;
  padding: 14px 16px;
}
.ph-return-summary-grid strong { display: block; font-size: 14px; margin-top: 2px; }
.ph-return-fully-msg {
  margin: 0;
  padding: 10px 16px 14px;
  color: #15803d;
  font-size: 13px;
  border-top: 1px solid var(--ph-border-light);
}
.ph-return-table input[type=number] { text-align: center; }
.ph-return-batches {
  margin-top: 6px;
}
.ph-return-batch-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.ph-return-batch-list li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ph-return-totals {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--ph-purple-bg);
  display: grid;
  gap: 6px;
  max-width: 360px;
}
.ph-return-totals > div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}
.ph-return-total-row {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  font-size: 15px !important;
}
.ph-return-form-actions {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.ph-badge-warn {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}
.ph-badge-green {
  background: rgba(22, 163, 74, 0.15);
  color: #15803d;
}

@media print {
  .ph-print-invoice {
    padding: 0;
  }
  .ph-print-invoice-header {
    page-break-inside: avoid;
  }
}

/* ============================================================
   Excel-like Minimal UI Overrides (Global)
   Flatter tables/forms/buttons and reduced material styling
   ============================================================ */
body {
  font-family: "Segoe UI", Tahoma, Arial, sans-serif !important;
}

.ph-card,
.ph-stat-card,
#mainmain a,
.ph-products-kpi,
.ph-products-grid-card,
.ph-products-grid-head {
  border-radius: 2px !important;
  box-shadow: none !important;
}

#mainmain a:hover,
.btn:hover,
.btn:focus {
  transform: none !important;
  box-shadow: none !important;
}

/* Global table simplification */
#resultTable,
.table,
table.table,
.ph-line-table,
.ph-ledger-table,
.ph-invoice-table,
.ph-return-table {
  border-radius: 0 !important;
  box-shadow: none !important;
  border: 1px solid #d6dbe3 !important;
  border-collapse: collapse !important;
  background: #fff !important;
}

#resultTable thead tr th,
.table thead tr th,
.table-bordered thead tr th,
.ph-line-table th,
.ph-ledger-table thead th,
.ph-invoice-table thead th,
.ph-return-table thead th {
  background: #f3f4f6 !important;
  color: #334155 !important;
  border: 1px solid #d6dbe3 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  padding: 7px 8px !important;
}

#resultTable tbody tr td,
.table tbody tr td,
.table-bordered tbody tr td,
.ph-line-table td,
.ph-ledger-table td,
.ph-invoice-table tbody td,
.ph-return-table td {
  border: 1px solid #e3e7ee !important;
  padding: 6px 8px !important;
  font-size: 12px !important;
  vertical-align: middle !important;
}

#resultTable tbody tr:hover,
.table tbody tr:hover,
.ph-line-table tbody tr:hover,
.ph-ledger-table tbody tr:hover {
  background: #f8fafc !important;
}

/* DataTables controls: simple and spreadsheet-like */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border-radius: 0 !important;
  box-shadow: none !important;
  border: 1px solid #cfd6e0 !important;
  background: #fff !important;
  height: 30px !important;
  font-size: 12px !important;
}

.dataTables_wrapper .dataTables_filter input:focus,
.dataTables_wrapper .dataTables_length select:focus {
  border-color: #94a3b8 !important;
  box-shadow: none !important;
}

/* Forms and inputs flattened */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="search"],
select,
textarea,
.chzn-container-single .chzn-single {
  border-radius: 0 !important;
  box-shadow: none !important;
  border: 1px solid #cfd6e0 !important;
  height: 32px !important;
  font-size: 12px !important;
  
}

.ph-meta-strip .ph-disc-inline input[type="number"],
.ph-meta-strip input, .ph-meta-strip select {
  margin: 0 !important;
}


textarea {
  height: auto !important;
  min-height: 70px;
}

input:focus,
select:focus,
textarea:focus,
.chzn-container-single .chzn-single:focus {
  box-shadow: none !important;
  border-color: #94a3b8 !important;
}

/* Buttons: flat and compact */
.btn,
.btn-info,
.btn-primary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-default,
.btn-outline {
  border-radius: 0 !important;
  box-shadow: none !important;
  text-shadow: none !important;
  font-weight: 500 !important;
  padding: 4px 10px !important;
  border-width: 1px !important;
}

.btn-info,
.btn-primary {
  background: #4f46e5 !important;
  border-color: #4338ca !important;
}

.btn-success {
  background: #15803d !important;
  border-color: #166534 !important;
}

.btn-warning {
  background: #b45309 !important;
  border-color: #92400e !important;
}

.btn-danger {
  background: #b91c1c !important;
  border-color: #991b1b !important;
}

.btn-default,
.btn-outline {
  background: #fff !important;
  color: #334155 !important;
  border-color: #cfd6e0 !important;
}

/* Badges/chips less pill-heavy */
.ph-badge,
.ph-stat-pill,
.ph-stock-indicator,
.ph-payment-badge {
  border-radius: 2px !important;
}

/* Dashboard visual upgrade */
.ph-dashboard-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.ph-dashboard-kpi {
  background: #fff;
  border: 1px solid #d8dde6;
  padding: 12px;
}

.ph-dashboard-kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  color: #64748b;
}

.ph-dashboard-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.ph-dashboard-kpi-value {
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  color: #0f172a;
}

.ph-dashboard-kpi-foot {
  margin-top: 7px;
  font-size: 12px;
  color: #64748b;
}

.ph-dashboard-insight-grid {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 12px;
}

.ph-dashboard-insight-card {
  padding: 12px;
}

.ph-dashboard-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 8px 0 4px;
  font-size: 12px;
}

.ph-dashboard-metric-label { color: #64748b; }
.ph-dashboard-metric-value {
  font-weight: 700;
  color: #0f172a;
}

.ph-dashboard-progress {
  height: 8px;
  border: 1px solid #d8dde6;
  background: #f8fafc;
}

.ph-dashboard-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #6366f1);
}

.ph-dashboard-mini-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ph-dashboard-mini-grid > div {
  border: 1px solid #e2e8f0;
  padding: 8px;
  background: #fff;
}

.ph-dashboard-mini-grid small {
  display: block;
  color: #64748b;
  font-size: 11px;
}

.ph-dashboard-mini-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  color: #0f172a;
}

@media (max-width: 1100px) {
  .ph-dashboard-insight-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Public invoice A4 bill (customers, no print) ── */
body.ph-public-invoice-body {
  margin: 0 !important;
  padding: 0 !important;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top left, rgba(130, 123, 242, 0.10), transparent 45%),
    var(--ph-bg) !important;
  overflow-x: hidden;
}

.ph-public-bill-wrap {
  width: 100%;
  margin: 0 auto;
  padding: 12px 8px 40px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
}

.ph-public-a4-page {
  width: 210mm;
  min-height: 297mm;
  max-width: 210mm;
  background: #fff;
  box-shadow: var(--ph-shadow-lg);
  box-sizing: border-box;
  padding: 12mm;
  flex-shrink: 0;
  transform-origin: top center;
}

.ph-public-a4-page .ph-print-invoice {
  padding: 0;
  width: 100%;
}

/* Keep desktop A4 header layout on all screen sizes */
.ph-public-a4-page .ph-print-invoice-header {
  display: grid !important;
  grid-template-columns: 1fr auto auto !important;
  gap: 16px !important;
  align-items: start !important;
}

.ph-public-a4-page .ph-print-barcode-block {
  min-width: 130px;
}

.ph-public-a4-page .ph-invoice-qr {
  display: inline-block !important;
  margin-top: 8px;
  min-width: 88px;
  min-height: 88px;
}

/* qrcodejs renders both canvas + img; show only one */
.ph-public-a4-page .ph-invoice-qr canvas {
  display: none !important;
}

.ph-public-a4-page .ph-invoice-qr img {
  width: 88px !important;
  height: 88px !important;
  display: block !important;
}

.ph-public-a4-page .ph-invoice-barcode-svg {
  max-width: 200px;
  height: auto;
}

.ph-public-a4-page .ph-print-lines {
  table-layout: fixed;
  width: 100%;
}

.ph-public-bill-empty {
  width: min(480px, 100%);
  background: #fff;
  border: 1px solid var(--ph-border);
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  color: var(--ph-text-secondary);
  box-shadow: var(--ph-shadow);
}

/* Customers cannot print this public view */
@media print {
  body.ph-public-invoice-body * {
    display: none !important;
  }
  body.ph-public-invoice-body::after {
    display: block !important;
    content: "Printing is not available for customer invoice links.";
    padding: 40px;
    font-size: 16px;
    text-align: center;
  }
}

/* ============================================================
   System-wide responsive layout
   ============================================================ */

.ph-nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ph-border);
  border-radius: 10px;
  background: var(--ph-bg);
  color: var(--ph-text-secondary);
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 16px;
  line-height: 1;
}

.ph-nav-toggle:hover,
.ph-nav-toggle:focus {
  background: var(--ph-purple-bg);
  color: var(--ph-purple);
  border-color: var(--ph-purple-light);
  outline: none;
}

.ph-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1035;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

body.ph-nav-open .ph-sidebar-backdrop,
body.ph-nav-open .ph-sidebar-backdrop[hidden] {
  display: block !important;
}

.ph-table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 1100px) {
  :root {
    --ph-sidebar-w: 260px;
  }

  body {
    padding-left: 0 !important;
  }

  #sidebar {
    transform: translateX(-105%) !important;
    transition: transform 0.22s ease !important;
    box-shadow: var(--ph-shadow-lg) !important;
  }

  body.ph-nav-open #sidebar {
    transform: translateX(0) !important;
  }

  .ph-topbar {
    left: 0;
    padding: 0 14px;
    gap: 10px;
  }

  .ph-nav-toggle {
    display: inline-flex;
  }

  .span10,
  .content-area,
  .ph-content {
    padding: 16px 14px 28px !important;
  }

  .container-fluid {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .ph-page-header {
    margin-bottom: 14px;
  }

  .contentheader,
  .ph-page-title {
    font-size: 18px;
  }

  .ph-stats-row {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
  }

  .ph-stat-card {
    padding: 14px;
  }

  .ph-stat-value {
    font-size: 20px;
  }

  #mainmain {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
    gap: 10px !important;
  }

  .ph-card {
    padding: 14px;
  }

  .ph-user-info {
    display: none;
  }

  .ph-user-chip {
    padding: 4px;
  }

  .ph-topbar-actions > span {
    display: none;
  }

  .ph-search-kbd {
    display: none;
  }

  /* Sale screen */
  .ph-sale-toolbar {
    gap: 6px;
  }

  .ph-sale-toolbar .ph-barcode-input,
  .ph-barcode-wrap {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }

  .ph-product-search-wrap {
    flex: 1 1 100%;
    min-width: 0;
  }

  .ph-meta-strip {
    flex-direction: column;
    align-items: stretch;
  }

  .ph-meta-strip .ph-meta-item,
  .ph-meta-strip .ph-meta-customer,
  .ph-meta-strip .ph-meta-pay,
  .ph-meta-strip .ph-disc-inline {
    flex: 1 1 100%;
    min-width: 0;
    width: 100%;
  }

  .ph-invoice-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .ph-invoice-footer .btn,
  .ph-invoice-footer a {
    width: 100%;
  }

  .ph-invoice-footer a .btn {
    width: 100%;
  }

  .ph-lines-card,
  .ph-invoice-list-card,
  .ph-products-table-card,
  .ph-sales-report-card,
  .ph-card {
    overflow-x: auto;
  }

  .ph-line-table {
    min-width: 520px;
  }

  .ph-date-filter-form .ph-date-field input {
    width: 100% !important;
    max-width: 100%;
  }

  .ph-date-filter-form .ph-date-field {
    flex: 1 1 140px;
  }

  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_length {
    float: none;
    text-align: left;
    width: 100%;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box;
  }
}

@media (max-width: 700px) {
  .ph-topbar {
    height: 60px;
    padding: 0 10px;
  }

  body {
    padding-top: 60px !important;
  }

  :root {
    --ph-header-h: 60px;
  }

  .ph-search-wrap {
    max-width: none;
  }

  .ph-search-wrap input {
    padding: 8px 12px 8px 36px !important;
    font-size: 12px !important;
  }

  .ph-topbar-icon {
    width: 36px;
    height: 36px;
  }

  #mainmain {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .ph-stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .ph-sale-toolbar .ph-btn-add {
    flex: 1 1 auto;
  }

  .ph-footer-total {
    font-size: 15px;
    text-align: center;
  }

  .ph-return-form-actions,
  .ph-sales-report-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ph-return-form-actions .btn,
  .ph-sales-report-actions .btn {
    width: 100%;
  }

  .ph-ledger-summary-dl {
    grid-template-columns: 1fr;
  }

  .ph-global-search-panel {
    margin: 8px;
    width: calc(100% - 16px);
    max-width: none;
  }
}

@media (max-width: 480px) {
  .ph-stats-row {
    grid-template-columns: 1fr;
  }

  .ph-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  .ph-line-table {
    min-width: 460px;
    font-size: 11px;
  }

  .ph-qty-wrap input,
  .ph-disc-wrap input,
  .js-line-qty,
  .js-line-discount {
    width: 42px !important;
  }
}
