/* ═══════════════════════════════════════════════
   True Site Sync — Clean Professional UI
   Simple. Functional. Built to scale.
═══════════════════════════════════════════════ */

/* ── CORE UTILITIES ── */
.hide { display: none !important; }

/* Full-screen overlay for measurement entry sheet */
.fullscreen-sheet {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100vw !important; height: 100vh !important;
  z-index: 999 !important;
  background: #f9fafb !important;
  overflow-y: auto !important;
  padding: 1rem 1.5rem !important;
  display: block !important;
}
.fullscreen-sheet .sheet-scroll-area { max-width: 100%; margin: 0 auto; padding: 0 0.5rem; }
.excel-table th, .excel-table td { border: 1px solid #e5e7eb; }
/* Hide the native number-input spinner (up/down) arrows across the ENTIRE app.
   They clutter every numeric field; users type values directly. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.table-input {
  width: 100%; border: none; background: transparent; padding: 0.5rem;
  outline: none; transition: all 0.15s; font-size: 0.875rem;
  -moz-appearance: textfield;
}
.table-input::-webkit-outer-spin-button,
.table-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.table-input:focus { background: #fefce8; box-shadow: inset 0 0 0 2px #2563eb; }
.table-input[readonly] { background: #f9fafb; color: #6b7280; cursor: not-allowed; font-weight: 500; }

/* Toast */
#toastContainer { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 2147483647; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.75rem 1.25rem; border-radius: 8px; color: white; font-weight: 500; font-size: 13px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.25s ease-out forwards; }
.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-warning { background: #d97706; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Autocomplete */
.autocomplete-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f3f4f6; font-size: 13px; color: #374151; }
.autocomplete-item:hover { background: #f3f4f6; }
.autocomplete-item strong { color: #2563eb; }

/* Nav */
.nav-btn { transition: all 0.15s ease; border-left: 3px solid transparent; }
.nav-btn.active { background-color: rgba(255,255,255,0.08); border-left-color: #2563eb; font-weight: 600; }

/* Print */
#print-container { display: none; }
@media print {
  body > *:not(#print-container) { display: none !important; }
  #print-container { display: block !important; position: absolute; left: 0; top: 0; width: 100%; padding: 20px; background: white; }
  .no-print { display: none !important; }
  body { background: white; color: black; font-size: 12pt; }
  table { width: 100%; border-collapse: collapse; margin-top: 15px; }
  th, td { border: 1px solid #d1d5db !important; padding: 8px 12px !important; text-align: left; }
  th { background-color: #f9fafb !important; color: #111827 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .shadow-sm, .shadow-md, .shadow-lg, .shadow-xl { box-shadow: none !important; }
}


/* ═══════════════════════════════════════════════
   DESIGN SYSTEM — Clean & Professional
═══════════════════════════════════════════════ */
:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  /* Neutral palette */
  --gray-50:  #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  /* Brand */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --green-50: #f0fdf4;
  --green-500:#10b981;
  --green-600:#059669;
  --red-50:   #fef2f2;
  --red-500:  #ef4444;
  --red-600:  #dc2626;
  --amber-50: #fffbeb;
  --amber-500:#f59e0b;
  --amber-600:#d97706;
  --orange-500:#f97316;
  --orange-600:#ea580c;

  /* ── Premium brand (white / deep-green / gold) — matches the landing site ── */
  --brand:        #059669;   /* primary green (buttons, accents) */
  --brand-dark:   #047857;   /* hover / pressed */
  --brand-mid:    #10b981;   /* bright accent */
  --brand-50:     #ecfdf5;   /* light tint bg */
  --brand-100:    #d1fae5;   /* light tint border */
  --brand-ink:    #065f46;   /* green text on light */
  --brand-ring:   rgba(5,150,105,0.16);
  --gold:         #b8860b;   /* refined gold accent (sparing) */
  --gold-soft:    #c8a23a;
  --gold-50:      #faf6ea;

  /* Sidebar — LIGHT neutral, Linear/Vercel/Notion style */
  --sb-bg: #fafbfc;
  --sb-border: rgba(13,40,28,0.06);
  --sb-text: #6b7280;
  --sb-text-active: #0f172a;
  --sb-hover: rgba(13,40,28,0.04);
  --sb-active-bg: #ffffff;

  /* Shadows — subtle */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 12px;

  /* ERP colors (kept for report compatibility) */
  --brand-blue: #14375E;
  --brand-orange: #E6772A;
  --brand-cream: #F8F4EC;
  --erp-primary: #14375E;
  --erp-accent: #E6772A;
  --erp-surface: #F8F4EC;
  --erp-ink: #1C2733;
  --erp-line: #D9CFBE;
  --erp-success: #059669;
  --erp-warn: #d97706;
  --erp-danger: #dc2626;
  --erp-info: #2563eb;
  --status-draft: #6b7280;
  --status-submitted: #2563eb;
  --status-review: #d97706;
  --status-approved: #059669;
  --status-rejected: #dc2626;
  --status-hold: #ea580c;
  --status-cancelled: #4b5563;
  --status-closed: #6b7280;
}


/* ── GLOBAL RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }

body {
  font-family: var(--font-sans) !important;
  background: var(--gray-50) !important;
  color: var(--gray-900) !important;
  -webkit-font-smoothing: antialiased !important;
  text-rendering: optimizeLegibility !important;
  overflow: hidden;
  line-height: 1.5;
}

/* Scrollbar — thin and quiet */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }


/* ═══════════════════════════════════
   SIDEBAR — Clean dark panel
═══════════════════════════════════ */
aside {
  width: 240px !important;
  background: var(--sb-bg) !important;
  border-right: 1px solid var(--sb-border) !important;
  box-shadow: none !important;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

/* Logo zone */
aside > div:first-child {
  position: relative; z-index: 2;
  padding: 16px 16px 14px !important;
  border-bottom: 1px solid var(--sb-border) !important;
  background: transparent !important;
}
aside > div:first-child h1 {
  font-family: var(--font-sans) !important;
  font-size: 1rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.3px !important;
  color: #fff !important;
}
aside > div:first-child p {
  font-family: var(--font-sans) !important;
  font-size: 10px !important;
  letter-spacing: 1px !important;
  font-weight: 500 !important;
  color: var(--gray-500) !important;
  text-transform: uppercase !important;
  margin-top: 2px !important;
}

/* Nav container */
aside nav {
  position: relative; z-index: 2;
  padding: 8px 8px 16px !important;
  flex: 1;
  overflow-y: auto;
}

/* Nav section labels */
aside nav > p {
  font-family: var(--font-sans) !important;
  font-size: 10px !important;
  font-weight: 600 !important;
  letter-spacing: 0.8px !important;
  color: var(--gray-500) !important;
  text-transform: uppercase !important;
  padding: 0 8px !important;
  margin: 16px 0 4px !important;
}

/* Nav buttons */
.nav-btn {
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  font-weight: 450 !important;
  color: var(--sb-text) !important;
  border-radius: var(--radius-md) !important;
  border-left: 2px solid transparent !important;
  padding: 7px 10px !important;
  transition: all 150ms ease !important;
  position: relative !important;
  letter-spacing: 0 !important;
  margin-bottom: 1px;
}
.nav-btn:hover {
  color: rgba(255,255,255,0.85) !important;
  background: var(--sb-hover) !important;
}
.nav-btn.active {
  color: #fff !important;
  background: var(--sb-active-bg) !important;
  border-left-color: var(--blue-500) !important;
  font-weight: 550 !important;
}
.nav-btn:active { opacity: 0.8 !important; }


/* ═══════════════════════════════════
   MAIN CONTENT AREA
═══════════════════════════════════ */
main {
  background: var(--gray-50) !important;
  padding: 0 !important;
}

/* Breadcrumb header bar */
#breadcrumbBar {
  background: #fff !important;
  border-bottom: 1px solid var(--gray-200) !important;
  box-shadow: none !important;
}

/* Content padding */
main > .p-4,
main > div.p-4 {
  padding: 24px 28px !important;
}

/* View entrance — very subtle */
.view-section:not(.hide) {
  animation: fadeIn 0.2s ease both;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


/* ═══════════════════════════════════
   PAGE HEADERS
═══════════════════════════════════ */
.view-section h2 {
  font-family: var(--font-sans) !important;
  font-weight: 700 !important;
  font-size: 1.5rem !important;
  letter-spacing: -0.4px !important;
  color: var(--gray-900) !important;
  line-height: 1.3 !important;
}
.view-section > p.text-slate-500,
.view-section > div > p.text-slate-500 {
  font-size: 13px !important;
  color: var(--gray-500) !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  margin-top: 2px !important;
}


/* ═══════════════════════════════════
   CARDS & SURFACES
═══════════════════════════════════ */
.bg-white {
  background: #ffffff !important;
  border: 1px solid var(--gray-200) !important;
  box-shadow: var(--shadow-xs) !important;
  transition: box-shadow 150ms ease, border-color 150ms ease !important;
}
.rounded-2xl { border-radius: var(--radius-xl) !important; }
.rounded-xl  { border-radius: var(--radius-lg) !important; }
.rounded-lg  { border-radius: var(--radius-md) !important; }
.rounded     { border-radius: var(--radius-sm) !important; }

/* Subtle hover on interactive cards only */
#projectsGrid .bg-white:hover,
#moduleCardsGrid .bg-white:hover {
  border-color: var(--gray-300) !important;
  box-shadow: var(--shadow-sm) !important;
}

/* Accent borders */
.border-l-4 { border-left-width: 3px !important; }
.border-l-blue-500   { border-left-color: var(--blue-500) !important; }
.border-l-green-500  { border-left-color: var(--green-500) !important; }
.border-l-orange-500 { border-left-color: var(--orange-500) !important; }
.border-l-red-500    { border-left-color: var(--red-500) !important; }
.border-t-4.border-t-blue-500   { border-top: 3px solid var(--blue-500) !important; }
.border-t-4.border-t-orange-500 { border-top: 3px solid var(--orange-500) !important; }
.border-t-4.border-t-green-500  { border-top: 3px solid var(--green-600) !important; }
.border-t-4.border-t-red-500    { border-top: 3px solid var(--red-500) !important; }


/* ═══════════════════════════════════
   KPI / DASHBOARD CARDS
═══════════════════════════════════ */
#dashboard .grid > div.bg-white p.text-3xl,
.font-mono {
  font-family: var(--font-mono) !important;
}

/* Net Cash hero */
.bg-\[#1e3a8a\] {
  background: var(--gray-900) !important;
  border: 1px solid var(--gray-800) !important;
  box-shadow: var(--shadow-sm) !important;
}
#dashProfit {
  font-family: var(--font-mono) !important;
  font-size: 2.5rem !important;
  font-weight: 600 !important;
  letter-spacing: -2px !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
}


/* ═══════════════════════════════════
   BUTTONS — Clean, no gradients
═══════════════════════════════════ */
button:not(.nav-btn) {
  font-family: var(--font-sans) !important;
  font-weight: 500 !important;
  transition: all 150ms ease !important;
  cursor: pointer;
  border-radius: var(--radius-md) !important;
}
button:not(.nav-btn):active { transform: scale(0.98) !important; }

/* Primary blue */
.bg-blue-600, button.bg-blue-600 {
  background: var(--blue-600) !important;
  box-shadow: none !important;
  border: none !important;
  color: #fff !important;
}
.bg-blue-600:hover { background: var(--blue-700) !important; }

/* Orange */
.bg-\[#f97316\], button.bg-\[#f97316\], .bg-orange-600, button.bg-orange-600, .bg-orange-500, button.bg-orange-500 {
  background: var(--orange-600) !important;
  box-shadow: none !important;
  border: none !important;
  color: #fff !important;
}
.bg-\[#f97316\]:hover, .bg-orange-600:hover, .bg-orange-500:hover { background: #c2410c !important; }

/* Green */
.bg-green-600, button.bg-green-600, .bg-emerald-600 {
  background: var(--green-600) !important;
  box-shadow: none !important;
  border: none !important;
  color: #fff !important;
}
.bg-green-600:hover { background: #047857 !important; }

/* Red */
.bg-red-600, button.bg-red-600 {
  background: var(--red-600) !important;
  box-shadow: none !important;
  border: none !important;
  color: #fff !important;
}

/* Dark */
.bg-slate-800, button.bg-slate-800 {
  background: var(--gray-800) !important;
  box-shadow: none !important;
  border: none !important;
  color: #fff !important;
}
.bg-slate-800:hover { background: var(--gray-900) !important; }

/* Ghost/Light buttons */
.bg-blue-100 { background: var(--blue-50) !important; border: 1px solid var(--blue-100) !important; }
.bg-blue-100:hover { background: var(--blue-100) !important; }
.bg-orange-100, .bg-amber-100 { background: var(--amber-50) !important; border: 1px solid #fde68a !important; }
.bg-orange-100:hover { background: #fef3c7 !important; }
.bg-green-100, .bg-emerald-50 { background: var(--green-50) !important; border: 1px solid #bbf7d0 !important; }


/* ═══════════════════════════════════
   FORM CONTROLS
═══════════════════════════════════ */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input),
select, textarea {
  font-family: var(--font-sans) !important;
  font-size: 13px !important;
  border: 1px solid var(--gray-200) !important;
  border-radius: var(--radius-sm) !important;
  background: #fff !important;
  color: var(--gray-900) !important;
  transition: border-color 150ms ease, box-shadow 150ms ease !important;
  outline: none !important;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input):hover,
select:hover, textarea:hover {
  border-color: var(--gray-300) !important;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input):focus,
select:focus, textarea:focus {
  border-color: var(--blue-500) !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1) !important;
}

label.block {
  font-family: var(--font-sans) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 0.3px !important;
  text-transform: uppercase !important;
  color: var(--gray-500) !important;
  margin-bottom: 4px !important;
}


/* ═══════════════════════════════════
   TABLES
═══════════════════════════════════ */
table { border-collapse: separate !important; border-spacing: 0 !important; }
thead th {
  font-family: var(--font-sans) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  letter-spacing: 0.3px !important;
  text-transform: uppercase !important;
  color: var(--gray-500) !important;
  padding: 8px 12px !important;
  background: var(--gray-50) !important;
  border-bottom: 1px solid var(--gray-200) !important;
}
.bg-slate-100 th, .bg-slate-50 th, thead.bg-slate-50 th, thead.bg-slate-100 th {
  background: var(--gray-50) !important;
}
tbody tr { transition: background 100ms ease !important; }
tbody tr:hover td { background: var(--gray-50) !important; }
td {
  font-size: 13px !important;
  padding: 8px 12px !important;
  vertical-align: middle !important;
  color: var(--gray-700) !important;
}
.excel-table th, .excel-table td { border-color: var(--gray-200) !important; }


/* ═══════════════════════════════════
   MODALS
═══════════════════════════════════ */
.fixed.inset-0 {
  backdrop-filter: blur(4px) !important;
  background: rgba(0,0,0,0.4) !important;
}
.fixed.inset-0 > div {
  background: #fff !important;
  border: 1px solid var(--gray-200) !important;
  box-shadow: var(--shadow-lg) !important;
  border-radius: var(--radius-xl) !important;
  animation: modalIn 0.2s ease both !important;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.fixed.inset-0 h3 { font-family: var(--font-sans) !important; font-weight: 600 !important; }
.fixed.inset-0 button.text-red-500 {
  width: 28px; height: 28px; border-radius: 50% !important;
  background: var(--red-50) !important;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px !important;
  transition: all 150ms ease !important;
}
.fixed.inset-0 button.text-red-500:hover { background: #fecaca !important; }


/* ═══════════════════════════════════
   AUTOCOMPLETE
═══════════════════════════════════ */
#autocomplete-list {
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--gray-200) !important;
  background: #fff !important;
  box-shadow: var(--shadow-md) !important;
}
.autocomplete-item { font-family: var(--font-sans) !important; font-size: 13px !important; }
.autocomplete-item:hover { background: var(--gray-50) !important; }


/* ═══════════════════════════════════
   BADGES / CHIPS
═══════════════════════════════════ */
.bg-green-100 { background: #dcfce7 !important; border: 1px solid #bbf7d0 !important; border-radius: 6px !important; }
.bg-orange-100, .bg-amber-100 { background: #ffedd5 !important; border: 1px solid #fed7aa !important; border-radius: 6px !important; }
.bg-blue-50 { background: var(--blue-50) !important; }
.bg-blue-100.text-blue-800 { background: var(--blue-50) !important; border: 1px solid var(--blue-100) !important; border-radius: 6px !important; }
.bg-red-50 { background: var(--red-50) !important; }
.bg-purple-100 { background: #f3e8ff !important; border: 1px solid #e9d5ff !important; border-radius: 6px !important; }
.bg-slate-100 { background: var(--gray-100) !important; }


/* ═══════════════════════════════════
   TYPOGRAPHY
═══════════════════════════════════ */
.font-mono,
.font-extrabold.text-orange-600,
.text-orange-600, .text-green-600, .text-red-600,
.text-blue-700, .text-emerald-600 {
  font-family: var(--font-mono) !important;
}
h3.font-bold {
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  letter-spacing: -0.2px !important;
}


/* ═══════════════════════════════════
   MISC
═══════════════════════════════════ */
.border-b { border-bottom-color: var(--gray-200) !important; }
.divide-y > * + * { border-top-color: var(--gray-100) !important; }
.bg-slate-50 { background: var(--gray-50) !important; }
.bg-slate-800 { background: var(--gray-800) !important; }

.overflow-x-auto { overflow-x: auto !important; }
.overflow-y-auto { overflow-y: auto !important; }
main.flex-1.h-full.overflow-y-auto { overflow-y: auto !important; }
.max-h-48, .max-h-64, .max-h-96, .max-h-\[90vh\], .max-h-\[55vh\] { overflow-y: auto !important; }

*:focus-visible { outline: 2px solid var(--blue-500) !important; outline-offset: 2px !important; }

/* Panel headers */
.bg-slate-50.border-b, .p-4.bg-slate-50.border-b, .p-5.bg-slate-50.border-b {
  background: var(--gray-50) !important;
  border-bottom: 1px solid var(--gray-200) !important;
}


/* ═══════════════════════════════════
   COMPANY PROFILE
═══════════════════════════════════ */
.profile-upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  background: var(--gray-50);
  transition: all 150ms ease;
  cursor: pointer;
}
.profile-upload-zone:hover { border-color: var(--blue-500); background: var(--blue-50); }
#companyLogoPreview {
  width: 96px; height: 96px;
  border-radius: var(--radius-md);
  object-fit: contain;
  border: 1px solid var(--gray-200);
  background: white;
}
.profile-field-group label {
  font-size: 11px !important; font-weight: 500 !important;
  text-transform: uppercase !important; letter-spacing: 0.3px !important;
  color: var(--gray-500) !important; display: block; margin-bottom: 4px;
}
.profile-field-group input,
.profile-field-group textarea {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans); font-size: 13px; font-weight: 400;
  background: #fff; color: var(--gray-900); outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.profile-field-group input:focus,
.profile-field-group textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}


/* ═══════════════════════════════════
   FULL-PAGE FORM PANELS
═══════════════════════════════════ */
div[id$="FormPanel"]:not(.hidden) {
  animation: fadeIn 0.15s ease both;
}


/* ═══════════════════════════════════
   SIDEBAR DROPDOWN MENUS
═══════════════════════════════════ */
.sidebar-dropdown { position: relative; }
.sidebar-dd-toggle .dd-arrow { opacity: 0.4; transition: all 150ms ease; }
.sidebar-dd-toggle.open .dd-arrow { transform: rotate(180deg); opacity: 0.8; }
.sidebar-dd-toggle.open { color: rgba(255,255,255,0.9) !important; }
.sidebar-dd-menu { border-left: 1px solid rgba(255,255,255,0.08); margin-left: 16px !important; }
.sidebar-dd-menu .nav-btn { font-size: 12px !important; padding: 5px 10px !important; }
.sidebar-dd-menu .nav-btn.active { border-left: none !important; background: rgba(59,130,246,0.12) !important; }
.sidebar-dd-menu .dd-plus { opacity: 0; transition: opacity 150ms; }
.sidebar-dd-menu .nav-btn:hover .dd-plus { opacity: 1; }


/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 1280px) { aside { width: 220px !important; } }

/* ── Mobile hamburger button — hidden on desktop ── */
.mobile-menu-btn { display: none; }
.mobile-overlay { display: none; }

/* ═══════════════════════════════════
   MOBILE — Phones & small tablets
═══════════════════════════════════ */
@media (max-width: 768px) {
  /* Sidebar: hidden by default, slide-in overlay on mobile */
  aside {
    position: fixed !important;
    top: 0 !important; left: 0 !important; bottom: 0 !important;
    width: 270px !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.25s ease !important;
    overflow-y: auto !important;
  }
  aside.mobile-open {
    transform: translateX(0) !important;
  }

  /* Dark overlay behind sidebar */
  .mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(0,0,0,0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .mobile-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Show hamburger button */
  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-600);
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
  }
  .mobile-menu-btn:active { background: var(--gray-200); }

  /* Header adjustments */
  #breadcrumbBar {
    padding: 8px 12px !important;
    gap: 8px;
  }
  .header-right-items {
    gap: 6px !important;
    flex-wrap: nowrap;
  }
  .header-date-text { display: none !important; }
  #headerUserBadge { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* Main content padding */
  main > .p-4, main > div.p-4 {
    padding: 12px !important;
  }
  .p-4.md\:p-8 { padding: 12px !important; }

  /* Page titles */
  .view-section h2 {
    font-size: 1.15rem !important;
    line-height: 1.3 !important;
  }

  /* Buttons — touch-friendly */
  button:not(.nav-btn) {
    min-height: 40px !important;
    font-size: 12px !important;
  }

  /* Grids → single column */
  .grid-cols-2, .grid-cols-3, .grid-cols-4, .grid-cols-5,
  .md\:grid-cols-2, .md\:grid-cols-3, .md\:grid-cols-4,
  .lg\:grid-cols-3, .lg\:grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Flex wrapping */
  .flex.items-center.justify-between { flex-wrap: wrap; gap: 8px; }
  .flex.items-center.gap-3, .flex.items-center.gap-4 { flex-wrap: wrap; gap: 6px !important; }

  /* Tables — horizontal scroll */
  .overflow-x-auto, table { overflow-x: auto !important; display: block; }
  table { min-width: 600px; }
  thead th { font-size: 10px !important; padding: 6px 8px !important; white-space: nowrap; }
  td { font-size: 12px !important; padding: 6px 8px !important; }

  /* Form inputs — larger touch targets */
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input),
  select, textarea {
    font-size: 14px !important;
    padding: 10px 12px !important;
    min-height: 42px;
  }
  .table-input {
    font-size: 13px !important;
    padding: 8px 6px !important;
    min-height: 36px;
  }

  /* Project cards grid */
  #projectsGrid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* Module cards grid */
  #moduleCardsGrid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Measurement sheet fullscreen — mobile adjustments */
  .fullscreen-sheet {
    padding: 8px !important;
  }
  .fullscreen-sheet .sheet-scroll-area { padding: 0 !important; }

  /* ── Measurement entry table → CARD layout on mobile ── */
  #tableContainer { max-height: none !important; overflow-x: visible !important; }
  #entryTable { min-width: 0 !important; width: 100% !important; display: block !important; }
  #entryTable thead { display: none !important; }
  #entryTable tbody { display: block !important; }
  #entryTable tbody tr {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px;
    background: #fff;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
  }
  #entryTable tbody td {
    display: flex !important;
    flex-direction: column;
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
  }
  #entryTable tbody td::before {
    content: attr(data-label);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #94a3b8;
    margin-bottom: 3px;
  }
  #entryTable tbody td[data-label=""]::before { content: ""; }
  /* Code & Description span full width */
  #entryTable tbody td[data-label="Code"],
  #entryTable tbody td[data-label="Description"] { grid-column: 1 / -1 !important; }
  /* Quantity highlighted */
  #entryTable tbody td[data-label="Quantity"] {
    grid-column: 1 / -1 !important;
    background: #eff6ff !important;
    border-radius: 8px;
    padding: 8px !important;
  }
  #entryTable tbody td .table-input {
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    min-height: 44px !important;
    font-size: 15px !important;
    background: #f8fafc !important;
  }
  #entryTable tbody td .qty-input { background: #fff !important; font-size: 20px !important; }
  /* Remove button full width */
  #entryTable tbody td[data-label=""] { grid-column: 1 / -1 !important; }
  #entryTable tbody td[data-label=""] button {
    width: 100%;
    background: #fef2f2 !important;
    color: #dc2626 !important;
    border: 1px solid #fecaca !important;
    border-radius: 8px;
    padding: 10px !important;
    font-size: 13px !important;
    font-weight: 700;
  }

  /* Modals — full width on mobile */
  .fixed.inset-0 > div {
    width: 95% !important;
    max-width: 100% !important;
    max-height: 90vh !important;
    margin: 20px auto !important;
  }

  /* BOQ dropdown — full width on mobile */
  .boq-dropdown {
    min-width: 280px !important;
    max-width: calc(100vw - 24px) !important;
    left: 12px !important;
    right: 12px !important;
  }

  /* Project form — stack fields */
  .grid.grid-cols-2.gap-4, .grid.grid-cols-3.gap-3,
  .grid.grid-cols-2.gap-3, .grid.grid-cols-3.gap-4 {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard KPI cards */
  .grid.grid-cols-3, .grid.grid-cols-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Hide non-essential desktop elements on mobile */
  .no-mobile { display: none !important; }

  /* Entry form engine — full width */
  .ef-modal { max-width: 100% !important; width: 95% !important; }
  .ef-grid { grid-template-columns: 1fr !important; }

  /* Sidebar nav items — bigger touch targets */
  aside .nav-btn {
    padding: 10px 12px !important;
    font-size: 13px !important;
    min-height: 40px;
  }

  /* Close sidebar when nav item clicked */
  aside .nav-btn { /* JS handles this via onclick */ }

  /* Login page mobile */
  #loginPage > div { width: 95% !important; max-width: 100% !important; padding: 24px 20px !important; }

  /* ── Measurement sheet mobile overhaul ── */
  .fullscreen-sheet .excel-table {
    font-size: 11px !important;
    min-width: auto !important;
  }
  .fullscreen-sheet .excel-table th {
    font-size: 9px !important;
    padding: 4px 3px !important;
    white-space: nowrap;
  }
  .fullscreen-sheet .excel-table td {
    padding: 2px 1px !important;
  }
  .fullscreen-sheet .table-input {
    font-size: 12px !important;
    padding: 6px 4px !important;
    min-height: 32px;
  }
  /* Hide less-used columns on small screens */
  .fullscreen-sheet .excel-table .col-coef,
  .fullscreen-sheet .excel-table .col-remarks {
    display: none;
  }
  /* Measurement header — stack on mobile */
  .fullscreen-sheet .flex.items-center.justify-between {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .fullscreen-sheet .flex.items-center.justify-between .flex.gap-3 {
    width: 100%;
    flex-wrap: wrap;
  }
  /* Project info banner — compact */
  .fullscreen-sheet .grid.grid-cols-3 {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }
  /* Quick actions — wrap */
  .fullscreen-sheet .flex.gap-3 { flex-wrap: wrap; gap: 6px !important; }

  /* ── Parties Ledger mobile ── */
  #partiesLedgerView {
    flex-direction: column !important;
    height: auto !important;
  }
  #partiesLedgerView > div:first-child {
    width: 100% !important;
    max-height: 200px;
  }
  #partiesLedgerView > div:last-child {
    width: 100% !important;
  }

  /* ── Splash screen mobile ── */
  #splashScreen h1 { font-size: 18px !important; }
  #splashScreen p { font-size: 11px !important; }
}

