/**
 * OrderHub v2 — Layout System
 * Sidebar navigation + Main area + Info bar
 * Optimized for 1280×1024 square monitors
 */

/* ─── CSS Variables ─────────────────────────────── */
:root {
  --sidebar-width-collapsed: 48px;
  --sidebar-width-expanded: 172px;
  --sidebar-bg: #ffffff;
  --sidebar-border: rgba(0,0,0,0.08);
  --sidebar-hover: rgba(102,126,234,0.08);
  --sidebar-active-bg: rgba(102,126,234,0.1);
  --sidebar-active-border: #667eea;
  --sidebar-text: #64748b;
  --sidebar-text-active: #1e293b;
  --sidebar-icon-size: 18px;

  --taskbar-height: 40px;
  --filter-height: 38px;
  --info-bar-height: 32px;

  --main-bg: #f0f2f5;
}

/* ─── App Layout (replaces old .app-layout) ───── */
.app-v2 {
  display: flex;
  min-height: 100vh;
  background: var(--main-bg);
}

/* ─── Sidebar ───────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width-collapsed);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width 0.2s ease;
  overflow: hidden;
}

.sidebar.expanded {
  width: var(--sidebar-width-expanded);
}

/* Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  gap: 10px;
  text-decoration: none;
  color: #1e293b;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--sidebar-border);
  white-space: nowrap;
  flex-shrink: 0;
}

.sidebar-brand .brand-icon {
  font-size: 20px;
  min-width: 24px;
  text-align: center;
}

.sidebar-brand .brand-text {
  opacity: 0;
  transition: opacity 0.15s ease;
  overflow: hidden;
}

.sidebar.expanded .brand-text {
  opacity: 1;
}

/* Nav items */
.sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  position: relative;
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: #1e293b;
}

.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  border-left-color: var(--sidebar-active-border);
}

/* ── Top-level main-menu items: dark bg, white text (expanded only) ── */
/* Targets both standalone links AND nav-group parent links */
.sidebar.expanded .sidebar-nav > a,
.sidebar.expanded .sidebar-nav > .nav-group > a {
  font-weight: 700;
  font-size: 13px;
  color: #f1f5f9 !important;
  background: #334155;
  border-radius: 6px;
  margin: 2px 6px;
  padding: 9px 10px;
  border-left-color: transparent;
}
.sidebar.expanded .sidebar-nav > a:hover,
.sidebar.expanded .sidebar-nav > .nav-group > a:hover {
  background: #1e293b;
  color: #f1f5f9 !important;
}
/* Keep dark style even when .active */
.sidebar.expanded .sidebar-nav > a.active,
.sidebar.expanded .sidebar-nav > .nav-group > a.active {
  background: #1e293b;
  color: #f1f5f9 !important;
  border-left-color: transparent;
}

/* Collapsed mode: reset all top-level items to transparent */
.sidebar:not(.expanded) .sidebar-nav > a,
.sidebar:not(.expanded) .sidebar-nav > .nav-group > a {
  background: transparent;
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 12.5px;
  margin: 0;
  border-radius: 0;
}

.sidebar-nav a .nav-icon {
  font-size: var(--sidebar-icon-size);
  min-width: 24px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-nav a .nav-label {
  opacity: 0;
  transition: opacity 0.15s ease;
  overflow: hidden;
}

.sidebar.expanded .nav-label {
  opacity: 1;
}

/* Collapsed tooltip */
.sidebar:not(.expanded) .sidebar-nav a:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 52px;
  top: 50%;
  transform: translateY(-50%);
  background: #1e293b;
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 200;
  pointer-events: none;
}

/* Separator line in nav */
.sidebar-sep {
  height: 1px;
  background: var(--sidebar-border);
  margin: 4px 8px;
}

/* ── Sub-Menu (hover-to-reveal) ────────────────── */

/* Wrapper around parent link + its sub-menu */
.nav-group {
  position: relative;
}

.sidebar-submenu {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1), opacity 0.2s ease;
  background: rgba(241,245,249,0.5);
  margin: 0 8px;
  border-radius: 0 0 8px 8px;
}

/* Show sub-menu ONLY via JS-controlled .pinned class (true accordion) */
.sidebar.expanded .sidebar-submenu.pinned {
  max-height: 400px;
  opacity: 1;
}

/* Hide sub-menus when sidebar collapsed */
.sidebar:not(.expanded) .sidebar-submenu {
  display: none !important;
}

/* Sub-menu items — smaller font for clear hierarchy */
.submenu-item {
  display: flex;
  align-items: center;
  padding: 4px 12px 4px 40px;
  font-size: 10.5px;
  color: #64748b;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
  margin-left: 4px;
  position: relative;
}

/* Subtle dot indicator before each sub-item */
.submenu-item::before {
  content: '';
  position: absolute;
  left: 28px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: all 0.15s;
}

.submenu-item:hover {
  color: #334155;
  background: rgba(102,126,234,0.06);
}

.submenu-item:hover::before {
  background: #667eea;
  transform: scale(1.3);
}

.submenu-item.active {
  color: #667eea;
  background: rgba(102,126,234,0.10);
  border-left-color: #667eea;
  font-weight: 600;
}

.submenu-item.active::before {
  background: #667eea;
  width: 5px;
  height: 5px;
}

/* Chevron indicator on parent links with sub-menus */
.sidebar.expanded .nav-group > a::after {
  content: '›';
  position: absolute;
  right: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #94a3b8;
  transition: transform 0.2s ease;
  line-height: 1;
}

.sidebar.expanded .nav-group:hover > a::after,
.sidebar.expanded .nav-group:has(.pinned) > a::after {
  transform: rotate(90deg);
  color: #667eea;
}

/* Footer (toggle + user) */
.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: 4px 0;
  flex-shrink: 0;
}

.sidebar-footer .sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: var(--sidebar-text);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-footer .sidebar-user .user-badge {
  min-width: 24px;
  text-align: center;
}

.sidebar-footer .sidebar-user .user-name {
  opacity: 0;
  transition: opacity 0.15s ease;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.expanded .sidebar-footer .user-name {
  opacity: 1;
}

.sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  color: var(--sidebar-text);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  width: 100%;
  text-align: left;
  white-space: nowrap;
  transition: color 0.15s;
}

.sidebar-toggle:hover {
  color: #1e293b;
}

.sidebar-toggle .toggle-icon {
  min-width: 24px;
  text-align: center;
  font-size: 16px;
  transition: transform 0.2s;
}

.sidebar.expanded .sidebar-toggle .toggle-icon {
  transform: rotate(180deg);
}

.sidebar-toggle .toggle-label {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.sidebar.expanded .toggle-label {
  opacity: 1;
}

/* ─── Main Area ─────────────────────────────────── */
.main-area {
  margin-left: var(--sidebar-width-collapsed);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

.sidebar.expanded ~ .main-area {
  margin-left: var(--sidebar-width-expanded);
}

/* ─── Taskbar (sticky top) ──────────────────────── */
.taskbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--taskbar-height);
  padding: 0 12px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  flex-shrink: 0;
}

.taskbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.taskbar-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
}

.taskbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Taskbar buttons — compact */
.taskbar .btn-tb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.btn-tb-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}
.btn-tb-primary:hover { filter: brightness(1.1); }

.btn-tb-success {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: #000;
}
.btn-tb-success:hover { filter: brightness(1.05); }

