/* ============================================================
   Tracksy — Stylesheet
   Office Smart Apps
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────── */
:root {
  /* Theme (overridden at runtime by applyTheme()) */
  --theme-primary:    #6366f1;
  --theme-secondary:  #8b5cf6;
  --theme-accent:     #06b6d4;
  --theme-font:       'Inter', system-ui, sans-serif;

  /* Bootstrap primary override */
  --bs-primary:     var(--theme-primary);
  --bs-primary-rgb: 99, 102, 241;

  /* Status tokens — light mode */
  --status-new-bg:          #e0e7ff;
  --status-new-fg:          #3730a3;
  --status-new-border:      #c7d2fe;

  --status-progress-bg:     #dbeafe;
  --status-progress-fg:     #1e40af;
  --status-progress-border: #bfdbfe;

  --status-completed-bg:    #d1fae5;
  --status-completed-fg:    #065f46;
  --status-completed-border:#a7f3d0;

  --status-closed-bg:       #f3f4f6;
  --status-closed-fg:       #374151;
  --status-closed-border:   #d1d5db;

  /* Payment status */
  --pay-unpaid-bg:          #fee2e2;
  --pay-unpaid-fg:          #991b1b;
  --pay-partial-bg:         #fef3c7;
  --pay-partial-fg:         #92400e;
  --pay-full-bg:            #d1fae5;
  --pay-full-fg:            #065f46;
}

/* ── Font ──────────────────────────────────────────────── */
body { font-family: var(--theme-font); }

/* ── Loader ────────────────────────────────────────────── */
/* ── App loader — slim top progress bar ─────────────────── */
.loader-bar-wrap {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9999;
  height: 3px; background: transparent; pointer-events: none;
}
.loader-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #818cf8, #06b6d4);
  background-size: 200% 100%;
  width: 0%;
  transition: width .4s ease;
  animation: loader-shimmer 1.5s linear infinite;
  border-radius: 0 2px 2px 0;
}
@keyframes loader-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.loader-bar-wrap.d-none { display: none !important; }

/* ── Sidebar icon buttons (Change Password / Change PIN) ── */
.sidebar-icon-btn {
  width: 28px; height: 28px; padding: 0; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid #e5e7eb;
  border-radius: 6px; color: #6c757d; cursor: pointer;
  font-size: 13px; transition: all .15s; line-height: 1;
}
.sidebar-icon-btn:hover {
  background: #f3f4f6; color: var(--theme-primary);
  border-color: rgba(99,102,241,.35);
}
.sidebar-icon-btn:active { transform: scale(.94); }

body.dark-mode .sidebar-icon-btn {
  border-color: #363a5a; color: #8888aa; background: none;
}
body.dark-mode .sidebar-icon-btn:hover {
  background: #1e2244; color: #818cf8; border-color: #6366f1;
}
/* ── Sidebar ───────────────────────────────────────────── */
@media (max-width: 991.98px) {
  #sidebar {
    position: fixed; top: 0; bottom: 0; left: 0;
    height: 100% !important; z-index: 1050;
    transform: translateX(-100%);
    transition: transform .22s cubic-bezier(.4,0,.2,1);
  }
  #sidebar.sidebar-open { transform: translateX(0); }
}
@media (min-width: 992px) {
  #sidebar {
    position: relative !important;
    transform: none !important;
    height: 100% !important;
    flex-shrink: 0;
  }
  #sidebar-overlay { display: none !important; }
}

/* ── Sidebar sync info widget ──────────────────────────── */
.sidebar-sync-info {
  font-size: 10px; color: #9ca3af;
  background: #f8f9fa;
  padding: 5px 10px;
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; min-height: 30px;
}

.nav-item-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  color: #6c757d; text-decoration: none;
  transition: all .15s;
}
.nav-item-link:hover { color: #212529; background: #f8f9fa; }
.nav-item-link.active {
  color: var(--theme-primary);
  background: rgba(99, 102, 241, .08);
}

/* ── Branch badge ──────────────────────────────────────── */
.branch-badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; font-size: 11px; font-weight: 500;
  color: var(--theme-primary);
  background: rgba(99,102,241,.08);
  border: 1px solid rgba(99,102,241,.2);
  border-radius: 999px; padding: 0 10px;
  white-space: nowrap;
}

/* ── Role badge ────────────────────────────────────────── */
.role-badge {
  display: inline-block; font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
  color: var(--theme-primary); background: rgba(99,102,241,.1);
  border-radius: 4px; padding: 1px 5px; margin-top: 1px;
}

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE — legacy class stubs (layout now handled by .auth-*)
   ══════════════════════════════════════════════════════════ */

/* App logo on login */
.app-logo { border-radius: 8px; }
.app-logo-placeholder { }
body:has(.app-logo[src]:not([src=""])) .app-logo-placeholder { display: none !important; }

/* ══════════════════════════════════════════════════════════
   EMERGENCY BANNERS
   ══════════════════════════════════════════════════════════ */

#emergency-banner { position: sticky; top: 0; z-index: 9998; }

.emergency-banner-red {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px;
  background: #dc3545; color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  text-align: center;
}

.emergency-banner-green {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 16px;
  background: #16a34a; color: #fff;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  animation: banner-in .3s ease;
}

@keyframes banner-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════
   SYNC STATUS BAR (always visible below header)
   ══════════════════════════════════════════════════════════ */

.sync-status-bar {
  padding: 4px 16px; border-bottom: 1px solid #e5e7eb;
  background: #fafafa; min-height: 32px;
  display: flex; align-items: center;
}

.sync-indicator-inner {
  display: flex; align-items: center; gap: 8px; flex: 1;
}