/* Extra small phones */
@media (max-width: 380px) {
  #moduleCardsGrid { grid-template-columns: 1fr !important; }
  .grid.grid-cols-3, .grid.grid-cols-4 { grid-template-columns: 1fr !important; }
  #breadcrumbPath { display: none !important; }
}


/* ═══════════════════════════════════════════════
   REPORTS MODULE
═══════════════════════════════════════════════ */
#reportsDashContent { padding: 0 0 32px; }

/* Breadcrumb */
.rpt-breadcrumb {
  display: flex; align-items: center; gap: 8px; padding: 4px 0 16px;
  font-size: 13px; font-weight: 500;
}
.rpt-bc-link { color: var(--blue-600); cursor: pointer; }
.rpt-bc-link:hover { text-decoration: underline; }
.rpt-bc-sep { color: var(--gray-300); font-size: 11px; }
.rpt-bc-active { color: var(--gray-700); }

/* KPI Strip */
.rpt-kpi-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.rpt-kpi-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg); padding: 14px 16px;
  border-left: 3px solid var(--blue-500);
}
.rpt-kpi-val { font-size: 20px; font-weight: 700; color: var(--gray-900); font-family: var(--font-mono); }
.rpt-kpi-lbl { font-size: 10px; color: var(--gray-400); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.3px; font-weight: 500; }
.rpt-kpi-card:nth-child(2) { border-left-color: var(--orange-500); }
.rpt-kpi-card:nth-child(3) { border-left-color: var(--green-500); }
.rpt-kpi-card:nth-child(4) { border-left-color: #8b5cf6; }
.rpt-kpi-card:nth-child(5) { border-left-color: var(--red-500); }

/* Search */
.rpt-search-bar { margin-bottom: 16px; }
.rpt-search-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-md);
  background: #fff; border: 1px solid var(--gray-200);
  color: var(--gray-900); font-size: 13px; font-weight: 400;
  outline: none; transition: all 0.15s;
}
.rpt-search-input::placeholder { color: var(--gray-400); }
.rpt-search-input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* Search Results */
.rpt-search-results {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius-md); padding: 6px;
  margin-bottom: 12px; max-height: 300px;
  overflow-y: auto; box-shadow: var(--shadow-md);
}
.rpt-search-count { color: var(--blue-600); font-size: 11px; padding: 4px 8px; font-weight: 500; }
.rpt-search-empty { color: var(--gray-400); font-size: 13px; padding: 16px; text-align: center; }
.rpt-search-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  border-radius: var(--radius-sm); cursor: pointer; transition: background 0.1s;
}
.rpt-search-item:hover { background: var(--gray-50); }
.rpt-search-item-icon { font-size: 18px; }
.rpt-search-item-name { color: var(--gray-900); font-size: 13px; font-weight: 500; }
.rpt-search-item-cat { color: var(--gray-400); font-size: 11px; }

