/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #3b82f6;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 240px;

  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --orange: #f97316;
  --orange-light: #fff7ed;

  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --header-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

html, body { height: 100%; font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
#app { height: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-card {
  background: white; border-radius: 16px; padding: 40px; width: 400px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon {
  width: 56px; height: 56px; background: var(--primary); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; color: white; margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.login-form .input-icon { position: relative; }
.login-form .input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.login-form input {
  width: 100%; padding: 10px 12px 10px 36px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  transition: border-color .2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.btn-login {
  width: 100%; padding: 12px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .2s; margin-top: 8px;
}
.btn-login:hover { background: var(--primary-dark); }
.login-hint { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-muted); background: #f8fafc; border-radius: 8px; padding: 12px; }
.login-error { background: var(--danger-light); color: var(--danger); border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; display: none; }
.login-error.show { display: block; }

/* ===== APP SHELL ===== */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width); background: var(--sidebar-bg); display: flex; flex-direction: column;
  flex-shrink: 0; overflow-y: auto; overflow-x: hidden;
}
.sidebar-header {
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-header .logo-icon {
  width: 36px; height: 36px; background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; flex-shrink: 0;
}
.sidebar-header .logo-text h2 { font-size: 15px; font-weight: 700; color: white; }
.sidebar-header .logo-text span { font-size: 11px; color: var(--sidebar-text); }
.sidebar-user {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: white;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; font-weight: 500; color: white; }
.user-info .user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section { padding: 16px 16px 6px; font-size: 10px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  color: var(--sidebar-text); cursor: pointer; transition: all .15s; border-left: 3px solid transparent;
  font-size: 13.5px; font-weight: 500; user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: rgba(59,130,246,.15); color: white; border-left-color: var(--primary); }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.btn-logout {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: rgba(239,68,68,.1); color: #fca5a5; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 500; font-family: inherit; transition: background .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.2); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-header {
  height: var(--header-h); background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0;
  box-shadow: var(--shadow);
}
.main-header h1 { font-size: 18px; font-weight: 700; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); border-color: var(--border-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 8px; }
.btn-whatsapp {
  background: #25d366;
  border: none;
  color: #052e1b;
  font-weight: 700;
}
.btn-whatsapp:hover {
  background: #20bd5a;
  color: #041b10;
}
.btn-whatsapp-ghost {
  color: #16a34a;
}
.btn-whatsapp-ghost:hover {
  color: #15803d;
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-info .label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-info .value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-info .change { font-size: 12px; margin-top: 2px; }
.change.up { color: var(--success); }
.change.down { color: var(--danger); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
th { padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
.table-empty { text-align: center; padding: 48px; color: var(--text-muted); }
.table-empty i { font-size: 36px; display: block; margin-bottom: 12px; color: var(--text-light); }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span-2 { grid-column: span 2; }
label { font-size: 13px; font-weight: 500; color: var(--text); }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=date], input[type=url],
select, textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; color: var(--text); background: white;
  transition: border-color .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input::placeholder { color: var(--text-light); }
textarea { resize: vertical; min-height: 80px; }
.input-with-prefix { display: flex; }
.input-prefix {
  padding: 9px 10px; background: #f8fafc; border: 1.5px solid var(--border); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--text-muted); font-size: 13px; white-space: nowrap;
}
.input-with-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }
.badge-orange { background: var(--orange-light); color: var(--orange); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: white; border-radius: 12px; width: 100%; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .2s ease;
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: var(--bg); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== SEARCH & FILTER BAR ===== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.search-box input { padding-left: 32px; }
.filter-select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: white; color: var(--text); min-width: 140px; }
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ===== POS ===== */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; height: calc(100vh - var(--header-h) - 48px); }
.pos-left { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.pos-search-bar { display: flex; gap: 10px; flex-shrink: 0; }
.pos-cats { display: flex; gap: 8px; overflow-x: auto; flex-shrink: 0; padding-bottom: 2px; }
.pos-cats::-webkit-scrollbar { height: 3px; }
.cat-btn {
  padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--border);
  background: white; color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.cat-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.pos-products { flex: 1; overflow-y: auto; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.product-card {
  background: white; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px 12px; cursor: pointer; transition: all .15s; text-align: center; user-select: none;
}
.product-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); transform: translateY(-1px); }
.product-card.out-of-stock { opacity: .5; cursor: not-allowed; }
.product-card .prod-icon { font-size: 28px; margin-bottom: 8px; }
.product-card .prod-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.product-card .prod-price { font-size: 15px; font-weight: 700; color: var(--primary); }
.product-card .prod-stock { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.product-card .prod-stock.low { color: var(--warning); }
.product-card .prod-stock.out { color: var(--danger); }

/* Cart */
.cart-panel { background: white; border-radius: var(--radius); border: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.cart-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cart-header h3 { font-size: 15px; font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 10px; }
.cart-empty i { font-size: 40px; color: var(--text-light); }
.cart-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px; background: #f8fafc;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 12px; color: var(--text-muted); }
.cart-item-controls { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); background: white;
  cursor: pointer; font-size: 14px; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; justify-content: center; transition: all .1s;
}
.qty-btn:hover { background: var(--primary); border-color: var(--primary); color: white; }
.qty-display { font-size: 14px; font-weight: 700; min-width: 24px; text-align: center; }
.cart-item-total { font-size: 14px; font-weight: 700; color: var(--text); }
.cart-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 2px; }

.cart-footer { border-top: 1px solid var(--border); padding: 14px; }
.cart-summary { margin-bottom: 12px; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.summary-row.discount input { width: 80px; text-align: right; padding: 4px 8px; }
.summary-total { font-size: 17px; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 2px solid var(--border); margin-top: 4px; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.pay-btn {
  padding: 9px 6px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: white; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); transition: all .15s; text-align: center;
}
.pay-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pay-btn:hover:not(.active) { border-color: var(--border-dark); color: var(--text); }
.pay-btn i { display: block; font-size: 16px; margin-bottom: 3px; }

/* ===== RECEIPT MODAL ===== */
.receipt { font-family: 'Courier New', monospace; padding: 4px; }
.receipt-header { text-align: center; margin-bottom: 16px; }
.receipt-header h3 { font-size: 18px; font-weight: 700; }
.receipt-divider { border: none; border-top: 1px dashed #ccc; margin: 12px 0; }
.receipt-row { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.receipt-total { font-size: 16px; font-weight: 700; }
.receipt-footer { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-muted); }

/* ===== DASHBOARD ===== */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.recent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; background: var(--warning-light); border: 1px solid rgba(245,158,11,.2); margin-bottom: 8px; }
.alert-item i { color: var(--warning); }
.alert-item .alert-text { flex: 1; font-size: 13px; }
.alert-item .alert-text strong { display: block; font-weight: 600; }

/* ===== ACCOUNTING ===== */
.pl-card { border-radius: var(--radius); overflow: hidden; }
.pl-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }
.pl-row:last-child { border-bottom: none; }
.pl-row.section-header { background: #f8fafc; font-weight: 700; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.pl-row.total { background: var(--primary-light); font-weight: 700; font-size: 15px; }
.pl-row.subtotal { font-weight: 600; background: #fafbff; }
.pl-row.net-profit { background: var(--success-light); font-weight: 800; font-size: 16px; color: var(--success); }
.pl-row.net-loss { background: var(--danger-light); font-weight: 800; font-size: 16px; color: var(--danger); }
.pl-positive { color: var(--success); font-weight: 600; }
.pl-negative { color: var(--danger); font-weight: 600; }
.pl-label { color: var(--text-muted); font-size: 12px; display: block; }

/* ===== STOCK MOVEMENT ===== */
.movement-in { color: var(--success); font-weight: 600; }
.movement-out { color: var(--danger); font-weight: 600; }
.movement-adj { color: var(--warning); font-weight: 600; }

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; background: var(--primary); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ===== MISC ===== */
.page-title { font-size: 18px; font-weight: 700; color: var(--text); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.p-16 { padding: 16px; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--bg); color: var(--text-muted);
}

/* Avatar color classes */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; color: white; }
.avatar-blue { background: #3b82f6; }
.avatar-green { background: #10b981; }
.avatar-purple { background: #8b5cf6; }
.avatar-orange { background: #f97316; }
.avatar-red { background: #ef4444; }

/* Inline edit number */
.qty-input { width: 50px; padding: 4px 6px; text-align: center; border: 1.5px solid var(--border); border-radius: 4px; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e293b; color: white; padding: 12px 18px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; min-width: 250px; max-width: 380px;
  animation: slideInRight .25s ease;
}
.toast.success { background: #064e3b; border-left: 4px solid var(--success); }
.toast.error { background: #7f1d1d; border-left: 4px solid var(--danger); }
.toast.warning { background: #78350f; border-left: 4px solid var(--warning); }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Number display */
.num-green { color: var(--success); font-weight: 600; }
.num-red { color: var(--danger); font-weight: 600; }
.num-blue { color: var(--primary); font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; background: none; border: none; font-size: 13.5px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s; font-family: inherit;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--text); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.page-btns { display: flex; gap: 4px; }
.page-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 4px; background: white; cursor: pointer; font-size: 12.5px; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== HAMBURGER BUTTON ===== */
.hamburger-btn {
  display: none; background: none; border: none; padding: 8px 10px;
  cursor: pointer; color: var(--text); font-size: 19px;
  border-radius: var(--radius-sm); line-height: 1;
  align-items: center; justify-content: center;
}
.hamburger-btn:hover { background: var(--bg); }

/* ===== SIDEBAR OVERLAY (mobile backdrop) ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 998;
}
.sidebar-overlay.show { display: block; }

/* ===== MOBILE POS TABS ===== */
.pos-mobile-tabs {
  display: none; flex-shrink: 0;
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 10px;
}
.pos-tab-btn {
  flex: 1; padding: 13px 8px; border: none; background: transparent;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all .15s; border-bottom: 3px solid transparent;
}
.pos-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }
.pos-tab-btn:not(.active):hover { background: var(--bg); color: var(--text); }
.pos-tab-badge {
  background: var(--primary); color: white; border-radius: 999px;
  min-width: 20px; height: 20px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.pos-tab-badge.hidden { display: none; }

/* ===== RESPONSIVE — TABLET (≤1024px) ===== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .recent-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ===== RESPONSIVE — MOBILE (≤768px) ===== */
@media (max-width: 768px) {

  /* Hamburger */
  .hamburger-btn { display: inline-flex; }

  /* Sidebar: slide in from left */
  .sidebar {
    position: fixed; left: calc(-1 * var(--sidebar-width) - 10px);
    top: 0; bottom: 0; z-index: 999;
    transition: left .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }

  /* Header */
  .main-header { padding: 0 12px; gap: 8px; }
  .main-header h1 { font-size: 15px; flex: 1; }
  .header-actions { gap: 6px; }

  /* Page padding */
  .page-content { padding: 10px; }

  /* Stat grids */
  .stat-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 14px 10px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 15px; }
  .stat-info .value { font-size: 18px; }
  .stat-info .label { font-size: 11px; }

  /* Charts & grids */
  .charts-grid { grid-template-columns: 1fr !important; }
  .recent-grid { grid-template-columns: 1fr !important; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-grid-3 { grid-template-columns: 1fr !important; }
  .form-group.span-2 { grid-column: span 1 !important; }

  /* Modals: bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 18px 18px 0 0; max-height: 92vh;
    width: 100%;
  }
  .modal-sm, .modal-md, .modal-lg, .modal-xl { max-width: 100%; }
  .modal-header { border-radius: 18px 18px 0 0; }

  /* Tables */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  td, th { padding: 10px 10px; font-size: 12.5px; }

  /* Tabs bar */
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0; -webkit-overflow-scrolling: touch; }
  .tab-btn { white-space: nowrap; padding: 10px 12px; font-size: 12.5px; }
  .tabs::-webkit-scrollbar { display: none; }

  /* Toolbar */
  .toolbar { gap: 6px; }
  .search-box { min-width: 0; flex: 1; }
  .filter-select { min-width: 100px; font-size: 12px; padding: 8px 8px; }

  /* Pagination */
  .pagination { flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }
  .page-btns { justify-content: center; }

  /* Toast */
  .toast-container { bottom: 12px; right: 8px; left: 8px; }
  .toast { min-width: unset; max-width: 100%; }

  /* Login */
  .login-card { width: calc(100% - 32px); margin: 16px; padding: 28px 20px; }

  /* Product grid */
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; gap: 8px !important; }
  .product-card { padding: 12px 8px; }
  .product-card .prod-icon { font-size: 24px; margin-bottom: 6px; }
  .product-card .prod-name { font-size: 12px; }
  .product-card .prod-price { font-size: 14px; }
  .product-card .prod-stock { font-size: 10px; }

  /* POS LAYOUT on mobile */
  .pos-mobile-tabs { display: flex; }

  #pos-view { height: auto !important; }

  .pos-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
    gap: 0 !important;
  }

  .pos-left {
    display: flex;
    height: calc(100dvh - var(--header-h) - 48px - 52px);
  }

  .pos-layout .cart-panel {
    display: none;
    height: calc(100dvh - var(--header-h) - 48px - 52px);
  }

  /* Show cart, hide products */
  .pos-layout.show-cart .pos-left { display: none; }
  .pos-layout.show-cart .cart-panel { display: flex; flex-direction: column; }

  /* Cart items area fills remaining space */
  .cart-panel .cart-items { flex: 1; }

  /* Pay methods: 3-col still works fine on mobile */
  .pay-methods { gap: 6px; }
  .pay-btn { padding: 10px 4px; font-size: 11.5px; }

  /* Settings: override inline grids */
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns:1fr 380px"],
  [style*="grid-template-columns: 1fr 380px"] {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard charts: fix height for small screens */
  .charts-grid canvas { max-height: 220px; }
}

/* ===== RESPONSIVE — SMALL MOBILE (≤480px) ===== */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr !important; gap: 6px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important; }
  .btn-lg { padding: 11px 14px; font-size: 14px; }
  .cart-item { gap: 6px; padding: 8px; }
}

/* ===== CLIENTS & DEBTS ===== */
.client-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.client-avatar-lg {
  width: 48px; height: 48px; font-size: 20px;
}

/* ===== INVOICES / QUOTES / DOCUMENT STYLES ===== */
.doc-totals {
  margin-left: auto; margin-top: 16px;
  width: 300px; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.totals-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted);
}
.totals-row:last-child { border-bottom: none; }
.totals-grand {
  font-size: 16px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); padding: 10px 14px;
}

/* badge extras */
.badge-info   { background: #dbeafe; color: #1d4ed8; }
.badge-danger { background: var(--danger-light); color: var(--danger); }

/* item-row responsive */
@media (max-width: 600px) {
  .item-row { grid-template-columns: 1fr 60px 90px 90px 28px !important; }
}

/* ===== CREDITS VIEW ===== */
.credit-summary-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--warning-light); color: var(--text); border: 1.5px solid #fde68a;
  border-radius: var(--radius); padding: 10px 16px; font-size: 14px;
}
.credits-grid {
  display: flex; flex-direction: column; gap: 16px;
}
.credit-customer-card {
  background: var(--card-bg); border-radius: var(--radius); border: 1.5px solid var(--border);
  box-shadow: var(--shadow); overflow: hidden;
}
.credit-customer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: var(--bg); border-bottom: 1px solid var(--border);
  gap: 12px; flex-wrap: wrap;
}
.credit-customer-id {
  display: flex; align-items: center; gap: 12px;
}
.credit-customer-name { font-weight: 700; font-size: 15px; }
.credit-customer-phone { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.credit-customer-total { text-align: right; flex-shrink: 0; }
.credit-total-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.credit-total-amount { font-size: 22px; font-weight: 800; color: var(--warning); }
.credit-sales-list { padding: 6px 0; }
.credit-sale-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; gap: 12px; border-bottom: 1px solid var(--border);
}
.credit-sale-row:last-child { border-bottom: none; }
.credit-sale-info { display: flex; flex-direction: column; gap: 2px; }
.credit-receipt { font-size: 13px; font-weight: 600; color: var(--text); }
.credit-date { font-size: 12px; color: var(--text-muted); }
.credit-age { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 10px; font-size: 11px; background: var(--primary-light); color: var(--primary); }
.credit-age.warning { background: var(--warning-light); color: #92400e; }
.credit-age.overdue { background: var(--danger-light); color: var(--danger); font-weight: 700; }
.credit-sale-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.credit-amount { font-size: 14px; font-weight: 700; color: var(--warning); min-width: 70px; text-align: right; }
.btn-success-ghost { color: var(--success) !important; }
.btn-success-ghost:hover { background: var(--success-light) !important; }
.credit-customer-footer {
  display: flex; gap: 10px; padding: 12px 18px; background: var(--bg);
  border-top: 1px solid var(--border); flex-wrap: wrap;
}

/* ===== SAFE AREA (notch/home bar on iOS) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .page-content { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .cart-footer  { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}


/* ===== VOLTWISE BRAND LOGO ===== */
.logo-img{display:block;object-fit:contain;border-radius:10px;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.12)}
.login-logo .brand-logo-img{width:96px;height:96px;margin:0 auto 12px;border-radius:16px;object-fit:contain;background:#fff;box-shadow:0 8px 20px rgba(15,23,42,.16)}
.sidebar-header .brand-logo-img{width:38px;height:38px;border-radius:9px;object-fit:contain;background:#fff;flex-shrink:0}
.document-logo{width:76px;height:76px;object-fit:contain;border-radius:10px}

/* Header notification center */
.notification-wrap { position: relative; }
.notification-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-bg, #fff);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.notification-btn:hover,
.notification-btn.has-unread { color: var(--primary); border-color: var(--primary); background: var(--primary-light); }
.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger, #dc2626);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.notification-badge.hidden,
.notification-panel.hidden { display: none; }
.notification-panel {
  position: absolute;
  right: 0;
  top: 46px;
  width: min(380px, calc(100vw - 24px));
  max-height: 520px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, .18);
  z-index: 1200;
  overflow: hidden;
}
.notification-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.btn-link {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  font-size: 12px;
}
.btn-link:disabled { opacity: .45; cursor: not-allowed; }
.notification-panel-body { max-height: 460px; overflow-y: auto; }
.notification-item {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: #fff;
}
.notification-item:hover { background: var(--bg-light, #f8fafc); }
.notification-item.unread { background: var(--primary-light); }
.notification-item.read { opacity: .78; }
.notification-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.notification-copy { min-width: 0; flex: 1; }
.notification-title { font-weight: 800; font-size: 13px; color: var(--text); }
.notification-message { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.35; }
.notification-time { font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.notification-empty { padding: 28px 14px; color: var(--text-muted); text-align: center; font-size: 13px; }
@media (max-width: 560px) {
  .notification-panel { right: -8px; width: calc(100vw - 16px); }
}

/* Permission-aware dashboard shortcuts */
.clickable-card { cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.clickable-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(15, 23, 42, .10); }
.quick-action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.quick-action-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.quick-action-btn > i { color: var(--primary); font-size: 18px; width: 22px; text-align: center; }
.quick-action-btn span { display: flex; flex-direction: column; gap: 2px; }
.quick-action-btn small { color: var(--text-muted); font-size: 11px; }

/* Activity Logs search/filter toolbar */
.activity-log-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.activity-log-search-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex: 1 1 520px;
}

.activity-log-search-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 240px) auto auto;
  gap: 10px;
  align-items: center;
}

.activity-log-search-row .form-control {
  width: 100%;
  min-height: 42px;
}

.activity-log-search-hint {
  color: #64748b;
  font-size: 12px;
}



/* Clean, compact Activity Logs table layout */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.activity-log-table { min-width: 1120px; table-layout: fixed; }
.activity-log-table th, .activity-log-table td { vertical-align: top; line-height: 1.35; }
.activity-log-table th:nth-child(1), .activity-log-table td:nth-child(1) { width: 145px; }
.activity-log-table th:nth-child(2), .activity-log-table td:nth-child(2) { width: 220px; }
.activity-log-table th:nth-child(3), .activity-log-table td:nth-child(3) { width: 105px; }
.activity-log-table th:nth-child(4), .activity-log-table td:nth-child(4) { width: 165px; }
.activity-log-table th:nth-child(5), .activity-log-table td:nth-child(5) { width: auto; }
.activity-log-table th:nth-child(6), .activity-log-table td:nth-child(6) { width: 185px; }
.activity-log-table th:nth-child(7), .activity-log-table td:nth-child(7) { width: 95px; text-align: right; }
.activity-log-table .log-user-name { display:block; font-weight:700; color:var(--text); word-break:break-word; }
.activity-log-table .log-user-email, .activity-log-table .log-time-ago, .activity-log-table .log-record { color:var(--text-muted); word-break:break-word; }
.activity-log-table .log-action { display:inline-block; font-weight:700; color:var(--text); white-space:normal; }
.activity-log-table .log-details { white-space:normal; overflow-wrap:anywhere; color:var(--text); }
.activity-log-table .system-row td { background:#f8fafc; }
.activity-log-table .badge { max-width:100%; white-space:normal; }
.activity-log-search-row { grid-template-columns: minmax(260px,1fr) minmax(190px,260px) minmax(170px,230px) auto auto; }

@media (max-width: 900px) {
  .activity-log-search-panel {
    align-items: stretch;
    flex-basis: 100%;
  }
  .activity-log-search-row {
    grid-template-columns: 1fr;
  }
}


/* Version 1 world-class foundation additions */
.shift-status-banner{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 12px;padding:10px 12px;border-radius:12px;font-size:13px;border:1px solid var(--border);background:#f8fafc}
.shift-status-banner.shift-open{background:#ecfdf5;border-color:#bbf7d0;color:#065f46}
.shift-status-banner.shift-closed{background:#fff7ed;border-color:#fed7aa;color:#9a3412}
.shift-status-banner .btn{margin-left:auto}
.badge-neutral{background:#e5e7eb;color:#374151}
.shift-filter.active{background:var(--primary);color:#fff;border-color:var(--primary)}
@media (max-width: 720px){.shift-status-banner .btn{margin-left:0;width:100%}}

/* ===== POS WORLD-CLASS USABILITY UPDATE: search, speed, stock warnings, held sale and mobile polish ===== */
.pos-search-bar-enhanced {
  display: grid !important;
  grid-template-columns: minmax(220px, 1fr) auto auto auto auto auto auto;
  gap: 8px !important;
  align-items: center;
  flex-wrap: nowrap !important;
}
.pos-search-box { min-width: 220px; }
.pos-cats-wrap { position: relative; flex-shrink: 0; }
.cat-btn span {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 18px; padding: 0 6px; margin-left: 6px;
  border-radius: 999px; background: rgba(15,23,42,.08); color: inherit; font-size: 11px; font-weight: 700;
}
.cat-btn.active span { background: rgba(255,255,255,.22); color: #fff; }
.product-card.low-stock-card { border-color: rgba(245, 158, 11, .45); background: linear-gradient(180deg, #fff 0%, #fffbeb 100%); }
.product-card .prod-sku { font-size: 10.5px; color: var(--text-muted); margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prod-price-tag { font-size: 10px; font-weight: 700; margin-left: 4px; }
.prod-in-cart {
  margin-top: 6px; padding: 4px 6px; border-radius: 8px;
  background: var(--primary-light); color: var(--primary); font-size: 10.5px; font-weight: 700;
}
.cart-item-stock { font-size: 10.5px; color: var(--text-muted); margin: 1px 0 3px; }
.cart-item-stock.warn { color: var(--warning); font-weight: 700; }
.pos-empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.pos-empty-state i { font-size: 42px; display: block; margin-bottom: 12px; color: var(--text-light); }
.pos-empty-state h3 { color: var(--text); margin-bottom: 6px; }
.pos-empty-state p { margin-bottom: 14px; }
.pos-load-more, .pos-result-count { text-align: center; padding: 12px 0 4px; color: var(--text-muted); font-size: 12px; }
.hold-summary-card {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--warning-light); border: 1px solid rgba(245,158,11,.3); border-radius: 12px;
  padding: 14px; margin-bottom: 14px; color: var(--text);
}
.held-sale-row {
  border: 1px solid var(--border); border-radius: 12px; padding: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: #fff;
}
.held-sale-row:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.08); }
.held-sale-title { font-weight: 800; color: var(--text); }
.held-sale-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.held-sale-actions { display: flex; gap: 6px; align-items: center; }

@media (max-width: 1100px) {
  .pos-search-bar-enhanced { grid-template-columns: minmax(180px, 1fr) auto auto auto; }
  .pos-search-bar-enhanced #pos-return-btn,
  .pos-search-bar-enhanced #pos-held-btn { grid-row: 2; }
}

@media (max-width: 768px) {
  .pos-search-bar-enhanced {
    position: sticky; top: 0; z-index: 12; background: var(--bg);
    grid-template-columns: 1fr auto auto; padding-bottom: 6px; border-bottom: 1px solid var(--border);
  }
  .pos-search-box { min-width: 0; grid-column: 1 / -1; }
  .pos-search-bar-enhanced .btn { min-height: 38px; }
  .pos-search-bar-enhanced #pos-add-product-btn,
  .pos-search-bar-enhanced #pos-return-btn,
  .pos-search-bar-enhanced #pos-held-btn { font-size: 12px; padding-left: 9px; padding-right: 9px; }
  .pos-cats-wrap { position: sticky; top: 86px; z-index: 11; background: var(--bg); padding: 4px 0 6px; }
  .product-card { min-height: 128px; display: flex; flex-direction: column; justify-content: center; }
  .held-sale-row { align-items: stretch; }
  .held-sale-main, .held-sale-actions { width: 100%; }
  .held-sale-actions .btn { flex: 1; }
}
.hidden { display: none !important; }

/* ===== LOGIN UX/UI FIXES (desktop + offline Electron) ===== */
.login-page {
  min-height: 100dvh;
  align-items: flex-start !important;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}

@media (min-height: 720px) {
  .login-page { align-items: center !important; }
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 22px;
}

.login-logo { margin-bottom: 22px; }
.login-logo .brand-logo-img {
  width: 82px;
  height: 82px;
}

.login-form .form-group { margin-bottom: 14px; }
.login-form .input-icon { position: relative; }
.login-form .input-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  text-align: center;
  pointer-events: none;
  color: var(--text-muted);
  z-index: 1;
}
.login-form .input-icon input {
  min-height: 44px;
  padding-left: 46px !important;
  padding-right: 12px;
}
.login-form .input-icon.has-action input { padding-right: 46px !important; }
.login-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}

.toggle-password {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.toggle-password:hover { background: #f1f5f9; color: var(--text); }
.toggle-password:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.login-advanced {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 6px 0 14px;
  padding: 4px 0;
}
.login-advanced details { width: 100%; }
.login-advanced summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 8px 2px;
  color: var(--text-muted);
  font-size: 12.5px;
  user-select: none;
}
.login-advanced summary::-webkit-details-marker { display: none; }
.login-advanced summary::after {
  content: "▾";
  color: var(--text-light);
  transition: transform .15s ease;
}
.login-advanced details[open] summary::after { transform: rotate(180deg); }
.login-advanced summary span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  color: var(--text);
}
.login-advanced summary small {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.login-advanced-body {
  display: grid;
  gap: 8px;
  padding: 4px 0 10px;
}
.login-small-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.login-help-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.35;
}
.login-cloud-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f8fafc;
  color: var(--text-muted);
  font-size: 12px;
}
.login-cloud-status span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-hint:empty { display: none; }
.login-error { line-height: 1.35; }
.btn-login {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-login:disabled {
  cursor: progress;
  opacity: .78;
}

@media (max-height: 700px) {
  .login-page { padding-top: 14px; padding-bottom: 14px; }
  .login-card { padding: 22px 20px; }
  .login-logo { margin-bottom: 16px; }
  .login-logo .brand-logo-img { width: 64px; height: 64px; margin-bottom: 8px; }
  .login-logo h1 { font-size: 20px; }
  .login-logo p { font-size: 12px; }
  .login-form .form-group { margin-bottom: 11px; }
  .btn-login { min-height: 48px; }
}

@media (max-width: 420px) {
  .login-page { padding: 12px; }
  .login-card { padding: 22px 18px; border-radius: 14px; }
  .login-advanced summary { align-items: flex-start; }
  .login-advanced summary small { display: none; }
}

/* Offline/Electron Font Awesome fallback. Activated by index.html when the FA webfont is unavailable. */
.fa-icons-fallback .fa-solid::before,
.fa-icons-fallback .fa-regular::before,
.fa-icons-fallback .fa-brands::before {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-weight: 700 !important;
  display: inline-block;
  min-width: 1em;
  text-align: center;
  content: "•";
}
.fa-icons-fallback .fa-envelope::before { content: "✉"; }
.fa-icons-fallback .fa-lock::before { content: "🔒"; }
.fa-icons-fallback .fa-key::before { content: "🔑"; }
.fa-icons-fallback .fa-link::before { content: "🔗"; }
.fa-icons-fallback .fa-cloud::before { content: "☁"; }
.fa-icons-fallback .fa-shield-halved::before { content: "🛡"; }
.fa-icons-fallback .fa-right-to-bracket::before { content: "→"; }
.fa-icons-fallback .fa-spinner::before { content: "⏳"; }


/* ===== APPEARANCE / DARK MODE ===== */
html[data-theme="dark"] {
  --sidebar-bg: #020617;
  --sidebar-hover: #111827;
  --sidebar-active: #60a5fa;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;

  --primary: #60a5fa;
  --primary-dark: #3b82f6;
  --primary-light: rgba(96,165,250,.14);
  --success: #34d399;
  --success-light: rgba(52,211,153,.14);
  --warning: #fbbf24;
  --warning-light: rgba(251,191,36,.14);
  --danger: #f87171;
  --danger-light: rgba(248,113,113,.14);
  --purple: #a78bfa;
  --purple-light: rgba(167,139,250,.14);
  --orange: #fb923c;
  --orange-light: rgba(251,146,60,.14);

  --bg: #0f172a;
  --card-bg: #111827;
  --border: #243244;
  --border-dark: #334155;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --text-light: #64748b;
  --shadow: 0 1px 3px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 6px 16px rgba(0,0,0,.35);
  --shadow-lg: 0 18px 40px rgba(0,0,0,.5);
  color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-theme="dark"] #app { background: var(--bg); color: var(--text); }
html[data-theme="dark"] .login-page { background: linear-gradient(135deg, #020617 0%, #0f172a 52%, #172554 100%); }
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .modal { background: var(--card-bg) !important; color: var(--text); border: 1px solid var(--border); }
html[data-theme="dark"] .login-hint,
html[data-theme="dark"] thead tr,
html[data-theme="dark"] .input-prefix,
html[data-theme="dark"] .badge-gray { background: #1f2937 !important; color: var(--text-muted); }
html[data-theme="dark"] input[type=text],
html[data-theme="dark"] input[type=email],
html[data-theme="dark"] input[type=number],
html[data-theme="dark"] input[type=password],
html[data-theme="dark"] input[type=date],
html[data-theme="dark"] input[type=url],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0b1220 !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #64748b; }
html[data-theme="dark"] tbody tr:hover { background: rgba(148,163,184,.08); }
html[data-theme="dark"] .btn-outline { background: rgba(15,23,42,.35); border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .btn-outline:hover,
html[data-theme="dark"] .btn-ghost:hover { background: rgba(148,163,184,.12); border-color: var(--border-dark); }
html[data-theme="dark"] .table-empty,
html[data-theme="dark"] .form-hint { color: var(--text-muted); }
html[data-theme="dark"] code { background: #0b1220 !important; color: #dbeafe !important; border: 1px solid var(--border); }
html[data-theme="dark"] hr { border-color: var(--border) !important; }
html[data-theme="dark"] .toggle-password:hover { background: #1f2937; }

/* Dark-mode rescue for older views that still use hard-coded pale inline backgrounds. */
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#f1f5f9"],
html[data-theme="dark"] [style*="background: #f1f5f9"],
html[data-theme="dark"] [style*="background:#fafafa"],
html[data-theme="dark"] [style*="background: #fafafa"] {
  background: #1f2937 !important;
  color: var(--text) !important;
}
html[data-theme="dark"] [style*="background:white"],
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #ffffff"] {
  background: var(--card-bg) !important;
  color: var(--text) !important;
}
html[data-theme="dark"] [style*="color:#374151"],
html[data-theme="dark"] [style*="color: #374151"],
html[data-theme="dark"] [style*="color:#111827"],
html[data-theme="dark"] [style*="color: #111827"] {
  color: var(--text) !important;
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--card-bg);
  color: var(--text);
  font-family: inherit;
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
}
.theme-toggle-btn:hover { background: var(--bg); border-color: var(--border-dark); transform: translateY(-1px); }
.theme-toggle-btn i { color: var(--primary); }
@media (max-width: 560px) { .theme-toggle-label { display: none; } .theme-toggle-btn { width: 36px; padding: 0; justify-content: center; } }

.appearance-options { display: grid; gap: 12px; }
.appearance-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 14px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, transform .15s;
}
.appearance-option:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-1px); }
.appearance-option.active { border-color: var(--primary); background: var(--primary-light); box-shadow: inset 0 0 0 1px rgba(59,130,246,.15); }
.appearance-option-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  color: var(--primary);
  flex-shrink: 0;
  font-size: 17px;
}
.appearance-option-copy { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.appearance-option-copy strong { font-size: 14px; }
.appearance-option-copy small { color: var(--text-muted); line-height: 1.4; }
.appearance-option-check { color: var(--primary); opacity: 0; }
.appearance-option.active .appearance-option-check { opacity: 1; }

/* ===== DARK MODE CONTRAST PATCH: Navy / Cyan / Amber theme ===== */
html[data-theme="dark"] {
  --sidebar-bg: #06111f;
  --sidebar-hover: #10243a;
  --sidebar-active: #38bdf8;
  --sidebar-text: #a8b7ca;
  --sidebar-text-active: #f8fafc;

  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --primary-light: rgba(56, 189, 248, .14);
  --success: #22c55e;
  --success-light: rgba(34, 197, 94, .16);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, .18);
  --danger: #fb7185;
  --danger-light: rgba(251, 113, 133, .16);
  --purple: #c084fc;
  --purple-light: rgba(192, 132, 252, .16);
  --orange: #fb923c;
  --orange-light: rgba(251, 146, 60, .16);

  --bg: #08111f;
  --card-bg: #101b2d;
  --card-bg-raised: #14243a;
  --card-bg-soft: #0d1728;
  --border: #263b56;
  --border-dark: #3a5270;
  --text: #f8fafc;
  --text-muted: #b6c5d8;
  --text-light: #8294ad;
  --shadow: 0 1px 3px rgba(0,0,0,.55), 0 1px 2px rgba(0,0,0,.45);
  --shadow-md: 0 10px 24px rgba(0,0,0,.35);
  --shadow-lg: 0 22px 48px rgba(0,0,0,.48);
}

html[data-theme="dark"] .main-content,
html[data-theme="dark"] .page-content {
  background: radial-gradient(circle at 20% 0%, rgba(56,189,248,.07), transparent 28%),
              linear-gradient(180deg, #0a1423 0%, #08111f 100%);
}

html[data-theme="dark"] .main-header,
html[data-theme="dark"] .card,
html[data-theme="dark"] .login-card,
html[data-theme="dark"] .modal {
  background: linear-gradient(180deg, var(--card-bg) 0%, var(--card-bg-soft) 100%) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .card-header {
  border-bottom-color: var(--border) !important;
}

html[data-theme="dark"] .quick-action-btn {
  background: linear-gradient(180deg, #182940 0%, #122136 100%) !important;
  border-color: #334a67 !important;
  color: var(--text) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 18px rgba(0,0,0,.18);
}

html[data-theme="dark"] .quick-action-btn strong {
  color: #ffffff !important;
  font-weight: 800;
}

html[data-theme="dark"] .quick-action-btn small {
  color: #c1cede !important;
}

html[data-theme="dark"] .quick-action-btn > i {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(56,189,248,.16);
  color: #7dd3fc !important;
  border: 1px solid rgba(125,211,252,.18);
}

html[data-theme="dark"] .quick-action-btn:hover {
  background: linear-gradient(180deg, #203653 0%, #172a45 100%) !important;
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 3px rgba(56,189,248,.14), 0 12px 26px rgba(0,0,0,.28);
  transform: translateY(-1px);
}

html[data-theme="dark"] .stat-card {
  background: linear-gradient(180deg, #14243a 0%, #101d31 100%) !important;
  border-color: #2c4360 !important;
}

html[data-theme="dark"] .clickable-card:hover {
  box-shadow: 0 0 0 3px rgba(56,189,248,.12), 0 14px 30px rgba(0,0,0,.32);
}

html[data-theme="dark"] .stat-info .label,
html[data-theme="dark"] .stat-info .change,
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .form-hint {
  color: var(--text-muted) !important;
}

html[data-theme="dark"] .stat-info .value,
html[data-theme="dark"] .card-header h3,
html[data-theme="dark"] .main-header h1,
html[data-theme="dark"] label {
  color: var(--text) !important;
}

html[data-theme="dark"] input[type=text],
html[data-theme="dark"] input[type=email],
html[data-theme="dark"] input[type=number],
html[data-theme="dark"] input[type=password],
html[data-theme="dark"] input[type=date],
html[data-theme="dark"] input[type=url],
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
  background: #0b1626 !important;
  border-color: #31465f !important;
  color: #f8fafc !important;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(56,189,248,.16);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #8395aa !important;
}

html[data-theme="dark"] thead tr,
html[data-theme="dark"] .login-hint,
html[data-theme="dark"] .input-prefix,
html[data-theme="dark"] .badge-gray {
  background: #14243a !important;
  color: var(--text-muted) !important;
}

html[data-theme="dark"] tbody tr:hover {
  background: rgba(56,189,248,.07) !important;
}

html[data-theme="dark"] th {
  color: #b6c5d8 !important;
}

html[data-theme="dark"] td,
html[data-theme="dark"] th {
  border-bottom-color: var(--border) !important;
}

html[data-theme="dark"] .theme-toggle-btn,
html[data-theme="dark"] .appearance-option {
  background: #14243a !important;
  border-color: #334a67 !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .theme-toggle-btn:hover,
html[data-theme="dark"] .appearance-option:hover,
html[data-theme="dark"] .appearance-option.active {
  background: #1b3150 !important;
  border-color: var(--primary) !important;
}

html[data-theme="dark"] .progress-bar-wrap {
  background: #0b1626 !important;
  border: 1px solid #263b56;
}

html[data-theme="dark"] .notification-icon {
  background: #14243a !important;
  border-color: #334a67 !important;
}

/* ===== DARK MODE VISIBILITY PATCH V2: POS + LEGACY SECTIONS =====
   Purpose: remove white cards/low contrast text in dark mode while keeping
   the VoltWise midnight theme readable in the POS, dashboard, tables,
   credits, modals, notifications and settings screens. */
html[data-theme="dark"] {
  --bg: #07111f;
  --card-bg: #101b2d;
  --card-bg-raised: #17243a;
  --card-bg-soft: #0d1728;
  --surface-1: #101b2d;
  --surface-2: #17243a;
  --surface-3: #1e304b;
  --border: #2d425f;
  --border-dark: #46617f;
  --text: #eef6ff;
  --text-muted: #b7c8db;
  --text-light: #8ea2b8;
  --primary: #38bdf8;
  --primary-dark: #0ea5e9;
  --primary-light: rgba(56, 189, 248, .16);
  --warning: #fbbf24;
  --warning-light: rgba(251, 191, 36, .17);
  --success: #34d399;
  --success-light: rgba(52, 211, 153, .15);
  --danger: #fb7185;
  --danger-light: rgba(251, 113, 133, .16);
}

html[data-theme="dark"] body,
html[data-theme="dark"] #app,
html[data-theme="dark"] .main-content,
html[data-theme="dark"] .page-content,
html[data-theme="dark"] #pos-view {
  background: #07111f !important;
  color: var(--text) !important;
}

/* Core surfaces */
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .credit-customer-card,
html[data-theme="dark"] .notification-panel,
html[data-theme="dark"] .appearance-option {
  background: linear-gradient(180deg, var(--surface-1) 0%, var(--card-bg-soft) 100%) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .credit-customer-header,
html[data-theme="dark"] .credit-customer-footer,
html[data-theme="dark"] .notification-panel-header {
  background: #0e192b !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}

/* Inputs, selects and search boxes */
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .filter-select,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .search-box input,
html[data-theme="dark"] .pos-search-box input {
  background: #0b1626 !important;
  color: #f8fafc !important;
  border-color: #344b68 !important;
}
html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] .form-control:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .18) !important;
  outline: none !important;
}
html[data-theme="dark"] option {
  background: #0b1626;
  color: #f8fafc;
}
html[data-theme="dark"] .search-box i,
html[data-theme="dark"] .input-icon i {
  color: #93a8bf !important;
}

/* Buttons */
html[data-theme="dark"] .btn-outline,
html[data-theme="dark"] .btn-ghost,
html[data-theme="dark"] .page-btn,
html[data-theme="dark"] .theme-toggle-btn {
  background: #101b2d !important;
  border-color: #344b68 !important;
  color: #dcecff !important;
}
html[data-theme="dark"] .btn-outline:hover,
html[data-theme="dark"] .btn-ghost:hover,
html[data-theme="dark"] .page-btn:hover,
html[data-theme="dark"] .theme-toggle-btn:hover {
  background: #1b3150 !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .btn-primary {
  background: linear-gradient(180deg, #38bdf8, #0ea5e9) !important;
  color: #06111f !important;
  border-color: #38bdf8 !important;
  font-weight: 800;
}
html[data-theme="dark"] .btn-success {
  background: linear-gradient(180deg, #34d399, #10b981) !important;
  color: #032017 !important;
  border-color: #34d399 !important;
  font-weight: 800;
}
html[data-theme="dark"] .btn-warning {
  background: linear-gradient(180deg, #fbbf24, #f59e0b) !important;
  color: #211400 !important;
  border-color: #fbbf24 !important;
  font-weight: 800;
}
html[data-theme="dark"] .btn-danger {
  background: linear-gradient(180deg, #fb7185, #e11d48) !important;
  color: #ffffff !important;
  border-color: #fb7185 !important;
  font-weight: 800;
}

/* POS shell */
html[data-theme="dark"] .pos-left,
html[data-theme="dark"] .pos-products,
html[data-theme="dark"] .pos-cats-wrap,
html[data-theme="dark"] .pos-search-bar,
html[data-theme="dark"] .pos-search-bar-enhanced {
  background: transparent !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .pos-search-bar-enhanced {
  border-color: transparent !important;
}
html[data-theme="dark"] .pos-price-mode span,
html[data-theme="dark"] .pos-result-count,
html[data-theme="dark"] .pos-load-more {
  color: var(--text-muted) !important;
}
html[data-theme="dark"] .pos-price-mode .btn-group {
  background: #0b1626 !important;
  border-color: #344b68 !important;
}
html[data-theme="dark"] .pos-mode-btn {
  color: #dbeafe !important;
}

/* Product category pills */
html[data-theme="dark"] .cat-btn {
  background: linear-gradient(180deg, #15243a 0%, #101d31 100%) !important;
  border-color: #344b68 !important;
  color: #d9e8fa !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset;
}
html[data-theme="dark"] .cat-btn:hover {
  background: #1b3150 !important;
  border-color: var(--primary) !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .cat-btn.active {
  background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%) !important;
  border-color: #7dd3fc !important;
  color: #06111f !important;
  font-weight: 800;
}
html[data-theme="dark"] .cat-btn span {
  background: rgba(148, 163, 184, .16) !important;
  color: #e6f3ff !important;
}
html[data-theme="dark"] .cat-btn.active span {
  background: rgba(6, 17, 31, .22) !important;
  color: #06111f !important;
}

/* Product cards */
html[data-theme="dark"] .product-card {
  background: linear-gradient(180deg, #182940 0%, #111f33 100%) !important;
  border-color: #344b68 !important;
  color: var(--text) !important;
  box-shadow: 0 10px 22px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.035);
}
html[data-theme="dark"] .product-card:hover {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(56,189,248,.18), 0 14px 28px rgba(0,0,0,.30) !important;
}
html[data-theme="dark"] .product-card.low-stock-card {
  background: linear-gradient(180deg, rgba(251,191,36,.13) 0%, #151f31 100%) !important;
  border-color: rgba(251,191,36,.62) !important;
}
html[data-theme="dark"] .product-card.out-of-stock {
  opacity: .78 !important;
  background: #0d1728 !important;
  border-color: #263b56 !important;
}
html[data-theme="dark"] .product-card .prod-name,
html[data-theme="dark"] .product-card .prod-icon {
  color: #f8fafc !important;
}
html[data-theme="dark"] .product-card .prod-price {
  color: #7dd3fc !important;
}
html[data-theme="dark"] .product-card .prod-sku,
html[data-theme="dark"] .product-card .prod-stock {
  color: #b6c8dc !important;
}
html[data-theme="dark"] .product-card .prod-stock.low {
  color: #fbbf24 !important;
}
html[data-theme="dark"] .product-card .prod-stock.out {
  color: #fb7185 !important;
}
html[data-theme="dark"] .prod-in-cart {
  background: rgba(56, 189, 248, .18) !important;
  color: #bff0ff !important;
  border: 1px solid rgba(125, 211, 252, .24);
}
html[data-theme="dark"] .pos-empty-state,
html[data-theme="dark"] .pos-empty-state p,
html[data-theme="dark"] .cart-empty,
html[data-theme="dark"] .cart-empty small {
  color: var(--text-muted) !important;
}
html[data-theme="dark"] .pos-empty-state h3 {
  color: var(--text) !important;
}

/* Cart panel */
html[data-theme="dark"] .cart-panel {
  background: linear-gradient(180deg, #111d30 0%, #0d1728 100%) !important;
  border-color: #39516f !important;
  color: var(--text) !important;
  box-shadow: 0 18px 42px rgba(0,0,0,.30);
}
html[data-theme="dark"] .cart-header {
  background: #101b2d !important;
  border-bottom-color: #344b68 !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .cart-header h3,
html[data-theme="dark"] .cart-header h3 i {
  color: #f8fafc !important;
}
html[data-theme="dark"] .cart-items,
html[data-theme="dark"] .cart-footer,
html[data-theme="dark"] .cart-customer-wrap {
  background: transparent !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .cart-item {
  background: linear-gradient(180deg, #17243a 0%, #111f33 100%) !important;
  border-color: #3a5270 !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .cart-item-name,
html[data-theme="dark"] .cart-item-total,
html[data-theme="dark"] .qty-display {
  color: #ffffff !important;
}
html[data-theme="dark"] .cart-item-price,
html[data-theme="dark"] .cart-item-stock,
html[data-theme="dark"] .summary-row,
html[data-theme="dark"] .cust-section-label,
html[data-theme="dark"] .cust-section-label span {
  color: var(--text-muted) !important;
}
html[data-theme="dark"] .cart-item-stock.warn {
  color: #fbbf24 !important;
}
html[data-theme="dark"] .qty-btn {
  background: #0b1626 !important;
  border-color: #46617f !important;
  color: #7dd3fc !important;
}
html[data-theme="dark"] .qty-btn:hover {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: #06111f !important;
}
html[data-theme="dark"] .cart-remove {
  color: #fb7185 !important;
}
html[data-theme="dark"] .cust-section {
  background: #101b2d !important;
  border-top: 1px solid #344b68 !important;
  border-bottom: 1px solid #344b68 !important;
  padding: 10px 0;
}
html[data-theme="dark"] .cust-section.cust-required {
  background: linear-gradient(180deg, rgba(251,113,133,.08), rgba(16,27,45,.92)) !important;
}
html[data-theme="dark"] .summary-total {
  color: #ffffff !important;
  border-top-color: #58708e !important;
}
html[data-theme="dark"] #cart-total {
  color: #ffffff !important;
}
html[data-theme="dark"] .pay-methods {
  background: transparent !important;
}
html[data-theme="dark"] .pay-btn {
  background: #111f33 !important;
  border-color: #3a5270 !important;
  color: #c9daec !important;
}
html[data-theme="dark"] .pay-btn:hover:not(.active) {
  background: #1b3150 !important;
  border-color: #7dd3fc !important;
  color: #ffffff !important;
}
html[data-theme="dark"] .pay-btn.active {
  background: rgba(56,189,248,.22) !important;
  border-color: #38bdf8 !important;
  color: #7dd3fc !important;
  box-shadow: 0 0 0 3px rgba(56,189,248,.12);
}
html[data-theme="dark"] .pay-btn:disabled {
  background: #0d1728 !important;
  border-color: #263b56 !important;
  color: #71859d !important;
  opacity: 1 !important;
}

/* Shift banner */
html[data-theme="dark"] .shift-status-banner {
  background: linear-gradient(180deg, #10243a 0%, #0d1f34 100%) !important;
  border-color: #3a5270 !important;
  color: #dcecff !important;
}
html[data-theme="dark"] .shift-status-banner.shift-open {
  background: linear-gradient(180deg, rgba(52,211,153,.18) 0%, #10243a 100%) !important;
  border-color: rgba(52,211,153,.48) !important;
  color: #d1fae5 !important;
}
html[data-theme="dark"] .shift-status-banner.shift-closed {
  background: linear-gradient(180deg, rgba(251,191,36,.16) 0%, #10243a 100%) !important;
  border-color: rgba(251,191,36,.44) !important;
  color: #fef3c7 !important;
}
html[data-theme="dark"] .shift-status-banner strong {
  color: #ffffff !important;
}

/* Dashboard, accounting, activity logs, credits */
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .quick-action-btn,
html[data-theme="dark"] .alert-item,
html[data-theme="dark"] .credit-summary-badge {
  background: linear-gradient(180deg, #17243a 0%, #111f33 100%) !important;
  border-color: #344b68 !important;
  color: var(--text) !important;
}
html[data-theme="dark"] .quick-action-btn strong,
html[data-theme="dark"] .credit-customer-name,
html[data-theme="dark"] .credit-receipt,
html[data-theme="dark"] .notification-title,
html[data-theme="dark"] .alert-text strong {
  color: #ffffff !important;
}
html[data-theme="dark"] .quick-action-btn small,
html[data-theme="dark"] .credit-customer-phone,
html[data-theme="dark"] .credit-date,
html[data-theme="dark"] .credit-total-label,
html[data-theme="dark"] .notification-message,
html[data-theme="dark"] .notification-time {
  color: var(--text-muted) !important;
}
html[data-theme="dark"] .pl-row.section-header,
html[data-theme="dark"] .pl-row.subtotal,
html[data-theme="dark"] .pl-row.total,
html[data-theme="dark"] .activity-log-table .system-row td,
html[data-theme="dark"] thead tr {
  background: #14243a !important;
  color: #dbeafe !important;
}
html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .credit-sale-row:hover {
  background: rgba(56,189,248,.07) !important;
}
html[data-theme="dark"] .notification-item {
  background: #101b2d !important;
  color: var(--text) !important;
  border-bottom-color: var(--border) !important;
}
html[data-theme="dark"] .notification-item:hover,
html[data-theme="dark"] .notification-item.unread {
  background: #17243a !important;
}
html[data-theme="dark"] .notification-icon {
  background: #0b1626 !important;
  border-color: #344b68 !important;
  color: #7dd3fc !important;
}

/* Badges and helper pills */
html[data-theme="dark"] .badge,
html[data-theme="dark"] .badge-gray,
html[data-theme="dark"] .badge-neutral,
html[data-theme="dark"] .badge-info {
  border: 1px solid rgba(148,163,184,.22);
}
html[data-theme="dark"] .badge-gray,
html[data-theme="dark"] .badge-neutral {
  background: #24364f !important;
  color: #dbeafe !important;
}
html[data-theme="dark"] .badge-primary,
html[data-theme="dark"] .badge-info {
  background: rgba(56,189,248,.18) !important;
  color: #7dd3fc !important;
}
html[data-theme="dark"] .badge-warning,
html[data-theme="dark"] .credit-age.warning {
  background: rgba(251,191,36,.18) !important;
  color: #fbbf24 !important;
}
html[data-theme="dark"] .badge-danger,
html[data-theme="dark"] .credit-age.overdue {
  background: rgba(251,113,133,.18) !important;
  color: #fb7185 !important;
}

/* Rescue remaining inline light boxes used in older views. */
html[data-theme="dark"] [style*="background:#fff7ed"],
html[data-theme="dark"] [style*="background: #fff7ed"],
html[data-theme="dark"] [style*="background:#fffbeb"],
html[data-theme="dark"] [style*="background: #fffbeb"],
html[data-theme="dark"] [style*="background:#ecfdf5"],
html[data-theme="dark"] [style*="background: #ecfdf5"],
html[data-theme="dark"] [style*="background:#fef2f2"],
html[data-theme="dark"] [style*="background: #fef2f2"],
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#f1f5f9"],
html[data-theme="dark"] [style*="background: #f1f5f9"],
html[data-theme="dark"] [style*="background:#fafafa"],
html[data-theme="dark"] [style*="background: #fafafa"] {
  background: #14243a !important;
  color: var(--text) !important;
  border-color: #344b68 !important;
}
html[data-theme="dark"] [style*="color:#9a3412"],
html[data-theme="dark"] [style*="color: #9a3412"],
html[data-theme="dark"] [style*="color:#92400e"],
html[data-theme="dark"] [style*="color: #92400e"],
html[data-theme="dark"] [style*="color:#374151"],
html[data-theme="dark"] [style*="color: #374151"],
html[data-theme="dark"] [style*="color:#111827"],
html[data-theme="dark"] [style*="color: #111827"],
html[data-theme="dark"] [style*="color:#64748b"],
html[data-theme="dark"] [style*="color: #64748b"] {
  color: var(--text-muted) !important;
}

/* Keep logo image backgrounds intentionally white so the VoltWise logo remains accurate. */
html[data-theme="dark"] .logo-img,
html[data-theme="dark"] .brand-logo-img,
html[data-theme="dark"] .sidebar-header .brand-logo-img,
html[data-theme="dark"] .login-logo .brand-logo-img {
  background: #ffffff !important;
}


/* ===== DARK MODE VISIBILITY PATCH V3: SETTINGS + DIAGNOSTICS =====
   This fixes remaining low-contrast inline light panels in Settings, Cloud Sync,
   Cloud Sync Diagnostic, WhatsApp settings, activity raw JSON panels, reports,
   user permissions and older legacy views. */
html[data-theme="dark"] #settings-view,
html[data-theme="dark"] #settings-tab-content {
  color: var(--text) !important;
}
html[data-theme="dark"] #settings-view .tabs {
  border-bottom-color: #315073 !important;
  background: transparent !important;
}
html[data-theme="dark"] #settings-view .tab-btn {
  color: #cfe3f8 !important;
}
html[data-theme="dark"] #settings-view .tab-btn:hover {
  color: #ffffff !important;
  background: rgba(56,189,248,.08) !important;
}
html[data-theme="dark"] #settings-view .tab-btn.active {
  color: #7dd3fc !important;
  border-bottom-color: #38bdf8 !important;
  background: rgba(56,189,248,.10) !important;
}

/* Cloud Sync cards */
html[data-theme="dark"] .cloud-primary-card,
html[data-theme="dark"] .settings-toggle-card,
html[data-theme="dark"] .settings-help-card,
html[data-theme="dark"] .whatsapp-sample-card,
html[data-theme="dark"] .cloud-guide-tip,
html[data-theme="dark"] .diag-step,
html[data-theme="dark"] .diag-user-card,
html[data-theme="dark"] .diag-help-card,
html[data-theme="dark"] .diag-meta-card {
  background: linear-gradient(180deg, #17243a 0%, #101d31 100%) !important;
  border: 1px solid #3a5270 !important;
  color: #eef6ff !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035) !important;
}
html[data-theme="dark"] .cloud-primary-card.is-primary,
html[data-theme="dark"] .diag-help-card {
  background: linear-gradient(180deg, rgba(251,191,36,.18) 0%, #17243a 100%) !important;
  border-color: rgba(251,191,36,.55) !important;
}
html[data-theme="dark"] .cloud-primary-card.is-secondary {
  background: linear-gradient(180deg, #17243a 0%, #101d31 100%) !important;
  border-color: #3a5270 !important;
}
html[data-theme="dark"] .cloud-primary-label,
html[data-theme="dark"] .cloud-primary-label span,
html[data-theme="dark"] .cloud-primary-label div,
html[data-theme="dark"] .cloud-primary-label strong,
html[data-theme="dark"] .settings-toggle-card,
html[data-theme="dark"] .settings-toggle-card *,
html[data-theme="dark"] .whatsapp-sample-card,
html[data-theme="dark"] .whatsapp-sample-card *,
html[data-theme="dark"] .cloud-guide-tip,
html[data-theme="dark"] .cloud-guide-tip *,
html[data-theme="dark"] .diag-step,
html[data-theme="dark"] .diag-step *,
html[data-theme="dark"] .diag-user-card,
html[data-theme="dark"] .diag-user-card *,
html[data-theme="dark"] .diag-help-card,
html[data-theme="dark"] .diag-help-card * {
  color: #eef6ff !important;
}
html[data-theme="dark"] .cloud-primary-label div,
html[data-theme="dark"] .diag-step div[style*="font-size:12px"],
html[data-theme="dark"] .diag-user-title,
html[data-theme="dark"] .settings-help-card {
  color: #c2d4e8 !important;
}
html[data-theme="dark"] .diag-ok {
  background: linear-gradient(180deg, rgba(52,211,153,.16) 0%, #13243a 100%) !important;
  border-color: rgba(52,211,153,.45) !important;
}
html[data-theme="dark"] .diag-error {
  background: linear-gradient(180deg, rgba(251,113,133,.15) 0%, #13243a 100%) !important;
  border-color: rgba(251,113,133,.48) !important;
}
html[data-theme="dark"] .diag-ok .fa-circle-check,
html[data-theme="dark"] [style*="color:#16a34a" i] { color: #34d399 !important; }
html[data-theme="dark"] .diag-error .fa-circle-xmark,
html[data-theme="dark"] [style*="color:#dc2626" i] { color: #fb7185 !important; }
html[data-theme="dark"] .diag-meta-card {
  background: #081321 !important;
  border-color: #2d425f !important;
}
html[data-theme="dark"] .diag-meta-card code,
html[data-theme="dark"] #settings-view code {
  background: #081321 !important;
  color: #dbeafe !important;
  border: 1px solid #344b68 !important;
  padding: 1px 5px !important;
  border-radius: 4px !important;
}

/* Universal rescue for legacy inline light panels. These are common in older
   screens and are the cause of pale boxes with unreadable text in dark mode. */
html[data-theme="dark"] [style*="#ffffff" i],
html[data-theme="dark"] [style*="background:#fff" i],
html[data-theme="dark"] [style*="background: #fff" i],
html[data-theme="dark"] [style*="#f8fafc" i],
html[data-theme="dark"] [style*="#f1f5f9" i],
html[data-theme="dark"] [style*="#f0fdf4" i],
html[data-theme="dark"] [style*="#eff6ff" i],
html[data-theme="dark"] [style*="#fef9c3" i],
html[data-theme="dark"] [style*="#fef3c7" i],
html[data-theme="dark"] [style*="#fffbeb" i],
html[data-theme="dark"] [style*="#fff7ed" i],
html[data-theme="dark"] [style*="#fef2f2" i],
html[data-theme="dark"] [style*="#fee2e2" i],
html[data-theme="dark"] [style*="#dcfce7" i],
html[data-theme="dark"] [style*="#dbeafe" i] {
  background: #14243a !important;
  color: #eef6ff !important;
  border-color: #3a5270 !important;
}
html[data-theme="dark"] [style*="#fef9c3" i],
html[data-theme="dark"] [style*="#fef3c7" i],
html[data-theme="dark"] [style*="#fffbeb" i],
html[data-theme="dark"] [style*="#fff7ed" i] {
  background: linear-gradient(180deg, rgba(251,191,36,.16) 0%, #14243a 100%) !important;
  border-color: rgba(251,191,36,.50) !important;
}
html[data-theme="dark"] [style*="#f0fdf4" i],
html[data-theme="dark"] [style*="#dcfce7" i] {
  background: linear-gradient(180deg, rgba(52,211,153,.14) 0%, #14243a 100%) !important;
  border-color: rgba(52,211,153,.42) !important;
}
html[data-theme="dark"] [style*="#fef2f2" i],
html[data-theme="dark"] [style*="#fee2e2" i] {
  background: linear-gradient(180deg, rgba(251,113,133,.14) 0%, #14243a 100%) !important;
  border-color: rgba(251,113,133,.42) !important;
}

/* Convert inline light/dark text colours into readable dark-theme colours. */
html[data-theme="dark"] [style*="color:#111" i],
html[data-theme="dark"] [style*="color: #111" i],
html[data-theme="dark"] [style*="#111827" i],
html[data-theme="dark"] [style*="#1e293b" i],
html[data-theme="dark"] [style*="#0f203a" i],
html[data-theme="dark"] [style*="#374151" i] {
  color: #eef6ff !important;
}
html[data-theme="dark"] [style*="#64748b" i],
html[data-theme="dark"] [style*="#6b7280" i],
html[data-theme="dark"] [style*="#94a3b8" i] {
  color: #b7c8db !important;
}
html[data-theme="dark"] [style*="#166534" i],
html[data-theme="dark"] [style*="#10b981" i] {
  color: #34d399 !important;
}
html[data-theme="dark"] [style*="#991b1b" i],
html[data-theme="dark"] [style*="#ef4444" i] {
  color: #fb7185 !important;
}
html[data-theme="dark"] [style*="#92400e" i],
html[data-theme="dark"] [style*="#854d0e" i],
html[data-theme="dark"] [style*="#9a3412" i],
html[data-theme="dark"] [style*="#f59e0b" i] {
  color: #fbbf24 !important;
}
html[data-theme="dark"] [style*="#1e40af" i],
html[data-theme="dark"] [style*="#1d4ed8" i],
html[data-theme="dark"] [style*="#3b82f6" i],
html[data-theme="dark"] [style*="#6366f1" i] {
  color: #7dd3fc !important;
}
html[data-theme="dark"] [style*="#25d366" i],
html[data-theme="dark"] [style*="#25D366" i] {
  color: #34d399 !important;
}

html[data-theme="dark"] .btn-whatsapp {
  background: linear-gradient(180deg, #34d399, #22c55e) !important;
  border: none !important;
  color: #041b10 !important;
  font-weight: 800;
}
html[data-theme="dark"] .btn-whatsapp:hover {
  background: linear-gradient(180deg, #6ee7b7, #34d399) !important;
  color: #03150c !important;
}
html[data-theme="dark"] .btn-whatsapp-ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: #34d399 !important;
}
html[data-theme="dark"] .btn-whatsapp-ghost:hover {
  background: rgba(52, 211, 153, .14) !important;
  border-color: rgba(52, 211, 153, .28) !important;
  color: #6ee7b7 !important;
}

/* Raw JSON / pre blocks and progress tracks */
html[data-theme="dark"] pre,
html[data-theme="dark"] [style*="font-family:monospace" i] {
  background: #081321 !important;
  color: #dbeafe !important;
  border-color: #344b68 !important;
}
html[data-theme="dark"] [style*="background:#eee" i],
html[data-theme="dark"] [style*="background: #eee" i] {
  background: #263b56 !important;
}

/* Keep printed receipt/invoice documents readable when previewed: use white paper
   only in generated print windows, not normal app cards. */
html[data-theme="dark"] .thermal-receipt,
html[data-theme="dark"] .print-paper,
html[data-theme="dark"] .invoice-paper,
html[data-theme="dark"] .quote-paper {
  background: #ffffff !important;
  color: #111111 !important;
}

/* Final exception: logos should stay on white/light backing in dark mode. */
html[data-theme="dark"] .logo-img,
html[data-theme="dark"] .brand-logo-img,
html[data-theme="dark"] .sidebar-header .brand-logo-img,
html[data-theme="dark"] .login-logo .brand-logo-img {
  background: #ffffff !important;
}