.sync-indicator-text { flex: 1; line-height: 1.2; }
.sync-line1 { font-size: 12px; font-weight: 500; color: #374151; }
.sync-line2 { font-size: 11px; color: #9ca3af; margin-top: 1px; }

.sync-refresh-btn {
  width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid #e5e7eb;
  border-radius: 6px; color: #6c757d; cursor: pointer;
  transition: all .15s; flex-shrink: 0;
}
.sync-refresh-btn:hover { background: #f3f4f6; color: #374151; }
.sync-refresh-btn:disabled { opacity: .5; cursor: not-allowed; }

.sync-refresh-msg {
  font-size: 11px; color: #6b7280;
  padding: 2px 8px; margin-top: 2px;
  background: rgba(99,102,241,.05);
  border-radius: 4px;
}

/* Sync dot states */
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}
.sync-dot-green  { background: #22c55e; }
.sync-dot-yellow { background: #eab308; }
.sync-dot-orange { background: #f97316; }
.sync-dot-red    { background: #ef4444; }
.sync-dot-blue   { background: #3b82f6; }

.sync-dot-pulse { animation: dot-pulse 1.2s ease-in-out infinite; }
@keyframes dot-pulse { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:.4; transform:scale(.8); } }

/* Legacy sync pill (kept for any remaining references) */
.sync-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap;
  transition: opacity .4s; user-select: none;
}
.sync-pill.sync-idle    { opacity: 0; pointer-events: none; }
.sync-pill.sync-saving  { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.sync-pill.sync-synced  { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.sync-pill.sync-offline { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

/* ══════════════════════════════════════════════════════════
   WHATSAPP TOGGLE
   ══════════════════════════════════════════════════════════ */

#wa-toggle-btn,
#wa-toggle-btn-mobile {
  transition: all .15s;
}
.wa-toggle-on  { border-color: rgba(37,211,102,.3) !important; }
.wa-toggle-off { opacity: .6; }

/* ══════════════════════════════════════════════════════════
   NOTIFICATION BADGE
   ══════════════════════════════════════════════════════════ */

.notification-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: #ef4444; color: #fff;
  font-size: 9px; font-weight: 700; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; line-height: 1;
}

/* ══════════════════════════════════════════════════════════
   STATUS BADGES
   Status values stored exactly as Config provides.
   Slug = lowercase + spaces replaced with hyphens.
   ══════════════════════════════════════════════════════════ */

.badge-status {
  font-size: 11px; font-weight: 500; padding: 3px 8px;
  border-radius: 999px; display: inline-block; white-space: nowrap;
}

/* Order statuses */
.badge-new           { background: var(--status-new-bg);       color: var(--status-new-fg); }
.badge-in-progress   { background: var(--status-progress-bg);  color: var(--status-progress-fg); }
.badge-completed     { background: var(--status-completed-bg); color: var(--status-completed-fg); }
.badge-closed        { background: var(--status-closed-bg);    color: var(--status-closed-fg); }

/* Payment status badges */
.badge-payment { font-size: 11px; font-weight: 500; padding: 3px 8px; border-radius: 999px; }
.badge-pay-unpaid          { background: var(--pay-unpaid-bg);  color: var(--pay-unpaid-fg); }
.badge-pay-partially-paid  { background: var(--pay-partial-bg); color: var(--pay-partial-fg); }
.badge-pay-fully-paid      { background: var(--pay-full-bg);    color: var(--pay-full-fg); }

/* ══════════════════════════════════════════════════════════
   INLINE STATUS SELECTS
   ══════════════════════════════════════════════════════════ */

.order-status-select,
.item-status-select {
  border-radius: 999px; font-weight: 500;
  border: 1px solid #dee2e6; background: #f8f9fa;
  cursor: pointer; font-size: 12px; padding: 2px 8px;
  transition: box-shadow .15s;
}
.order-status-select:focus,
.item-status-select:focus {
  box-shadow: 0 0 0 2px rgba(99,102,241,.15); outline: none;
}

.order-status-select.status-new,
.item-status-select.status-new         { background: var(--status-new-bg);       color: var(--status-new-fg);       border-color: var(--status-new-border); }
.order-status-select.status-in-progress,
.item-status-select.status-in-progress { background: var(--status-progress-bg);  color: var(--status-progress-fg);  border-color: var(--status-progress-border); }
.order-status-select.status-completed,
.item-status-select.status-completed   { background: var(--status-completed-bg); color: var(--status-completed-fg); border-color: var(--status-completed-border); }
.order-status-select.status-closed,
.item-status-select.status-closed      { background: var(--status-closed-bg);    color: var(--status-closed-fg);    border-color: var(--status-closed-border); }

/* ══════════════════════════════════════════════════════════
   TAG PILLS
   ══════════════════════════════════════════════════════════ */

.tag-pill {
  display: inline-block; font-size: 11px; padding: 2px 8px;
  border-radius: 999px; border: 1px solid #dee2e6;
  background: #f8f9fa; color: #6c757d;
  cursor: pointer; transition: all .15s; user-select: none;
}
.tag-pill.active {
  background: var(--theme-primary); color: #fff;
  border-color: var(--theme-primary);
}
.tag-pill:hover:not(.active) { border-color: rgba(99,102,241,.4); }

/* Customer tags */
.customer-tag {
  display: inline-block; font-size: 10px; padding: 2px 7px;
  border-radius: 999px; background: rgba(99,102,241,.1);
  color: var(--theme-primary); font-weight: 500;
  border: 1px solid rgba(99,102,241,.2);
}

/* ══════════════════════════════════════════════════════════
   PHONE FIELD WITH COUNTRY CODE
   ══════════════════════════════════════════════════════════ */

.phone-field-wrapper {
  display: flex; gap: 0;
}
.phone-country-select {
  width: 120px; flex-shrink: 0;
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  font-size: 13px;
}
.phone-number-input {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  border-left: none !important;
}
.phone-number-input:focus { border-left: 1px solid #6366f1 !important; }

.country-flag {
  font-size: 14px; margin-right: 4px; vertical-align: middle;
}

/* ══════════════════════════════════════════════════════════
   CUSTOMER SELECTION CARD
   ══════════════════════════════════════════════════════════ */

.customer-select-card {
  border: 1px solid #e5e7eb; border-radius: 8px;
  overflow: hidden; margin-top: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.customer-select-header {
  padding: 8px 12px; background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px; font-weight: 600; color: #374151;
}
.customer-select-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  transition: background .1s;
  font-size: 13px;
}
.customer-select-row:last-child { border-bottom: none; }
.customer-select-row:hover { background: rgba(99,102,241,.05); }
.customer-select-row.new-customer {
  color: var(--theme-primary); font-weight: 500;
  border-top: 1px solid #e5e7eb;
}
.customer-select-name  { font-weight: 500; }
.customer-select-meta  { font-size: 11px; color: #6c757d; }

/* ══════════════════════════════════════════════════════════
   ORDER AGING / OVERDUE
   ══════════════════════════════════════════════════════════ */

.order-row-aging    { background-color: #fffbeb !important; }
.order-row-overdue  { background-color: #fef2f2 !important; }
.order-row-aging:hover   { background-color: #fef9c3 !important; }
.order-row-overdue:hover { background-color: #fee2e2 !important; }

.aging-indicator {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; padding: 1px 6px;
  border-radius: 999px;
}
.aging-indicator.overdue { background: #fee2e2; color: #991b1b; }
.aging-indicator.aging   { background: #fef3c7; color: #92400e; }

/* ══════════════════════════════════════════════════════════
   OUTSTANDING BALANCE
   ══════════════════════════════════════════════════════════ */

.outstanding-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px;
  background: #fef3c7; color: #92400e;
  border: 1px solid #fde68a;
}
.outstanding-badge.overdue {
  background: #fee2e2; color: #991b1b;
  border-color: #fecaca;
}
.outstanding-badge.paid {
  background: #d1fae5; color: #065f46;
  border-color: #a7f3d0;
}

/* ══════════════════════════════════════════════════════════
   REF PENDING INDICATOR
   ══════════════════════════════════════════════════════════ */

.ref-pending {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: #9ca3af; font-style: italic;
}
.ref-pending::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: #d1d5db;
  display: inline-block;
}

.ref-synced { font-family: monospace; font-size: 11px; }

/* ══════════════════════════════════════════════════════════
   ORDERS — TAB BAR
   ══════════════════════════════════════════════════════════ */

.ord-tab-bar {
  display: flex; align-items: stretch;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 0; overflow-x: auto;
  scrollbar-width: none; gap: 0;
}
.ord-tab-bar::-webkit-scrollbar { display: none; }
.ord-tab {
  padding: 8px 14px; font-size: 12.5px; font-weight: 500;
  color: #6c757d; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 6px;
}
.ord-tab:hover { color: #343a40; background: #f8f9fa; }
.ord-tab.active { color: var(--theme-primary); border-bottom-color: var(--theme-primary); }
.ord-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 5px;
  border-radius: 999px; font-size: 10px; font-weight: 600;
  background: #e9ecef; color: #6c757d;
  transition: background .15s, color .15s;
}
.ord-tab.active .ord-tab-count {
  background: rgba(99,102,241,.15); color: var(--theme-primary);
}
.ord-tab-content { padding-top: 14px; }

/* ══════════════════════════════════════════════════════════
   ORDERS — EXPANDED ROWS
   ══════════════════════════════════════════════════════════ */

.order-row { cursor: pointer; }
.order-row.expanded { background: #f8f9ff; }
.item-header-row { background: transparent !important; }
.item-header-row:hover { background: transparent !important; }
.item-header-row > td { padding: 0 !important; }

.items-expand-panel {
  background: #fafbff; border: 1px solid #e8ecf4;
  border-radius: 8px; padding: 12px; margin: 4px 0;
}
.items-expand-panel .table { background: transparent; }
.items-expand-panel .table th {
  font-size: 11px; font-weight: 600; color: #8c8fa3;
  border-bottom: 1px solid #e8ecf4;
}
.items-expand-panel .table td { border-bottom: 1px solid #f0f2f8; }
.item-child-row:last-child td { border-bottom: none; }

.order-addr-row td { padding-top: 0 !important; border-top: none !important; }
.order-addr-row:hover td { background: inherit !important; }

/* ══════════════════════════════════════════════════════════
   TABLES
   ══════════════════════════════════════════════════════════ */

.table-tracksy th { font-size: 12px; font-weight: 600; color: #6c757d; white-space: nowrap; }
.table-tracksy td { font-size: 13px; vertical-align: middle; }
.table-tracksy tbody tr:nth-child(odd)        { background-color: #ffffff; }
.table-tracksy tbody tr:nth-child(even)       { background-color: #f5f6ff; }
.table-tracksy tbody tr:nth-child(odd):hover  { background-color: #eef0ff !important; }
.table-tracksy tbody tr:nth-child(even):hover { background-color: #e8eaff !important; }
.item-header-row,
.item-header-row:hover { background-color: transparent !important; }
.items-expand-panel .table-item-rows tbody tr:nth-child(odd)  { background-color: #fafbff; }
.items-expand-panel .table-item-rows tbody tr:nth-child(even) { background-color: #eff1ff; }

/* ══════════════════════════════════════════════════════════
   STAT CARDS
   ══════════════════════════════════════════════════════════ */

.stat-card { border-radius: 8px; border: 1px solid #e5e7eb; }
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */

.tracksy-toast {
  animation: slideInRight .2s ease;
}
@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ══════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════ */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* ══════════════════════════════════════════════════════════
   VIRTUAL SCROLL — Orders
   ══════════════════════════════════════════════════════════ */

#orders-vs-host {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: .375rem;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
#orders-vs-host .table-responsive { border: none; border-radius: 0; overflow: visible; }
#orders-vs-host .table-tracksy tbody tr { display: table-row; height: 40px; box-sizing: border-box; }
#orders-vs-host .table-tracksy thead { position: sticky; top: 0; z-index: 2; background: #fff; }

/* ══════════════════════════════════════════════════════════
   CONFLICT / PENDING BANNER (sync)
   ══════════════════════════════════════════════════════════ */

.sync-conflict-banner {
  background: #fef3c7; border: 1px solid #fde68a;
  border-radius: 6px; padding: 10px 14px;
  font-size: 12px; color: #92400e;
  display: flex; align-items: center; gap: 8px;
}
.sync-pending-banner {
  background: #eff6ff; border: 1px solid #bfdbfe;
  border-radius: 6px; padding: 10px 14px;
  font-size: 12px; color: #1e40af;
  display: flex; align-items: center; gap: 8px;
}

/* ══════════════════════════════════════════════════════════
   INACTIVITY COUNTDOWN PILL (before PIN lock)
   ══════════════════════════════════════════════════════════ */

#inactivity-pill {
  display: none; position: fixed; bottom: 1.25rem; right: 1.25rem;
  z-index: 9998; background: rgba(30,30,30,.82); color: #fff;
  font-size: 12px; font-weight: 600; padding: 6px 14px;
  border-radius: 999px; align-items: center; gap: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  pointer-events: none; backdrop-filter: blur(4px);
  animation: pill-in .2s ease;
}
@keyframes pill-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }

/* ══════════════════════════════════════════════════════════
   DUPLICATE DETECTION BANNER
   ══════════════════════════════════════════════════════════ */

.duplicate-banner {
  background: #fef9c3; border: 1px solid #fde047;
  border-radius: 8px; padding: 12px 14px;
  font-size: 13px; color: #713f12;
  margin-bottom: 12px;
}
.duplicate-banner .dup-order-ref {
  font-family: monospace; font-weight: 700;
}

/* ══════════════════════════════════════════════════════════
   DARK MODE
   ══════════════════════════════════════════════════════════ */

/* Override status tokens in dark mode */
body.dark-mode {
  --status-new-bg:           #2a3050; --status-new-fg:           #818cf8; --status-new-border:       #4a4f80;
  --status-progress-bg:      #0e2040; --status-progress-fg:      #60a5fa; --status-progress-border:  #1e4080;
  --status-completed-bg:     #0a2a18; --status-completed-fg:     #34d399; --status-completed-border: #1a5038;
  --status-closed-bg:        #1e2035; --status-closed-fg:        #9ca3af; --status-closed-border:    #374151;
  --pay-unpaid-bg:           #2a0e10; --pay-unpaid-fg:           #f87171;
  --pay-partial-bg:          #3a2a10; --pay-partial-fg:          #fbbf24;
  --pay-full-bg:             #0a2a18; --pay-full-fg:             #34d399;
}

body.dark-mode { background: #1a1a2e; color: #e0e0e0; }
body.dark-mode .bg-white,
body.dark-mode .card { background: #16213e !important; color: #e0e0e0; }
body.dark-mode .border-end,
body.dark-mode .border-bottom,
body.dark-mode .border-top,
body.dark-mode .border { border-color: #2a2a4a !important; }
body.dark-mode .text-muted { color: #8888aa !important; }

/* Nav */
body.dark-mode .nav-item-link { color: #8888aa; }
body.dark-mode .nav-item-link:hover { color: #e0e0e0; background: rgba(255,255,255,.05); }
body.dark-mode .nav-item-link.active { color: #818cf8; background: rgba(129,140,248,.1); }

/* Badges */
body.dark-mode .branch-badge { color: #818cf8; background: rgba(129,140,248,.12); border-color: rgba(129,140,248,.25); }
body.dark-mode .role-badge   { color: #818cf8; background: rgba(129,140,248,.15); }

/* Auth pages (.auth-page, .auth-card etc.) always use the dark gradient — no dark-mode override needed */

/* Loader — dark theme always */

/* Header */
body.dark-mode header { background: #16213e !important; border-color: #2a2d4a !important; }
body.dark-mode footer { background: #16213e !important; border-color: #2a2d4a !important; color: #8888aa; }
body.dark-mode #footer-address-card { background: #1a1d3a !important; border-color: #2a2d4a !important; color: #8888aa; }

/* Sidebar */
body.dark-mode #sidebar { background: #16213e !important; border-color: #2a2d4a !important; }

/* Sidebar sync info — dark mode */
body.dark-mode .sidebar-sync-info { background: #1a1d3a; color: #6a7090; border-color: #2a2d4a; }
body.dark-mode .sync-refresh-btn { border-color: #363a5a !important; color: #9ca3d4 !important; }
body.dark-mode .sync-refresh-btn:hover { background: #1e2244 !important; color: #e0e0e0 !important; }

/* Tables — comprehensive dark mode (paint immediately, no hover required) */
body.dark-mode .table { color: #d0d4e8; }
body.dark-mode .table > :not(caption) > * > * {
  background-color: inherit !important;
  color: inherit !important;
  border-color: #252845 !important;
}
body.dark-mode .table-tracksy th,
body.dark-mode .table-tracksy thead > tr > th {
  color: #9ca3d4 !important;
  background-color: #1a1d3a !important;
  border-color: #2a2d4a !important;
}
body.dark-mode .table-tracksy td { color: #d0d4e8 !important; border-color: #252845 !important; }

/* Row-level backgrounds */
body.dark-mode .table-tracksy tbody > tr:nth-child(odd)  { background-color: #16213e !important; }
body.dark-mode .table-tracksy tbody > tr:nth-child(even) { background-color: #1a1f3a !important; }

/* Cell-level backgrounds (override Bootstrap's own cell-level vars) */
body.dark-mode .table-tracksy tbody > tr:nth-child(odd)  > td,
body.dark-mode .table-tracksy tbody > tr:nth-child(odd)  > th { background-color: #16213e !important; color: #d0d4e8 !important; }
body.dark-mode .table-tracksy tbody > tr:nth-child(even) > td,
body.dark-mode .table-tracksy tbody > tr:nth-child(even) > th { background-color: #1a1f3a !important; color: #d0d4e8 !important; }

/* Hover */
body.dark-mode .table-tracksy tbody > tr:hover > td,
body.dark-mode .table-tracksy tbody > tr:hover > th { background-color: #1e2a4a !important; color: #e0e0e0 !important; }
body.dark-mode .table-hover > tbody > tr:hover > * { --bs-table-accent-bg: #1e2a4a; background-color: #1e2a4a !important; color: #e0e0e0 !important; }

/* Bootstrap 5 CSS variable overrides for striped tables */
body.dark-mode .table-striped > tbody > tr:nth-of-type(odd)  > * { --bs-table-accent-bg: #16213e; background-color: #16213e !important; color: #d0d4e8 !important; }
body.dark-mode .table-striped > tbody > tr:nth-of-type(even) > * { --bs-table-accent-bg: #1a1f3a; background-color: #1a1f3a !important; color: #d0d4e8 !important; }

/* table-light thead (used in Sessions, CSV preview, payments etc.) */
body.dark-mode .table-light,
body.dark-mode .table > thead,
body.dark-mode .table > thead > tr > th,
body.dark-mode thead.table-light > tr > th { background-color: #1a1d3a !important; color: #9ca3d4 !important; border-color: #2a2d4a !important; }

body.dark-mode .table-responsive { border-color: #2a2d4a !important; }
body.dark-mode .table-tracksy .badge { background-color: #252845 !important; color: #b0b8d8 !important; border-color: #363a5a !important; }

/* Orders tabs */
body.dark-mode .ord-tab-bar { border-color: #2a2d4a; }
body.dark-mode .ord-tab { color: #7880a0; }
body.dark-mode .ord-tab:hover { color: #c8cce0; background: rgba(255,255,255,.04); }
body.dark-mode .ord-tab.active { color: #818cf8; border-bottom-color: #818cf8; }
body.dark-mode .ord-tab-count { background: #2a2d4a; color: #7880a0; }
body.dark-mode .ord-tab.active .ord-tab-count { background: rgba(129,140,248,.15); color: #818cf8; }

/* Orders expand */
body.dark-mode .items-expand-panel { background: #1a1a2e; border-color: #2a2a4a; }
body.dark-mode .items-expand-panel .table th { color: #8888aa; border-color: #2a2a4a; }
body.dark-mode .items-expand-panel .table td { color: #d0d0e8; border-color: #2a2a4a; }
body.dark-mode .item-child-row { background-color: #141828 !important; color: #d0d0e8 !important; }
body.dark-mode .item-child-row td { background-color: transparent !important; color: #d0d0e8 !important; }
body.dark-mode .item-child-row:nth-child(even) { background-color: #1a1f38 !important; }
body.dark-mode .order-row.expanded { background: rgba(99,102,241,.05); }
body.dark-mode .order-row-aging   { background-color: #2a2010 !important; }
body.dark-mode .order-row-overdue { background-color: #2a0e10 !important; }
body.dark-mode .order-addr-row td { color: #8888aa; }
body.dark-mode .order-status-select,
body.dark-mode .item-status-select { background: #1a1a2e; border-color: #2a2a4a; }

/* Forms */
body.dark-mode .form-control,
body.dark-mode .form-select,
body.dark-mode input[type="text"],
body.dark-mode input[type="number"],
body.dark-mode input[type="email"],
body.dark-mode input[type="password"],
body.dark-mode input[type="search"],
body.dark-mode input[type="tel"],
body.dark-mode textarea,
body.dark-mode select {
  background-color: #1a1d3a !important; color: #e0e0e0 !important; border-color: #363a5a !important;
}
body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus,
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
  background-color: #1e2244 !important; color: #e8ecff !important;
  border-color: #6366f1 !important; box-shadow: 0 0 0 3px rgba(99,102,241,.2) !important;
}
body.dark-mode .form-control::placeholder,
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder { color: #5a6080 !important; opacity: 1; }
body.dark-mode .form-control:disabled,
body.dark-mode .form-select:disabled,
body.dark-mode input:disabled,
body.dark-mode textarea:disabled,
body.dark-mode select:disabled {
  background-color: #141628 !important; color: #6a7090 !important; border-color: #2a2d4a !important;
}
body.dark-mode .form-text,
body.dark-mode small.text-muted,
body.dark-mode .form-label { color: #8890b8 !important; }
body.dark-mode label,
body.dark-mode .form-label.small { color: #a0a8c8 !important; }
body.dark-mode .input-group-text {
  background: #1e2244 !important; border-color: #2a2d4a !important; color: #8890b8 !important;
}
body.dark-mode input[type="date"],
body.dark-mode input[type="time"],
body.dark-mode input[type="datetime-local"],
body.dark-mode input[type="month"] {
  background-color: #1e2240 !important; color: #e0e0f0 !important;
  border-color: #3a3e60 !important; color-scheme: dark;
}
body.dark-mode input[type="date"]::-webkit-calendar-picker-indicator,
body.dark-mode input[type="time"]::-webkit-calendar-picker-indicator,
body.dark-mode input[type="datetime-local"]::-webkit-calendar-picker-indicator,
body.dark-mode input[type="month"]::-webkit-calendar-picker-indicator {
  filter: invert(.75) brightness(1.5); cursor: pointer; opacity: .85;
}
body.dark-mode input[type="number"]::-webkit-inner-spin-button,
body.dark-mode input[type="number"]::-webkit-outer-spin-button { filter: invert(.7); }

/* Modals */
body.dark-mode .modal-content { background: #16213e !important; color: #e0e0e0 !important; border-color: #2a2d4a !important; }
body.dark-mode .modal-header  { background: #1a1d3a !important; border-color: #2a2d4a !important; color: #e0e0e0 !important; }
body.dark-mode .modal-header .btn-close { filter: invert(1) brightness(.8); }
body.dark-mode .modal-body    { background: #16213e !important; color: #d0d4e8 !important; }
body.dark-mode .modal-footer  { background: #1a1d3a !important; border-color: #2a2d4a !important; }
body.dark-mode .modal-body .form-control,
body.dark-mode .modal-body .form-select,
body.dark-mode .modal-body input[type="date"],
body.dark-mode .modal-body input[type="text"],
body.dark-mode .modal-body input[type="number"],
body.dark-mode .modal-body textarea {
  background: #1e2244 !important; color: #e0e0e0 !important; border-color: #363a5a !important;
}
body.dark-mode .modal-body .input-group-text { background: #252a50 !important; border-color: #363a5a !important; color: #8890b8 !important; }
body.dark-mode .modal-body label,
body.dark-mode .modal-body .form-label,
body.dark-mode .modal-body .form-label.small { color: #a0a8c8 !important; }
body.dark-mode .modal-body .text-muted,
body.dark-mode .modal-body small.text-muted { color: #7880a0 !important; }
body.dark-mode .modal-body .bg-light,
body.dark-mode .modal-body .rounded.border { background: #1a1d3a !important; border-color: #2a2d4a !important; color: #d0d4e8 !important; }
body.dark-mode .modal-body .tag-pill { background: #1e2244; border-color: #363a5a; color: #9ca3d4; }
body.dark-mode .modal-body .tag-pill.active { background: #6366f1; color: #fff; border-color: #6366f1; }

/* Cards */
body.dark-mode .card { border-color: #2a2d4a !important; }
body.dark-mode .card-header { background: #1a1d3a !important; border-color: #2a2d4a !important; color: #c8cce0 !important; }
body.dark-mode .card-body { color: #d0d4e8; }
body.dark-mode .stat-card { border-color: #2a2d4a; background: #16213e; }

/* Buttons */
body.dark-mode .btn-light { background: #1e2244 !important; border-color: #363a5a !important; color: #c8cce0 !important; }
body.dark-mode .btn-light:hover { background: #262b52 !important; color: #e8ecff !important; }
body.dark-mode .btn-outline-secondary { border-color: #363a5a !important; color: #9ca3d4 !important; }
body.dark-mode .btn-outline-secondary:hover { background: #1e2244 !important; color: #e0e0e0 !important; }

/* Dropdowns */
body.dark-mode .dropdown-menu { background: #16213e !important; border-color: #2a2d4a !important; }
body.dark-mode .dropdown-item { color: #c8cce0 !important; }
body.dark-mode .dropdown-item:hover { background: #1e2a4a !important; }

/* Tag pills */
body.dark-mode .tag-pill { background: #1e2244; border-color: #363a5a; color: #9ca3d4; }
body.dark-mode .tag-pill.active { background: #6366f1; color: #fff; border-color: #6366f1; }
body.dark-mode .customer-tag { background: rgba(129,140,248,.15); color: #818cf8; border-color: rgba(129,140,248,.25); }

/* Alerts */
body.dark-mode .alert-warning { background: #2a2010 !important; border-color: #6a5020 !important; color: #fbbf24 !important; }

/* Scrollbar */
body.dark-mode ::-webkit-scrollbar-thumb { background: #363a5a; }
body.dark-mode ::-webkit-scrollbar-track { background: #1a1d3a; }

/* hr */
body.dark-mode hr { border-color: #2a2d4a !important; opacity: 1; }

/* List groups */
body.dark-mode .list-group-item { background: #16213e !important; color: #d0d4e8 !important; border-color: #2a2d4a !important; }
body.dark-mode .list-group-item:hover { background: #1e2a4a !important; }

/* Customer selection card */
body.dark-mode .customer-select-card { border-color: #2a2d4a; }
body.dark-mode .customer-select-header { background: #1a1d3a; border-color: #2a2d4a; color: #c8cce0; }
body.dark-mode .customer-select-row { border-color: #252845; color: #d0d4e8; }
body.dark-mode .customer-select-row:hover { background: rgba(129,140,248,.08); }
body.dark-mode .customer-select-row.new-customer { color: #818cf8; border-color: #2a2d4a; }

/* Duplicate banner */
body.dark-mode .duplicate-banner { background: #2a2010; border-color: #78400e; color: #fbbf24; }

/* Sync banners */
body.dark-mode .sync-conflict-banner { background: #2a2010; border-color: #6a5020; color: #fbbf24; }
body.dark-mode .sync-pending-banner  { background: #0e1f40; border-color: #1e4080; color: #60a5fa; }

/* Orders vs host */
body.dark-mode #orders-vs-host .table-tracksy thead { background: #1a1d3a; }

/* ══════════════════════════════════════════════════════════
   SETTINGS PAGE — Row layout, alternate colours, dark mode
   ══════════════════════════════════════════════════════════ */

/* Tighter key/value rows */
.settings-row {
  display: flex; align-items: flex-start;
  padding: 5px 0; border-bottom: 1px solid #f0f2f8;
  font-size: 13px; gap: 0;
}
.settings-row:last-child { border-bottom: none; }
.settings-row:nth-child(odd)  { background: #fff; }
.settings-row:nth-child(even) { background: #f8f9ff; }
.settings-row .s-key {
  flex: 0 0 40%; padding: 3px 8px 3px 0;
  color: #6c757d; font-weight: 500; font-size: 12px;
}
.settings-row .s-val {
  flex: 1; padding: 3px 0;
  color: #212529; word-break: break-word;
}

/* Read-only badge — visible in both modes */
.settings-readonly-badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 500; padding: 2px 8px;
  border-radius: 4px; border: 1px solid rgba(99,102,241,.25);
  background: rgba(99,102,241,.08); color: #6366f1;
  white-space: nowrap;
}

/* Dark mode settings */
body.dark-mode .settings-row { border-color: #252845; }
body.dark-mode .settings-row:nth-child(odd)  { background: #16213e; }
body.dark-mode .settings-row:nth-child(even) { background: #1a1f3a; }
body.dark-mode .settings-row .s-key { color: #8888aa; }
body.dark-mode .settings-row .s-val { color: #d0d4e8; }
body.dark-mode .settings-readonly-badge {
  background: rgba(129,140,248,.12); color: #818cf8;
  border-color: rgba(129,140,248,.3);
}

/* Settings card body — remove default Bootstrap padding inconsistency */
.settings-card-body { padding: 0 !important; }

/* Badge pills in settings (order tags etc.) */
.settings-badge-pill {
  display: inline-block; font-size: 11px; font-weight: 500;
  padding: 2px 9px; border-radius: 999px; margin: 2px 3px 2px 0;
  background: rgba(99,102,241,.1); color: #4338ca;
  border: 1px solid rgba(99,102,241,.2);
}
body.dark-mode .settings-badge-pill {
  background: rgba(129,140,248,.14); color: #a5b4fc;
  border-color: rgba(129,140,248,.25);
}

/* ══════════════════════════════════════════════════════════
   ORDERS — Phone search step & wizard stepper
   ══════════════════════════════════════════════════════════ */

/* ── Wizard stepper (clean rebuild) ─────────────────────── */
.wiz-stepper {
  display: flex; align-items: center; justify-content: center;
  padding: 14px 20px; border-bottom: 1px solid #e5e7eb;
  background: #f9fafb; gap: 0;
}
.wiz-step {
  display: flex; flex-direction: column; align-items: center;
  gap: 5px; flex-shrink: 0;
}
.wiz-step__circle {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  border: 2px solid #d1d5db; color: #9ca3af; background: #fff;
  transition: background .2s, border-color .2s, color .2s;
  line-height: 1;
}
.wiz-step__label {
  font-size: 11px; font-weight: 500; color: #9ca3af;
  white-space: nowrap; transition: color .2s;
}
.wiz-step__line {
  flex: 1; height: 2px; background: #e5e7eb;
  min-width: 40px; max-width: 80px;
  align-self: flex-start; margin-top: 13px;
  transition: background .2s;
}
.wiz-step__line--done { background: #22c55e; }

/* Active step */
.wiz-step--active .wiz-step__circle {
  background: var(--theme-primary); border-color: var(--theme-primary); color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary) 20%, transparent);
}
.wiz-step--active .wiz-step__label { color: var(--theme-primary); font-weight: 600; }

/* Done step */
.wiz-step--done .wiz-step__circle {
  background: #22c55e; border-color: #22c55e; color: #fff;
}
.wiz-step--done .wiz-step__label { color: #16a34a; }

/* Dark mode */
body.dark-mode .wiz-stepper { background: #1a1d3a; border-color: #2a2d4a; }
body.dark-mode .wiz-step__circle { background: #16213e; border-color: #363a5a; color: #5a6080; }
body.dark-mode .wiz-step__label  { color: #5a6080; }
body.dark-mode .wiz-step__line   { background: #2a2d4a; }
body.dark-mode .wiz-step--active .wiz-step__circle { background: #818cf8; border-color: #818cf8; color: #fff; box-shadow: 0 0 0 3px rgba(129,140,248,.2); }
body.dark-mode .wiz-step--active .wiz-step__label  { color: #818cf8; }
body.dark-mode .wiz-step--done   .wiz-step__circle { background: #34d399; border-color: #34d399; color: #fff; }
body.dark-mode .wiz-step--done   .wiz-step__label  { color: #34d399; }
body.dark-mode .wiz-step__line--done { background: #34d399; }

/* Legacy classes — keep for any remaining references */
.order-wizard-steps { display:flex; align-items:center; padding:14px 20px; border-bottom:1px solid #e5e7eb; background:#f9fafb; justify-content:center; }
.wizard-step        { display:flex; align-items:center; gap:7px; font-size:12px; font-weight:500; color:#9ca3af; }
.wizard-step-num    { width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:700; border:2px solid currentColor; }
.wizard-step.active .wizard-step-num { background:var(--theme-primary); color:#fff; border-color:var(--theme-primary); }
.wizard-step.done   .wizard-step-num { background:#22c55e; color:#fff; border-color:#22c55e; }
.wizard-connector   { flex:1; height:2px; background:#e5e7eb; min-width:20px; max-width:60px; margin:0 4px; }

/* Phone search step */
.phone-search-box {
  text-align: center; padding: 32px 24px;
}
.phone-search-box .phone-search-input {
  max-width: 280px; font-size: 1.1rem;
  letter-spacing: .05em; text-align: center;
}

/* Payment tabs (same style as orders tabs) */
.pay-tab-bar {
  display: flex; align-items: stretch;
  border-bottom: 2px solid #e5e7eb;
  margin-bottom: 0; overflow-x: auto;
  scrollbar-width: none; gap: 0;
}
.pay-tab-bar::-webkit-scrollbar { display: none; }
.pay-tab {
  padding: 8px 14px; font-size: 12.5px; font-weight: 500;
  color: #6c757d; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  cursor: pointer; white-space: nowrap;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 6px;
}
.pay-tab:hover { color: #343a40; background: #f8f9fa; }
.pay-tab.active { color: var(--theme-primary); border-bottom-color: var(--theme-primary); }
.pay-tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 5px;
  border-radius: 999px; font-size: 10px; font-weight: 600;
  background: #e9ecef; color: #6c757d;
  transition: background .15s, color .15s;
}
.pay-tab.active .pay-tab-count { background: rgba(99,102,241,.15); color: var(--theme-primary); }

/* Payment tabs dark mode */
body.dark-mode .pay-tab-bar { border-color: #2a2d4a; }
body.dark-mode .pay-tab { color: #7880a0; }
body.dark-mode .pay-tab:hover { color: #c8cce0; background: rgba(255,255,255,.04); }
body.dark-mode .pay-tab.active { color: #818cf8; border-bottom-color: #818cf8; }
body.dark-mode .pay-tab-count { background: #2a2d4a; color: #7880a0; }
body.dark-mode .pay-tab.active .pay-tab-count { background: rgba(129,140,248,.15); color: #818cf8; }

/* ── Spinning refresh icon ──────────────────────────────── */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin-icon { animation: spin .7s linear infinite; display: inline-block; }

/* ── Country code phone select ──────────────────────────── */
.phone-input-group { display: flex; gap: 0; }
.phone-input-group .form-select {
  border-radius: 6px 0 0 6px !important;
  border-right: none !important;
  min-width: 110px; max-width: 120px;
  font-size: 12px; padding-left: 6px; padding-right: 4px;
}
.phone-input-group .form-control {
  border-radius: 0 6px 6px 0 !important;
  border-left: 1px solid #dee2e6 !important;
}
body.dark-mode .phone-input-group .form-control {
  border-left-color: #363a5a !important;
}

/* ══════════════════════════════════════════════════════════
   SCREEN LOCK — Premium numpad UI
   ══════════════════════════════════════════════════════════ */

/* ── Animated background rings ──────────────────────────── */
.plk-bg-ring {
  position: fixed; border-radius: 50%; pointer-events: none;
  border: 1px solid rgba(255,255,255,.04);
  animation: plk-pulse 6s ease-in-out infinite;
}
.plk-ring-1 { width:500px; height:500px; top:50%; left:50%; transform:translate(-50%,-50%); animation-delay:0s; }
.plk-ring-2 { width:720px; height:720px; top:50%; left:50%; transform:translate(-50%,-50%); animation-delay:1.5s; }
.plk-ring-3 { width:960px; height:960px; top:50%; left:50%; transform:translate(-50%,-50%); animation-delay:3s; }

@keyframes plk-pulse {
  0%,100% { opacity:.4; transform:translate(-50%,-50%) scale(1); }
  50%      { opacity:.8; transform:translate(-50%,-50%) scale(1.04); }
}

/* ── Business header ─────────────────────────────────────── */
.plk-biz-header {
  position:fixed; top:20px; left:50%; transform:translateX(-50%);
  display:flex; align-items:center; gap:8px;
  color:rgba(255,255,255,.55); font-size:12px; font-weight:500;
  letter-spacing:.02em; white-space:nowrap;
  z-index:10003;
}
.plk-biz-dot {
  width:8px; height:8px; border-radius:50%; flex-shrink:0;
  box-shadow:0 0 8px currentColor;
}
.plk-biz-name { color:rgba(255,255,255,.8); font-weight:600; }
.plk-biz-sep  { color:rgba(255,255,255,.25); }
.plk-biz-tag  { color:rgba(255,255,255,.4); font-size:11px; }

/* ── Lock card ───────────────────────────────────────────── */
.plk-card {
  position:relative; z-index:10003;
  display:flex; flex-direction:column; align-items:center;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.1);
  border-radius:24px;
  padding:32px 28px 24px;
  width:min(340px,92vw);
  box-shadow:0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05) inset;
  backdrop-filter:blur(20px);
}

/* ── Avatar ──────────────────────────────────────────────── */
.plk-avatar-wrap {
  position:relative; margin-bottom:16px;
}
.plk-avatar {
  width:68px; height:68px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  font-size:22px; font-weight:700; color:#fff;
  border:2px solid rgba(255,255,255,.15);
  box-shadow:0 8px 24px rgba(0,0,0,.4);
  letter-spacing:.03em;
}
.plk-lock-icon {
  position:absolute; bottom:-4px; right:-4px;
  width:24px; height:24px; border-radius:50%;
  background:#1e293b; border:2px solid rgba(255,255,255,.2);
  display:flex; align-items:center; justify-content:center;
  color:rgba(255,255,255,.6); font-size:10px;
}

/* ── Text ────────────────────────────────────────────────── */
.plk-name {
  color:#fff; font-size:17px; font-weight:600;
  margin-bottom:4px; text-align:center;
}
.plk-sub {
  color:rgba(255,255,255,.4); font-size:12px;
  margin-bottom:24px; text-align:center;
}

/* ── PIN dots ────────────────────────────────────────────── */
.plk-dots {
  display:flex; gap:12px; margin-bottom:8px;
  transition:transform .1s;
}
.plk-dot {
  width:14px; height:14px; border-radius:50%;
  border:2px solid rgba(255,255,255,.25);
  background:transparent;
  transition:background .15s, border-color .15s, transform .15s;
}
.plk-dot.filled {
  background:#fff;
  border-color:#fff;
  transform:scale(1.15);
}
/* Shake on error */
.plk-dots.shake {
  animation:plk-shake .4s cubic-bezier(.36,.07,.19,.97);
}
@keyframes plk-shake {
  0%,100% { transform:translateX(0); }
  20%  { transform:translateX(-6px); }
  40%  { transform:translateX(6px); }
  60%  { transform:translateX(-4px); }
  80%  { transform:translateX(4px); }
}
/* Verifying pulse */
.plk-dots.verifying .plk-dot.filled {
  animation:plk-blink .6s ease infinite;
}
@keyframes plk-blink {
  0%,100% { opacity:1; } 50% { opacity:.3; }
}
/* Success flash */
.plk-dots.success .plk-dot.filled {
  background:#22c55e; border-color:#22c55e;
  box-shadow:0 0 10px #22c55e88;
}

/* ── Error text ──────────────────────────────────────────── */
.plk-err {
  min-height:18px; font-size:12px; color:#f87171;
  text-align:center; margin-bottom:20px;
  opacity:0; transition:opacity .2s;
}
.plk-err.visible { opacity:1; }

/* ── Numpad ──────────────────────────────────────────────── */
.plk-numpad {
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:10px; width:100%; margin-bottom:16px;
}
.plk-key {
  height:56px; border-radius:14px;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.08);
  color:#fff; font-size:20px; font-weight:500;
  cursor:pointer; user-select:none;
  display:flex; align-items:center; justify-content:center;
  transition:background .12s, transform .08s, box-shadow .12s;
  -webkit-tap-highlight-color:transparent;
}
.plk-key:hover {
  background:rgba(255,255,255,.14);
  box-shadow:0 2px 12px rgba(0,0,0,.3);
}
.plk-key:active {
  background:rgba(255,255,255,.22);
  transform:scale(.92);
}
.plk-key-ghost {
  background:rgba(255,255,255,.03);
  border-color:transparent;
  font-size:16px; color:rgba(255,255,255,.5);
}
.plk-key-ghost:hover {
  background:rgba(255,255,255,.08);
  color:rgba(255,255,255,.8);
}

/* ── Forgot PIN ──────────────────────────────────────────── */
.plk-forgot {
  background:none; border:none; padding:0;
  color:rgba(255,255,255,.3); font-size:11px;
  cursor:pointer; text-decoration:underline;
  transition:color .15s; text-underline-offset:3px;
}
.plk-forgot:hover { color:rgba(255,255,255,.6); }

/* ══════════════════════════════════════════════════════════
   AUTH PAGES — dark gradient consistent with Screen Lock
   (onboarding, invalid, expired, login, change password, change PIN)
   ══════════════════════════════════════════════════════════ */

/* ── Full-page dark background shared by all auth screens ── */
.auth-page {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1035 50%, #0d1b3e 100%);
  overflow-y: auto; padding: 60px 16px 32px;
}

/* ── Brand bar (top) ─────────────────────────────────────── */
.auth-brand {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.55); font-size: 12px; font-weight: 500;
  letter-spacing: .02em; white-space: nowrap; z-index: 2;
}
.auth-brand-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #818cf8; flex-shrink: 0;
  box-shadow: 0 0 8px #818cf888;
}
.auth-brand-name { color: rgba(255,255,255,.85); font-weight: 600; }
.auth-brand-sep  { color: rgba(255,255,255,.25); }
.auth-brand-tag  { color: rgba(255,255,255,.4); font-size: 11px; }

/* ── Frosted glass card ──────────────────────────────────── */
.auth-card {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 24px;
  padding: 32px 28px 28px;
  width: min(400px, 92vw);
  box-shadow: 0 32px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.05) inset;
  backdrop-filter: blur(20px);
  animation: auth-card-in .35s cubic-bezier(.34,1.56,.64,1) both;
}
.auth-card-login { width: min(440px, 92vw); }

@keyframes auth-card-in {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

/* ── Icon wrap ───────────────────────────────────────────── */
.auth-icon-wrap {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.1);
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

/* ── Typography ──────────────────────────────────────────── */
.auth-title {
  color: #fff; font-size: 18px; font-weight: 700;
  margin: 0 0 6px; text-align: center;
}
.auth-sub {
  color: rgba(255,255,255,.45); font-size: 13px;
  margin: 0 0 20px; text-align: center; line-height: 1.5;
}
.auth-label {
  display: block; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase;
  color: rgba(255,255,255,.5); margin-bottom: 5px;
}

/* ── Inputs ──────────────────────────────────────────────── */
.auth-input {
  width: 100%; padding: 11px 14px;
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 10px !important;
  color: #fff !important; font-size: 14px;
  outline: none; transition: border-color .15s, background .15s;
  display: block; box-sizing: border-box;
}
.auth-input::placeholder { color: rgba(255,255,255,.3) !important; }
.auth-input:focus {
  background: rgba(255,255,255,.12) !important;
  border-color: rgba(129,140,248,.7) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,.2) !important;
}
.auth-input:read-only { opacity: .55; cursor: default; }

/* ── Buttons ─────────────────────────────────────────────── */
.auth-btn-primary {
  padding: 12px 20px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity .15s, transform .08s;
  box-shadow: 0 4px 16px rgba(99,102,241,.4);
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.auth-btn-primary:hover { opacity: .9; color: #fff; }
.auth-btn-primary:active { transform: scale(.97); color: #fff; }

.auth-btn-ghost {
  padding: 12px 20px; border-radius: 12px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: rgba(255,255,255,.7); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: background .15s, transform .08s;
  display: inline-flex; align-items: center; justify-content: center;
}
.auth-btn-ghost:hover  { background: rgba(255,255,255,.12); color: #fff; }
.auth-btn-ghost:active { transform: scale(.97); }

/* ── Error ───────────────────────────────────────────────── */
.auth-error {
  background: rgba(239,68,68,.18);
  border: 1px solid rgba(239,68,68,.35);
  border-radius: 8px; padding: 8px 12px;
  color: #fca5a5; font-size: 13px;
}

/* ── Links & footer ──────────────────────────────────────── */
.auth-link {
  color: #818cf8; text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-link:hover { color: #a5b4fc; }
.auth-footer-text {
  color: rgba(255,255,255,.4); font-size: 12px;
  text-align: center; margin-top: 12px;
}
.auth-page-footer {
  position: relative; z-index: 2;
  color: rgba(255,255,255,.25); font-size: 11px;
  text-align: center; margin-top: 20px;
}

/* ── Login form: tabs ────────────────────────────────────── */
.auth-tabs {
  display: flex; border-bottom: 1px solid rgba(255,255,255,.12);
  width: 100%; margin-bottom: 4px;
}
.auth-tab {
  flex: 1; padding: 8px 12px; background: none; border: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  color: rgba(255,255,255,.45); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.auth-tab:hover { color: rgba(255,255,255,.75); }
.auth-tab.active {
  color: #818cf8; border-bottom-color: #818cf8;
}
.auth-tab-admin.active { color: #fbbf24; border-bottom-color: #fbbf24; }

/* ── Admin info banner ───────────────────────────────────── */
.auth-admin-info {
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: 8px; padding: 8px 12px;
  color: #fde68a; font-size: 12px;
  display: flex; align-items: flex-start; gap: 8px;
}

/* Loader: see .loader-bar-wrap at top */

/* ── intl-tel-input overrides ───────────────────────────── */
.iti { width: 100%; }
.iti__flag-container { z-index: 10; }
/* Auth pages (dark bg) */
.auth-page .iti__selected-dial-code,
.auth-page .iti__arrow { color: rgba(255,255,255,.7); }
.auth-page .iti { width: 100%; }
.auth-page .iti__tel-input { width: 100% !important; }
/* Modal / light context */
.iti__dropdown-content { border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); }
.iti__country-list { max-height: 220px; }
body.dark-mode .iti__dropdown-content { background: #16213e; border-color: #2a2d4a; }
body.dark-mode .iti__country { color: #d0d4e8; }
body.dark-mode .iti__country:hover { background: #1e2a4a; }
body.dark-mode .iti__dial-code { color: #8888aa; }
body.dark-mode .iti__selected-flag { background: rgba(255,255,255,.06); border-color: #363a5a; }

/* ══════════════════════════════════════════════════════════
   APP SPLASH LOADER
   ══════════════════════════════════════════════════════════ */
.app-splash {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f0c29 0%, #1a1035 50%, #0d1b3e 100%);
  transition: opacity .35s ease;
}
.app-splash__inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 0;
}
.app-splash__logo {
  width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.2rem; color: #fff; margin-bottom: 16px;
  box-shadow: 0 8px 32px rgba(99,102,241,.45);
  animation: splash-pulse 2s ease-in-out infinite;
}
@keyframes splash-pulse {
  0%,100% { box-shadow: 0 8px 32px rgba(99,102,241,.45); }
  50%      { box-shadow: 0 8px 48px rgba(99,102,241,.75); }
}
.app-splash__name {
  font-size: 24px; font-weight: 700; color: #fff;
  letter-spacing: .04em; margin-bottom: 28px;
}
.app-splash__bar-wrap {
  width: 180px; height: 3px; border-radius: 2px;
  background: rgba(255,255,255,.12); overflow: hidden;
  margin-bottom: 12px;
}
.app-splash__bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #6366f1, #818cf8, #06b6d4);
  background-size: 200% 100%;
  border-radius: 2px;
  transition: width .4s ease;
  animation: loader-shimmer 1.5s linear infinite;
}
.app-splash__msg {
  font-size: 12px; color: rgba(255,255,255,.4);
  letter-spacing: .03em;
}

/* Remove old thin bar rules */
.loader-bar-wrap { display: none !important; }

/* ══════════════════════════════════════════════════════════
   CARD / BLOCK VIEW MODE
   body.view-card  → card layout
   body.view-table → standard table layout (default)
   ══════════════════════════════════════════════════════════ */

/* ── In card view, hide standard table wrappers ─────────── */
body.view-card .table-responsive { display: none !important; }

/* ── Card grid that replaces the table ──────────────────── */
body.view-card .card-view-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
/* Hidden by default — only shown in card view */
.card-view-grid { display: none; }

/* ── Individual record card ──────────────────────────────── */
.record-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  transition: box-shadow .15s;
}
.record-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.record-card__title {
  font-weight: 600; font-size: 14px; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.record-card__meta {
  color: #6c757d; font-size: 11px;
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  margin-bottom: 8px;
}
.record-card__row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-top: 1px solid #f3f4f6;
}
.record-card__row:first-child { border-top: none; }
.record-card__label { color: #6c757d; font-size: 11px; }
.record-card__value { font-weight: 500; }
.record-card__actions {
  display: flex; gap: 6px; margin-top: 10px; padding-top: 10px;
  border-top: 1px solid #f3f4f6;
}

/* Dark mode */
body.dark-mode .record-card {
  background: #16213e;
  border-color: #2a2d4a;
  color: #d0d4e8;
}
body.dark-mode .record-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.35); }
body.dark-mode .record-card__row  { border-color: #1e2244; }
body.dark-mode .record-card__actions { border-color: #1e2244; }
body.dark-mode .record-card__label { color: #8888aa; }

/* ── View toggle button active state ─────────────────────── */
body.view-card #view-toggle-btn,
body.view-card #view-toggle-btn-mobile {
  background: var(--theme-primary);
  color: #fff;
  border-color: var(--theme-primary);
}

/* ── Card grid: align-items:start prevents overlap on expand ─ */
.card-view-grid {
  align-items: start !important;
}
.record-card {
  display: flex;
  flex-direction: column;
}

/* ── Card item pill rows (expand panel) ───────────────────── */
.card-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 4px;
}
.card-item-row {
  background: rgba(99,102,241,.04);
  border: 1px solid rgba(99,102,241,.12);
  border-radius: 8px;
  padding: 8px 10px;
}
.card-item-row__main {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}
.card-item-row__name {
  font-weight: 600;
  font-size: 13px;
}
.card-item-row__amount {
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.card-item-row__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

/* ── Card totals strip ────────────────────────────────────── */
.card-totals-strip {
  border-top: 1px solid rgba(99,102,241,.12);
  padding-top: 8px;
  font-size: 12px;
}
.card-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0;
}

/* Dark mode card items */
body.dark-mode .card-item-row {
  background: rgba(99,102,241,.08);
  border-color: rgba(99,102,241,.2);
}
body.dark-mode .card-totals-strip {
  border-color: rgba(99,102,241,.2);
}

/* ── Dark mode badge fix ───────────────────────────────── */
/* bg-light badges in dark mode need an override */
body.dark-mode .badge.bg-light,
body.dark-mode .badge.bg-light.text-muted {
  background-color: #2a2d4a !important;
  color: #c8cce0 !important;
  border-color: #3a3e5a !important;
}
/* Ensure border badges are visible in dark mode */
body.dark-mode .badge.border {
  border-color: #3a3e5a !important;
}
/* Tag pills in card view dark mode */
body.dark-mode .card-item-row .badge.bg-light {
  background-color: #1e2244 !important;
  color: #9ca3d4 !important;
  border-color: #363a5a !important;
}
/* Order tag badges in table/card rows */
body.dark-mode .order-row .badge.bg-light,
body.dark-mode .record-card .badge.bg-light {
  background-color: #2a2d4a !important;
  color: #c8cce0 !important;
  border-color: #3a3e5a !important;
}

/* ── Dashboard Activity List ───────────────────────────── */
.dash-activity-list {
  display: flex;
  flex-direction: column;
}
.dash-activity-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--bs-border-color, #e5e7eb);
  transition: background .1s;
}
.dash-activity-row:last-child { border-bottom: none; }
.dash-activity-row:hover { background: rgba(99,102,241,.04); }

.dash-activity-row__icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(99,102,241,.08);
}
.dash-activity-row__body {
  flex: 1;
  min-width: 0;
}
.dash-activity-row__top {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.dash-activity-row__label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}
.dash-activity-row__desc {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100px;
}
.dash-activity-row__bottom {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.dash-activity-row__amount {
  font-size: 13px;
  flex-shrink: 0;
  text-align: right;
  min-width: 70px;
}

/* Dark mode activity list */
body.dark-mode .dash-activity-row {
  border-color: #2a2d4a;
}
body.dark-mode .dash-activity-row:hover {
  background: rgba(129,140,248,.06);
}
body.dark-mode .dash-activity-row__icon {
  background: rgba(129,140,248,.12);
}
body.dark-mode .dash-activity-row__label {
  color: #c8cce0;
}
body.dark-mode .dash-activity-row__desc {
  color: #6a7090;
}

/* ── Payments Card View — custom row layout ────────────── */
.pay-card-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.pay-card-id {
  font-size: 11px;
  color: #6c757d;
  flex: 0 0 auto;
}
.pay-card-type {
  flex: 1;
  text-align: center;
}
.pay-card-date {
  font-size: 11px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.pay-card-row2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.pay-card-customer {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.pay-card-phone {
  font-size: 11px;
  flex-shrink: 0;
  white-space: nowrap;
}

body.dark-mode .pay-card-row2 {
  border-color: rgba(255,255,255,.06);
}
body.dark-mode .pay-card-id,
body.dark-mode .pay-card-date,
body.dark-mode .pay-card-phone {
  color: #7880a0;
}