/* Section Title */
.rpt-section-title {
  color: var(--gray-500); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 12px; padding-left: 2px;
}

/* Category Grid */
.rpt-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 20px;
}
.rpt-app-icon {
  display: flex; flex-direction: column; align-items: center;
  padding: 18px 10px 14px;
  border-radius: var(--radius-lg);
  background: #fff;
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.rpt-app-icon:hover {
  border-color: var(--blue-500);
  background: var(--blue-50);
}
.rpt-app-icon-circle {
  width: 48px; height: 48px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.rpt-app-icon-emoji { font-size: 22px; }
.rpt-app-icon-name { color: var(--gray-700); font-size: 11.5px; font-weight: 600; line-height: 1.3; margin-bottom: 2px; }
.rpt-app-icon-count { color: var(--gray-400); font-size: 10px; font-weight: 400; }

/* Recent Reports */
.rpt-recent-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.rpt-recent-item {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: 6px;
  background: var(--gray-100); border: 1px solid var(--gray-200);
  color: var(--gray-600); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.15s;
}
.rpt-recent-item:hover { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-700); }
.rpt-recent-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--blue-500); }

/* Category Header */
.rpt-cat-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; margin-bottom: 16px;
  border-radius: var(--radius-lg);
  background: #fff; border: 1px solid var(--gray-200);
}
.rpt-cat-header-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.rpt-cat-header-title { color: var(--gray-900); font-size: 16px; font-weight: 700; }
.rpt-cat-header-count { color: var(--gray-400); font-size: 12px; margin-top: 1px; font-weight: 400; }

/* Report List */
.rpt-report-list { display: flex; flex-direction: column; gap: 2px; }
.rpt-report-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-md);
  background: #fff; border: 1px solid transparent;
  cursor: pointer; transition: all 0.1s;
}
.rpt-report-row:hover {
  background: var(--gray-50); border-color: var(--gray-200);
}
.rpt-report-row-num { color: var(--gray-400); font-size: 11px; font-weight: 500; min-width: 24px; }
.rpt-report-row-icon { font-size: 16px; }
.rpt-report-row-info { flex: 1; }
.rpt-report-row-name { color: var(--gray-900); font-size: 13px; font-weight: 500; }
.rpt-report-row-meta { display: flex; gap: 8px; margin-top: 2px; }
.rpt-type-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; }
.rpt-ds-badge { font-size: 10px; color: var(--gray-400); font-weight: 400; }
.rpt-report-row-arrow { color: var(--gray-300); font-size: 14px; }
.rpt-report-row:hover .rpt-report-row-arrow { color: var(--blue-500); }

/* Report Header */
.rpt-report-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px; flex-wrap: wrap; gap: 10px;
}
.rpt-report-title { color: var(--gray-900); font-size: 18px; font-weight: 700; }
.rpt-report-subtitle { color: var(--gray-400); font-size: 12px; margin-top: 2px; }
.rpt-report-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rpt-btn {
  padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.1s; border: none;
}
.rpt-btn-outline {
  background: #fff; border: 1px solid var(--gray-200); color: var(--gray-600);
}
.rpt-btn-outline:hover { background: var(--gray-50); border-color: var(--gray-300); }
.rpt-btn-sm {
  padding: 4px 8px; font-size: 11px; background: var(--red-50); color: var(--red-600);
  border: 1px solid #fecaca; border-radius: 4px; cursor: pointer; font-weight: 500;
}
.rpt-btn-sm:hover { background: #fee2e2; }

/* Filter Bar */
.rpt-filter-bar {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius-md);
  background: var(--gray-50); border: 1px solid var(--gray-200);
  margin-bottom: 14px;
}
.rpt-filter-group { display: flex; flex-direction: column; gap: 2px; }
.rpt-filter-label { color: var(--gray-500); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.rpt-filter-select, .rpt-filter-input {
  padding: 6px 10px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--gray-200);
  color: var(--gray-900); font-size: 12px; font-weight: 400;
  outline: none; min-width: 120px;
}
.rpt-filter-select:focus, .rpt-filter-input:focus {
  border-color: var(--blue-500); box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}

