/*
Theme Name:  Pharmacy Management Theme
Theme URI:   https://example.com
Description: ফার্মেসি ম্যানেজমেন্ট সিস্টেম থিম | Pharmacy Management System Theme
Version:     1.0.0
Author:      Pharmacy Dev
Text Domain: pharmacy-mgmt
*/

/* ===== CSS VARIABLES ===== */
:root {
  /* Green palette */
  --green-900: #1B5E20;
  --green-800: #2E7D32;
  --green-700: #388E3C;
  --green-600: #43A047;
  --green-500: #4CAF50;
  --green-200: #A5D6A7;
  --green-100: #C8E6C9;
  --green-50:  #E8F5E9;

  /* Status colors */
  --red-700:    #C62828;
  --red-500:    #F44336;
  --red-100:    #FFCDD2;
  --yellow-500: #FF9800;
  --yellow-100: #FFF3E0;
  --blue-700:   #1565C0;
  --blue-500:   #2196F3;
  --blue-100:   #BBDEFB;

  /* Grays */
  --gray-900: #212121;
  --gray-700: #616161;
  --gray-500: #9E9E9E;
  --gray-400: #BDBDBD;
  --gray-300: #E0E0E0;
  --gray-200: #EEEEEE;
  --gray-100: #F5F5F5;
  --gray-50:  #FAFAFA;
  --white:    #FFFFFF;

  /* Neumorphism — light theme */
  --neuro-bg:        #e0e5ec;
  --neuro-dark:      #b8bec7;
  --neuro-light:     #ffffff;
  --neuro-raised:    6px 6px 14px #b8bec7, -6px -6px 14px #ffffff;
  --neuro-raised-sm: 4px 4px 8px  #b8bec7, -4px -4px 8px  #ffffff;
  --neuro-inset:     inset 4px 4px 8px #b8bec7, inset -4px -4px 8px #ffffff;
  --neuro-inset-sm:  inset 2px 2px 5px #b8bec7, inset -2px -2px 5px #ffffff;

  /* Neumorphism — green sidebar theme */
  --neuro-green-base:   #236929;
  --neuro-green-raised: 4px 4px 10px rgba(0,0,0,0.35), -3px -3px 8px rgba(255,255,255,0.1);
  --neuro-green-inset:  inset 3px 3px 8px rgba(0,0,0,0.4), inset -3px -3px 6px rgba(255,255,255,0.08);

  --sidebar-width: 260px;
  --topbar-height: 60px;
  --shadow:    var(--neuro-raised);
  --radius:    12px;
  --radius-sm: 8px;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  font-family: 'Hind Siliguri', 'Segoe UI', system-ui, sans-serif;
  background: var(--neuro-bg);
  color: var(--gray-900);
  line-height: 1.6;
}
a { color: var(--green-800); text-decoration: none; }
a:hover { color: var(--green-600); }
img { max-width: 100%; }

/* ===== LAYOUT ===== */
.pm-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.pm-sidebar {
  width: var(--sidebar-width);
  background: var(--neuro-green-base);
  color: var(--white);
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  box-shadow: 6px 0 24px rgba(0,0,0,0.35);
}
.pm-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 999;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.pm-sidebar-backdrop.show { display: block; }
.pm-sidebar-logo {
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  text-align: center;
}
.pm-sidebar-logo h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1.3;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}
.pm-sidebar-logo span {
  font-size: 0.85rem;
  font-weight: 700;
  color: #FF5252;
  background: rgba(0,0,0,0.35);
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  margin-top: 6px;
  letter-spacing: 0.3px;
}
.pm-sidebar-logo-img {
  display: block;
  width: 84px;
  height: 84px;
  object-fit: contain;
  margin: 0 auto 8px;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}

.pm-sidebar nav { padding: 12px 0; flex: 1; }
.pm-sidebar nav ul { list-style: none; padding: 0 8px; }
.pm-sidebar nav ul li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  color: rgba(255,255,255,0.8);
  font-size: 0.9rem;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: box-shadow 0.2s, color 0.2s, background 0.2s;
}
.pm-sidebar nav ul li a:hover {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  box-shadow: var(--neuro-green-raised);
}
.pm-sidebar nav ul li a.active {
  background: rgba(0,0,0,0.22);
  color: var(--white);
  box-shadow: var(--neuro-green-inset);
  font-weight: 600;
}
.pm-sidebar nav ul li a .nav-icon { font-size: 1.1rem; width: 20px; text-align: center; }
.pm-sidebar nav ul li a .badge {
  margin-left: auto;
  background: var(--red-500);
  color: #fff;
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
}
.pm-sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.8rem;
  color: var(--green-100);
}
.pm-sidebar-footer a { color: var(--green-100); }