.btn-tb-secondary {
  background: rgba(0,0,0,0.04);
  color: #64748b;
  border: 1px solid rgba(0,0,0,0.1);
}
.btn-tb-secondary:hover {
  background: rgba(0,0,0,0.08);
  color: #1e293b;
}

.btn-tb-info {
  background: rgba(37,99,235,0.08);
  color: #2563eb;
  border: 1px solid rgba(37,99,235,0.2);
}
.btn-tb-info:hover {
  background: rgba(37,99,235,0.15);
}

.btn-tb .badge-count {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 8px;
  min-width: 16px;
  text-align: center;
}

/* ─── Filter Bar (sticky below taskbar) ─────────── */
.filter-bar {
  position: sticky;
  top: var(--taskbar-height);
  z-index: 49;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #fafbfc;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.filter-bar .filter-search {
  flex: 0 0 200px;
  max-width: 220px;
  height: 28px;
  padding: 0 8px 0 28px;
  font-size: 12px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s;
}

.filter-bar .filter-search:focus {
  border-color: var(--sidebar-active-border);
}

.filter-bar .filter-search-wrap {
  position: relative;
  flex: 0 0 200px;
  max-width: 220px;
}

.filter-bar .filter-search-wrap::before {
  content: '🔍';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  pointer-events: none;
}

.filter-bar .filter-search-wrap .filter-search {
  flex: unset;
  width: 100%;
}

.filter-bar select {
  height: 28px;
  padding: 0 24px 0 6px;
  font-size: 11.5px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  color: #334155;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(0,0,0,0.3)'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}

.filter-bar select:focus {
  border-color: var(--sidebar-active-border);
}

.filter-bar select option {
  background: #ffffff;
  color: #1e293b;
}

.filter-bar .filter-sep {
  width: 1px;
  height: 18px;
  background: rgba(0,0,0,0.1);
  margin: 0 2px;
}

.filter-bar .btn-filter {
  height: 28px;
  padding: 0 8px;
  font-size: 11px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  color: #64748b;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.filter-bar .btn-filter:hover {
  background: rgba(0,0,0,0.04);
  color: #1e293b;
}

.filter-bar .date-range {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-bar .date-range input[type="date"] {
  height: 28px;
  padding: 0 6px;
  font-size: 11px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  color: #334155;
  outline: none;
}

.filter-bar .date-range span {
  color: #94a3b8;
  font-size: 11px;
}

/* ─── Content Area ──────────────────────────────── */
.content-area {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  padding-bottom: calc(var(--info-bar-height) + 12px);
}

/* ─── Info Bar (sticky bottom) ──────────────────── */
.info-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width-collapsed);
  right: 0;
  height: var(--info-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  background: #ffffff;
  border-top: 1px solid rgba(0,0,0,0.08);
  z-index: 50;
  font-size: 11px;
  color: #64748b;
  transition: left 0.2s ease;
}

.sidebar.expanded ~ .main-area .info-bar {
  left: var(--sidebar-width-expanded);
}

.info-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.info-bar-left .info-stat {
  display: flex;
  align-items: center;
  gap: 3px;
}

.info-bar-left .info-stat .stat-value {
  font-weight: 600;
  color: #1e293b;
}

.info-bar-left .info-sep {
  width: 1px;
  height: 14px;
  background: rgba(0,0,0,0.1);
}

.info-bar-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.info-bar .pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
}

.info-bar .pg-btn:hover {
  background: rgba(0,0,0,0.08);
  color: #1e293b;
}

.info-bar .pg-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.info-bar .pg-info {
  padding: 0 6px;
  font-size: 11px;
  color: #64748b;
}

/* ─── Card-Row List (information-dense) ─────────── */
.order-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.order-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: start;
  padding: 6px 8px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  gap: 6px;
}

.order-row:hover {
  background: #f8faff;
  border-color: rgba(102,126,234,0.25);
  box-shadow: 0 1px 3px rgba(102,126,234,0.08);
}

.order-row.selected {
  background: rgba(102,126,234,0.06);
  border-color: rgba(102,126,234,0.3);
}

.order-row-check {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px;
}

.order-row-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.order-row-body {
  min-width: 0;
}

/* Line 1: Code + Customer + Phone + Address (full width) */
.order-row-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
  min-width: 0;
}

.order-row-line1 .or-code {
  font-weight: 600;
  color: #4f6ade;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.order-row-line1 .or-code:hover {
  text-decoration: underline;
}

.order-row-line1 .or-customer {
  color: #1e293b;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-row-line1 .or-phone {
  color: #64748b;
  font-size: 11px;
  white-space: nowrap;
  flex-shrink: 0;
}

.order-row-line1 .or-address {
  color: #94a3b8;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

/* Line 2: Products (inline flow, max 4 lines, unified color) */
.order-row-line2 {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 3px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.order-row-line2 .pl-item {
  font-weight: 500;
  color: #334155;
}

.order-row-line2 .pl-sep {
  display: inline-flex;
  align-items: center;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  margin: 0 4px;
  padding: 0 3px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  vertical-align: middle;
}

.order-row-line2 .or-more {
  color: #94a3b8;
  font-size: 10px;
  font-style: italic;
}

/* Line 3: Meta info */
.order-row-line3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  color: #94a3b8;
  margin-top: 2px;
}

.order-row-line3 .or-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.order-row-line3 .or-meta span {
  white-space: nowrap;
}

.order-row-line3 .or-meta .meta-sep {
  color: rgba(0,0,0,0.15);
}

/* Right side: status badge + COD + actions */
.order-row-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding-top: 1px;
}

.order-row-right .or-status {
  font-size: 10.5px;
}

.order-row-right .or-cod {
  font-size: 12px;
  font-weight: 600;
  color: #d97706;
}

.order-row-right .or-actions {
  display: flex;
  gap: 3px;
  margin-top: 1px;
}

.order-row-right .or-actions .btn-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.12s;
  color: #64748b;
}

.order-row-right .or-actions .btn-row-action:hover {
  background: rgba(0,0,0,0.08);
  color: #1e293b;
}

/* Context dropdown menu */
.ctx-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 170px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 4px 0;
  display: none;
}

.ctx-menu.show {
  display: block;
}

.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 12px;
  font-size: 12px;
  color: #334155;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}

.ctx-menu button:hover {
  background: rgba(102,126,234,0.08);
}

.ctx-menu-sep {
  height: 1px;
  background: rgba(0,0,0,0.06);
  margin: 3px 0;
}

/* ─── Mass actions dropdown (redesigned for taskbar) ── */
.mass-dropdown {
  position: relative;
  display: inline-block;
}

.mass-dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  min-width: 200px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 200;
  padding: 4px 0;
  display: none;
}

.mass-dropdown-menu.show {
  display: block;
}

.mass-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 12px;
  font-size: 12px;
  color: #334155;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}

.mass-dropdown-menu button:hover {
  background: rgba(102,126,234,0.08);
}

/* ─── Select All checkbox in filter bar ─────────── */
.filter-bar .select-all-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
}

.filter-bar .select-all-wrap input {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

.filter-bar .select-all-wrap label {
  font-size: 11px;
  color: #94a3b8;
  cursor: pointer;
}

/* ─── Filter Checkbox (inline) ──────────────────── */
.filter-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 11.5px;
  color: #475569;
  white-space: nowrap;
  padding: 0 4px;
  user-select: none;
  transition: color 0.15s;
}

