/* ═══════════════════════════════════════════════════════════════════════
   AJS INFOTECH CSC BUSINESS ERP & CRM – v3 FULL MODERN SAAS UI
   Premium Blue & White Theme + Deep Navy Sidebar + Modern POS Billing UI
   ═══════════════════════════════════════════════════════════════════════ */
:root, [data-theme="light"] {
  --bg: #eef4fc;
  --bg2: #ffffff;
  --bg3: #f8fafd;
  --card: #ffffff;
  --card-border: #dce5f2;
  --accent: #2563eb;
  --accent2: #1d4ed8;
  --accent3: #0d9488;
  --accent4: #4f46e5;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --danger: #ef4444;
  --success: #16a34a;
  --warning: #ea580c;
  --info: #2563eb;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
  --glow: 0 4px 16px rgba(37, 99, 235, 0.25);
}
[data-theme="dark"] {
  --bg: #0b1120;
  --bg2: #111827;
  --bg3: #1e293b;
  --card: #162033;
  --card-border: rgba(255,255,255,0.09);
  --accent: #3b82f6;
  --accent2: #2563eb;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
}

body { background: var(--bg) !important; color: var(--text) !important; }

/* ── DARK NAVY SIDEBAR ── */
.sidebar {
  background: linear-gradient(180deg, #091334 0%, #0f1d4a 55%, #0c173a 100%) !important;
  border-right: 1px solid rgba(255,255,255,0.08) !important;
  box-shadow: 4px 0 24px rgba(9,19,52,0.18);
}
.sidebar-logo { border-bottom: 1px solid rgba(255,255,255,0.09) !important; padding: 14px 14px !important; }
.sidebar .brand-icon {
  background: linear-gradient(135deg, #2563eb, #06b6d4) !important;
  color: #fff !important; box-shadow: 0 4px 12px rgba(37,99,235,0.45);
}
.sidebar .brand-text h3 { color: #ffffff !important; font-weight: 800; letter-spacing: .3px; }
.sidebar .brand-text span { color: #93c5fd !important; font-weight: 600; }
.sidebar .nav-section-title { color: #64748b !important; }
.sidebar .nav-item { color: #cbd5e1 !important; border-radius: 9px !important; margin-bottom: 3px !important; }
.sidebar .nav-item:hover { background: rgba(255,255,255,0.09) !important; color: #ffffff !important; }
.sidebar .nav-item.active {
  background: linear-gradient(90deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important; border-color: transparent !important;
  box-shadow: 0 4px 14px rgba(37,99,235,0.45);
}
.sidebar .nav-item.active::before { background: #60a5fa !important; }
.sidebar .sidebar-footer { border-top: 1px solid rgba(255,255,255,0.09) !important; }
.sidebar .user-chip { background: rgba(255,255,255,0.08) !important; border-color: rgba(255,255,255,0.12) !important; }
.sidebar .user-name { color: #ffffff !important; }
.sidebar .user-role { color: #93c5fd !important; }

.sidebar-subnav { padding-left: 12px; margin: 2px 0 8px; display: none; }
.sidebar-subnav.open { display: block; }
.sidebar-subnav .sub-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 5px 9px; font-size: 0.72rem; color: #94a3b8; border-radius: 7px;
  cursor: pointer; margin-bottom: 2px; transition: 0.2s;
}
.sidebar-subnav .sub-item:hover, .sidebar-subnav .sub-item.active {
  background: rgba(59,130,246,0.26); color: #ffffff;
}
.sidebar-subnav .sub-cnt {
  background: rgba(255,255,255,0.13); color: #e2e8f0;
  padding: 1px 6px; border-radius: 99px; font-size: 0.62rem; font-weight: 700;
}

/* ── TOPNAV & GLOBAL CARDS ── */
.topnav {
  background: var(--bg2) !important;
  border-bottom: 1px solid var(--card-border) !important;
  box-shadow: 0 2px 10px rgba(15,23,42,0.04);
}
.card, .stat-card {
  background: var(--card) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 2px 10px rgba(15,23,42,0.04);
}
.stat-card:hover { box-shadow: 0 6px 18px rgba(37,99,235,0.1) !important; }
thead tr { background: linear-gradient(90deg, rgba(37,99,235,0.08), rgba(14,165,233,0.06)) !important; }
th { color: var(--text2) !important; font-weight: 700 !important; }
.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(37,99,235,0.28) !important;
}
.btn-success { background: linear-gradient(135deg, #16a34a, #15803d) !important; color: #fff !important; }
.btn-purple { background: linear-gradient(135deg, #7c3aed, #6d28d9) !important; color: #fff !important; }
.tab-bar { background: var(--bg3) !important; border: 1px solid var(--card-border); padding: 4px !important; border-radius: 10px !important; }
.tab-btn.active { background: linear-gradient(135deg, #2563eb, #1d4ed8) !important; color: #ffffff !important; box-shadow: 0 2px 8px rgba(37,99,235,0.28); }
.chip.active { background: #2563eb !important; color: #ffffff !important; border-color: #2563eb !important; }

/* ── DASHBOARD HERO, KPI STRIP, QUICK SERVICES & ACCOUNTS SUMMARY ── */
.ajs-welcome-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-bottom: 12px; padding: 14px 18px; border-radius: 14px;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 60%, #e0f2fe 100%);
  border: 1px solid #bfdbfe;
  box-shadow: 0 4px 16px rgba(37,99,235,0.08);
}
[data-theme="dark"] .ajs-welcome-bar {
  background: linear-gradient(135deg, #162033 0%, #1e293b 100%);
  border-color: rgba(59,130,246,0.28);
}
.ajs-welcome-bar h2 { font-size: 1.25rem; font-weight: 800; color: var(--text); margin: 0; }
.ajs-welcome-bar p { font-size: 0.78rem; color: var(--text2); margin: 3px 0 0; }
.ajs-brand-pills { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ajs-csc-pill {
  background: #0f1d4a; color: #fff; padding: 5px 12px; border-radius: 99px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: .4px;
}
.ajs-date-pill {
  background: var(--bg2); border: 1px solid #bfdbfe; padding: 5px 12px;
  border-radius: 99px; font-size: 0.74rem; font-weight: 700; color: #1d4ed8;
}

.ajs-dash-split {
  display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 12px; margin-bottom: 12px;
}
@media(max-width:1150px){ .ajs-dash-split { grid-template-columns: 1fr; } }

.ajs-quick-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px;
}
.ajs-qcard {
  background: var(--bg3); border: 1px solid var(--card-border); border-radius: 11px;
  padding: 10px 6px; text-align: center; cursor: pointer; transition: 0.2s;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.ajs-qcard:hover {
  border-color: #2563eb; background: rgba(37,99,235,0.05);
  transform: translateY(-2px); box-shadow: 0 5px 14px rgba(37,99,235,0.13);
}
.ajs-qcard i { font-size: 1.15rem; color: #2563eb; }
.ajs-qcard span { font-size: 0.7rem; font-weight: 700; color: var(--text); line-height: 1.15; }
.ajs-qcard small { font-size: 0.58rem; color: var(--text2); }

.ajs-qa-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.ajs-qa-btn {
  display: flex; align-items: center; gap: 7px; padding: 9px 10px; border-radius: 9px;
  border: 1px solid var(--card-border); background: var(--bg3); color: var(--text);
  font-size: 0.74rem; font-weight: 700; cursor: pointer; transition: 0.2s; text-align: left;
}
.ajs-qa-btn:hover { border-color: #2563eb; background: rgba(37,99,235,0.08); color: #2563eb; }
.ajs-qa-btn i { color: #2563eb; font-size: 0.9rem; width: 16px; text-align: center; }

.ajs-mid-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media(max-width:800px){ .ajs-mid-cards { grid-template-columns: 1fr; } }
.ajs-wo-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.ajs-wo-mini {
  padding: 10px 6px; border-radius: 10px; text-align: center; cursor: pointer;
  border: 1px solid var(--card-border); transition: 0.2s;
}
.ajs-wo-mini:hover { transform: translateY(-2px); }
.ajs-wo-mini b { display: block; font-size: 1.2rem; font-family: 'Syne', sans-serif; }
.ajs-wo-mini span { font-size: 0.65rem; font-weight: 700; }

.ajs-acct-list { display: flex; flex-direction: column; gap: 7px; }
.ajs-acct-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 10px; border-radius: 8px; background: var(--bg3); border: 1px solid var(--card-border);
  font-size: 0.78rem; font-weight: 600;
}

/* ── MODERN POS BILLING & LIVE INVOICE PREVIEW PAGE ── */
.pos-billing-grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.9fr); gap: 14px; align-items: start;
}
@media(max-width:1120px){ .pos-billing-grid { grid-template-columns: 1fr; } }

.pos-card-hdr {
  background: linear-gradient(90deg, #1e3a8a, #2563eb); color: #ffffff;
  padding: 10px 14px; border-radius: 10px 10px 0 0; margin: -12px -12px 12px -12px;
  display: flex; justify-content: space-between; align-items: center;
}
.pos-card-hdr h3 { font-size: 0.92rem; margin: 0; color: #fff; display: flex; align-items: center; gap: 7px; }
.pos-item-table th, .pos-item-table td { padding: 6px !important; vertical-align: top !important; }
.pos-item-table input, .pos-item-table select { padding: 5px 7px !important; font-size: 0.76rem !important; min-height: 28px !important; }

.pos-summary-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 10px 12px; background: var(--bg3); border: 1px solid var(--card-border);
  border-radius: 10px; margin-top: 10px;
}
.pos-grand-pill {
  background: linear-gradient(135deg, #1e3a8a, #2563eb); color: #fff;
  padding: 7px 14px; border-radius: 9px; font-size: 1rem; font-weight: 800; font-family: 'Syne', sans-serif;
}
.pos-action-row {
  display: grid; grid-template-columns: 1.2fr 1fr 0.7fr; gap: 8px; margin-top: 10px;
}
@media(max-width:600px){ .pos-action-row { grid-template-columns: 1fr; } }

/* Live A4 Invoice Preview Card */
.live-inv-paper {
  background: #ffffff; color: #0f172a; border: 1px solid #cbd5e1; border-radius: 10px;
  padding: 14px; box-shadow: 0 8px 24px rgba(15,23,42,0.08); font-family: Arial, sans-serif; font-size: 11px;
}
.live-inv-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  border-bottom: 2.5px solid #1d4ed8; padding-bottom: 8px; margin-bottom: 8px; gap: 8px;
}
.live-inv-brand { font-size: 15px; font-weight: 900; color: #1e3a8a; line-height: 1.1; }
.live-inv-meta { font-size: 9.5px; color: #475569; margin-top: 2px; line-height: 1.35; }
.live-inv-tbl { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 10px; }
.live-inv-tbl th { background: #eff6ff !important; color: #1e3a8a !important; border: 1px solid #cbd5e1; padding: 4px 5px !important; font-size: 9px !important; }
.live-inv-tbl td { border: 1px solid #e2e8f0; padding: 4px 5px !important; color: #0f172a !important; }
.live-inv-footer {
  display: flex; justify-content: space-between; align-items: center; margin-top: 10px;
  padding-top: 8px; border-top: 1px dashed #cbd5e1; gap: 10px;
}

/* ── EXACT STATUS COLORS (Section 11) ── */
.wo-badge { display:inline-flex; align-items:center; gap:4px; padding:3px 9px; border-radius:99px; font-size:0.68rem; font-weight:700; white-space:nowrap; }
.wo-new { background:#dbeafe; color:#1d4ed8; }
.wo-pending { background:#ffedd5; color:#c2410c; }
.wo-in-progress { background:#f3e8ff; color:#7e22ce; }
.wo-on-hold { background:#e2e8f0; color:#475569; }
.wo-completed { background:#dcfce7; color:#15803d; }
.wo-ready { background:#ccfbf1; color:#0f766e; }
.wo-delivered { background:#14532d; color:#ffffff; }
.wo-cancelled { background:#fee2e2; color:#991b1b; }
.wo-overdue { background:#ef4444; color:#ffffff; animation: ajsPulse 1.6s infinite; }
@keyframes ajsPulse { 0%,100%{opacity:1;} 50%{opacity:.68;} }

/* Invoice Row Pending Task Options */
.wo-row-toggle {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 5px;
  font-size: 0.72rem; font-weight: 700; color: #2563eb; cursor: pointer; user-select: none;
}
.wo-row-panel {
  margin-top: 6px; padding: 8px; border-radius: 8px;
  background: rgba(37,99,235,0.06); border: 1px dashed #2563eb;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
}
.wo-row-panel input, .wo-row-panel select { font-size: 0.72rem !important; padding: 4px 6px !important; min-height: 26px !important; }
@media(max-width:760px){ .wo-row-panel, .ajs-wo-mini-grid { grid-template-columns: repeat(2, 1fr); } }

/* Task Details Grid & Timeline */
.wo-detail-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 14px; }
@media(max-width:900px){ .wo-detail-grid { grid-template-columns: 1fr; } }
.wo-info-card {
  background: var(--bg3); border: 1px solid var(--card-border);
  border-radius: 10px; padding: 12px; margin-bottom: 10px;
}
.wo-info-card h4 { font-size: 0.84rem; margin-bottom: 8px; color: var(--accent); display:flex; align-items:center; gap:6px; }
.wo-kv { display:grid; grid-template-columns: 120px 1fr; gap: 4px 8px; font-size: 0.78rem; }
.wo-kv .k { color: var(--text2); font-weight: 600; }
.wo-kv .v { color: var(--text); font-weight: 600; word-break: break-word; }

.ajs-timeline { border-left: 2px solid #2563eb; padding-left: 14px; margin-left: 6px; max-height: 300px; overflow-y: auto; }
.ajs-tl-item { position: relative; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px dashed var(--card-border); }
.ajs-tl-item::before {
  content:''; position:absolute; left:-20px; top:3px; width:10px; height:10px;
  border-radius:50%; background:#2563eb; border:2px solid var(--card);
}
.ajs-tl-time { font-size: 0.7rem; font-weight: 700; color: #2563eb; }
.ajs-tl-title { font-size: 0.8rem; font-weight: 700; color: var(--text); margin-top: 2px; }
.ajs-tl-meta { font-size: 0.7rem; color: var(--text2); margin-top: 2px; }

/* Signature Pad */
#delSignCanvas {
  border: 1.5px dashed #94a3b8; border-radius: 8px; background: #ffffff;
  touch-action: none; width: 100%; height: 110px; cursor: crosshair; display: block;
}

/* ── v4 SHOPKEEPER BADGE, REMINDER CHIPS & AUTO-INVOICE BOX ── */
.badge-shopkeeper { background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd; }
.ajs-rem-box {
  background: rgba(245,158,11,0.08); border: 1px dashed #d97706;
  border-radius: 9px; padding: 9px 11px; margin-top: 8px;
}
.ajs-auto-inv-box {
  background: rgba(22,163,74,0.08); border: 1px solid #86efac;
  border-radius: 9px; padding: 9px 11px; margin-top: 4px;
}
.ajs-alert-item {
  padding: 7px 9px; border-radius: 8px; margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.ajs-alert-item .ajs-alert-acts { display: flex; gap: 4px; flex-shrink: 0; }

/* ── v5 UNIFIED MODERN INVOICE & EDIT MODE ── */
.pos-edit-banner {
  display: none; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  background: linear-gradient(90deg, rgba(245,158,11,0.14), rgba(37,99,235,0.1));
  border: 1.5px solid #f59e0b; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px;
  font-size: 0.78rem; font-weight: 700; color: #b45309;
}
.pos-edit-banner.active { display: flex; }
.pos-sn-input {
  margin-top: 4px !important; font-size: 0.68rem !important;
  padding: 3px 6px !important; min-height: 24px !important;
  background: rgba(37,99,235,0.04) !important;
}
.pos-action-row-4 {
  display: grid; grid-template-columns: 1.15fr 1fr 0.9fr 0.6fr; gap: 7px; margin-top: 10px;
}
@media(max-width:680px){ .pos-action-row-4 { grid-template-columns: 1fr 1fr; } }

/* ── v5.6 KHATABOOK & PARTY LEDGER PRO UI ── */
.kb-hero-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-bottom: 10px; padding: 12px 14px; border-radius: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #eff6ff 65%, #f0fdf4 100%);
  border: 1px solid #bfdbfe;
}
[data-theme="dark"] .kb-hero-bar {
  background: linear-gradient(135deg, #162033 0%, #1e293b 100%);
  border-color: rgba(59,130,246,0.28);
}
.kb-type-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px;
}
.kb-type-pill {
  padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--card-border);
  background: var(--bg3); color: var(--text2); font-weight: 800; font-size: 0.82rem;
  cursor: pointer; text-align: center; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.kb-type-pill.active-credit {
  background: rgba(22,163,74,0.12); border-color: #16a34a; color: #15803d;
  box-shadow: 0 3px 10px rgba(22,163,74,0.16);
}
.kb-type-pill.active-debit {
  background: rgba(239,68,68,0.12); border-color: #ef4444; color: #dc2626;
  box-shadow: 0 3px 10px rgba(239,68,68,0.16);
}
.kb-party-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.78rem; color: #fff; flex-shrink: 0;
  background: linear-gradient(135deg, #2563eb, #0d9488);
}
.kb-party-cell { display: flex; align-items: center; gap: 8px; }
.kb-mode-tag {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 6px;
  font-size: 0.65rem; font-weight: 700; background: rgba(37,99,235,0.1); color: #1d4ed8;
}
.kb-auto-tag {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px; border-radius: 5px;
  font-size: 0.62rem; font-weight: 700; background: rgba(124,58,237,0.12); color: #6d28d9;
}
.kb-amt-due { color: #dc2626; font-weight: 800; }
.kb-amt-adv { color: #16a34a; font-weight: 800; }
.kb-stmt-filter {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 8px 10px; background: var(--bg3); border: 1px solid var(--card-border); border-radius: 9px; margin-bottom: 10px;
}

/* ── v5.7 KHATABOOK INVOICE VS CASH CATEGORIES & SCOPE SWITCHER ── */
.kb-cat-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px;
}
.kb-cat-pill {
  padding: 7px 10px; border-radius: 9px; border: 1.5px solid var(--card-border);
  background: var(--bg3); color: var(--text2); font-weight: 700; font-size: 0.76rem;
  cursor: pointer; text-align: center; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.kb-cat-pill.active-cash {
  background: rgba(234,88,12,0.12); border-color: #ea580c; color: #c2410c;
}
.kb-cat-pill.active-invoice {
  background: rgba(37,99,235,0.12); border-color: #2563eb; color: #1d4ed8;
}
.kb-scope-bar {
  display: inline-flex; gap: 4px; background: var(--bg2); border: 1px solid var(--card-border);
  border-radius: 9px; padding: 3px;
}
.kb-scope-btn {
  border: 0; background: transparent; color: var(--text2); font-size: 0.72rem; font-weight: 700;
  padding: 5px 10px; border-radius: 7px; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 5px;
}
.kb-scope-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,0.28);
}
.kb-cat-badge-inv {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 5px;
  font-size: 0.62rem; font-weight: 800; background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe;
}
.kb-cat-badge-cash {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; border-radius: 5px;
  font-size: 0.62rem; font-weight: 800; background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa;
}
.kb-work-chip {
  display: inline-block; margin-top: 3px; padding: 2px 7px; border-radius: 5px;
  background: rgba(37,99,235,0.07); color: #1e3a8a; font-size: 0.68rem; font-weight: 600;
}
[data-theme="dark"] .kb-work-chip { background: rgba(59,130,246,0.16); color: #93c5fd; }

/* ── v5.7 BEAUTIFUL MODERN MAIN-SCREEN TOAST NOTIFICATIONS ── */
#toast-container {
  position: fixed !important;
  top: 62px !important;
  right: 18px !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 9500 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  width: 350px !important;
  max-width: calc(100vw - 24px) !important;
  pointer-events: none !important;
}
@media(max-width: 680px) {
  #toast-container {
    top: 52px !important;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: calc(100vw - 20px) !important;
    max-width: 380px !important;
  }
}
#toast-container .toast {
  pointer-events: auto !important;
  position: relative !important;
  overflow: hidden !important;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(14px) !important;
  -webkit-backdrop-filter: blur(14px) !important;
  border: 1px solid #dce5f2 !important;
  border-left: 4px solid #2563eb !important;
  border-radius: 13px !important;
  padding: 12px 34px 14px 13px !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 11px !important;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(15, 23, 42, 0.06) !important;
  animation: ajsToastIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards !important;
  color: #0f172a !important;
}
[data-theme="dark"] #toast-container .toast {
  background: rgba(22, 32, 51, 0.95) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45) !important;
}
#toast-container .toast.toast-success { border-left-color: #16a34a !important; }
#toast-container .toast.toast-error   { border-left-color: #ef4444 !important; }
#toast-container .toast.toast-warning { border-left-color: #f59e0b !important; }
#toast-container .toast.toast-info    { border-left-color: #2563eb !important; }

#toast-container .toast .toast-icon {
  width: 34px !important; height: 34px !important; border-radius: 10px !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font-size: 1rem !important; flex-shrink: 0 !important;
}
#toast-container .toast-success .toast-icon { background: rgba(22,163,74,0.14) !important; color: #16a34a !important; }
#toast-container .toast-error   .toast-icon { background: rgba(239,68,68,0.14) !important; color: #ef4444 !important; }
#toast-container .toast-warning .toast-icon { background: rgba(245,158,11,0.16) !important; color: #d97706 !important; }
#toast-container .toast-info    .toast-icon { background: rgba(37,99,235,0.14) !important; color: #2563eb !important; }

#toast-container .toast .toast-content h5 {
  font-family: 'Syne', sans-serif !important; font-size: 0.84rem !important;
  font-weight: 800 !important; margin: 0 0 2px !important; line-height: 1.25 !important;
}
#toast-container .toast .toast-content p {
  font-size: 0.75rem !important; color: var(--text2) !important; margin: 0 !important; line-height: 1.35 !important;
}
.toast-close-btn {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
  border-radius: 6px; border: 0; background: transparent; color: var(--text3);
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.78rem;
  transition: 0.15s;
}
.toast-close-btn:hover { background: rgba(100,116,139,0.15); color: var(--text); }
.toast-progress {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: currentColor; opacity: 0.35; transform-origin: left;
  animation: ajsToastBar 3.8s linear forwards;
}
#toast-container .toast:hover .toast-progress { animation-play-state: paused; }
#toast-container .toast.hide {
  animation: ajsToastOut 0.24s ease forwards !important;
}
@keyframes ajsToastIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ajsToastOut {
  to { opacity: 0; transform: translateX(24px) scale(0.96); }
}
@keyframes ajsToastBar {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* ── v5.8 KHATABOOK DIRECT INVOICE PAYMENT LINK BOX ── */
.kb-inv-link-box {
  background: linear-gradient(135deg, rgba(37,99,235,0.07), rgba(22,163,74,0.06));
  border: 1.5px solid #93c5fd;
  border-radius: 10px;
  padding: 10px 11px;
  margin-bottom: 10px;
}
[data-theme="dark"] .kb-inv-link-box {
  background: rgba(37,99,235,0.14);
  border-color: rgba(96,165,250,0.4);
}
.kb-inv-link-hdr {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  font-size: 0.74rem; font-weight: 800; color: #1d4ed8; margin-bottom: 6px;
}
[data-theme="dark"] .kb-inv-link-hdr { color: #93c5fd; }
.kb-inv-preview-line {
  margin-top: 6px; padding: 6px 8px; border-radius: 7px;
  background: rgba(255,255,255,0.75); border: 1px dashed #86efac;
  font-size: 0.72rem; color: #15803d; font-weight: 700; line-height: 1.4;
}
[data-theme="dark"] .kb-inv-preview-line {
  background: rgba(15,23,42,0.55); color: #86efac;
}
.kb-inline-pay-btn {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 6px;
  border-radius: 5px; border: 0; background: #16a34a; color: #fff;
  font-size: 0.62rem; font-weight: 800; cursor: pointer; margin-left: 4px;
}
.kb-inline-pay-btn:hover { background: #15803d; }

/* ── v5.9 MODAL STACKING, TOAST FIX, 3-OPTION INVOICE CHOOSER & LEDGER SEARCH ── */
.modal-backdrop {
  z-index: 400;
}
#globalCustomerDrop {
  z-index: 9000 !important;
}
#toast-container {
  position: fixed !important;
  top: 60px !important;
  right: 16px !important;
  bottom: auto !important;
  left: auto !important;
  z-index: 99999 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: 340px !important;
  max-width: calc(100vw - 24px) !important;
  pointer-events: none !important;
}
@media(max-width: 680px) {
  #toast-container {
    top: 52px !important;
    left: 12px !important;
    right: 12px !important;
    transform: none !important;
    width: auto !important;
    max-width: none !important;
  }
}
#toast-container .toast {
  pointer-events: auto !important;
  min-height: 52px !important;
  box-sizing: border-box !important;
  word-break: break-word !important;
}
.inv-choice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}
.inv-choice-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 11px;
  border: 1.5px solid var(--card-border);
  background: var(--bg3);
  cursor: pointer;
  transition: 0.18s ease;
  text-align: left;
  width: 100%;
  color: var(--text);
}
.inv-choice-card:hover {
  border-color: #2563eb;
  background: rgba(37,99,235,0.08);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,0.12);
}
.inv-choice-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.inv-choice-card h4 {
  margin: 0 0 2px;
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--text);
}
.inv-choice-card p {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text2);
  line-height: 1.35;
}
.kb-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kb-search-clear {
  background: transparent;
  border: 0;
  color: var(--text3);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 4px;
  display: none;
}
.kb-search-clear.show { display: inline-block; }
.kb-match-pill {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  background: rgba(37,99,235,0.1);
  color: #1d4ed8;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════════════
   v6.2 SINGLE-WINDOW EXECUTIVE DASHBOARD & UNIFIED TOP HEADER BAR
   - Shifts Welcome, Brand, Date & Action Buttons into .topnav
   - Fixes full-width button stretch & tabular KPI number wrapping
   - High-density Bento layout showing maximum data in a single window
   ═══════════════════════════════════════════════════════════════════════ */
.topnav {
  height: auto !important;
  min-height: 52px !important;
  padding: 6px 14px !important;
  gap: 10px !important;
  flex-wrap: nowrap;
}
.topnav-title {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  overflow: visible !important;
  white-space: normal !important;
}
.ajs-top-welcome {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ajs-top-wline1 {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  line-height: 1.15;
}
.ajs-top-wname {
  font-family: 'Syne', sans-serif;
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
}
.ajs-top-brand-pill {
  background: linear-gradient(90deg, #1e3a8a, #2563eb);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.ajs-top-date-pill {
  background: rgba(37, 99, 235, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.32);
  color: #2563eb;
  font-size: 0.63rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
[data-theme="dark"] .ajs-top-date-pill {
  background: rgba(59, 130, 246, 0.16);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.35);
}
.ajs-top-wsub {
  font-size: 0.66rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ajs-top-quickbtns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ajs-top-quickbtns .btn {
  width: auto !important;
  min-height: 30px !important;
  padding: 5px 10px !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  white-space: nowrap !important;
}
.topnav-actions {
  gap: 6px !important;
  flex-shrink: 0;
}
.topnav-actions .search-box {
  min-width: 145px !important;
  max-width: 185px;
  padding: 4px 8px !important;
}
.topnav-actions .search-box input {
  font-size: 0.74rem !important;
}

/* Hide old bulky welcome bar completely */
#ajsWelcomeBar { display: none !important; }

/* ── SLEEK SINGLE-WINDOW DASHBOARD SHELL ── */
#page-dashboard.page {
  padding: 10px 12px !important;
}

/* Executive 8-KPI Compact Bento Strip */
.ajs-kpi-grid-v62 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 9px;
}
@media (min-width: 1700px) {
  .ajs-kpi-grid-v62 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}
@media (max-width: 960px) {
  .ajs-kpi-grid-v62 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.ajs-kpi-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px !important;
  min-height: 60px !important;
  background: var(--card) !important;
  border: 1px solid var(--card-border) !important;
  border-radius: 11px !important;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.ajs-kpi-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3.5px;
  border-radius: 11px 0 0 11px;
  background: var(--kpi-accent, #2563eb);
}
.ajs-kpi-card:hover {
  transform: translateY(-1px);
  border-color: var(--kpi-accent, #2563eb) !important;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12) !important;
}
.ajs-kpi-ico {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.ajs-kpi-body {
  min-width: 0;
  flex: 1;
}
.ajs-kpi-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.ajs-kpi-val {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif !important;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem !important;
  font-weight: 800 !important;
  line-height: 1.15 !important;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ajs-kpi-pill {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ajs-kpi-pill.up { background: rgba(22, 163, 74, 0.14); color: #22c55e; }
.ajs-kpi-pill.down { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.ajs-kpi-pill.neutral { background: rgba(59, 130, 246, 0.14); color: #3b82f6; }
.ajs-kpi-pill.warn { background: rgba(245, 158, 11, 0.16); color: #f59e0b; }
.ajs-kpi-lbl {
  font-size: 0.69rem;
  font-weight: 600;
  color: var(--text2);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Middle 3-Column Bento Workspace */
.ajs-bento-mid {
  display: grid;
  grid-template-columns: 1.45fr 0.95fr 0.9fr;
  gap: 9px;
  margin-bottom: 9px;
  align-items: stretch;
}
@media (max-width: 1180px) {
  .ajs-bento-mid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 780px) {
  .ajs-bento-mid {
    grid-template-columns: 1fr;
  }
}
.ajs-bento-mid .card,
.ajs-bento-bot .card {
  padding: 9px 11px !important;
  display: flex;
  flex-direction: column;
}
.ajs-bento-mid .card-header,
.ajs-bento-bot .card-header {
  margin-bottom: 7px !important;
  min-height: 24px !important;
}
.ajs-bento-mid .card-title,
.ajs-bento-bot .card-title {
  font-size: 0.8rem !important;
  font-weight: 800 !important;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Ultra-Compact Quick Services Tile Grid (20 items fit cleanly in ~190px) */
.ajs-quick-grid-v62 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
@media (max-width: 1360px) {
  .ajs-quick-grid-v62 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .ajs-quick-grid-v62 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.ajs-qtile {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 7px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: 0.16s ease;
  min-width: 0;
}
.ajs-qtile:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  transform: translateY(-1px);
}
.ajs-qtile i {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.14);
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.ajs-qtile-txt {
  min-width: 0;
  line-height: 1.15;
}
.ajs-qtile-txt span {
  display: block;
  font-size: 0.67rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ajs-qtile-txt small {
  display: block;
  font-size: 0.56rem;
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Middle Col Stack: Work Order + Accounts Snapshot */
.ajs-col-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.ajs-wo-mini-grid-v62 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.ajs-wo-mini-grid-v62 .ajs-wo-mini {
  padding: 7px 4px;
  border-radius: 8px;
}
.ajs-wo-mini-grid-v62 .ajs-wo-mini b {
  font-family: 'DM Sans', sans-serif !important;
  font-size: 1.05rem;
  font-weight: 800;
}
.ajs-wo-mini-grid-v62 .ajs-wo-mini span {
  font-size: 0.6rem;
}
.ajs-acct-grid-v62 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.ajs-acct-tile {
  padding: 7px 8px;
  border-radius: 8px;
  background: var(--bg3);
  border: 1px solid var(--card-border);
  cursor: pointer;
}
.ajs-acct-tile small {
  display: block;
  font-size: 0.6rem;
  color: var(--text2);
  font-weight: 600;
}
.ajs-acct-tile b {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  font-weight: 800;
  margin-top: 2px;
  white-space: nowrap;
}

/* Compact Quick Actions in Col 3 */
.ajs-qa-grid-v62 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.ajs-qa-grid-v62 .ajs-qa-btn {
  padding: 6px 8px;
  font-size: 0.68rem;
  border-radius: 7px;
  gap: 5px;
}
.ajs-qa-grid-v62 .ajs-qa-btn i {
  font-size: 0.74rem;
  width: 14px;
}

/* Bottom 4-Panel Executive Data Row (Charts + Recent Invoices + Pending Tasks) */
.ajs-bento-bot {
  display: grid;
  grid-template-columns: 1.05fr 0.8fr 1.25fr 0.9fr;
  gap: 9px;
  align-items: stretch;
}
@media (max-width: 1280px) {
  .ajs-bento-bot {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 720px) {
  .ajs-bento-bot {
    grid-template-columns: 1fr;
  }
}
.ajs-bento-bot .chart-wrap {
  height: 150px !important;
  flex: 1;
}
.ajs-bento-bot .chart-wrap canvas {
  max-height: 150px !important;
}
.ajs-bento-bot table {
  font-size: 0.72rem !important;
}
.ajs-bento-bot th,
.ajs-bento-bot td {
  padding: 5px 6px !important;
}
#page-dashboard #dashPendingTasks {
  max-height: 165px;
  overflow-y: auto;
}
#page-dashboard #ajsDashAlerts {
  max-height: 126px !important;
  overflow-y: auto;
}

/* Responsive Topbar Polish */
@media (max-width: 1120px) {
  .ajs-top-wsub, .ajs-top-brand-pill { display: none; }
  .topnav-actions .search-box { min-width: 110px !important; max-width: 135px; }
}
@media (max-width: 820px) {
  .topnav { flex-wrap: wrap !important; padding: 6px 10px !important; }
  .ajs-top-quickbtns { order: 3; width: 100%; justify-content: flex-start; overflow-x: auto; padding-top: 2px; }
  .topnav-actions .search-box { display: none; }
}