/* ===== TOPBAR ===== */
.pm-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--neuro-bg);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 99;
  gap: 16px;
  box-shadow: 0 4px 10px var(--neuro-dark), 0 -2px 4px var(--neuro-light);
}
.pm-topbar-title { font-size: 1rem; font-weight: 600; flex: 1; color: var(--gray-900); }
.pm-topbar-user { font-size: 0.85rem; color: var(--gray-700); }
.pm-topbar-user strong { color: var(--green-800); }

/* ===== MAIN CONTENT ===== */
.pm-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 24px;
  min-height: calc(100vh - var(--topbar-height));
  flex: 1;
  /* A flex item defaults to min-width:auto, so a wide table made the whole content area wider
     than the screen and pushed buttons/columns off the right edge. 0 lets .pm-table-wrap scroll. */
  min-width: 0;
  background: var(--neuro-bg);
}

/* ===== PAGE HEADER ===== */
.pm-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}
.pm-page-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--green-900);
}

/* ===== STAT CARDS ===== */
.pm-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.pm-stat-card {
  background: var(--neuro-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--neuro-raised);
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.pm-stat-card .stat-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
  box-shadow: var(--neuro-raised-sm);
}
.pm-stat-card .stat-body {}
.pm-stat-card .stat-label { font-size: 0.78rem; color: var(--gray-500); margin-bottom: 4px; }
.pm-stat-card .stat-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.pm-stat-card .stat-sub   { font-size: 0.76rem; color: var(--gray-500); margin-top: 2px; }

.stat-green  .stat-icon { background: var(--green-50);   color: var(--green-700); }
.stat-blue   .stat-icon { background: var(--blue-100);   color: var(--blue-500); }
.stat-yellow .stat-icon { background: var(--yellow-100); color: var(--yellow-500); }
.stat-red    .stat-icon { background: var(--red-100);    color: var(--red-500); }

/* ===== CARD ===== */
.pm-card {
  background: var(--neuro-bg);
  border-radius: var(--radius);
  box-shadow: var(--neuro-raised);
}
.pm-card-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pm-card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--green-900); }
.pm-card-body { padding: 20px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: box-shadow 0.15s, transform 0.1s;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover  { transform: translateY(-1px); opacity: 0.92; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary   { background: var(--green-700);  color: #fff; box-shadow: 4px 4px 10px rgba(56,142,60,0.45),   -3px -3px 8px rgba(255,255,255,0.25); }
.btn-secondary { background: var(--neuro-bg);   color: var(--gray-900); box-shadow: var(--neuro-raised-sm); }
.btn-success   { background: var(--green-500);  color: #fff; box-shadow: 4px 4px 10px rgba(76,175,80,0.45),   -3px -3px 8px rgba(255,255,255,0.25); }
.btn-danger    { background: var(--red-500);    color: #fff; box-shadow: 4px 4px 10px rgba(244,67,54,0.45),   -3px -3px 8px rgba(255,255,255,0.25); }
.btn-warning   { background: var(--yellow-500); color: #fff; box-shadow: 4px 4px 10px rgba(255,152,0,0.45),   -3px -3px 8px rgba(255,255,255,0.25); }
.btn-info      { background: var(--blue-500);   color: #fff; box-shadow: 4px 4px 10px rgba(33,150,243,0.45),  -3px -3px 8px rgba(255,255,255,0.25); }
.btn-outline   { background: var(--neuro-bg); border: 1.5px solid var(--green-700); color: var(--green-700); box-shadow: var(--neuro-raised-sm); }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-lg { padding: 11px 22px; font-size: 0.95rem; }

/* ===== FORMS ===== */
.pm-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--gray-700);
}
.form-group label .required { color: var(--red-500); }
input[type="text"], input[type="number"], input[type="email"],
input[type="date"], input[type="tel"], input[type="password"],
select, textarea {
  padding: 9px 13px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--neuro-bg);
  box-shadow: var(--neuro-inset);
  transition: box-shadow 0.2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  box-shadow: var(--neuro-inset), 0 0 0 2px var(--green-500);
}
textarea { resize: vertical; min-height: 80px; }
.input-group { display: flex; }
.input-group input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); box-shadow: var(--neuro-inset); }
.input-group .btn  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: nowrap; }

/* ===== TABLES ===== */
.pm-table-wrap { overflow-x: auto; }
.pm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}
.pm-table th {
  background: rgba(46,125,50,0.08);
  color: var(--green-900);
  font-weight: 600;
  padding: 11px 14px;
  text-align: left;
  border-bottom: 2px solid rgba(46,125,50,0.15);
  white-space: nowrap;
}
.pm-table td {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  vertical-align: middle;
}
.pm-table tbody tr:hover { background: rgba(0,0,0,0.03); }
.pm-table .text-right { text-align: right; }
.pm-table .text-center{ text-align: center; }