.filter-checkbox:hover {
  color: #1e293b;
}

.filter-checkbox input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #667eea;
}

.filter-checkbox input[type="checkbox"]:checked + span {
  color: #667eea;
  font-weight: 600;
}

/* Full-width row in advanced filter grid */
.adv-filter-full {
  grid-column: 1 / -1;
}

/* ─── Quick status badge click ──────────────────── */
.badge-clickable {
  cursor: pointer;
  transition: filter 0.15s;
}

.badge-clickable:hover {
  filter: brightness(0.85);
}

/* ─── Empty state ───────────────────────────────── */
.content-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: #94a3b8;
}

.content-empty .empty-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.content-empty p {
  font-size: 13px;
}

/* ─── Loading ───────────────────────────────────── */
.content-loading {
  display: flex;
  justify-content: center;
  padding: 32px;
}

/* ─── Split Modal ──────────────────────────────── */
.split-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.split-col {
  background: var(--main-bg, #f0f2f5);
  border-radius: 8px;
  padding: 12px;
  border: 1px solid var(--sidebar-border, rgba(0,0,0,0.08));
}
.split-col-new {
  border-color: #667eea;
  background: rgba(102,126,234,0.04);
}
.split-col-header {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--sidebar-text-active, #1e293b);
}
.split-preview {
  min-height: 40px;
}
.split-preview-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  padding: 3px 0;
  color: var(--sidebar-text, #64748b);
  border-bottom: 1px dashed rgba(0,0,0,0.06);
}
.split-preview-line:last-child { border-bottom: none; }
.split-totals {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(0,0,0,0.1);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  color: var(--sidebar-text-active, #1e293b);
}
.split-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 6px;
  margin-bottom: 6px;
  transition: border-color 0.15s;
}
.split-line:hover {
  border-color: #667eea;
}
.split-check {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.split-line-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.split-line-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--sidebar-text-active, #1e293b);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.split-line-code {
  font-size: 11px;
  color: var(--sidebar-text, #64748b);
}
.split-line-qty {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.split-qty-input {
  width: 52px;
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 4px;
  font-size: 12px;
  text-align: center;
  background: #fff;
  color: var(--sidebar-text-active, #1e293b);
}
.split-qty-input:focus {
  border-color: #667eea;
  outline: none;
}
.split-line-price {
  font-size: 12px;
  font-weight: 600;
  color: #667eea;
  flex-shrink: 0;
  min-width: 60px;
  text-align: right;
}

/* ─── Invoice Split (Two-Column in Slide Panel) ── */
.inv-split-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 12px;
}
.inv-split-col {
  background: #fafbfc;
  border-radius: 8px;
  padding: 12px;
  border: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  min-height: 200px;
}
.inv-split-col-new {
  border-color: rgba(102,126,234,0.35);
  background: rgba(102,126,234,0.03);
}
.inv-split-col-header {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.inv-split-col-header .isc-code {
  color: #4f6ade;
}
.inv-split-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 60px;
}
.inv-split-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  font-size: 12px;
  transition: border-color 0.15s, box-shadow 0.12s;
}
.inv-split-line:hover {
  border-color: rgba(102,126,234,0.3);
  box-shadow: 0 1px 4px rgba(102,126,234,0.08);
}
.inv-split-line-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.inv-split-line-name {
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.inv-split-line-code {
  font-size: 10.5px;
  color: #667eea;
  font-weight: 600;
}
.inv-split-line-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  font-size: 11.5px;
}
.inv-split-line-qty {
  color: #475569;
  font-weight: 600;
  min-width: 30px;
  text-align: center;
}
.inv-split-line-price {
  color: #0f766e;
  font-weight: 600;
  min-width: 55px;
  text-align: right;
}
.inv-split-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  background: rgba(102,126,234,0.08);
  border: 1px solid rgba(102,126,234,0.2);
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  color: #667eea;
  flex-shrink: 0;
  transition: all 0.15s;
  line-height: 1;
}
.inv-split-arrow:hover {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
  box-shadow: 0 2px 6px rgba(102,126,234,0.3);
}
.inv-split-arrow:active {
  transform: scale(0.92);
}
.inv-split-arrow.arrow-left {
  background: rgba(234,88,12,0.08);
  border-color: rgba(234,88,12,0.2);
  color: #ea580c;
}
.inv-split-arrow.arrow-left:hover {
  background: #ea580c;
  color: #fff;
  border-color: #ea580c;
}
.inv-split-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  color: #94a3b8;
  font-size: 12px;
  font-style: italic;
  border: 2px dashed rgba(0,0,0,0.08);
  border-radius: 6px;
}
.inv-split-financials {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.inv-split-fin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 6px;
}
.inv-split-fin-row .fin-label {
  color: #64748b;
  font-weight: 500;
}
.inv-split-fin-row .fin-value {
  font-weight: 600;
  color: #1e293b;
}
.inv-split-fin-row.total {
  padding-top: 6px;
  border-top: 1px solid rgba(0,0,0,0.1);
  margin-top: 2px;
}
.inv-split-fin-row.total .fin-label {
  color: #1e293b;
  font-weight: 700;
}
.inv-split-fin-row.total .fin-value {
  color: #d97706;
  font-weight: 700;
  font-size: 14px;
}
.inv-split-fin-input {
  width: 80px;
  padding: 3px 6px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  font-size: 12px;
  text-align: right;
  background: #fff;
  color: #1e293b;
}
.inv-split-fin-input:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}
.inv-split-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(0,0,0,0.08);
}

/* ─── Split Meta Section ──────────────────────────── */
.inv-split-meta {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-split-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  gap: 6px;
}
.inv-split-meta-row .fin-label {
  color: #64748b;
  font-weight: 500;
  min-width: 60px;
}
.inv-split-meta-row .fin-value {
  font-weight: 500;
  color: #1e293b;
  text-align: right;
}
.inv-split-meta-select {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  font-size: 12px;
  background: #fff;
  color: #1e293b;
  cursor: pointer;
  max-width: 160px;
}
.inv-split-meta-select:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}
.inv-split-meta-textarea {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  font-size: 12px;
  background: #fff;
  color: #1e293b;
  resize: vertical;
  font-family: inherit;
  min-height: 36px;
}
.inv-split-meta-textarea:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}

/* ─── Status Select in Taskbar ────────────────────── */
.sp-tb-status-select {
  padding: 4px 10px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  font-size: 12px;
  background: rgba(102,126,234,0.06);
  color: #1e293b;
  cursor: pointer;
  font-weight: 500;
  min-width: 130px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sp-tb-status-select:hover {
  border-color: rgba(102,126,234,0.4);
  background: rgba(102,126,234,0.1);
}
.sp-tb-status-select:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}

/* ─── Merge Modal ──────────────────────────────── */