/* Report Table */
.rpt-table-wrap {
  border-radius: var(--radius-md); overflow: hidden;
  background: #fff; border: 1px solid var(--gray-200);
  margin-bottom: 14px;
}
.rpt-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rpt-table th {
  background: var(--gray-50); color: var(--gray-500); padding: 8px 12px;
  font-weight: 500; text-transform: uppercase; font-size: 10px;
  letter-spacing: 0.3px; text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.rpt-table td {
  padding: 8px 12px; color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}
.rpt-table tr:hover td { background: var(--gray-50); }
.rpt-table .text-right { text-align: right; }

/* Multi-level header */
.rpt-multi-header-cell {
  background: var(--gray-100) !important; color: var(--gray-700) !important;
  text-align: center !important; font-size: 10px !important; font-weight: 600 !important;
  padding: 6px !important; border-bottom: 1px solid var(--gray-200) !important;
}

/* Aggregate footer */
.rpt-aggregate-row td {
  background: var(--green-50) !important; border-top: 2px solid var(--green-600) !important;
  border-bottom: 2px solid var(--green-600) !important; padding: 8px 12px !important;
}
.rpt-agg-label { color: var(--green-600) !important; font-size: 11px !important; text-transform: uppercase; }
.rpt-agg-val { color: #065f46 !important; }

/* Total row */
.rpt-total-row td {
  background: var(--gray-50) !important; font-weight: 600 !important;
  border-top: 1px solid var(--gray-300) !important;
}

/* Statutory badge */
.rpt-statutory-badge {
  display: inline-block; background: #faf5ff; color: #7c3aed;
  border: 1px solid #e9d5ff; border-radius: 6px;
  padding: 5px 12px; font-size: 11px; font-weight: 500;
  margin-bottom: 8px;
}

/* Domain note */
.rpt-domain-note {
  background: var(--amber-50); color: #92400e;
  border: 1px solid #fde68a; border-radius: 6px;
  padding: 8px 12px; font-size: 12px; font-weight: 400;
  margin-bottom: 10px;
}

/* Row count */
.rpt-row-count { text-align: right; padding: 6px 12px; font-size: 11px; color: var(--gray-400); }

/* Badges */
.rpt-badge-amber { background: var(--amber-50); color: #b45309; }
.rpt-badge-purple { background: #faf5ff; color: #7c3aed; }
.rpt-badge-gray { background: var(--gray-100); color: var(--gray-500); }
.rpt-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 500; }
.rpt-badge-emerald { background: var(--green-50); color: var(--green-600); }
.rpt-badge-red { background: var(--red-50); color: var(--red-600); }
.rpt-badge-blue { background: var(--blue-50); color: var(--blue-600); }

/* Empty State */
.rpt-empty { text-align: center; padding: 48px 20px; color: var(--gray-400); }
.rpt-empty-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.4; }
.rpt-empty p { font-size: 14px; font-weight: 400; }
.rpt-empty-hint { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* Computed Report Card */
.rpt-computed-card { text-align: center; padding: 36px 20px; }
.rpt-computed-icon { font-size: 32px; margin-bottom: 10px; }
.rpt-computed-card h4 { color: var(--gray-900); font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.rpt-computed-desc { color: var(--gray-400); font-size: 13px; margin-bottom: 14px; }
.rpt-computed-sources { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.rpt-source-tag {
  background: var(--blue-50); color: var(--blue-600);
  border: 1px solid var(--blue-100);
  padding: 3px 10px; border-radius: 6px;
  font-size: 11px; font-weight: 500;
}

/* Summary Bar */
.rpt-summary-bar {
  display: flex; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: var(--radius-md);
  background: var(--green-50); border: 1px solid #bbf7d0;
  margin-bottom: 14px;
}
.rpt-summary-item { color: var(--gray-600); font-size: 12px; }
.rpt-summary-item strong { color: var(--green-600); }

/* Status badges */
.rpt-status { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; text-transform: uppercase; }
.rpt-status-draft { background: var(--gray-100); color: var(--status-draft); }
.rpt-status-submitted { background: var(--blue-50); color: var(--status-submitted); }
.rpt-status-review { background: var(--amber-50); color: var(--status-review); }
.rpt-status-approved { background: var(--green-50); color: var(--status-approved); }
.rpt-status-rejected { background: var(--red-50); color: var(--status-rejected); }
.rpt-status-hold { background: #fff7ed; color: var(--status-hold); }
.rpt-status-cancelled { background: var(--gray-100); color: var(--status-cancelled); }
.rpt-status-closed { background: var(--gray-50); color: var(--status-closed); }

/* Aging / Progress / Variance bands */
.rpt-aging-0-30 { color: var(--erp-success); }
.rpt-aging-31-60 { color: var(--amber-600); }
.rpt-aging-61-90 { color: var(--orange-600); }
.rpt-aging-90plus { color: var(--erp-danger); }
.rpt-progress-100 { color: var(--erp-success); font-weight: 600; }
.rpt-progress-90 { color: var(--amber-600); }
.rpt-progress-75 { color: var(--orange-600); }
.rpt-progress-low { color: var(--erp-danger); }
.rpt-var-ok { color: var(--erp-success); }
.rpt-var-warn { color: var(--amber-600); }
.rpt-var-alert { color: var(--orange-600); }
.rpt-var-danger { color: var(--erp-danger); font-weight: 600; }

/* Approval workflow */
.rpt-approval-strip { display: flex; gap: 4px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.rpt-approval-step { display: flex; align-items: center; gap: 3px; font-size: 10px; padding: 2px 7px; border-radius: 4px; background: var(--gray-100); color: var(--gray-500); }
.rpt-approval-step.active { background: var(--blue-50); color: var(--blue-600); font-weight: 600; }
.rpt-approval-step.done { background: var(--green-50); color: var(--green-600); }
.rpt-approval-arrow { color: var(--gray-300); font-size: 10px; }

/* Module badge */
.rpt-module-badge { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 9px; font-weight: 500; text-transform: uppercase; margin-left: 4px; }
.rpt-module-flagship { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* Pro header/footer (kept for compatibility, now unused) */
.rpt-pro-header, .rpt-pro-title-bar, .rpt-pro-context, .rpt-pro-footer,
.rpt-pro-sign-strip, .rpt-pro-confidential { display: none; }

/* Reports responsive */
@media (max-width: 768px) {
  .rpt-category-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .rpt-app-icon { padding: 12px 8px 10px; }
  .rpt-app-icon-circle { width: 40px; height: 40px; }
  .rpt-kpi-strip { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
  .rpt-filter-bar { flex-direction: column; }
  .rpt-report-header { flex-direction: column; }
}


/* ═══════════════════════════════════════════════
   BOQ DROPDOWN — Auto-suggestion for measurements
═══════════════════════════════════════════════ */
.boq-dropdown {
  position: fixed;
  z-index: 100000;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0,0,0,0.15), 0 4px 10px rgba(0,0,0,0.08);
  min-width: 340px;
  max-width: 520px;
  max-height: 280px;
  overflow-y: auto;
  animation: fadeIn 0.12s ease;
}
.boq-dd-header {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
}
.boq-dd-empty {
  padding: 14px 12px;
  font-size: 12px;
  color: var(--gray-400);
  text-align: center;
}
.boq-dd-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
  font-size: 12px;
}
.boq-dd-item:last-child { border-bottom: none; }
.boq-dd-item:hover { background: var(--blue-50); }
.boq-dd-item .dd-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--blue-600);
  min-width: 60px;
  font-size: 11px;
}
.boq-dd-item .dd-desc {
  flex: 1;
  color: var(--gray-700);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.boq-dd-item .dd-uom {
  color: var(--gray-400);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  min-width: 28px;
  text-align: center;
}
.boq-dd-item .dd-bal {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  min-width: 70px;
  text-align: right;
}
.boq-dd-item .dd-group {
  font-size: 9px;
  font-weight: 700;
}


/* ═══════════════════════════════════════════════
   ENTRY FORM ENGINE — Modal styles
═══════════════════════════════════════════════ */
.ef-overlay {
  position: fixed; inset: 0; z-index: 199999;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
}
.ef-modal {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 640px;
  animation: fadeIn 0.15s ease;
}
.ef-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.ef-title {
  font-size: 16px; font-weight: 600; color: var(--gray-900);
  font-family: var(--font-sans);
}
.ef-close {
  width: 28px; height: 28px; border-radius: 6px;
  background: var(--gray-100); border: none;
  font-size: 18px; color: var(--gray-500);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.1s;
}
.ef-close:hover { background: var(--red-50); color: var(--red-500); }

.ef-body { padding: 20px; }
.ef-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.ef-field-full { grid-column: 1 / -1; }
.ef-label {
  display: block; font-size: 11px; font-weight: 500;
  color: var(--gray-500); text-transform: uppercase;
  letter-spacing: 0.3px; margin-bottom: 4px;
}
.ef-input {
  width: 100%; padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px; color: var(--gray-900);
  background: #fff; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ef-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.ef-textarea { resize: vertical; min-height: 48px; }

.ef-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
}
.ef-btn-cancel {
  padding: 8px 16px; border-radius: var(--radius-sm);
  background: #fff; border: 1px solid var(--gray-200);
  color: var(--gray-600); font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.ef-btn-cancel:hover { background: var(--gray-50); }
.ef-btn-save {
  padding: 8px 20px; border-radius: var(--radius-sm);
  background: var(--blue-600); border: none;
  color: #fff; font-size: 13px; font-weight: 500;
  cursor: pointer;
}
.ef-btn-save:hover { background: var(--blue-700); }

@media (max-width: 640px) {
  .ef-grid { grid-template-columns: 1fr; }
  .ef-modal { max-width: 100%; }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE SHELL — bottom nav, safe areas, native-feel modals
   (mobileShell.js). Desktop ≥769px unaffected.
   ═══════════════════════════════════════════════════════════════ */

/* Bottom navigation bar — hidden on desktop, shown ≤768px */
.mobile-bottom-nav { display: none; }

@media (max-width: 768px) {
  body.app-ready .mobile-bottom-nav {
    display: flex;
    align-items: stretch;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 9000;
    background: #ffffff;
    border-top: 1px solid var(--gray-200, #e2e8f0);
    box-shadow: 0 -4px 24px rgba(15,23,42,.10);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    height: calc(62px + env(safe-area-inset-bottom, 0px));
    overflow: visible;                 /* let the raised FAB spill above the bar */
  }
  .mobile-bottom-nav .mbn-item {
    flex: 1 1 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px;
    background: none; border: none; outline: none;
    color: #94a3b8;
    font-size: 10px !important; font-weight: 700;
    min-height: 0 !important;
    padding: 9px 0 7px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s;
  }
  .mobile-bottom-nav .mbn-item .mbn-ico { font-size: 19px; line-height: 1; }
  .mobile-bottom-nav .mbn-item.active { color: #6d28d9; }
  .mobile-bottom-nav .mbn-item:active { color: #5b21b6; }

  /* Raised centre "+" (open full menu) */
  .mobile-bottom-nav .mbn-fab {
    position: relative;
    flex: 0 0 68px;
  }
  .mobile-bottom-nav .mbn-fab .mbn-fab-circle {
    position: absolute;
    top: -22px; left: 50%; transform: translateX(-50%);
    width: 54px; height: 54px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 60%, #5b21b6 100%);
    box-shadow: 0 8px 20px rgba(124,58,237,.45), 0 2px 6px rgba(0,0,0,.15);
    border: 4px solid #fff;
    transition: transform .12s ease;
  }
  .mobile-bottom-nav .mbn-fab .mbn-fab-circle { color: #fff; font-size: 30px; font-weight: 300; line-height: 1; padding-bottom: 3px; }
  .mobile-bottom-nav .mbn-fab:active .mbn-fab-circle { transform: translateX(-50%) scale(.92); }

  /* ─── Android WebView scroll fix ───
     On Android, 100vh (Tailwind h-screen) can be TALLER than the visible area,
     so the bottom of the page — the last dashboard cards, the purchase panel's
     footer, the attendance grid — ends up below the fold with no way to scroll
     to it. Pin the app shell and every full-screen overlay to the DYNAMIC
     viewport height (dvh), which matches what's actually visible. vh is kept as
     a fallback for very old WebViews. */
  #appContainer { height: 100vh; height: 100dvh !important; }
  #purchaseFormPanel,
  #purchaseFormPanel > div { height: 100vh; height: 100dvh !important; bottom: auto !important; }

  /* Make room so the bottom bar never covers content / FABs. Extra room under
     the raised centre button. */
  #appContainer main { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
  .fullscreen-sheet { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }

  /* Safe-area top padding for the app header (status bar / notch) */
  #breadcrumbBar { padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important; }
  #appSidebar { padding-top: env(safe-area-inset-top, 0px); }

  /* Native-feel modals: slide up as a bottom sheet, full width */
  [id$="Modal"] > div,
  [id$="Modal"] .modal-card,
  .ef-modal {
    border-radius: 18px 18px 0 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    max-height: 92vh !important;
    margin: 0 !important;
    animation: mSheetUp .22s ease;
  }
  [id$="Modal"] {
    align-items: flex-end !important;
    padding: 0 !important;
  }
}

@keyframes mSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* ════════════════════════════════════════════════════════════════
   MOBILE — Project module (Phase 2): app-launcher dashboard + cards
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Project dashboard header: stack title + actions, full-width buttons */
  #projectDashboard > .flex.items-center.justify-between { flex-direction: column; align-items: stretch !important; gap: 10px; }
  #projectDashboard > .flex.items-center.justify-between .flex.items-center.gap-3 { width: 100%; }
  #projectDashboard > .flex.items-center.justify-between .flex.items-center.gap-3 button { flex: 1; text-align: center; min-height: 38px !important; }

  /* KPI strip: 2 across, compact */
  #projDashKPIs { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; margin-bottom: 16px !important; }
  #projDashKPIs > div { padding: 12px !important; border-radius: 16px !important; }

  /* Module grid → 3-col app-launcher tiles (icon on top, label below) */
  #moduleCardsGrid { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
  #moduleCardsGrid > div { padding: 14px 6px !important; border-radius: 18px !important; }
  #moduleCardsGrid > div > .flex { flex-direction: column !important; align-items: center !important; gap: 8px !important; text-align: center; }
  #moduleCardsGrid > div h4 { font-size: 11px !important; line-height: 1.15; }
  #moduleCardsGrid > div p { display: none !important; }      /* hide description */
  #moduleCardsGrid > div > .flex > span { display: none !important; }  /* hide hover arrow */

  /* Clients / Projects home cards: tighter padding, real tap targets */
  #projectsGrid { gap: 12px !important; }
  #projectsGrid .p-5 { padding: 16px !important; }
  #projectsGrid button { min-height: 36px !important; font-size: 12px !important; padding: 6px 12px !important; }

  /* Home header: stack title + add button (full-width, thumb-friendly) */
  #projectsHome > .flex.items-center.justify-between,
  #projectsHome .flex.items-center.justify-between:first-of-type { flex-wrap: wrap; gap: 10px; }
  #projHomeActionBtn { width: 100%; justify-content: center; min-height: 46px; }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE — Site modules (Phase 3): Execution, Issues, Petty Cash,
   Planning, Micro-Planning
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* JS-rendered module modals → full-width bottom sheets */
  #exModalOverlay, #issueModalOverlay, #pcModalOverlay {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  #exModalOverlay > div, #issueModalOverlay > div, #pcModalOverlay > div {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 18px 18px 0 0 !important;
    max-height: 94vh !important;
    animation: mSheetUp .22s ease;
  }
  /* Stack every multi-column form row inside those modals (forms read 1-up) */
  #exModalOverlay [style*="grid-template-columns:1fr 1fr"],
  #issueModalOverlay [style*="grid-template-columns:1fr 1fr"],
  #pcModalOverlay [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Dashboards: collapse only the very cramped 3-column rows */
  #executionRoot [style*="1fr 1fr 1fr"],
  #issuesRoot [style*="1fr 1fr 1fr"],
  #pettyCashRoot [style*="1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  /* Execution hub icon tiles: comfortable 3-across on phones */
  #executionRoot [style*="minmax(165px"],
  #pettyCashRoot [style*="minmax(165px"] {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  /* Planning / Micro-Planning wide tables → smooth horizontal scroll, denser */
  #planningView .overflow-x-auto, #microPlanView .overflow-x-auto,
  #planningView table, #microPlanView table { -webkit-overflow-scrolling: touch; }
  #planningView table, #microPlanView table { font-size: 11px !important; min-width: 640px; }
  #planningView thead th, #microPlanView thead th { font-size: 10px !important; white-space: nowrap; }

  /* Planning/Micro headers + toolbars stack cleanly */
  #planningView > .flex.items-center.justify-between,
  #microPlanView > .flex.items-center.justify-between { flex-direction: column; align-items: stretch !important; gap: 10px; }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE — Project resource modules (Phase 4): Inventory, Equipment,
   Tools, Assets, Labour, Micro-Planning
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Resource hub icon tiles → comfortable 2-across app launcher */
  #invGrid, #equipGrid, #labourGrid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  #invGrid > div, #equipGrid > div, #labourGrid > div { padding: 18px 10px !important; }
  #invGrid > div > div:first-child,
  #equipGrid > div > div:first-child,
  #labourGrid > div > div:first-child { width: 46px !important; height: 46px !important; font-size: 22px !important; }

  /* Headers with any justify-between variant wrap cleanly */
  .flex.justify-between.items-end,
  .flex.items-end.justify-between,
  .flex.justify-between.items-start { flex-wrap: wrap; gap: 8px; }

  /* Micro-Planning stat rows: 3-up is too tight on phones → 2-up */
  #microPlanView .grid.grid-cols-3 { grid-template-columns: repeat(2, 1fr) !important; }

  /* Resource-module tables: denser text + smooth horizontal scroll */
  #inventoryView table, #assetsView table, #labourView table,
  #equipmentView table, #recipeView table, #microPlanView table {
    font-size: 11px !important; min-width: 600px;
  }
  #inventoryView thead th, #assetsView thead th, #labourView thead th,
  #equipmentView thead th, #recipeView thead th, #microPlanView thead th {
    font-size: 10px !important; white-space: nowrap; padding: 6px 8px !important;
  }
  #inventoryView .overflow-x-auto, #assetsView .overflow-x-auto, #labourView .overflow-x-auto,
  #equipmentView .overflow-x-auto, #recipeView .overflow-x-auto, #microPlanView .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE — Finance & Admin (Phase 5): Parties Ledger, Bank & Cash,
   Users & Roles, Plan & Billing
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Master-detail layouts → stack list above detail, drop fixed viewport heights */
  #partiesLedgerView { height: auto !important; flex-direction: column; }
  #accountsManagerView > .flex.flex-col { height: auto !important; }
  #partiesLedgerView > div:first-child,
  #accountsManagerView > .flex.flex-col > div:first-child {
    width: 100% !important; max-height: 42vh;
  }
  #partiesLedgerView > div:last-child,
  #accountsManagerView > .flex.flex-col > div:last-child {
    width: 100% !important; min-height: 56vh;
  }
  /* Detail action buttons wrap to a tidy row */
  #partyActionButtons, #accountsManagerView .p-4 .flex.gap-2.flex-wrap { flex-wrap: wrap; gap: 6px; }

  /* Users & Roles / Plan & Billing cards: lighter padding on phones */
  #masterData #usersRolesSection, #planBillingContent { padding: 14px !important; }

  /* Finance / admin tables: denser text + smooth horizontal scroll */
  #partiesLedgerView table, #accountsManagerView table, #masterData table,
  #masterFinancialView table, #accountingView table, #planBillingView table,
  #clientDashboardView table {
    font-size: 11px !important; min-width: 560px;
  }
  #partiesLedgerView thead th, #masterData thead th, #masterFinancialView thead th,
  #clientDashboardView thead th {
    font-size: 10px !important; white-space: nowrap; padding: 6px 8px !important;
  }
  #partiesLedgerView .overflow-x-auto, #accountsManagerView .overflow-x-auto,
  #masterData .overflow-x-auto, #masterFinancialView .overflow-x-auto,
  #clientDashboardView .overflow-x-auto { -webkit-overflow-scrolling: touch; }
}


/* ═══════════════════════════════════════════════════════════
   PREMIUM THEME LAYER (v1.5.0)
   Visual-only: recolors the blue accent → brand green + gold,
   and polishes shared primitives. No markup/JS changes.
   Appended last so it wins by source order.
═══════════════════════════════════════════════════════════ */

/* ── Primary buttons: blue → brand green ── */
.bg-blue-600, button.bg-blue-600, a.bg-blue-600,
.bg-blue-500, button.bg-blue-500 {
  background: var(--brand) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(5,95,70,.18) !important;
}
.bg-blue-600:hover, button.bg-blue-600:hover, a.bg-blue-600:hover,
.bg-blue-500:hover, button.bg-blue-500:hover,
.hover\:bg-blue-700:hover, .hover\:bg-blue-600:hover { background: var(--brand-dark) !important; }
.bg-blue-700, button.bg-blue-700 { background: var(--brand-dark) !important; color:#fff !important; }

/* ── Light/ghost blue → brand tint ── */
.bg-blue-50  { background: var(--brand-50) !important; }
.bg-blue-100 { background: var(--brand-50) !important; border-color: var(--brand-100) !important; }
.bg-blue-100:hover { background: var(--brand-100) !important; }

/* ── Blue text & icons → brand green ── */
.text-blue-400, .text-blue-500, .text-blue-600, .text-blue-700,
a.text-blue-600, a.text-blue-500 { color: var(--brand-ink) !important; }
.text-blue-600:hover, .text-blue-500:hover, a.text-blue-600:hover { color: var(--brand-dark) !important; }

/* ── Blue borders / rings → brand ── */
.border-blue-100 { border-color: var(--brand-100) !important; }
.border-blue-200, .border-blue-300 { border-color: var(--brand-100) !important; }
.ring-blue-500, .ring-blue-400, .focus\:ring-blue-500:focus { --tw-ring-color: var(--brand) !important; box-shadow: 0 0 0 3px var(--brand-ring) !important; }

/* ── Form focus: blue → brand green ── */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input):focus,
select:focus, textarea:focus {
  border-color: var(--brand-mid) !important;
  box-shadow: 0 0 0 3px var(--brand-ring) !important;
}
.table-input:focus { box-shadow: inset 0 0 0 2px var(--brand) !important; background: var(--brand-50) !important; }
input[type=checkbox], input[type=radio] { accent-color: var(--brand) !important; }

/* ── Sidebar: brand-green active state + gold accent rail ── */
.nav-btn.active {
  background-color: var(--sb-active-bg) !important;
  border-left-color: var(--brand-mid) !important;
  color: #fff !important;
  font-weight: 600 !important;
}
.nav-btn.active::after{ content:""; position:absolute; right:10px; top:50%; transform:translateY(-50%);
  width:5px; height:5px; border-radius:50%; background: var(--gold-soft); opacity:.9; }
.nav-btn{ position:relative; }
aside > div:first-child h1 { letter-spacing:-.4px !important; }

/* ── Buttons: a touch more premium (radius + weight) ── */
button:not(.nav-btn){ border-radius: var(--radius-lg) !important; font-weight: 600 !important; }

/* ── Cards / white panels: softer, deeper, more "expensive" ── */
.shadow-sm{ box-shadow: 0 1px 2px rgba(13,40,28,.05) !important; }
.shadow, .shadow-md{ box-shadow: 0 4px 16px -6px rgba(13,40,28,.12) !important; }
.shadow-lg, .shadow-xl{ box-shadow: 0 18px 40px -18px rgba(13,40,28,.20) !important; }
.rounded-lg{ border-radius: 12px !important; }
.rounded-xl{ border-radius: 14px !important; }
.rounded-2xl{ border-radius: 18px !important; }

/* ── Module cards on the home/dashboard: lift on hover with brand edge ── */
#moduleCardsGrid .bg-white{ transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease !important; }
#moduleCardsGrid .bg-white:hover{
  transform: translateY(-2px) !important;
  border-color: var(--brand-100) !important;
  box-shadow: 0 16px 34px -16px rgba(13,40,28,.22) !important;
}

/* ── Table headers: faint brand tint for a crisp, premium grid ── */
thead th{ background: #f6faf8 !important; color: var(--gray-600) !important; }
tbody tr:hover td{ background: #f6faf8 !important; }

/* ── Headings: tighter, more confident ── */
.view-section h2{ letter-spacing:-.3px !important; color: var(--gray-900) !important; }

/* ── Primary text-links (text-blue used as links) keep underline-free hover ── */
a.text-blue-600, a.text-blue-500 { text-decoration: none !important; }

/* ── Active tab under(border) accents that used blue ── */
.border-blue-500, .border-b-blue-500 { border-color: var(--brand) !important; }


/* ═══════════════════════════════════════════════════════════
   PREMIUM POLISH LAYER (v1.5.1) — Linear / Vercel / Stripe feel
   - Light, near-white sidebar (replaces dark navy)
   - More breathing room everywhere
   - Borders → subtle background tints
   - Smaller, tighter typography
   - Razor-thin shadows
   - Visual-only. No markup or JS touched.
═══════════════════════════════════════════════════════════ */

/* ── Sidebar: force LIGHT — override Tailwind's bg-[#0f172a] on <aside> ── */
aside, aside.bg-\[\#0f172a\] {
  background: var(--sb-bg) !important;
  color: var(--sb-text) !important;
  border-right: 1px solid var(--sb-border) !important;
  box-shadow: none !important;
}
/* Logo zone — neutralise the inline dark gradient */
aside > div:first-child,
aside > div:first-child[style] {
  background: var(--sb-bg) !important;
  border-bottom: 1px solid var(--sb-border) !important;
  padding: 18px 18px 14px !important;
}
aside > div:first-child h1 { color: #0f172a !important; font-weight: 700 !important; }
aside > div:first-child p { color: #94a3b8 !important; }

/* Nav section labels — quieter */
aside nav > p {
  color: #9ca3af !important;
  font-weight: 600 !important;
  font-size: 10px !important;
  letter-spacing: 0.6px !important;
  padding: 0 12px !important;
  margin: 18px 0 6px !important;
}

/* Nav buttons — Linear-style */
.nav-btn {
  color: #4b5563 !important;
  font-size: 12.5px !important;
  font-weight: 500 !important;
  border-left: none !important;          /* drop the colored rail */
  padding: 7px 12px !important;
  border-radius: 8px !important;
  margin: 1px 6px !important;
  letter-spacing: 0 !important;
}
.nav-btn:hover {
  color: #0f172a !important;
  background: var(--sb-hover) !important;
}
.nav-btn.active {
  color: #0f172a !important;
  background: #ffffff !important;
  border-left: none !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 2px rgba(13,40,28,.04), 0 1px 1px rgba(13,40,28,.03) !important;
}
.nav-btn.active::after { display: none !important; }  /* drop the gold dot — too busy */

/* Project context badge in sidebar (inline blue tint → neutral white card) */
#projectContextNav > div:first-child,
#projectContextNav > div:first-child[style] {
  background: #ffffff !important;
  border: 1px solid var(--sb-border) !important;
  border-radius: 10px !important;
  padding: 8px 10px !important;
  box-shadow: 0 1px 2px rgba(13,40,28,.04) !important;
}
#sidebarProjName { color: #0f172a !important; font-weight: 600 !important; }

/* ── Main body: more breathing room ── */
main { background: #ffffff !important; }
main > .p-4, main > div.p-4 { padding: 32px 40px !important; }
#breadcrumbBar { border-bottom: 1px solid var(--sb-border) !important; padding: calc(12px + env(safe-area-inset-top, 0px)) 24px 12px !important; }

/* ── Cards: borders → soft tints, almost-invisible shadow ── */
.bg-white {
  background: #ffffff !important;
}
.bg-white.rounded-lg, .bg-white.rounded-xl, .bg-white.rounded-2xl,
.bg-white.shadow, .bg-white.shadow-sm, .bg-white.shadow-md, .bg-white.shadow-lg {
  border-color: transparent !important;
  box-shadow: 0 1px 2px rgba(13,40,28,.04), 0 0 0 1px rgba(13,40,28,.04) !important;
}
/* Tinted "no-border" cards — when a card needs separation, use a soft fill instead */
.bg-slate-50, .bg-slate-100 { background: #f7f9f8 !important; border-color: transparent !important; }
.bg-gray-50,  .bg-gray-100  { background: #f7f9f8 !important; border-color: transparent !important; }

/* ── Borders: globally softer (almost invisible by default) ── */
.border, .border-slate-100, .border-slate-200, .border-slate-300,
.border-gray-100, .border-gray-200, .border-gray-300 {
  border-color: rgba(13,40,28,0.06) !important;
}

/* ── Typography: smaller, tighter, more confident hierarchy ── */
html { font-size: 13.5px !important; }     /* ~7% tighter base */
.view-section h2 {
  font-size: 1.45rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.5px !important;
  line-height: 1.2 !important;
  color: #0f172a !important;
}
.view-section h3 { font-size: 0.95rem !important; font-weight: 600 !important; letter-spacing: -0.2px !important; color:#0f172a !important; }
.view-section > p, .view-section > div > p { font-size: 12.5px !important; }
.text-xs { font-size: 11px !important; letter-spacing: 0.1px !important; }
label.block { font-size: 10.5px !important; letter-spacing: 0.4px !important; }

/* ── Shadows: razor-thin throughout ── */
.shadow-sm,
.shadow,
.shadow-md  { box-shadow: 0 1px 2px rgba(13,40,28,.04), 0 0 0 1px rgba(13,40,28,.04) !important; }
.shadow-lg  { box-shadow: 0 6px 22px -10px rgba(13,40,28,.10), 0 0 0 1px rgba(13,40,28,.04) !important; }
.shadow-xl, .shadow-2xl { box-shadow: 0 14px 36px -18px rgba(13,40,28,.14), 0 0 0 1px rgba(13,40,28,.04) !important; }

/* ── Buttons: tighter, no shadow ── */
button:not(.nav-btn) {
  border-radius: 9px !important;
  font-weight: 600 !important;
  font-size: 12.5px !important;
  box-shadow: none !important;
}
.bg-blue-600, button.bg-blue-600 {
  box-shadow: 0 1px 1px rgba(5,95,70,.10) !important;
}

/* ── Inputs: borders → soft inset look ── */
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input),
select, textarea {
  background: #f7f9f8 !important;
  border-color: transparent !important;
  font-size: 12.5px !important;
  padding: 8px 11px !important;
  transition: background 120ms ease, box-shadow 120ms ease !important;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input):hover,
select:hover, textarea:hover {
  background: #f1f5f3 !important;
  border-color: transparent !important;
}
input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input):focus,
select:focus, textarea:focus {
  background: #ffffff !important;
  border-color: var(--brand-mid) !important;
  box-shadow: 0 0 0 3px var(--brand-ring) !important;
}

/* ── Tables: no heavy borders, hairline rows ── */
thead th {
  background: transparent !important;
  border-bottom: 1px solid rgba(13,40,28,.08) !important;
  color: #94a3b8 !important;
  font-size: 10.5px !important;
  letter-spacing: 0.5px !important;
}
td { border-bottom: 1px solid rgba(13,40,28,.05) !important; }
tbody tr:hover td { background: #f7f9f8 !important; }

/* ── Modals: thinner shadow, generous padding ── */
.fixed.inset-0 > div {
  box-shadow: 0 24px 60px -22px rgba(13,40,28,.22), 0 0 0 1px rgba(13,40,28,.05) !important;
  border-color: transparent !important;
}

/* ── Top header & badges: quieter ── */
#headerProjBadge, #headerUserBadge { box-shadow: none !important; border-color: rgba(13,40,28,.06) !important; }

/* ── Scrollbar — even quieter on light sidebar ── */
aside ::-webkit-scrollbar-thumb { background: rgba(13,40,28,.08) !important; }
aside ::-webkit-scrollbar-thumb:hover { background: rgba(13,40,28,.16) !important; }

/* ═══════════════════════════════════════════════════════════
   FILOO PURPLE THEME — hub grids (dashboard modules, Equipment,
   Labour, Inventory, Settings). Soft lilac ground, white rounded
   cards with purple-tinted shadow, colourful gradient icon tiles.
   ═══════════════════════════════════════════════════════════ */

/* Soft lilac page ground so the white cards float (Filoo look) */
#appContainer main { background: linear-gradient(180deg,#F4F1FD 0%,#F7F5FE 60%) !important; }

/* ── Hub cards ── */
#moduleCardsGrid > div,
#equipGrid > div,
#labourGrid > div,
#invGrid > div,
#settingsHomeGrid > div {
  border: none !important;
  border-radius: 20px !important;
  box-shadow: 0 14px 28px -18px rgba(91,52,217,.5) !important;
}
#moduleCardsGrid > div:hover,
#equipGrid > div:hover,
#labourGrid > div:hover,
#invGrid > div:hover,
#settingsHomeGrid > div:hover {
  border: none !important;
  box-shadow: 0 18px 34px -16px rgba(91,52,217,.6) !important;
}

/* ── Icon tiles → white glyph on a gradient (border removed) ── */
#equipGrid > div > div:first-child,
#labourGrid > div > div:first-child,
#invGrid > div > div:first-child,
#settingsHomeGrid > div > div:first-child,
#moduleCardsGrid > div > div > div:first-child {
  border: none !important;
  color: #fff !important;
}

/* ── Gradient rotation (pink · teal · blue · amber · green) ── */
#equipGrid > div:nth-child(5n+1) > div:first-child,
#labourGrid > div:nth-child(5n+1) > div:first-child,
#invGrid > div:nth-child(5n+1) > div:first-child,
#settingsHomeGrid > div:nth-child(5n+1) > div:first-child,
#moduleCardsGrid > div:nth-child(5n+1) > div > div:first-child { background: linear-gradient(135deg,#FF6FA5,#FF4E7D) !important; }

#equipGrid > div:nth-child(5n+2) > div:first-child,
#labourGrid > div:nth-child(5n+2) > div:first-child,
#invGrid > div:nth-child(5n+2) > div:first-child,
#settingsHomeGrid > div:nth-child(5n+2) > div:first-child,
#moduleCardsGrid > div:nth-child(5n+2) > div > div:first-child { background: linear-gradient(135deg,#37D6C4,#17A8A0) !important; }

#equipGrid > div:nth-child(5n+3) > div:first-child,
#labourGrid > div:nth-child(5n+3) > div:first-child,
#invGrid > div:nth-child(5n+3) > div:first-child,
#settingsHomeGrid > div:nth-child(5n+3) > div:first-child,
#moduleCardsGrid > div:nth-child(5n+3) > div > div:first-child { background: linear-gradient(135deg,#5E8BFF,#3B63F0) !important; }

#equipGrid > div:nth-child(5n+4) > div:first-child,
#labourGrid > div:nth-child(5n+4) > div:first-child,
#invGrid > div:nth-child(5n+4) > div:first-child,
#settingsHomeGrid > div:nth-child(5n+4) > div:first-child,
#moduleCardsGrid > div:nth-child(5n+4) > div > div:first-child { background: linear-gradient(135deg,#FFC64D,#F79A1E) !important; }

#equipGrid > div:nth-child(5n+5) > div:first-child,
#labourGrid > div:nth-child(5n+5) > div:first-child,
#invGrid > div:nth-child(5n+5) > div:first-child,
#settingsHomeGrid > div:nth-child(5n+5) > div:first-child,
#moduleCardsGrid > div:nth-child(5n+5) > div > div:first-child { background: linear-gradient(135deg,#3BD07A,#1EA85B) !important; }

/* Section headings a touch bolder to match the concept */
#moduleCardsGrid ~ * h2, .filoo-hd { letter-spacing: -.2px; }

/* ═══ Estimation module fields ═══ */
.est-in{ width:100%; padding:11px 12px; border:1.5px solid #E9E6F2; border-radius:10px; font-size:15px; background:#fff; outline:none; }
.est-in:focus{ border-color:#7C5CFC; box-shadow:0 0 0 3px rgba(124,92,252,.12); }
.est-cell{ width:100%; padding:8px 9px; border:1px solid #E9E6F2; border-radius:8px; font-size:14px; background:#fff; outline:none; }
.est-cell:focus{ border-color:#7C5CFC; box-shadow:0 0 0 2px rgba(124,92,252,.14); }
.est-cell.text-right{ text-align:right; }
@media (max-width:768px){ .est-in, .est-cell{ font-size:16px !important; min-height:46px; } }

/* ═══ Filoo mobile home (greeting · hero · tiles · recent) ═══ */
#filooHome{ display:none; }
/* On the Filoo home, hide the app header chips (breadcrumb / sync / user / logout)
   — the greeting + avatar replace them — and pad the top for the status bar. */
body.filoo-home #breadcrumbBar { display:none !important; }
body.filoo-home #appContainer main { padding-top: calc(12px + env(safe-area-inset-top, 0px)) !important; }
#filooHome .fh-av{ cursor:pointer; }
.g-pink{ background:linear-gradient(135deg,#FF6FA5,#FF4E7D) !important; }
.g-teal{ background:linear-gradient(135deg,#37D6C4,#17A8A0) !important; }
.g-blue{ background:linear-gradient(135deg,#5E8BFF,#3B63F0) !important; }
.g-amber{ background:linear-gradient(135deg,#FFC64D,#F79A1E) !important; }
.g-green{ background:linear-gradient(135deg,#3BD07A,#1EA85B) !important; }
#filooHome .fh-hd{ display:flex; align-items:flex-start; justify-content:space-between; margin:2px 2px 16px; }
#filooHome .fh-hi{ font-size:14px; color:#8B86A8; font-weight:600; }
#filooHome .fh-name{ font-size:24px; font-weight:800; letter-spacing:-.4px; color:#241E45; margin-top:2px; }
#filooHome .fh-av{ width:46px; height:46px; border-radius:14px; background:linear-gradient(135deg,#FFD27A,#FF8A5B); color:#5a2b00; font-weight:800; display:flex; align-items:center; justify-content:center; font-size:15px; box-shadow:0 8px 18px -8px rgba(255,138,91,.8); flex:none; }
#filooHome .fh-hero{ border-radius:22px; padding:20px; color:#fff; position:relative; overflow:hidden; background:linear-gradient(135deg,#7C5CFC,#5B34D9); box-shadow:0 22px 42px -20px rgba(91,52,217,.8); cursor:pointer; }
#filooHome .fh-hero:before{ content:""; position:absolute; right:-30px; top:-30px; width:130px; height:130px; border-radius:50%; background:rgba(255,255,255,.12); }
#filooHome .fh-hero:after{ content:""; position:absolute; right:26px; bottom:-40px; width:90px; height:90px; border-radius:50%; background:rgba(255,255,255,.08); }
#filooHome .fh-tag{ font-size:11px; font-weight:700; letter-spacing:.4px; text-transform:uppercase; opacity:.85; position:relative; }
#filooHome .fh-big{ font-size:22px; font-weight:800; margin-top:3px; position:relative; }
#filooHome .fh-sub{ font-size:12.5px; opacity:.85; margin-top:2px; position:relative; }
#filooHome .fh-bar{ height:7px; border-radius:6px; background:rgba(255,255,255,.25); margin-top:16px; overflow:hidden; position:relative; }
#filooHome .fh-bar i{ display:block; height:100%; border-radius:6px; background:linear-gradient(90deg,#FFE08A,#FFB65B); }
#filooHome .fh-row{ display:flex; justify-content:space-between; margin-top:9px; font-size:11.5px; opacity:.92; position:relative; }
#filooHome .fh-open{ position:absolute; right:18px; top:18px; background:#fff; color:#5B34D9; font-size:11px; font-weight:800; padding:7px 12px; border-radius:20px; z-index:1; }
#filooHome .fh-sec{ display:flex; justify-content:space-between; align-items:baseline; margin:22px 2px 12px; }
#filooHome .fh-sec h3{ font-size:16px; font-weight:800; color:#241E45; margin:0; }
#filooHome .fh-sec a{ font-size:12px; color:#7C5CFC; font-weight:700; cursor:pointer; }
#filooHome .fh-tiles{ display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
#filooHome .fh-tile{ background:#fff; border-radius:18px; padding:12px 4px; text-align:center; box-shadow:0 10px 22px -16px rgba(70,40,160,.5); cursor:pointer; }
#filooHome .fh-tile .fh-ic{ width:44px; height:44px; margin:0 auto 8px; border-radius:14px; display:flex; align-items:center; justify-content:center; font-size:20px; }
#filooHome .fh-tile span{ font-size:10.5px; font-weight:700; color:#241E45; }
#filooHome .fh-tile small{ display:block; font-size:9px; color:#8B86A8; font-weight:600; margin-top:1px; }
#filooHome .fh-list{ display:flex; flex-direction:column; gap:10px; }
#filooHome .fh-item{ background:#fff; border-radius:18px; padding:12px 14px; display:flex; align-items:center; gap:12px; box-shadow:0 10px 24px -18px rgba(70,40,160,.55); }
#filooHome .fh-item .fh-ic{ width:42px; height:42px; border-radius:13px; display:flex; align-items:center; justify-content:center; font-size:19px; flex:none; }
#filooHome .fh-item .fh-m{ flex:1; min-width:0; }
#filooHome .fh-item .fh-m b{ font-size:13.5px; font-weight:700; display:block; color:#241E45; }
#filooHome .fh-item .fh-m small{ font-size:11px; color:#8B86A8; font-weight:600; }
#filooHome .fh-item .fh-amt{ font-size:13px; font-weight:800; color:#5B34D9; }

/* ═══════════════════════════════════════════════════════════
   MOBILE-FRIENDLY FORMS — applies to every form (sales, purchase,
   measurement, inventory, labour, …). Bigger tap targets, no
   iOS zoom-on-focus, and multi-column field grids stack to one
   column so fields are full-width and easy to fill on a phone.
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* 16px stops iOS Safari/WebView zooming in when a field is focused. */
  input:not([type=checkbox]):not([type=radio]):not([type=file]):not(.table-input),
  select, textarea {
    font-size: 16px !important;
    min-height: 48px !important;
    border-radius: 12px !important;
    padding: 12px 14px !important;
  }
  select { background-position: right 12px center !important; }
  textarea { min-height: 90px !important; }

  /* Any grid that holds form fields collapses to a single column so each
     field is full-width. Grids without inputs (stat tiles, card lists) are
     untouched. :has is supported in modern Android WebView / Safari; older
     engines simply ignore this rule (safe degradation). */
  .grid:has(input),
  .grid:has(select),
  .grid:has(textarea) {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  /* Two side-by-side fields in a flex row also stack. */
  .form-row, .field-row, .grid-cols-2:has(input), .grid-cols-2:has(select) {
    display: block !important;
  }
  .form-row > *, .field-row > * { width: 100% !important; margin-bottom: 12px; }

  /* Labels get a touch more room above their field. */
  label { font-size: 13px !important; }

  /* Primary save/add buttons inside modals & full-screen forms go full width
     and tall so they're an easy thumb target. */
  .fullscreen-sheet .actions button,
  .fullscreen-form .form-actions button,
  .modal-footer button,
  .form-save-btn {
    width: 100% !important;
    min-height: 50px !important;
    font-size: 15px !important;
    border-radius: 12px !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   SALES · PURCHASE · ESTIMATE line items → stacked labelled
   cards on mobile (like the measurement sheet). CSS-only: columns
   are fixed-order, so ::before labels each field by position.
   (:has/:is degrade safely to the scrollable table on old engines.)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  table:has(#estTableBody), table:has(#siFormTableBody), table:has(#purTableBody) { display:block !important; width:100% !important; min-width:0 !important; }
  table:has(#estTableBody) thead, table:has(#siFormTableBody) thead, table:has(#purTableBody) thead { display:none !important; }
  #estTableBody, #siFormTableBody, #purTableBody { display:block !important; }
  #estTableBody > tr, #siFormTableBody > tr, #purTableBody > tr {
    display:grid !important; grid-template-columns:1fr 1fr; gap:10px;
    background:#fff; border:1px solid #ECE7F7 !important; border-radius:16px; padding:14px; margin-bottom:12px;
    box-shadow:0 8px 20px -14px rgba(91,52,217,.45);
  }
  #estTableBody > tr > td, #siFormTableBody > tr > td, #purTableBody > tr > td {
    display:flex !important; flex-direction:column; border:none !important; padding:0 !important; background:transparent !important; min-width:0;
  }
  #estTableBody td::before, #siFormTableBody td::before, #purTableBody td::before {
    font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:.3px; color:#9B95BD; margin-bottom:4px;
  }
  #estTableBody td :is(input,select), #siFormTableBody td :is(input,select), #purTableBody td :is(input,select) {
    width:100% !important; min-height:46px !important; font-size:16px !important;
    border:1px solid #E6E1F3 !important; border-radius:10px !important; background:#FAF9FF !important; padding:10px 12px !important;
  }
  /* Estimate: # · Description · Qty · Unit · Rate · Amount · Del */
  #estTableBody > tr > td:nth-child(1) { display:none !important; }
  #estTableBody > tr > td:nth-child(2) { grid-column:1/-1; }
  #estTableBody > tr > td:nth-child(2)::before { content:"Description"; }
  #estTableBody > tr > td:nth-child(3)::before { content:"Qty"; }
  #estTableBody > tr > td:nth-child(4)::before { content:"Unit"; }
  #estTableBody > tr > td:nth-child(5)::before { content:"Rate"; }
  #estTableBody > tr > td:nth-child(6)::before { content:"Amount"; }
  #estTableBody > tr > td:nth-child(7) { grid-column:1/-1; }
  /* Purchase: # · Material/Tool · Qty · Rate · Amount · Del */
  #purTableBody > tr > td:nth-child(1) { display:none !important; }
  #purTableBody > tr > td:nth-child(2) { grid-column:1/-1; }
  #purTableBody > tr > td:nth-child(2)::before { content:"Material / Tool"; }
  #purTableBody > tr > td:nth-child(3)::before { content:"Qty"; }
  #purTableBody > tr > td:nth-child(4)::before { content:"Rate"; }
  #purTableBody > tr > td:nth-child(5)::before { content:"Amount"; }
  #purTableBody > tr > td:nth-child(6) { grid-column:1/-1; }
  /* Sale invoice: Item · HSN · Qty · Unit · Rate · Disc · Tax · Amount · Del */
  #siFormTableBody > tr > td:nth-child(1) { grid-column:1/-1; }
  #siFormTableBody > tr > td:nth-child(1)::before { content:"Item"; }
  #siFormTableBody > tr > td:nth-child(2)::before { content:"HSN / SAC"; }
  #siFormTableBody > tr > td:nth-child(3)::before { content:"Qty"; }
  #siFormTableBody > tr > td:nth-child(4)::before { content:"Unit"; }
  #siFormTableBody > tr > td:nth-child(5)::before { content:"Rate"; }
  #siFormTableBody > tr > td:nth-child(6)::before { content:"Disc %"; }
  #siFormTableBody > tr > td:nth-child(7) { grid-column:1/-1; }
  #siFormTableBody > tr > td:nth-child(7)::before { content:"Tax"; }
  #siFormTableBody > tr > td:nth-child(8) { grid-column:1/-1; }
  #siFormTableBody > tr > td:nth-child(8)::before { content:"Amount"; }
  #siFormTableBody > tr > td:nth-child(9) { grid-column:1/-1; }
  /* Delete buttons: full-width red */
  #estTableBody > tr > td:last-child button, #purTableBody > tr > td:last-child button, #siFormTableBody > tr > td:last-child button {
    width:100% !important; background:#FEF2F2 !important; color:#DC2626 !important; border:1px solid #FECACA !important; border-radius:10px !important; min-height:42px; font-weight:800;
  }
  /* Read-only Amount cells → tinted, bold (not a tiny input) */
  #estTableBody td:nth-child(6) input[readonly], #purTableBody td:nth-child(5) input[readonly], #siFormTableBody td:nth-child(8) input[readonly] {
    background:#F3F0FD !important; color:#5B34D9 !important; font-weight:800 !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   SALES INVOICE FORM — Vyapar-inspired clean mobile layout
   ═══════════════════════════════════════════════════════════ */
.si-mobile-savebar { display:none; }
@media (max-width: 768px) {
  /* Sticky bottom Save bar (Save & New | Save) */
  .si-mobile-savebar {
    display:flex !important; position:absolute; left:0; right:0; bottom:0; z-index:60;
    background:#fff; border-top:1px solid #ECE7F7; box-shadow:0 -8px 22px -14px rgba(70,40,160,.45);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .si-mobile-savebar button { flex:1; border:none; padding:18px; font-size:16px; font-weight:800; cursor:pointer; }
  .si-mobile-savebar .sn { background:#fff; color:#241E45; }
  .si-mobile-savebar .sv { background:linear-gradient(135deg,#6D4AFF,#5B34D9); color:#fff; }
  /* Hide the tiny top Save (the bottom bar replaces it) */
  #saleInvoiceFormPanel .flex-shrink-0 button[onclick*="saveSaleInvoiceForm"] { display:none !important; }

  /* Soft lilac page, clean single-column field groups, room for the save bar */
  #siFormScrollArea { background:#F5F3FB !important; }
  #siFormScrollArea > div { padding:14px 14px 96px !important; }
  #saleInvoiceFormPanel [style*="grid-template-columns:1fr 1fr"] { grid-template-columns:1fr !important; gap:12px !important; }
  #saleInvoiceFormPanel .bg-white { border-radius:16px !important; box-shadow:0 8px 20px -16px rgba(70,40,160,.35) !important; }
  #saleInvoiceFormPanel .si-field {
    min-height:52px !important; font-size:16px !important; border-radius:13px !important;
    border:1.5px solid #E9E6F2 !important; background:#fff !important; padding:13px 14px !important;
  }
  #saleInvoiceFormPanel .si-lbl { font-size:12px !important; font-weight:700 !important; color:#8A86A0 !important; }
  /* Credit/Cash toggle: green active like the reference */
  #siToggleCredit.bg-blue-500, #siToggleCash.bg-blue-500 { background:#15A34A !important; }
}

/* ═══════════════════════════════════════════════════════════
 * Execution Intelligence Platform (executionEngine.js)
 * ═══════════════════════════════════════════════════════════ */
.ee-wrap { max-width: 100%; }
.ee-head { margin-bottom: 12px; }
.ee-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 2px solid #e2e8f0; margin-bottom: 16px; overflow-x: auto; }
.ee-tab { padding: 8px 14px; font-size: 12px; font-weight: 700; color: #64748b; background: transparent; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; cursor: pointer; border-radius: 6px 6px 0 0; }
.ee-tab:hover { color: #334155; background: #f1f5f9; }
.ee-tab.active { color: #7c3aed; border-bottom-color: #7c3aed; }
.ee-body { min-height: 200px; }
.ee-empty { text-align: center; padding: 48px 16px; color: #64748b; }
.ee-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ee-note { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 11px; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }

.ee-btn-primary { background: #7c3aed; color: #fff; font-size: 12px; font-weight: 700; padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; }
.ee-btn-primary:hover { background: #6d28d9; }
.ee-btn-ok { background: #16a34a; color: #fff; font-size: 12px; font-weight: 700; padding: 8px 16px; border-radius: 8px; border: none; cursor: pointer; }
.ee-btn-ok:hover { background: #15803d; }
.ee-btn-ghost { background: #fff; color: #475569; font-size: 12px; font-weight: 700; padding: 8px 14px; border-radius: 8px; border: 1px solid #cbd5e1; cursor: pointer; }
.ee-btn-ghost:hover { background: #f8fafc; }

.ee-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ee-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px rgba(15,23,42,.05); display: flex; flex-direction: column; gap: 10px; }
.ee-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ee-card-title { font-weight: 800; color: #0f172a; font-size: 14px; line-height: 1.2; }
.ee-card-sub { font-size: 10px; color: #94a3b8; margin-top: 2px; }
.ee-badge { font-size: 9px; font-weight: 800; padding: 3px 8px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.ee-badge.ok { background: #dcfce7; color: #15803d; }
.ee-badge.draft { background: #f1f5f9; color: #64748b; }
.ee-badge.ver { background: #ede9fe; color: #6d28d9; }
.ee-card-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ee-card-metrics > div { background: #f8fafc; border-radius: 8px; padding: 6px 8px; }
.ee-card-metrics span { display: block; font-size: 9px; color: #94a3b8; text-transform: uppercase; letter-spacing: .3px; }
.ee-card-metrics b { font-size: 13px; color: #0f172a; }
.ee-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-top: 1px solid #f1f5f9; padding-top: 8px; }
.ee-card-cta { margin-top: 2px; }
.ee-mini { font-size: 10px; color: #94a3b8; }
.ee-lnk { font-size: 10px; font-weight: 700; color: #475569; background: #f1f5f9; border: none; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.ee-lnk:hover { background: #e2e8f0; }
.ee-lnk.ok { background: #dcfce7; color: #15803d; }
.ee-lnk.del { background: #fef2f2; color: #dc2626; }

/* editor */
.ee-editor { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px; }
.ee-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ee-lock-banner { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; font-size: 11px; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }
.ee-ro .ee-input, .ee-ro .ee-cell { background: #f8fafc; }
.ee-sec { border: 1px solid #eef2f7; border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.ee-sec-h { background: #f8fafc; padding: 8px 12px; font-size: 12px; font-weight: 800; color: #334155; display: flex; justify-content: space-between; align-items: center; }
.ee-hint { font-size: 9px; font-weight: 600; color: #94a3b8; }
.ee-sec-b { padding: 12px; }
.ee-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.ee-fld { display: flex; flex-direction: column; gap: 3px; }
.ee-fld > span { font-size: 10px; font-weight: 700; color: #64748b; }
.ee-input { border: 1px solid #cbd5e1; border-radius: 8px; padding: 7px 9px; font-size: 13px; width: 100%; background: #fff; }
.ee-input:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124,58,237,.12); }

.ee-tblwrap { overflow-x: auto; margin-bottom: 8px; }
.ee-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.ee-tbl th { background: #f8fafc; text-align: left; padding: 6px 8px; font-size: 10px; font-weight: 700; color: #64748b; white-space: nowrap; border-bottom: 1px solid #e2e8f0; }
.ee-tbl td { padding: 4px 6px; border-bottom: 1px solid #f1f5f9; }
.ee-cell { border: 1px solid #e2e8f0; border-radius: 6px; padding: 5px 7px; font-size: 12px; width: 82px; }
.ee-cell.wide { width: 150px; }
.ee-cell.sm { width: 60px; }
.ee-cell:focus { outline: none; border-color: #7c3aed; }
.ee-rowdel { background: #fef2f2; color: #dc2626; border: none; border-radius: 6px; width: 24px; height: 24px; font-size: 12px; cursor: pointer; }
.ee-addrow { background: #f1f5f9; color: #475569; border: 1px dashed #cbd5e1; border-radius: 8px; padding: 6px 12px; font-size: 11px; font-weight: 700; cursor: pointer; }
.ee-addrow:hover { background: #e2e8f0; }

.ee-cost { display: grid; gap: 4px; max-width: 420px; }
.ee-cost-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; padding: 3px 0; }
.ee-cost-line span { color: #64748b; }
.ee-cost-line .ee-input { max-width: 140px; }
.ee-cost-total { display: flex; justify-content: space-between; border-top: 2px solid #e2e8f0; margin-top: 4px; padding-top: 8px; font-size: 14px; font-weight: 800; color: #0f172a; }

/* reason + simple modals */
.ee-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: flex; align-items: center; justify-content: center; z-index: 9999; padding: 16px; }
.ee-modal { background: #fff; border-radius: 16px; width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.ee-modal-h { font-size: 15px; font-weight: 800; color: #0f172a; padding: 16px 18px 8px; }
.ee-modal-h .req { color: #dc2626; }
.ee-modal-body, .ee-modal .ee-fld, .ee-diffs, .ee-capture { padding-left: 18px; padding-right: 18px; }
.ee-modal-body { padding-bottom: 8px; }
.ee-modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.ee-diffs { display: grid; gap: 4px; margin-bottom: 10px; }
.ee-diff { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 6px 10px; font-size: 11px; display: flex; justify-content: space-between; gap: 10px; }
.ee-diff span { color: #92400e; }
.ee-diff b { color: #0f172a; }
.ee-capture { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 8px 0; }
.ee-chip { display: inline-flex; align-items: center; gap: 4px; background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 999px; padding: 6px 12px; font-size: 11px; font-weight: 700; color: #475569; cursor: pointer; }
.ee-chip:hover { background: #e2e8f0; }
.ee-chip.on { background: #dcfce7; border-color: #86efac; color: #15803d; }
.ee-chip.rec { background: #fef2f2; border-color: #fca5a5; color: #dc2626; animation: eePulse 1s infinite; }
@keyframes eePulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
.ee-cap-status { font-size: 10px; color: #94a3b8; }
.ee-ver-row { border-bottom: 1px solid #f1f5f9; padding: 8px 0; font-size: 12px; }
.ee-ver-row b { color: #0f172a; }
.ee-tag { background: #ede9fe; color: #6d28d9; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.ee-media { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ee-mchip { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 4px 9px; font-size: 10px; color: #475569; text-decoration: none; }

/* compare & variance */
.ee-cmpwrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; }
.ee-cmp { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 560px; }
.ee-cmp th { background: #f8fafc; padding: 9px 12px; font-size: 11px; font-weight: 800; color: #334155; text-align: left; position: sticky; top: 0; border-bottom: 2px solid #e2e8f0; }
.ee-cmp th:first-child, .ee-cmp td:first-child { position: sticky; left: 0; background: #fff; z-index: 1; }
.ee-cmp th:first-child { background: #f8fafc; z-index: 2; }
.ee-cmp td { padding: 8px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.ee-vlabel { font-weight: 700; color: #334155; white-space: nowrap; }
.ee-cmp-total td { background: #f8fafc; font-weight: 800; }
.ee-sub { display: block; font-size: 10px; margin-top: 1px; }
.ee-vg { color: #16a34a; font-weight: 700; }
.ee-vr { color: #dc2626; font-weight: 700; }
.ee-v0 { color: #94a3b8; }
.ee-legend { font-size: 10px; color: #64748b; margin-top: 8px; text-align: center; }

/* dashboard */
.ee-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ee-kpi { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px; }
.ee-kpi span { font-size: 10px; color: #94a3b8; text-transform: uppercase; letter-spacing: .3px; }
.ee-kpi b { display: block; font-size: 20px; font-weight: 800; color: #0f172a; margin-top: 2px; }
.ee-kpi i { font-size: 10px; font-style: normal; color: #64748b; }
.ee-kpi.bad b, .ee-kpi.bad i { color: #dc2626; }
.ee-kpi.good b, .ee-kpi.good i { color: #16a34a; }
.ee-dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.ee-dashcard { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; }
.ee-dashcard-h { font-size: 12px; font-weight: 800; color: #334155; margin-bottom: 10px; }
.ee-barrow { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ee-barlbl { font-size: 10px; color: #475569; width: 110px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ee-bartrack { flex: 1; height: 14px; background: #f1f5f9; border-radius: 7px; overflow: hidden; }
.ee-barfill { display: block; height: 100%; border-radius: 7px; }
.ee-barval { font-size: 11px; font-weight: 700; color: #0f172a; width: 54px; text-align: right; flex-shrink: 0; }

/* insights */
.ee-ins-list { display: grid; gap: 10px; }
.ee-ins { display: flex; gap: 12px; background: #fff; border: 1px solid #e2e8f0; border-left-width: 4px; border-radius: 12px; padding: 12px 14px; }
.ee-ins.good { border-left-color: #16a34a; }
.ee-ins.warn { border-left-color: #d97706; }
.ee-ins.bad { border-left-color: #dc2626; }
.ee-ins.info { border-left-color: #2563eb; }
.ee-ins-ic { font-size: 20px; flex-shrink: 0; }
.ee-ins-t { font-size: 13px; font-weight: 800; color: #0f172a; }
.ee-ins-b { font-size: 11px; color: #475569; margin-top: 2px; }
.ee-ins-a { font-size: 11px; color: #7c3aed; font-weight: 600; margin-top: 4px; }

@media (max-width: 640px) {
  .ee-editor { padding: 12px; }
  .ee-card-metrics { grid-template-columns: repeat(3, 1fr); }
  .ee-input, .ee-cell { font-size: 16px; }
  .ee-barlbl { width: 84px; }
}

/* Execution engine — labour assignment board */
.ee-short td { background: #fef2f2; }
.ee-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.ee-wchip { display: inline-flex; align-items: center; gap: 6px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 999px; padding: 4px 6px 4px 12px; font-size: 12px; font-weight: 700; color: #15803d; }
.ee-wchip i { font-style: normal; font-weight: 500; font-size: 10px; color: #16a34a; }
.ee-wassign { border: 1px solid #bbf7d0; border-radius: 999px; padding: 2px 6px; font-size: 10px; background: #fff; color: #15803d; cursor: pointer; }
.ee-need-row { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f5f9; }
.ee-need-t { font-size: 12px; font-weight: 700; color: #334155; width: 120px; flex-shrink: 0; }
.ee-need-chips { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.ee-achip { display: inline-flex; align-items: center; gap: 4px; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 999px; padding: 2px 4px 2px 10px; font-size: 11px; font-weight: 600; color: #1d4ed8; }
.ee-achip button { background: #dbeafe; border: none; border-radius: 999px; width: 18px; height: 18px; font-size: 10px; color: #1d4ed8; cursor: pointer; }

/* ═══════════════════════════════════════════════════════════
 * Measurement Sheet — Grouped View (premium redesign)
 * Scoped to #groupedEntryContainer. Preserves all g-* JS hooks.
 * ═══════════════════════════════════════════════════════════ */
#groupedEntryContainer{
  font-family:-apple-system,BlinkMacSystemFont,'SF Pro Text','Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --msg-acc:#4f46e5; --msg-acc2:#7c3aed; --msg-ink:#0f172a; --msg-sub:#475569;
  --msg-mut:#94a3b8; --msg-line:#eceff4; --msg-surface:#ffffff; --msg-tint:#f6f7fb;
}
#groupedEntryContainer .g-items{ width:100%; }

/* ── item card ── */
.msg-item{
  background:var(--msg-surface); border:1px solid var(--msg-line); border-radius:18px;
  margin-bottom:18px; overflow:hidden;
  box-shadow:0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.02);
  transition:box-shadow .28s cubic-bezier(.2,.7,.3,1), transform .28s cubic-bezier(.2,.7,.3,1), border-color .28s;
}
.msg-item:hover{ transform:translateY(-1px); border-color:#e4e8f0; box-shadow:0 1px 2px rgba(16,24,40,.04), 0 18px 44px -22px rgba(16,24,40,.24); }
.msg-item:focus-within{ border-color:#dad6fb; box-shadow:0 1px 2px rgba(16,24,40,.04), 0 20px 48px -22px rgba(79,70,229,.34); }

/* ── header ── */
.msg-head{ display:flex; align-items:center; gap:14px; padding:16px 18px 14px; }
.msg-num{
  width:30px; height:30px; border-radius:9px; flex-shrink:0;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:800; font-size:13px; font-variant-numeric:tabular-nums;
  background:linear-gradient(135deg,#6366f1,#7c3aed); box-shadow:0 4px 10px -3px rgba(99,102,241,.55);
}
.msg-idfields{ display:flex; align-items:center; gap:10px; flex:1; min-width:0; flex-wrap:wrap; }
.msg-code{
  width:118px; font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-weight:700; font-size:12px; letter-spacing:.5px; text-transform:uppercase; color:var(--msg-acc);
  background:#f5f5ff; border:1px solid #e8e8fc; border-radius:9px; padding:8px 10px; outline:none; transition:.18s;
}
.msg-code::placeholder{ color:#b9b9e6; }
.msg-code:focus{ background:#fff; border-color:var(--msg-acc); box-shadow:0 0 0 3px rgba(79,70,229,.13); }
.msg-desc{
  flex:1; min-width:200px; font-size:16px; font-weight:650; color:var(--msg-ink);
  border:none; border-bottom:2px solid transparent; background:transparent; padding:6px 4px; outline:none; transition:.18s;
}
.msg-desc::placeholder{ color:#c3cad6; font-weight:500; }
.msg-desc:focus{ border-bottom-color:var(--msg-acc); }
.msg-unit{
  width:78px; text-align:center; font-size:12px; font-weight:700; color:var(--msg-sub);
  background:var(--msg-tint); border:1px solid var(--msg-line); border-radius:9px; padding:8px; outline:none; transition:.18s;
}
.msg-unit::placeholder{ color:#b8c0cd; }
.msg-unit:focus{ background:#fff; border-color:var(--msg-acc); box-shadow:0 0 0 3px rgba(79,70,229,.13); }
.msg-head-actions{ display:flex; gap:6px; flex-shrink:0; }
.msg-iconbtn{
  width:32px; height:32px; border-radius:9px; border:1px solid var(--msg-line); background:#fff; color:#9aa4b2;
  font-size:14px; cursor:pointer; display:flex; align-items:center; justify-content:center; transition:.15s;
}
.msg-iconbtn:hover{ background:#f1f5f9; color:#475569; }
.msg-iconbtn.danger:hover{ background:#fef2f2; color:#ef4444; border-color:#fecaca; }

/* ── measurement table ── */
.msg-tablewrap{ overflow-x:auto; }
.msg-table{ width:100%; border-collapse:separate; border-spacing:0; min-width:560px; }
.msg-table thead th{
  background:#fbfbfd; padding:9px 12px; text-align:center;
  font-size:10px; font-weight:700; letter-spacing:.6px; text-transform:uppercase; color:#9aa4b2;
  border-top:1px solid var(--msg-line); border-bottom:1px solid var(--msg-line); white-space:nowrap;
}
.msg-table thead th.msg-th-desc{ text-align:left; }
.msg-table thead th.msg-th-qty{ color:var(--msg-acc); }
.msg-colclear{ opacity:0; margin-left:5px; border:none; background:none; color:#cbd5e1; cursor:pointer; font-size:10px; transition:.15s; }
.msg-table th:hover .msg-colclear{ opacity:1; }
.msg-colclear:hover{ color:#ef4444; }
.msg-line td{ padding:5px 8px; border-bottom:1px solid #f4f6f9; }
.msg-line:last-child td{ border-bottom:none; }
.msg-line:hover td{ background:#fafbfe; }
.msg-in{
  width:100%; height:38px; border:1px solid transparent; border-radius:9px; padding:0 10px;
  font-size:14px; color:var(--msg-ink); background:transparent; outline:none; transition:.15s; font-variant-numeric:tabular-nums;
}
.msg-in::placeholder{ color:#cbd5e1; }
.msg-in:hover{ background:#f5f7fb; }
.msg-in:focus{ background:#fff; border-color:var(--msg-acc); box-shadow:0 0 0 3px rgba(79,70,229,.12); }
.msg-num-in{ text-align:center; }
.msg-text-in{ text-align:left; font-weight:500; }
.msg-qty{
  width:100%; height:38px; text-align:center; font-weight:800; font-size:14px; color:var(--msg-acc);
  background:#f4f4ff; border:1px solid #e8e8fc; border-radius:9px; outline:none; font-variant-numeric:tabular-nums; transition:.15s;
}
.msg-qty:focus{ background:#fff; border-color:var(--msg-acc); box-shadow:0 0 0 3px rgba(79,70,229,.15); }
.msg-line-actions{ white-space:nowrap; text-align:center; }
.msg-linebtn{ width:28px; height:28px; border:none; background:none; border-radius:7px; cursor:pointer; font-size:14px; color:#cbd5e1; transition:.15s; }
.msg-linebtn.dup:hover{ background:#ecfdf5; color:#10b981; }
.msg-linebtn.del:hover{ background:#fef2f2; color:#ef4444; }

/* ── footer ── */
.msg-foot{
  display:flex; align-items:center; justify-content:space-between; gap:14px; flex-wrap:wrap;
  padding:12px 18px 15px; border-top:1px solid var(--msg-line); background:linear-gradient(180deg,#fcfcfe,#fafbfd);
}
.msg-foot-left{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.msg-addline{
  display:inline-flex; align-items:center; gap:6px; font-size:13px; font-weight:700; color:var(--msg-acc);
  background:#f2f2ff; border:1px solid #e8e8fc; border-radius:10px; padding:8px 14px; cursor:pointer; transition:.18s;
}
.msg-addline:hover{ background:var(--msg-acc); color:#fff; box-shadow:0 8px 16px -5px rgba(79,70,229,.5); transform:translateY(-1px); }
.msg-fill{ display:flex; align-items:center; gap:5px; font-size:11px; color:#94a3b8; padding-left:12px; border-left:1px solid var(--msg-line); }
.msg-fill-lbl{ font-weight:600; }
.msg-fill input{ width:46px; height:30px; border:1px solid var(--msg-line); border-radius:8px; text-align:center; font-size:12px; outline:none; background:#fff; transition:.15s; }
.msg-fill input:focus{ border-color:var(--msg-acc); box-shadow:0 0 0 3px rgba(79,70,229,.1); }
.msg-fill-apply{ height:30px; padding:0 12px; border:none; border-radius:8px; background:#0f172a; color:#fff; font-size:11px; font-weight:700; cursor:pointer; transition:.15s; }
.msg-fill-apply:hover{ background:#1e293b; }
.msg-fill-clear{ border:none; background:none; color:#94a3b8; font-size:11px; font-weight:600; cursor:pointer; padding:4px 6px; }
.msg-fill-clear:hover{ color:#ef4444; }
.msg-total{ display:flex; align-items:baseline; gap:8px; }
.msg-total-lbl{ font-size:11px; font-weight:600; color:#94a3b8; text-transform:uppercase; letter-spacing:.5px; }
.msg-total-val{ font-size:22px; font-weight:800; color:var(--msg-ink); font-variant-numeric:tabular-nums; letter-spacing:-.5px; }
.msg-total-uom{ font-size:13px; font-weight:600; color:#94a3b8; }

@media (max-width:640px){
  .msg-in, .msg-qty, .msg-code, .msg-desc, .msg-unit{ font-size:16px; }
  .msg-head{ gap:10px; padding:14px; align-items:flex-start; }
  .msg-idfields{ gap:8px; }
  .msg-code{ width:auto; flex:0 1 auto; max-width:52%; order:1; }
  .msg-unit{ width:72px; flex:0 0 auto; order:2; }
  .msg-desc{ order:3; flex:1 1 100%; min-width:0; width:100%; }
  .msg-num{ margin-top:3px; }
  .msg-head-actions{ margin-top:1px; }
}

/* ═══════════════════════════════════════════════════════════
 * Schedule Builder (scheduleBuilder.js) — drag-drop location schedule
 * ═══════════════════════════════════════════════════════════ */
.sb-wrap{ font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; }
.sb-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.sb-empty{ text-align:center; padding:48px 16px; color:#64748b; }
.sb-btn-primary{ background:#0ea5e9; color:#fff; font-size:12px; font-weight:700; padding:8px 16px; border-radius:9px; border:none; cursor:pointer; }
.sb-btn-primary:hover{ background:#0284c7; }
.sb-btn-ok{ background:#16a34a; color:#fff; font-size:12px; font-weight:700; padding:8px 14px; border-radius:9px; border:none; cursor:pointer; }
.sb-btn-ok:hover{ background:#15803d; }
.sb-btn-ghost{ background:#fff; color:#475569; font-size:12px; font-weight:700; padding:8px 14px; border-radius:9px; border:1px solid #cbd5e1; cursor:pointer; }
.sb-btn-ghost:hover{ background:#f8fafc; }
.sb-mini{ font-size:11px; color:#94a3b8; }

.sb-body{ display:grid; grid-template-columns:250px 1fr; gap:16px; align-items:start; }

/* palette */
.sb-palette{ background:#fff; border:1px solid #e2e8f0; border-radius:14px; padding:12px; position:sticky; top:8px; }
.sb-pal-head{ font-size:12px; font-weight:800; color:#334155; margin-bottom:8px; }
.sb-search{ width:100%; border:1px solid #cbd5e1; border-radius:8px; padding:7px 10px; font-size:13px; outline:none; margin-bottom:8px; }
.sb-search:focus{ border-color:#0ea5e9; box-shadow:0 0 0 3px rgba(14,165,233,.12); }
.sb-cats{ display:flex; flex-wrap:wrap; gap:4px; margin-bottom:10px; }
.sb-cat{ font-size:10px; font-weight:700; color:#64748b; background:#f1f5f9; border:none; border-radius:999px; padding:4px 9px; cursor:pointer; }
.sb-cat.active{ background:#0ea5e9; color:#fff; }
.sb-pal-list{ display:flex; flex-direction:column; gap:6px; max-height:62vh; overflow-y:auto; }
.sb-chip{ display:flex; align-items:center; gap:8px; background:#f8fafc; border:1px solid #e2e8f0; border-radius:10px; padding:8px 10px; cursor:grab; transition:.14s; }
.sb-chip:hover{ background:#eff6ff; border-color:#bfdbfe; transform:translateX(2px); }
.sb-chip:active{ cursor:grabbing; }
.sb-chip-ic{ font-size:16px; flex-shrink:0; }
.sb-chip-nm{ font-size:12px; font-weight:600; color:#334155; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* location tabs */
.sb-main{ min-width:0; }
.sb-loctabs{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom:12px; }
.sb-loctab{ display:flex; align-items:center; gap:6px; background:#fff; border:1px solid #e2e8f0; border-radius:10px; padding:7px 12px; cursor:pointer; transition:.14s; }
.sb-loctab:hover{ border-color:#bae6fd; }
.sb-loctab.active{ border-color:#0ea5e9; box-shadow:0 0 0 3px rgba(14,165,233,.12); }
.sb-loctab-nm{ font-size:13px; font-weight:700; color:#0f172a; }
.sb-loctab-ct{ font-size:10px; font-weight:700; color:#0ea5e9; background:#e0f2fe; border-radius:999px; padding:1px 7px; }
.sb-loctab-actions{ display:flex; gap:2px; }
.sb-loctab-actions button{ border:none; background:none; cursor:pointer; font-size:12px; padding:2px 3px; border-radius:5px; }
.sb-loctab-actions button:hover{ background:#f1f5f9; }

/* zone */
.sb-zonebar{ display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.sb-startfld{ font-size:11px; font-weight:700; color:#64748b; display:flex; align-items:center; gap:6px; }
.sb-startfld input{ border:1px solid #cbd5e1; border-radius:8px; padding:6px 8px; font-size:13px; }
.sb-zone{ background:#f8fafc; border:1.5px dashed #cbd5e1; border-radius:14px; padding:12px; min-height:200px; display:flex; flex-direction:column; gap:8px; transition:.14s; }
.sb-zone.sb-over{ border-color:#0ea5e9; background:#eff6ff; }
.sb-zone-empty, .sb-zone-tail{ text-align:center; color:#94a3b8; font-size:12px; font-weight:600; padding:20px; border:1.5px dashed #d7dee7; border-radius:10px; }
.sb-zone-tail{ padding:10px; }
.sb-zone-empty.sb-over, .sb-zone-tail.sb-over{ border-color:#0ea5e9; color:#0ea5e9; background:#e0f2fe; }
.sb-task{ display:flex; align-items:center; gap:10px; background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:10px 12px; box-shadow:0 1px 2px rgba(15,23,42,.04); cursor:grab; transition:.14s; }
.sb-task:hover{ box-shadow:0 6px 16px -8px rgba(15,23,42,.22); }
.sb-task.sb-over{ border-color:#0ea5e9; box-shadow:0 -3px 0 #0ea5e9 inset; }
.sb-task-seq{ width:22px; height:22px; border-radius:7px; background:#0f172a; color:#fff; font-size:11px; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.sb-task-ic{ font-size:20px; flex-shrink:0; }
.sb-task-main{ flex:1; min-width:0; }
.sb-task-nm{ font-size:14px; font-weight:700; color:#0f172a; display:flex; align-items:center; gap:8px; }
.sb-dup{ font-size:9px; font-weight:700; color:#b45309; background:#fef3c7; border:1px solid #fde68a; border-radius:999px; padding:1px 7px; text-transform:uppercase; letter-spacing:.3px; }
.sb-task-fields{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-top:5px; }
.sb-task-fields label{ display:flex; align-items:center; gap:4px; font-size:10px; font-weight:700; color:#94a3b8; text-transform:uppercase; letter-spacing:.3px; }
.sb-in{ border:1px solid #e2e8f0; border-radius:7px; padding:4px 6px; font-size:12px; font-weight:600; color:#0f172a; outline:none; }
.sb-in:focus{ border-color:#0ea5e9; box-shadow:0 0 0 3px rgba(14,165,233,.1); }
.sb-in[type=number]{ width:48px; text-align:center; }
.sb-in-date{ font-family:inherit; }
.sb-end{ font-size:11px; font-weight:700; color:#0ea5e9; text-transform:none; letter-spacing:0; }
.sb-task-del{ width:26px; height:26px; border:none; background:#fef2f2; color:#ef4444; border-radius:7px; cursor:pointer; font-size:12px; flex-shrink:0; }
.sb-task-del:hover{ background:#fee2e2; }

@media (max-width:820px){
  .sb-body{ grid-template-columns:1fr; }
  .sb-palette{ position:static; }
  .sb-pal-list{ max-height:none; flex-direction:row; flex-wrap:wrap; }
  .sb-chip{ flex:0 0 auto; }
  .sb-in, .sb-search{ font-size:16px; }
}

/* Schedule Builder — Save button (deferred sync) */
.sb-btn-save{ background:#fff; color:#16a34a; font-size:12px; font-weight:700; padding:8px 14px; border-radius:9px; border:1px solid #bbf7d0; cursor:pointer; transition:.15s; }
.sb-btn-save:hover{ background:#f0fdf4; }
.sb-btn-save.sb-dirty{ background:#16a34a; color:#fff; border-color:#16a34a; box-shadow:0 4px 12px -3px rgba(22,163,74,.5); animation:sbPulse 1.6s ease-in-out infinite; }
@keyframes sbPulse{ 0%,100%{ box-shadow:0 4px 12px -3px rgba(22,163,74,.5); } 50%{ box-shadow:0 4px 18px -2px rgba(22,163,74,.75); } }