/* ===== BADGES / STATUS ===== */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success  { background: var(--green-100); color: var(--green-800); }
.badge-danger   { background: var(--red-100);   color: var(--red-500); }
.badge-warning  { background: var(--yellow-100);color: #E65100; }
.badge-info     { background: var(--blue-100);  color: var(--blue-500); }
.badge-gray     { background: var(--gray-300);  color: var(--gray-700); }

/* ===== MODALS ===== */
.pm-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.pm-modal {
  background: var(--neuro-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 12px 12px 32px rgba(0,0,0,0.25), -6px -6px 20px rgba(255,255,255,0.7);
}
.pm-modal-lg { max-width: 900px; }
.pm-modal-xl { max-width: 960px; width: 96%; }
.pm-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pm-modal-header h3 { font-size: 1rem; font-weight: 600; color: var(--green-900); }
.pm-modal-close {
  cursor: pointer;
  background: var(--neuro-bg);
  border: none;
  font-size: 1.4rem;
  color: var(--gray-500);
  line-height: 1;
  border-radius: 50%;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--neuro-raised-sm);
  transition: box-shadow 0.15s;
}
.pm-modal-close:hover { box-shadow: var(--neuro-inset-sm); color: var(--gray-900); }
.pm-modal-body { padding: 20px; }
.pm-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ===== ALERTS ===== */
.pm-alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.pm-alert-success { background: var(--green-50);   border-left: 4px solid var(--green-600); color: var(--green-900); box-shadow: var(--neuro-inset-sm); }
.pm-alert-error   { background: var(--red-100);    border-left: 4px solid var(--red-500);   color: #b71c1c; box-shadow: var(--neuro-inset-sm); }
.pm-alert-warning { background: var(--yellow-100); border-left: 4px solid var(--yellow-500);color: #e65100; box-shadow: var(--neuro-inset-sm); }

/* ===== SEARCH BAR ===== */
.pm-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.pm-search-input {
  flex: 1;
  min-width: 200px;
  max-width: 350px;
}

/* ===== POS SPECIFIC ===== */
.pm-pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}
/* Below ~1100px the search column would be squeezed to a few hundred px next to the 360px cart */
@media (max-width: 1100px) {
  .pm-pos-layout { grid-template-columns: minmax(0, 1fr); }
  .pm-pos-cart { position: static; }
}
.pm-pos-cart {
  background: var(--neuro-bg);
  border-radius: var(--radius);
  box-shadow: var(--neuro-raised);
  position: sticky;
  top: calc(var(--topbar-height) + 24px);
}
.pm-pos-cart-header {
  padding: 14px 18px;
  background: var(--green-900);
  color: var(--white);
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.pm-pos-cart-items {
  max-height: 340px;
  overflow-y: auto;
}
.pm-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 0.85rem;
}
.pm-cart-item .item-name { flex: 1; font-weight: 500; }
.pm-cart-item .item-qty input {
  width: 56px; text-align: center;
  padding: 4px 6px;
}
.pm-cart-item .item-price { min-width: 70px; text-align: right; font-weight: 600; color: var(--green-800); }
.pm-cart-item .item-remove { color: var(--red-500); cursor: pointer; background: none; border: none; font-size: 1rem; }
.pm-pos-cart-totals {
  padding: 14px 18px;
  border-top: 2px solid rgba(46,125,50,0.15);
}
.pm-pos-cart-totals .total-row {
  display: flex; justify-content: space-between;
  font-size: 0.88rem; margin-bottom: 6px;
}
.pm-pos-cart-totals .total-final {
  font-size: 1.1rem; font-weight: 700;
  color: var(--green-800);
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 8px; margin-top: 4px;
}
.pm-medicine-search-results {
  background: var(--neuro-bg);
  border: none;
  border-radius: var(--radius-sm);
  max-height: 320px;
  overflow-y: auto;
  position: fixed;
  z-index: 99999;
  box-shadow: 8px 8px 20px rgba(0,0,0,0.2), -4px -4px 10px rgba(255,255,255,0.6);
}
.pm-medicine-search-results .result-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  font-size: 0.92rem;
  line-height: 1.5;
}
.pm-medicine-search-results .result-item:hover { background: rgba(46,125,50,0.06); }
.pm-medicine-search-results .result-item.out-of-stock { opacity: 0.6; cursor: not-allowed; background: rgba(0,0,0,0.03); }
.pm-medicine-search-results .result-item.out-of-stock:hover { background: rgba(0,0,0,0.03); }
.pm-medicine-search-results .result-item .med-name { font-weight: 500; }
.pm-medicine-search-results .result-item .med-meta { font-size: 0.78rem; color: var(--gray-500); }

/* ===== RECEIPT PRINT ===== */
.receipt-area {
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  max-width: 320px;
  margin: 0 auto;
  padding: 16px;
}
.receipt-area .receipt-header { text-align: center; margin-bottom: 12px; }
.receipt-area .receipt-header h3 { font-size: 1rem; font-weight: 700; }
.receipt-area .receipt-divider { border: none; border-top: 1px dashed #000; margin: 8px 0; }
.receipt-area .receipt-row { display: flex; justify-content: space-between; margin-bottom: 2px; }
.receipt-area .receipt-total { font-weight: 700; font-size: 0.9rem; }

@media print {
  body * { visibility: hidden; }
  #receipt-print, #receipt-print * { visibility: visible; }
  #receipt-print { position: fixed; top: 0; left: 0; width: 100%; }
}

/* ===== CHART CONTAINERS ===== */
.pm-charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.chart-container { height: 260px; position: relative; }

/* ===== EXPENSE COMPARISON CARDS ===== */
.pm-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.pm-compare-card {
  background: var(--neuro-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--neuro-inset-sm);
  padding: 14px 16px;
}
.pm-compare-label { font-size: 0.82rem; font-weight: 600; color: var(--gray-700); margin-bottom: 8px; }
.pm-compare-amount { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.pm-compare-diff { font-size: 0.85rem; font-weight: 600; }

/* ===== FLOATING ADD-EXPENSE BUTTON (Dashboard) ===== */
.pm-fab {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--green-700);
  color: #fff;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 4px 4px 10px rgba(56,142,60,0.45), -3px -3px 8px rgba(255,255,255,0.25);
  z-index: 500;
  transition: transform 0.15s ease;
}
.pm-fab:hover { transform: scale(1.08); }
.pm-fab:active { transform: scale(0.96); }
@media (max-width: 640px) {
  .pm-fab { bottom: 80px; right: 16px; width: 50px; height: 50px; font-size: 1.15rem; }
}

/* ===== LOADER ===== */
.pm-loader {
  display: flex; align-items: center; justify-content: center;
  padding: 40px; color: var(--gray-500);
  flex-direction: column; gap: 10px;
}
.pm-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(0,0,0,0.1);
  border-top-color: var(--green-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== TOAST NOTIFICATIONS ===== */
#pm-toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pm-toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.88rem;
  box-shadow: 4px 4px 12px rgba(0,0,0,0.25), -2px -2px 8px rgba(255,255,255,0.1);
  animation: slideIn 0.3s ease;
  min-width: 260px;
}
.pm-toast-success { background: var(--green-700); }
.pm-toast-error   { background: var(--red-500); }
.pm-toast-info    { background: var(--blue-500); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== TABS ===== */
.pm-tabs {
  display: flex;
  gap: 0;
  background: var(--neuro-bg);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--neuro-inset);
  margin-bottom: 20px;
}
.pm-tab-btn {
  flex: 1;
  padding: 9px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.88rem;
  font-family: inherit;
  color: var(--gray-700);
  border-radius: var(--radius-sm);
  transition: box-shadow 0.2s, color 0.2s, background 0.2s;
}
.pm-tab-btn.active {
  color: var(--green-800);
  font-weight: 600;
  background: var(--neuro-bg);
  box-shadow: var(--neuro-raised-sm);
}
.pm-tab-panel { display: none; }
.pm-tab-panel.active { display: block; }

/* ===== MOBILE RESPONSIVE ===== */
.pm-menu-toggle {
  background: var(--neuro-bg);
  border: none;
  cursor: pointer;
  font-size: 1.3rem;
  color: var(--green-900);
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  box-shadow: var(--neuro-raised-sm);
  display: none;
  align-items: center;
  justify-content: center;
}

@media (max-width: 900px) {
  .pm-sidebar { transform: translateX(-100%); }
  .pm-sidebar.open { transform: translateX(0); }
  .pm-main { margin-left: 0; }
  .pm-topbar { left: 0; }
  .pm-menu-toggle { display: flex; }
  .pm-pos-layout { grid-template-columns: minmax(0, 1fr); }
  .pm-pos-cart { position: static; }
}

@media (max-width: 600px) {
  .pm-main { padding: 12px; }
  .pm-stats-grid { grid-template-columns: 1fr 1fr; }
  .pm-ledger-stat-val { font-size: 1rem; }
  .pm-ledger-stat { padding: 10px 16px; }
}
/* POS cart table: hide cost column on very narrow screens */
@media (max-width: 480px) {
  #tbl-cart th:nth-child(4),
  #tbl-cart td:nth-child(4) { display: none; }
}

/* Customer detail 5-col stat grid */
.pm-cust-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
@media (max-width: 640px) {
  .pm-cust-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .pm-cust-stat-grid .pm-ledger-stat { border-left: none !important; border-top: 1px solid var(--gray-200); }
}

/* ===== CUSTOMER MODULE ===== */
.pm-cust-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .pm-cust-stats-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 480px) { .pm-cust-stats-grid { grid-template-columns: 1fr; } }

/* Tier badges */
.pm-tier {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.68rem; font-weight: 700; padding: 2px 7px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.4px; vertical-align: middle;
}
.pm-tier-vip     { background: linear-gradient(135deg,#f59e0b,#d97706); color: #fff; }
.pm-tier-regular { background: var(--green-50); color: var(--green-800); border: 1px solid var(--green-200); }
.pm-tier-new     { background: var(--blue-100); color: var(--blue-700); }

/* Overdue chips */
.pm-overdue-chip {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  padding: 1px 7px; border-radius: 12px; margin-left: 5px; vertical-align: middle;
}
.pm-overdue-yellow { background: var(--yellow-100); color: #92400e; }
.pm-overdue-red    { background: var(--red-100); color: var(--red-700); animation: pm-pulse 1.8s infinite; }
@keyframes pm-pulse { 0%,100%{opacity:1;} 50%{opacity:.55;} }

/* Ledger stats row inside detail modal */
.pm-ledger-stat {
  padding: 14px 18px;
  text-align: center;
  background: var(--neuro-bg);
  border-radius: var(--radius-sm);
  box-shadow: var(--neuro-raised-sm);
}
.pm-ledger-stat-label {
  font-size: 0.7rem; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px;
}
.pm-ledger-stat-val {
  font-size: 1.35rem; font-weight: 700; line-height: 1.2;
}
.pm-ledger-stat-val.green { color: var(--green-700); }
.pm-ledger-stat-val.blue  { color: #1d4ed8; }
.pm-ledger-stat-val.red   { color: var(--red-500); }

/* Ledger table */
.pm-ledger-tbl { font-size: 0.82rem; }
.pm-ledger-tbl thead th {
  background: rgba(46,125,50,0.07); font-size: 0.75rem;
  padding: 7px 8px; border-bottom: 2px solid rgba(0,0,0,0.06);
}
.pm-ledger-tbl td { padding: 6px 8px; }

/* Radio labels in settle modal */
.pm-radio-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.85rem; cursor: pointer;
}

/* ===== WordPress Admin Bar Adjustments ===== */
.admin-bar .pm-sidebar {
  top: 32px;
  height: calc(100vh - 32px);
}
.admin-bar .pm-topbar {
  top: 32px;
}
.admin-bar .pm-main {
  margin-top: calc(var(--topbar-height) + 32px);
}

@media screen and (max-width: 782px) {
  .admin-bar .pm-sidebar {
    top: 46px;
    height: calc(100vh - 46px);
  }
  .admin-bar .pm-topbar {
    top: 46px;
  }
  .admin-bar .pm-main {
    margin-top: calc(var(--topbar-height) + 46px);
  }
}