.merge-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.merge-card:hover {
  border-color: rgba(102,126,234,0.3);
  box-shadow: 0 2px 6px rgba(102,126,234,0.08);
}
.merge-card-target {
  border-color: #667eea;
  background: rgba(102,126,234,0.04);
}
.merge-card-label {
  display: block;
  cursor: pointer;
}
.merge-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.merge-card-code {
  font-size: 13px;
  font-weight: 600;
  color: #667eea;
}
.merge-card-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  background: #667eea;
  color: #fff;
  font-weight: 500;
}
.merge-card-info {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--sidebar-text, #64748b);
  margin-top: 2px;
}
.merge-card-products {
  font-size: 11px;
  color: var(--sidebar-text, #64748b);
  line-height: 1.5;
  margin: 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.merge-check {
  float: left;
  margin: 2px 10px 0 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.merge-preview {
  margin-top: 16px;
  padding: 12px;
  background: rgba(102,126,234,0.04);
  border: 1px solid rgba(102,126,234,0.2);
  border-radius: 8px;
}

/* ═══════════════════════════════════════════════════
   Slide-Over Detail Panel
   ═══════════════════════════════════════════════════ */

/* Backdrop — semi-transparent overlay on the list side */
.slide-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.18);
  z-index: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.slide-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Panel — slides from right */
.slide-panel {
  position: fixed;
  top: 0;
  right: -58vw;
  bottom: 0;
  width: 56vw;
  max-width: 860px;
  background: #ffffff;
  box-shadow: -4px 0 30px rgba(0,0,0,0.12);
  z-index: 850;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.slide-panel.open {
  right: 0;
}

/* Panel Header */
.sp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: #fafbfc;
  flex-shrink: 0;
}
.sp-header-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sp-header-title .sp-status {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.sp-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(0,0,0,0.04);
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}
.sp-close:hover {
  background: rgba(220,38,38,0.1);
  color: #dc2626;
}

/* ─── Unified Taskbar ─────────────────────────── */
.sp-taskbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  background: #ffffff;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.sp-taskbar .sp-tb-sep {
  width: 1px;
  height: 20px;
  background: rgba(0,0,0,0.1);
  margin: 0 4px;
}
.sp-tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  cursor: pointer;
  background: #ffffff;
  color: #475569;
  white-space: nowrap;
  transition: all 0.15s;
}
.sp-tb-btn:hover {
  background: rgba(102,126,234,0.06);
  border-color: rgba(102,126,234,0.3);
  color: #667eea;
}
.sp-tb-btn.active,
.sp-tb-btn.btn-edit-active {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}
.sp-tb-btn.btn-save {
  background: #22c55e;
  color: #fff;
  border-color: #22c55e;
}
.sp-tb-btn.btn-save:hover {
  background: #16a34a;
  border-color: #16a34a;
}
.sp-tb-btn.btn-cancel-edit {
  background: #f1f5f9;
  color: #64748b;
  border-color: rgba(0,0,0,0.1);
}
.sp-tb-btn.btn-cancel-edit:hover {
  background: #e2e8f0;
}
.sp-tb-btn.btn-danger {
  color: #dc2626;
}
.sp-tb-btn.btn-danger:hover {
  background: rgba(220,38,38,0.08);
  border-color: rgba(220,38,38,0.3);
}
.sp-tb-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Panel Body ──────────────────────────────── */
.sp-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Section cards */
.sp-section {
  margin-bottom: 16px;
}
.sp-section-title {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sp-card {
  background: #fafbfc;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 12px 16px;
}

/* Customer info grid */
.sp-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.sp-info-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sp-info-label {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}
.sp-info-value {
  font-size: 13px;
  color: #1e293b;
  font-weight: 500;
}
.sp-info-value.phone {
  color: #667eea;
  cursor: pointer;
}
.sp-info-value.address {
  grid-column: 1 / -1;
}

/* Product lines in view mode */
.sp-lines {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sp-line {
  display: flex;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 12.5px;
}
.sp-line:last-child {
  border-bottom: none;
}
.sp-line-idx {
  width: 24px;
  color: #94a3b8;
  font-size: 11px;
  text-align: center;
  flex-shrink: 0;
}
.sp-line-name {
  flex: 1;
  color: #1e293b;
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-line-code {
  color: #667eea;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  flex-shrink: 0;
}
.sp-line-live {
  color: #9333ea;
  font-size: 10px;
  margin-left: 4px;
  flex-shrink: 0;
}
.sp-line-qty {
  min-width: 36px;
  text-align: center;
  color: #475569;
  font-weight: 600;
  flex-shrink: 0;
}
.sp-line-price {
  min-width: 56px;
  text-align: right;
  color: #0f766e;
  font-weight: 600;
  flex-shrink: 0;
}
.sp-line-total {
  min-width: 64px;
  text-align: right;
  color: #1e293b;
  font-weight: 600;
  flex-shrink: 0;
}

/* Financial summary */
.sp-financials {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sp-fin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: #475569;
  padding: 2px 0;
}
.sp-fin-row.total {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 8px;
  margin-top: 4px;
}
.sp-fin-row .fin-label {
  color: #64748b;
  white-space: nowrap;
  min-width: 72px;
}
.sp-fin-row .fin-value {
  font-weight: 600;
}

/* ─── 2-Column Financial Grid (Edit/Create) ──── */
.sp-fin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}
.sp-fin-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0;
}
.sp-fin-col:first-child {
  border-right: 1px solid rgba(0,0,0,0.06);
  padding-right: 16px;
}
.sp-fin-col:last-child {
  padding-left: 4px;
}
.fin-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.fin-note {
  font-size: 11px;
  color: #aaa;
  white-space: nowrap;
}

/* ─── Premium Financial Input (with k suffix) ──── */
.fin-input-unit {
  display: inline-flex;
  align-items: center;
  position: relative;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
  overflow: hidden;
}
.fin-input-unit:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.fin-input-unit:focus-within {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.fin-input-unit input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 5px 2px 5px 10px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  text-align: right;
  width: 72px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
  -moz-appearance: textfield;
}
.fin-input-unit input::-webkit-outer-spin-button,
.fin-input-unit input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.fin-input-unit .fin-unit {
  padding: 5px 8px 5px 2px;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  user-select: none;
  letter-spacing: 0.3px;
}

/* Discount type select inside fin-input-group */
.fin-input-group select.fin-select {
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 500;
  color: #475569;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.fin-input-group select.fin-select:hover {
  border-color: #cbd5e1;
  background: #f1f5f9;
}
.fin-input-group select.fin-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* Voucher input */
.fin-voucher-wrap {
  display: inline-flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  transition: all 0.2s ease;
  overflow: hidden;
}
.fin-voucher-wrap:hover {
  border-color: #cbd5e1;
}
.fin-voucher-wrap:focus-within {
  border-color: #8b5cf6;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(139,92,246,0.1);
}
.fin-voucher-wrap input {
  border: none !important;
  background: transparent !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  text-transform: uppercase;
  width: 80px;
  letter-spacing: 0.5px;
}
.fin-voucher-btn {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: 600;
  color: #6366f1;
  background: rgba(99,102,241,0.08);
  border: none;
  border-left: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.fin-voucher-btn:hover {
  background: rgba(99,102,241,0.15);
  color: #4f46e5;
}

/* Financial value display (Tiền hàng, COD) */
.fin-value-k {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
  letter-spacing: -0.3px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}

.sp-fin-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 10px;
  margin-top: 8px;
}
.sp-fin-gift {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12.5px;
  color: #64748b;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(245,158,11,0.04);
  transition: all 0.15s;
}
.sp-fin-gift:hover {
  background: rgba(245,158,11,0.1);
  border-color: rgba(245,158,11,0.3);
}
.sp-fin-gift input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #f59e0b;
}
.sp-fin-cod {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  color: #1e293b;
}
.sp-fin-cod .fin-value {
  font-weight: 700;
  color: #0f766e;
  font-size: 16px;
}

/* ─── Gift Voucher Section ─────────────────────── */
.gift-voucher-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
}
.gv-header {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}
.gv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gv-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 20px;
  background: #fefce8;
  color: #92400e;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.gv-pill:hover {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(245,158,11,0.2);
}
.gv-pill:active {
  transform: translateY(0);
}
.gv-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  border-radius: 10px;
  padding: 10px 14px;
  position: relative;
}
.gv-card.gv-used {
  background: #f1f5f9;
  border-color: #cbd5e1;
  opacity: 0.7;
}
.gv-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.gv-code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 700;
  font-size: 14px;
  color: #92400e;
  cursor: pointer;
  letter-spacing: 0.5px;
}
.gv-code:hover { text-decoration: underline; }
.gv-value {
  background: #f59e0b;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 12px;
}
.gv-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: #78716c;
  margin-bottom: 6px;
}
.gv-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
}
.gv-badge-active { background: #dcfce7; color: #166534; }
.gv-badge-used { background: #fee2e2; color: #991b1b; }
.gv-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.gv-btn-copy, .gv-btn-remove {
  padding: 3px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.gv-btn-copy:hover { background: #f0f9ff; border-color: #93c5fd; }
.gv-btn-remove { color: #dc2626; }
.gv-btn-remove:hover { background: #fef2f2; border-color: #fca5a5; }
.gv-empty {
  font-size: 12px;
  color: #94a3b8;
  font-style: italic;
}
/* View mode gift voucher */
.sp-financials .gift-voucher-section { margin-top: 10px; }
.sp-financials .gv-card { padding: 8px 12px; }
.sp-financials .gv-meta { font-size: 11px; color: #78716c; }


/* Notes section */
.sp-notes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sp-note-block {
  font-size: 12px;
  color: #475569;
  line-height: 1.5;
}
.sp-note-block .note-title {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 4px;
}

/* Audit/Meta info */
.sp-meta {
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ─── Edit Form inside Panel ──────────────────── */
.sp-edit-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.sp-edit-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sp-edit-form .form-group.full-width {
  grid-column: 1 / -1;
}
.sp-edit-form label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}
.sp-edit-form .form-control {
  font-size: 12.5px;
  padding: 5px 8px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  background: #fff;
  color: #1e293b;
  transition: border-color 0.15s;
}
.sp-edit-form .form-control:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}

/* ─── Slide Panel Edit Grid ──────────────────── */
.sp-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.sp-edit-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.sp-edit-field label {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}
.sp-edit-field input,
.sp-edit-field select,
.sp-edit-field textarea {
  font-size: 12.5px;
  padding: 5px 8px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 5px;
  background: #fff;
  color: #1e293b;
  transition: border-color 0.15s;
  font-family: inherit;
}
.sp-edit-field input:focus,
.sp-edit-field select:focus,
.sp-edit-field textarea:focus {
  border-color: #667eea;
  outline: none;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}
.sp-edit-field input:disabled,
.sp-edit-field select:disabled,
.sp-edit-field textarea:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
}

/* ─── Lock Indicator ──────────────────────────── */
.order-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #b45309;
  background: rgba(245,158,11,0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
  white-space: nowrap;
}

/* ─── Lock Indicator (on order cards) ───────────── */
.or-lock {
  font-size: 13px;
  cursor: help;
  margin-left: 2px;
  animation: lock-pulse 2s ease-in-out infinite;
}
@keyframes lock-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Lock banner in slide panel */
.sp-lock-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #92400e;
  font-size: 12px;
  font-weight: 500;
  border-bottom: 1px solid #fcd34d;
}
.sp-lock-banner .lock-icon { font-size: 14px; }

/* ─── Active Order Highlight ────────────────────── */
.order-row.active-panel,
.card-v2.active-panel {
  background: linear-gradient(90deg, #eff6ff 0%, #f8faff 100%) !important;
  border-left: 3px solid #3b82f6 !important;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.15);
}
.order-row.active-panel:hover,
.card-v2.active-panel:hover {
  background: linear-gradient(90deg, #dbeafe 0%, #eff6ff 100%) !important;
}

/* ═══════════════════════════════════════════════════ */
/*  Card v2 — 6 Cell Layout (default for Invoices)    */
/*  7 Cell Layout override for Orders (.card-v2-order)*/
/* ═══════════════════════════════════════════════════ */

.card-v2 {
  display: grid;
  grid-template-columns: 26px minmax(155px, 210px) minmax(140px, 190px) 1fr minmax(110px, 150px) 44px;
  align-items: stretch;
  padding: 0;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
  gap: 0;
  min-height: 0;
}

/* Orders page: 7 columns (+ status/notes column) */
.card-v2.card-v2-order {
  grid-template-columns: 26px minmax(120px, 160px) minmax(90px, 140px) minmax(140px, 190px) 1fr minmax(110px, 150px) 44px;
}

/* Invoices page: 7 columns (+ status/notes column) */
.card-v2.card-v2-invoice {
  grid-template-columns: 26px minmax(120px, 170px) minmax(90px, 140px) minmax(140px, 190px) 1fr minmax(110px, 150px) 44px;
}

.card-v2:hover {
  background: #f8faff;
  border-color: rgba(102,126,234,0.25);
  box-shadow: 0 1px 4px rgba(102,126,234,0.08);
}

.card-v2.selected {
  background: rgba(102,126,234,0.06);
  border-color: rgba(102,126,234,0.3);
}

/* ── Checkbox Cell ────────────────────────────────── */
.card-v2-check {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 0 8px 6px;
}

.card-v2-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  margin-top: 2px;
}

/* ── Cell shared styles ──────────────────────────── */
.card-cell {
  padding: 7px 8px;
  min-width: 0;
  border-right: 1px solid rgba(0,0,0,0.04);
}

.card-cell:last-child {
  border-right: none;
}

/* ── Cell 1: Order Info ──────────────────────────── */
.card-cell-order {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.card-cell-order .cc-code {
  font-size: 11.5px;
  font-weight: 600;
  color: #4f6ade;
  white-space: nowrap;
  cursor: pointer;
  line-height: 1.3;
}

.card-cell-order .cc-code:hover {
  text-decoration: underline;
}

/* Invoice uses cc-header with inline status */
.card-cell-order .cc-header {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.card-cell-order .cc-status {
  display: inline-flex;
}

.card-cell-order .cc-status .status-badge {
  font-size: 9px;
  padding: 1px 5px;
  line-height: 1.3;
}

.card-cell-order .cc-time {
  font-size: 10px;
  color: #94a3b8;
  white-space: nowrap;
}

.card-cell-order .cc-delay {
  font-size: 10px;
  white-space: nowrap;
  line-height: 1.2;
}

.card-cell-order .cc-meta {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-cell-order .cc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* ── Cell 1b: Status + Notes ─────────────────────── */
.card-cell-status {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 6px;
}

.card-cell-status .cc-status {
  display: inline-flex;
}

.card-cell-status .cc-status .status-badge {
  font-size: 9px;
  padding: 1px 5px;
  line-height: 1.3;
}

.card-cell-status .cc-note {
  font-size: 10px;
  color: #b45309;
  background: rgba(245, 158, 11, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
  cursor: help;
  word-break: break-word;
}

.card-cell-status .cc-custnote {
  font-size: 10px;
  color: #7c3aed;
  background: rgba(124, 58, 237, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
  cursor: help;
  word-break: break-word;
}

/* ── Cell 2: Customer ────────────────────────────── */
.card-cell-customer {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-cell-customer .cc-name {
  font-size: 12px;
  font-weight: 500;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.card-cell-customer .cc-phone {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}

.card-cell-customer .cc-addr {
  font-size: 10.5px;
  color: #94a3b8;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* ── Cell 3: Products ────────────────────────────── */
.card-cell-products {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
}

.card-cell-products .cc-pl-list {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  line-height: 1.6;
  font-size: 11px;
}

.card-cell-products .cc-pl-list.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

.card-cell-products .cc-pl-item {
  font-weight: 500;
  cursor: pointer;
  color: #334155; /* unified slate-700 — no more per-item color cycling */
}

.card-cell-products .cc-pl-item:hover {
  text-decoration: underline dashed;
  text-underline-offset: 2px;
  color: #1e293b;
}

/* Prominent "+" separator between products */
.card-cell-products .cc-pl-sep {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  margin: 0 4px;
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 3px;
  line-height: 1.4;
  vertical-align: middle;
  user-select: none;
}

/* Live code tag styling */
.card-cell-products .cc-pl-live {
  color: #059669;
  font-size: 10px;
}

.card-cell-products .cc-pl-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: #667eea;
  cursor: pointer;
  padding: 1px 0;
  background: none;
  border: none;
  font-weight: 600;
  transition: color 0.12s;
  margin-top: 2px;
}

.card-cell-products .cc-pl-toggle:hover {
  color: #4f46e5;
  text-decoration: underline;
}

/* ── Cell 4: Financials ──────────────────────────── */
.card-cell-financials {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
  text-align: right;
}

.card-cell-financials .cc-cod {
  font-size: 13px;
  font-weight: 700;
  color: #d97706;
  white-space: nowrap;
  line-height: 1.3;
}

.card-cell-financials .cc-prepaid {
  font-size: 10.5px;
  color: #059669;
  white-space: nowrap;
}

.card-cell-financials .cc-receivable {
  font-size: 10.5px;
  color: #dc2626;
  font-weight: 600;
  white-space: nowrap;
}

.card-cell-financials .cc-ship {
  font-size: 10.5px;
  color: #64748b;
  white-space: nowrap;
}

.card-cell-financials .cc-count {
  font-size: 10.5px;
  color: #94a3b8;
  white-space: nowrap;
}

.card-cell-financials .cc-pay {
  font-size: 10px;
  color: #64748b;
  white-space: nowrap;
  margin-top: auto;
}

/* ── Cell 5: Actions ─────────────────────────────── */
.card-cell-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  padding: 6px 4px;
}

.card-cell-actions .btn-row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.12s;
  color: #64748b;
}

.card-cell-actions .btn-row-action:hover {
  background: rgba(102,126,234,0.1);
  border-color: rgba(102,126,234,0.3);
  color: #4f6ade;
}

/* ── Copyable — Click-to-Copy ────────────────────── */
.copyable {
  cursor: pointer;
  position: relative;
  transition: color 0.1s;
}

.copyable:hover {
  text-decoration: underline dashed;
  text-underline-offset: 2px;
  text-decoration-color: rgba(0,0,0,0.25);
}

.copyable:active {
  opacity: 0.6;
}

/* Mini clipboard icon on hover */
.copyable::after {
  content: '📋';
  position: absolute;
  top: -1px;
  right: -14px;
  font-size: 9px;
  opacity: 0;
  transition: opacity 0.12s;
  pointer-events: none;
}

.copyable:hover::after {
  opacity: 0.5;
}

/* Pulse animation on copy */
@keyframes copy-flash {
  0% { background: rgba(102,126,234,0.15); }
  100% { background: transparent; }
}

.copyable.copied {
  animation: copy-flash 0.4s ease-out;
}

/* ── Lock icon on card-v2 ────────────────────────── */
.card-v2 .cc-lock {
  display: inline-flex;
  font-size: 11px;
  animation: lock-pulse 2s ease-in-out infinite;
}

/* ─── Body Scroll Lock when Panel Open ──────────── */
body.panel-open {
  overflow: hidden;
}

/* ─── Content Empty & Loading States ───────────── */
.content-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: #94a3b8;
  font-size: 14px;
}
.content-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.6;
}
.content-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
}

/* ─── Split Line Modal Items ───────────────────── */
.split-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.split-line:hover {
  background: rgba(102,126,234,0.04);
}
.split-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.split-line-info {
  flex: 1;
  min-width: 0;
}
.split-line-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.split-line-code {
  display: block;
  font-size: 11px;
  color: #667eea;
  font-weight: 600;
}
.split-line-price {
  font-size: 13px;
  font-weight: 600;
  color: #0f766e;
  flex-shrink: 0;
}

/* ─── Filter Bar: Select-All & Search Wrap ──────── */
.select-all-wrap {
  display: flex;
  align-items: center;
  padding: 0 4px;
}
.select-all-wrap input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.filter-search-wrap {
  flex: 1;
  max-width: 260px;
  min-width: 160px;
}
.filter-search {
  width: 100%;
  font-size: 11.5px;
  padding: 4px 8px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  background: #ffffff;
  color: #1e293b;
  outline: none;
  transition: border-color 0.15s;
}
.filter-search:focus {
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102,126,234,0.12);
}
.btn-filter {
  font-size: 11.5px;
  padding: 4px 10px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-filter:hover {
  background: rgba(102,126,234,0.06);
  border-color: rgba(102,126,234,0.3);
  color: #667eea;
}

/* ── Create Invoice Chooser (OH-21) ─────────────── */
.create-chooser-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chooser-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.chooser-card:hover {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102,126,234,0.04), rgba(118,75,162,0.04));
  box-shadow: 0 2px 12px rgba(102,126,234,0.12);
  transform: translateY(-1px);
}
.chooser-icon {
  font-size: 28px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(102,126,234,0.1), rgba(118,75,162,0.1));
  border-radius: 10px;
  flex-shrink: 0;
}
.chooser-info {
  flex: 1;
  min-width: 0;
}
.chooser-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #1e293b);
  margin-bottom: 4px;
}
.chooser-desc {
  font-size: 12px;
  color: var(--text-muted, #64748b);
  line-height: 1.4;
}
.chooser-arrow {
  font-size: 18px;
  color: var(--text-muted, #94a3b8);
  transition: transform 0.2s, color 0.2s;
  flex-shrink: 0;
}
.chooser-card:hover .chooser-arrow {
  transform: translateX(4px);
  color: #667eea;
}

/* ═══════════════════════════════════════════════════
   OH-37: Customer Management Module CSS
   ═══════════════════════════════════════════════════ */

/* ── KPI Cards ──────────────────────────────────── */
.customer-kpi {
  display: flex;
  gap: 8px;
  padding: 8px 12px 0;
  flex-wrap: wrap;
}
.customer-kpi .kpi-card {
  flex: 1;
  min-width: 100px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 10px 14px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.customer-kpi .kpi-value {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.customer-kpi .kpi-label {
  display: block;
  font-size: 10.5px;
  color: #64748b;
  margin-top: 2px;
}
.customer-kpi .kpi-new .kpi-value { color: #3b82f6; }
.customer-kpi .kpi-vip .kpi-value { color: #f59e0b; }
.customer-kpi .kpi-blacklisted .kpi-value { color: #ef4444; }

/* ── Customer Card Row ──────────────────────────── */
.customer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.cust-row:hover {
  background: #f8faff;
  border-color: rgba(102,126,234,0.25);
  box-shadow: 0 1px 3px rgba(102,126,234,0.08);
}
.cust-row.active-panel {
  background: linear-gradient(135deg, rgba(102,126,234,0.06) 0%, rgba(118,75,162,0.04) 100%);
  border-color: rgba(102,126,234,0.3);
  border-left: 3px solid #667eea;
}

/* Avatar */
.cust-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.cust-avatar-lg {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.cust-row-body {
  flex: 1;
  min-width: 0;
}
.cust-row-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.4;
}
.cust-name {
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.cust-phone {
  color: #64748b;
  font-size: 11.5px;
  white-space: nowrap;
  cursor: pointer;
}
.cust-phone:hover { color: #667eea; }

.cust-row-line2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
  flex-wrap: wrap;
}
.cust-stat { white-space: nowrap; }
.cust-addr {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.cust-wallet {
  color: #22c55e;
  font-weight: 500;
}

.cust-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.cust-row-actions .btn-icon {
  width: 28px;
  height: 28px;
  border: none;
  background: rgba(0,0,0,0.03);
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.cust-row-actions .btn-icon:hover {
  background: rgba(102,126,234,0.1);
}

/* ── Customer Badges ────────────────────────────── */
.cust-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
  line-height: 1.5;
}
.cust-badge-vip {
  background: rgba(245,158,11,0.12);
  color: #d97706;
  border: 1px solid rgba(245,158,11,0.25);
}
.cust-badge-new {
  background: rgba(59,130,246,0.1);
  color: #2563eb;
  border: 1px solid rgba(59,130,246,0.2);
}
.cust-badge-blacklisted {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
  border: 1px solid rgba(239,68,68,0.2);
}

/* ── Customer Detail Tabs ───────────────────────── */
.cust-tabs {
  display: flex;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  background: #fafbfc;
  padding: 0 4px;
  overflow-x: auto;
  flex-shrink: 0;
}
.cust-tab {
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 500;
  color: #64748b;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.cust-tab:hover {
  color: #1e293b;
  background: rgba(0,0,0,0.02);
}
.cust-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  font-weight: 600;
}
.cust-tab-content {
  padding: 0;
}
.cust-tab-pane {
  display: none;
  padding: 8px 0;
}
.cust-tab-pane.active {
  display: block;
}

/* ── Stats Grid ─────────────────────────────────── */
.cust-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 0 4px;
}
.cust-stat-card {
  background: #f8fafc;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
}
.cust-stat-val {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}
.cust-stat-lbl {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 2px;
}

/* ── Info Row (key-value pair) ───────────────────── */
.info-row {
  display: flex;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 12px;
}
.info-row:last-child { border-bottom: none; }
.info-lbl {
  flex: 0 0 90px;
  color: #94a3b8;
  font-size: 11px;
}
.info-val {
  flex: 1;
  color: #1e293b;
  font-weight: 500;
}

/* ── Mini Cards (orders/invoices in detail panel) ─ */
.cust-mini-card {
  padding: 8px 10px;
  margin: 0 4px 4px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.cust-mini-card:hover {
  background: #f8faff;
  border-color: rgba(102,126,234,0.2);
}
.mini-card-line1 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.mini-code {
  font-weight: 600;
  color: #4f6ade;
  font-size: 11.5px;
}
.mini-date {
  color: #94a3b8;
  font-size: 10.5px;
  margin-left: auto;
}
.mini-card-line2 {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
  flex-wrap: wrap;
}
.mini-card-line3 {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

/* ── Product Table ──────────────────────────────── */
.cust-product-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 4px;
}
.cust-product-table th {
  text-align: left;
  padding: 6px 8px;
  background: #f8fafc;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  font-weight: 600;
  color: #64748b;
  font-size: 11px;
}
.cust-product-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.cust-product-row {
  cursor: pointer;
  transition: background 0.1s;
}
.cust-product-row:hover { background: #f8faff; }
.cust-product-detail {
  display: none;
}
.cust-product-detail.show { display: table-row; }
.cust-product-detail td {
  background: #f8fafc;
  padding: 6px 12px;
}
.product-purchases {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.purchase-item {
  font-size: 10.5px;
  color: #64748b;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── Incidents ──────────────────────────────────── */
.cust-incident {
  padding: 8px 10px;
  margin: 0 4px 4px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
}
.incident-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.incident-reason {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
  padding-left: 4px;
}

/* ── Wallet Transactions ──────────────────────────── */
.wallet-tx-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wallet-tx-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 6px;
  margin: 0 4px;
}
.wallet-tx-row:hover { background: #f8fafc; }
.wallet-tx-icon {
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}
.wallet-tx-body {
  flex: 1;
  min-width: 0;
}
.wallet-tx-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}
.wallet-tx-source {
  font-weight: 500;
  color: #334155;
}
.wallet-tx-ref {
  font-size: 11px;
  color: #6366f1;
  background: #eef2ff;
  padding: 1px 5px;
  border-radius: 3px;
}
.wallet-tx-date {
  font-size: 10.5px;
  color: #94a3b8;
  margin-left: auto;
}
.wallet-tx-note {
  font-size: 11px;
  color: #64748b;
  margin-top: 2px;
}
.wallet-tx-amount {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}
.wallet-tx-amount.tx-credit { color: #16a34a; }
.wallet-tx-amount.tx-debit { color: #ef4444; }

/* ── Wallet Adjustment Form ────────────────── */
.wallet-adjust-form {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
}
.waf-row {
  margin-bottom: 12px;
}
.waf-row:last-child {
  margin-bottom: 0;
}
.waf-type-btns {
  display: flex;
  gap: 8px;
}
.waf-type-btn {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #64748b;
  transition: all 0.2s;
}
.waf-type-btn:hover {
  border-color: #94a3b8;
}
.waf-type-btn.waf-credit.active {
  border-color: #16a34a;
  background: #f0fdf4;
  color: #16a34a;
  font-weight: 600;
}
.waf-type-btn.waf-debit.active {
  border-color: #ef4444;
  background: #fef2f2;
  color: #ef4444;
  font-weight: 600;
}
.waf-field label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 500;
}
.waf-field .form-control {
  width: 100%;
  box-sizing: border-box;
}

/* ── Avatar Images ──────────────────────────── */
img.cust-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
img.cust-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   OH-38: Report Pages — Filter Bar + KPI Cards + Table
   ═══════════════════════════════════════════════════════ */

/* ─── Time Filter Bar ─────────────────────────────── */
.rf-presets {
  display: flex;
  gap: 4px;
  align-items: center;
}

.rf-btn {
  padding: 4px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #fff;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.rf-btn:hover {
  border-color: #667eea;
  color: #667eea;
  background: rgba(102,126,234,0.04);
}

.rf-btn.active {
  background: #667eea;
  color: #fff;
  border-color: #667eea;
}

.rf-custom {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-left: 8px;
}

.rf-custom input[type="date"] {
  padding: 3px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  font-size: 12px;
  color: #334155;
  background: #fff;
}

.rf-apply {
  padding: 4px 12px;
  border: none;
  border-radius: 5px;
  background: #059669;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.rf-apply:hover {
  background: #047857;
}

/* ─── KPI Cards Grid ─────────────────────────────── */
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 12px;
}

.rk-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
  text-align: center;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.rk-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  opacity: 0.6;
}

.rk-card:hover {
  box-shadow: 0 4px 16px rgba(102,126,234,0.12);
  transform: translateY(-2px);
}

.rk-value {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
  margin-bottom: 4px;
}

.rk-label {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}

/* KPI card color variants */
.rk-card.rk-accent::before { background: linear-gradient(90deg, #667eea, #764ba2); opacity: 1; }
.rk-card.rk-accent .rk-value { color: #667eea; }

.rk-card.rk-success::before { background: #22c55e; opacity: 1; }
.rk-card.rk-success .rk-value { color: #059669; }

.rk-card.rk-warn::before { background: #f59e0b; opacity: 1; }
.rk-card.rk-warn .rk-value { color: #d97706; }

.rk-card.rk-danger::before { background: #ef4444; opacity: 1; }
.rk-card.rk-danger .rk-value { color: #dc2626; }

.rk-card.rk-info::before { background: #3b82f6; opacity: 1; }
.rk-card.rk-info .rk-value { color: #2563eb; }

.rk-card.rk-dark::before { background: #475569; opacity: 1; }
.rk-card.rk-dark .rk-value { color: #334155; }

.rk-card.rk-vip::before { background: linear-gradient(90deg, #f59e0b, #ef4444); opacity: 1; }
.rk-card.rk-vip .rk-value { color: #f59e0b; }

/* ─── Sortable Table Headers ─────────────────────── */
.sort-header {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 0.2s;
}

.sort-header:hover {
  color: #667eea;
}

.sort-icon {
  font-size: 11px;
  margin-left: 2px;
  opacity: 0.3;
  transition: opacity 0.2s;
}

.sort-header:hover .sort-icon {
  opacity: 0.7;
}

/* ─── Report table enhancements ──────────────────── */
#reportTable th {
  white-space: nowrap;
  font-size: 12px;
}

#reportTable td {
  font-size: 13px;
}

/* Chart card */
#chartCard {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px 18px;
}

/* ─── Responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .report-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .rk-value { font-size: 18px; }
  .rf-presets { flex-wrap: wrap; }
  .rf-custom { flex-wrap: wrap; }
}

/* ═══════════════════════════════════════════════════ */
/* ─── Voucher Management (OH-57) ───────────────── */
/* ═══════════════════════════════════════════════════ */

/* Stats Pills */
.voucher-stats {
  display: flex;
  gap: 8px;
  padding: 8px 12px 0;
}

.vs-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 16px;
  border-radius: 8px;
  min-width: 70px;
  background: #fff;
  border: 1px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.vs-pill .vs-num {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

.vs-pill .vs-label {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 500;
  margin-top: 2px;
}

.vs-total { border-top: 3px solid #667eea; }
.vs-unused { border-top: 3px solid #22c55e; }
.vs-used { border-top: 3px solid #ef4444; }
.vs-expired { border-top: 3px solid #f59e0b; }

.vs-total .vs-num { color: #667eea; }
.vs-unused .vs-num { color: #22c55e; }
.vs-used .vs-num { color: #ef4444; }
.vs-expired .vs-num { color: #f59e0b; }

/* Voucher List */
.voucher-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Voucher Card */
.voucher-card {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.15s;
  border-left: 3px solid #22c55e;
}

.voucher-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border-color: rgba(102,126,234,0.2);
}

.voucher-card.vc-used {
  border-left-color: #ef4444;
  opacity: 0.7;
}

.voucher-card.vc-used:hover {
  opacity: 0.85;
}

/* Card Main Row */
.vc-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.vc-code-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.vc-code {
  font-size: 15px;
  font-weight: 700;
  color: #667eea;
  letter-spacing: 0.5px;
  cursor: pointer;
  font-family: 'SF Mono', 'Fira Code', 'JetBrains Mono', monospace;
}

.vc-code:hover {
  color: #4f46e5;
  text-decoration: underline;
}

.vc-value {
  font-size: 16px;
  font-weight: 700;
  color: #059669;
  white-space: nowrap;
}

/* Status Badges */
.vc-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

.vc-badge-active {
  background: rgba(34,197,94,0.12);
  color: #16a34a;
}

.vc-badge-used {
  background: rgba(239,68,68,0.1);
  color: #dc2626;
}

.vc-badge-expired {
  background: rgba(245,158,11,0.12);
  color: #d97706;
}

/* Meta Row */
.vc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 6px;
  font-size: 11.5px;
  color: #64748b;
}

.vc-meta-item {
  white-space: nowrap;
}

.vc-note {
  color: #b45309;
  font-style: italic;
}

/* Usage Info */
.vc-usage {
  margin-top: 6px;
  font-size: 11px;
  color: #94a3b8;
  padding: 4px 8px;
  background: rgba(0,0,0,0.02);
  border-radius: 4px;
}

.vc-usage-label {
  font-weight: 600;
  color: #64748b;
}

/* Footer Row */
.vc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(0,0,0,0.04);
}

.vc-created {
  font-size: 10.5px;
  color: #94a3b8;
}

.vc-actions {
  display: flex;
  gap: 4px;
}

.btn-vc {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  font-size: 11px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 5px;
  cursor: pointer;
  background: #fff;
  color: #64748b;
  transition: all 0.12s;
}

.btn-vc:hover {
  background: rgba(0,0,0,0.04);
  color: #1e293b;
}

.btn-vc-edit:hover {
  border-color: rgba(102,126,234,0.3);
  color: #667eea;
}

.btn-vc-delete:hover {
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
}

.btn-vc-revoke {
  border-color: rgba(245,158,11,0.3);
  color: #d97706;
}

.btn-vc-revoke:hover {
  background: rgba(245,158,11,0.08);
  color: #b45309;
}

/* Batch Result */
.batch-success {
  margin-top: 12px;
  padding: 12px;
  background: rgba(34,197,94,0.06);
  border: 1px solid rgba(34,197,94,0.2);
  border-radius: 8px;
}

.batch-success-header {
  font-weight: 600;
  color: #16a34a;
  margin-bottom: 8px;
  font-size: 13px;
}

.batch-codes {
  width: 100%;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  padding: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  background: #fff;
  color: #1e293b;
  resize: none;
}

/* Pagination (reusable) */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 22px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 4px;
  color: #64748b;
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s;
}

.page-btn:hover { background: rgba(0,0,0,0.08); color: #1e293b; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.page-info {
  padding: 0 6px;
  font-size: 11px;
  color: #64748b;
}

/* Empty state */
.voucher-list .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #94a3b8;
  font-size: 16px;
}

/* Filter bar overrides for voucher phone input */
.filter-bar input.filter-search[id="filterPhone"] {
  padding-left: 8px;
}

/* ─── Voucher Responsive ────────────────────────── */
@media (max-width: 768px) {
  .voucher-stats { flex-wrap: wrap; }
  .vs-pill { flex: 1; min-width: 60px; }
  .vc-main { flex-wrap: wrap; }
  .vc-meta { font-size: 10.5px; }
}
