@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

/* ═══════════════════════════════════════════════════════════════
   Lilo Expenses CRM — v7 Bold Handwriting UI
   ═══════════════════════════════════════════════════════════════ */
:root {
  --lilo-sidebar-bg: #ffffff;
  --lilo-sidebar-w:  220px;
  --lilo-accent:     #3b82f6;
  --lilo-header-h:   52px;
  --lilo-font:       'Inter', sans-serif;
  --lilo-sys-font:   'Inter', sans-serif;
  --lilo-text:       #1e293b;
  --lilo-muted:      #64748b;
  --lilo-border:     #e2e8f0;
  --lilo-bg:         #f8fafc;
  --lilo-card-bg:    #ffffff;
}

/* ── Base ───────────────────────────────────────────────────────── */
.lilo-wrap {
  position: relative; min-height: 100vh;
  font-family: 'Inter', sans-serif;
  font-size: 15px; color: var(--lilo-text);
  background: var(--lilo-bg);
}
.lilo-wrap * { box-sizing: border-box; }
.lilo-sys { font-family: var(--lilo-sys-font) !important; }

/* ── Sidebar — light/white theme (v20) ─────────────────────────── */
/* Pinned to the viewport (not the page content) so it never stretches to
   match a long page's height — only the main content area scrolls, the
   sidebar itself stays a fixed height and position the whole time. */
.lilo-wrap .main-sidebar {
  position: fixed; top: 0; left: 0; height: 100vh;
  width: var(--lilo-sidebar-w);
  background: var(--lilo-sidebar-bg);
  border-right: 1px solid var(--lilo-border);
  z-index: 100; overflow-y: auto;
}
.lilo-wrap .brand-link {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid var(--lilo-border);
  color: var(--lilo-text) !important; text-decoration: none;
}
.lilo-wrap .brand-link strong {
  font-family: 'Inter', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--lilo-text); line-height: 1.1; letter-spacing: .2px;
}
.lilo-wrap .brand-link small {
  font-family: 'Inter', sans-serif;
  font-size: 11px; letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--lilo-muted); display: block;
}
.nav-section-label {
  font-family: var(--lilo-sys-font);
  font-size: 9px; font-weight: 700;
  letter-spacing: 1.3px; text-transform: uppercase;
  color: #94a3b8;
  padding: 7px 16px 2px;
  margin-top: 0;
}
.lilo-wrap .nav-item { margin: 1px 6px; }
.lilo-wrap .lilo-nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 10px; border-radius: 8px;
  color: #64748b !important;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px; font-weight: 500;
  transition: all .15s; text-decoration: none;
}
.lilo-wrap .lilo-nav-link:hover { background: #f1f5f9; color: #1e293b !important; }
.lilo-wrap .lilo-nav-link.active {
  background: #eff6ff !important;
  color: #1d4ed8 !important;
  font-weight: 600;
  box-shadow: inset 2px 0 0 #3b82f6;
}
.lilo-wrap .lilo-nav-link .nav-icon { width: 17px; font-size: 13px; text-align: center; opacity: .85; }
.lilo-wrap .lilo-nav-link p { margin: 0; line-height: 1; }

/* ── Top navbar ─────────────────────────────────────────────────── */
.lilo-wrap .content-wrapper { margin-left: var(--lilo-sidebar-w); min-height: 100vh; background: var(--lilo-bg); }
.lilo-wrap .main-header {
  position: sticky; top: 0; z-index: 90;
  height: var(--lilo-header-h);
  background: #fff; border-bottom: 1px solid var(--lilo-border);
  display: flex; align-items: center; padding: 0 18px;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,.03);
}
#lilo-page-title {
  font-family: 'Inter', sans-serif !important;
  font-size: 26px !important; font-weight: 700 !important;
  color: var(--lilo-text);
}
#lilo-project-filter {
  font-family: var(--lilo-sys-font);
  border: 1px solid var(--lilo-border); border-radius: 6px;
  padding: 4px 10px; font-size: 12px;
  background: #f8fafc; color: var(--lilo-text);
}

/* ── Content ────────────────────────────────────────────────────── */
.lilo-wrap .content { padding: 14px 18px; }

/* ── Stat boxes — flat, soft, modern (v20) ─────────────────────── */
.lilo-stat-box {
  background: var(--lilo-card-bg);
  border-radius: 12px; border: 1px solid var(--lilo-border);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: box-shadow .2s, transform .15s;
}
.lilo-stat-box:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); transform: translateY(-1px); }
.lilo-stat-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.lilo-stat-icon.blue  { background: #dbeafe; color: #1d4ed8; }
.lilo-stat-icon.red   { background: #fee2e2; color: #b91c1c; }
.lilo-stat-icon.green { background: #dcfce7; color: #15803d; }
.lilo-stat-icon.amber { background: #fef3c7; color: #b45309; }
.lilo-stat-label {
  font-family: var(--lilo-sys-font);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--lilo-muted); margin-bottom: 2px; white-space: nowrap;
}
.lilo-stat-value {
  font-family: 'Inter', sans-serif;
  font-size: 17px; font-weight: 800;
  color: var(--lilo-text); line-height: 1.1; white-space: nowrap;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.lilo-wrap .card {
  background: var(--lilo-card-bg);
  border: 1px solid var(--lilo-border);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
  margin-bottom: 12px;
}
.lilo-wrap .card-header {
  padding: 9px 14px; border-bottom: 1px solid var(--lilo-border);
  background: #fff; border-radius: 10px 10px 0 0;
  display: flex; align-items: center; justify-content: space-between;
}
.lilo-wrap .card-title {
  font-family: 'Inter', sans-serif !important;
  font-size: 17px !important; font-weight: 700 !important;
  color: var(--lilo-text) !important; margin: 0 !important;
}
.lilo-wrap .card-body { padding: 10px 14px; }
.lilo-wrap .card-body.p-0 { padding: 0; }

/* ── Tables ─────────────────────────────────────────────────────── */
.lilo-wrap .table { font-size: 14px; margin: 0; width: 100%; }
.lilo-wrap .table th {
  font-family: var(--lilo-sys-font);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  color: var(--lilo-muted); white-space: nowrap;
  padding: 7px 10px; border-bottom: 2px solid var(--lilo-border);
  background: #f8fafc;
}
.lilo-wrap .table td {
  font-family: 'Inter', sans-serif;
  font-size: 15px; padding: 6px 10px;
  vertical-align: middle; border-bottom: 1px solid #f1f5f9;
}
.lilo-wrap .table tbody tr:hover td { background: #f8fafc; }
.lilo-wrap .table tbody tr:last-child td { border-bottom: none; }

/* ── Buttons ────────────────────────────────────────────────────── */
.lilo-wrap .btn {
  font-family: 'Inter', sans-serif;
  font-size: 15px; font-weight: 600;
  border-radius: 7px; padding: 4px 14px;
}
.lilo-wrap .btn-sm { padding: 3px 11px; font-size: 14px; }
.lilo-wrap .btn-xs { padding: 2px 8px; font-size: 13px; border-radius: 5px; }

/* ── Status badges ──────────────────────────────────────────────── */
.badge-paid    { background:#dcfce7; color:#15803d; padding:3px 11px; border-radius:20px; font-size:12px; font-weight:700; font-family:'Inter',sans-serif; letter-spacing:.2px; }
.badge-partial { background:#fff7ed; color:#c2410c; padding:3px 11px; border-radius:20px; font-size:12px; font-weight:700; font-family:'Inter',sans-serif; letter-spacing:.2px; }
.badge-unpaid  { background:#fef2f2; color:#b91c1c; padding:3px 11px; border-radius:20px; font-size:12px; font-weight:700; font-family:'Inter',sans-serif; letter-spacing:.2px; }

/* ── Category badges ────────────────────────────────────────────── */
.cat-badge { display:inline-block; padding:2px 8px; border-radius:5px; font-size:13px; font-weight:700; font-family: 'Inter', sans-serif; white-space:nowrap; }

/* ── Amounts ────────────────────────────────────────────────────── */
.amount-red   { color:#dc2626; font-weight:700; }
.amount-green { color:#16a34a; font-weight:700; }
.amount-blue  { color:#2563eb; font-weight:700; }
.bal-positive { color:#15803d; font-weight:700; }
.bal-negative { color:#b91c1c; font-weight:700; }

/* ── Form controls ──────────────────────────────────────────────── */
.lilo-wrap .form-control, .lilo-wrap .form-select {
  font-family: var(--lilo-sys-font);
  font-size: 13px; padding: 5px 10px;
  border: 1px solid #cbd5e1; border-radius: 6px; height: auto;
}
.lilo-wrap .form-control:focus, .lilo-wrap .form-select:focus {
  border-color: var(--lilo-accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.lilo-wrap .form-group { margin-bottom: 10px; }
.lilo-wrap .form-group label {
  font-family: var(--lilo-sys-font);
  font-size: 11px; font-weight: 700; color: var(--lilo-muted);
  margin-bottom: 3px; display: block;
  text-transform: uppercase; letter-spacing: .4px;
}

/* ── Payments ledger ────────────────────────────────────────────── */
.payments-tabs-bar {
  position: sticky; top: var(--lilo-header-h); z-index: 80;
  background: #fff; border-bottom: 1px solid var(--lilo-border);
  padding: 6px 14px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.payments-tabs-bar .nav-tabs { border: none; gap: 4px; display: flex; }
.payments-tabs-bar .nav-tabs .nav-link {
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 600;
  padding: 4px 16px; border-radius: 7px;
  border: 1.5px solid var(--lilo-border);
  color: var(--lilo-muted); background: #f8fafc;
}
.payments-tabs-bar .nav-tabs .nav-link.active {
  background: var(--lilo-accent); color: #fff; border-color: var(--lilo-accent);
}
.opening-bal-input { display: flex; align-items: center; gap: 6px; }
.opening-bal-input label { font-family: var(--lilo-sys-font); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--lilo-muted); margin: 0; }
.opening-bal-input input { font-family: var(--lilo-sys-font); width: 110px; padding: 3px 8px; border: 1.5px solid var(--lilo-border); border-radius: 6px; font-size: 13px; }
.btn-save-ob { font-family: var(--lilo-sys-font) !important; padding: 3px 10px !important; font-size: 11px !important; font-weight: 700 !important; }

/* Ledger — sticky header, no internal height cap so the page scrolls
   naturally (matches the Follow-up Tracker table behaviour) instead of
   cutting rows off inside a small fixed-height box. */
.lilo-ledger-wrap { overflow-x: auto; }
.lilo-ledger { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 1020px; }
.lilo-ledger thead th {
  position: sticky; top: 0; z-index: 10;
  background: #1e293b; color: rgba(255,255,255,.85);
  padding: 6px 5px; white-space: nowrap;
  font-family: var(--lilo-sys-font);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
  border-right: 1px solid rgba(255,255,255,.08);
}
/* ─ Compact single-line rows ─ */
.lilo-ledger tbody td {
  padding: 3px 5px;
  border-bottom: 1px solid #f1f5f9;
  font-family: 'Inter', sans-serif;
  font-size: 12px; font-weight: 500;
  vertical-align: middle;
  white-space: nowrap;
  line-height: 1;
  height: 30px; max-height: 30px; overflow: hidden;
}
.lilo-ledger tbody tr:hover td { background: #eff6ff; }
.lilo-ledger tbody tr.credit-row td { background: #f0fdf4; }
.opening-bal-row td { background: #eff6ff !important; font-weight: 700; color: #1e40af; }

/* Add row — sits directly under the dark header with a matching dark-to-amber
   transition so it doesn't visually "jump" against the navy header above it */
.lilo-ledger thead tr.add-row th,
.lilo-ledger thead tr.add-row td {
  background: #fef3c7 !important;
  border-top: 2px solid #1e293b !important;
  border-bottom: 2px solid #f59e0b !important;
  padding: 6px 4px !important;
  height: 56px !important;
  max-height: none !important;
  position: sticky;
  top: 33px; /* sits just below the header row */
  z-index: 9;
  vertical-align: middle !important;
}
.lilo-ledger thead tr.add-row input,
.lilo-ledger thead tr.add-row select {
  width: 100%; padding: 5px 6px;
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  font-family: 'Inter', sans-serif;
  border: 1.5px solid #d4a017; border-radius: 5px; background: #fff;
  height: 34px; line-height: 1;
}
.lilo-ledger thead tr.add-row input::placeholder { color: #92732c; font-weight: 600; }
.lilo-ledger thead tr.add-row select { font-weight: 700 !important; color: #111827 !important; }
.btn-save-row {
  padding: 6px 14px; font-size: 13px; font-family: 'Inter', sans-serif;
  background: #22c55e; color: #fff; border: none; border-radius: 6px;
  cursor: pointer; font-weight: 800; white-space:nowrap;
}
.btn-save-row:hover { background: #16a34a; }
.voucher-thumb { width: 20px; height: 20px; object-fit: cover; border-radius: 3px; cursor: pointer; border: 1px solid var(--lilo-border); }
.btn-upload-voucher { background: none; border: none; cursor: pointer; padding: 1px; font-size: 14px; color: #3b82f6; }

/* ── Add Cash — single-line inline ─────────────────────────────── */
.add-cash-cell { padding: 0 3px !important; vertical-align: middle !important; }
.add-cash-wrap { display: flex; align-items: center; gap: 2px; white-space: nowrap; }
.add-cash-input {
  width: 50px; font-size: 10px; padding: 1px 3px; height: 19px;
  border: 1px solid #bae6fd; border-radius: 3px;
  background: #f0f9ff; color: #0c4a6e; outline: none;
}
.add-cash-input:focus { border-color: #3b82f6; background: #fff; }
.add-cash-btn {
  width: 19px; height: 19px; border: none; border-radius: 3px;
  background: #3b82f6; color: #fff; font-size: 9px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.add-cash-btn:hover { background: #2563eb; }
.add-cash-saved { font-size: 9px; color: #16a34a; font-weight: 700; white-space: nowrap; }

/* Yan Cash & colours */
.yan-cash-cell { font-weight: 700 !important; font-size: 12px !important; }
.bal-positive  { color: #16a34a !important; }
.bal-negative  { color: #dc2626 !important; }
.amount-red    { color: #dc2626 !important; font-weight: 600; }
.amount-green  { color: #16a34a !important; font-weight: 600; }

/* ── Quick action buttons ───────────────────────────────────────── */
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 14px 8px; border-radius: 10px;
  border: 1px solid var(--lilo-border); background: #fff;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600; color: var(--lilo-text);
  cursor: pointer; transition: all .15s; text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.quick-action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.quick-action-btn i { font-size: 20px; }

/* ── DataTables ─────────────────────────────────────────────────── */
.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { font-family: var(--lilo-sys-font); font-size: 12px; }
.dataTables_wrapper .dataTables_paginate .paginate_button { padding: 2px 8px !important; font-size: 12px !important; border-radius: 4px !important; }
.dataTables_wrapper { padding: 8px 14px; }
.dataTables_wrapper .row { margin: 0; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { padding: 6px 0 0; }
.dataTables_wrapper .dataTables_info, .dataTables_wrapper .dataTables_paginate { padding: 6px 0; }

/* ── Modals ─────────────────────────────────────────────────────── */
.modal-backdrop { z-index: 1050 !important; }
.modal { z-index: 1055 !important; }
.lilo-wrap .modal-content { border-radius: 12px; border: none; box-shadow: 0 20px 60px rgba(0,0,0,.2); font-family: 'Inter', sans-serif; }
.lilo-wrap .modal-header { padding: 12px 16px; border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--lilo-border); }
.lilo-wrap .modal-title { font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 700; }
.lilo-wrap .modal-body { padding: 14px 16px; }
.lilo-wrap .modal-footer { padding: 10px 16px; border-top: 1px solid var(--lilo-border); }
.modal-header .btn-close { opacity:.5; cursor:pointer; background:transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23000'%3e%3cpath d='M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z'/%3e%3c/svg%3e") center/1em no-repeat; border:0; border-radius:.25rem; width:1em; height:1em; padding:.25em; box-sizing:content-box; }
.modal-header .btn-close:hover { opacity:1; }
.modal-header.text-white .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ── List group ─────────────────────────────────────────────────── */
.list-group-item { padding: 8px 12px; font-family: 'Inter', sans-serif; font-size: 15px; border-color: #f1f5f9; }

/* ── Bills 3-col ────────────────────────────────────────────────── */
.bills-3col-wrap { display: flex; gap: 10px; align-items: flex-start; }
.bills-col-parties { width: 195px; flex-shrink: 0; }
.bills-col-table { flex: 1; min-width: 0; }

.bills-panel-card { margin-bottom: 0; border: 1px solid #e2e8f0; border-radius: 9px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.bills-panel-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 11px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.bills-panel-header-title { font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 700; color: #334155; display: flex; align-items: center; gap: 5px; }
.bph-btn-all {
  font-family: var(--lilo-sys-font);
  font-size: 10px; padding: 2px 9px; border-radius: 4px;
  border: 1.5px solid #3b82f6; background: #fff; color: #3b82f6;
  cursor: pointer; font-weight: 700; transition: all .12s;
}
.bph-btn-all.active, .bph-btn-all:hover { background: #3b82f6; color: #fff; }
.bph-btn-close { background: none; border: none; color: #94a3b8; font-size: 15px; cursor: pointer; padding: 0; line-height: 1; transition: color .12s; }
.bph-btn-close:hover { color: #ef4444; }
.bills-add-btn {
  font-family: 'Inter', sans-serif;
  font-size: 14px; padding: 3px 12px; border-radius: 5px;
  background: #3b82f6; color: #fff; border: none;
  cursor: pointer; font-weight: 700;
}
.bills-add-btn:hover { background: #2563eb; }

/* Party scroll */
.bills-party-scroll { /* no height cap — scrolls with the page, matches the main table fix */ }
.bills-party-section-title {
  font-family: var(--lilo-sys-font);
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: #64748b; padding: 6px 12px 4px;
  background: #f8fafc; border-bottom: 1px solid #e2e8f0; border-top: 1px solid #e2e8f0;
}
.bills-party-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-bottom: 1px solid #f1f5f9;
  cursor: pointer; transition: background .1s; gap: 4px;
}
.bills-party-item:hover { background: #eff6ff; }
.bills-party-item.active { background: #dbeafe; border-left: 3px solid #3b82f6; padding-left: 9px; }
.bills-party-item .bpi-name {
  font-family: 'Inter', sans-serif;
  font-size: 14px; font-weight: 600; color: #1e293b;
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bills-party-item .bpi-pending {
  font-family: 'Inter', sans-serif;
  font-size: 13px; font-weight: 700; color: #ef4444; white-space: nowrap; flex-shrink: 0;
}
.bills-party-item .bpi-pending.zero { color: #22c55e; }

/* Bills table — no internal height cap, page scrolls naturally instead of
   cutting rows off inside a small fixed-height box (matches Follow-up Tracker) */
.bills-table-scroll { overflow-x: auto; }
.bills-compact-table { width: 100%; border-collapse: collapse; margin: 0; }
.bills-compact-table thead th {
  font-family: var(--lilo-sys-font);
  background: #1e293b; color: rgba(255,255,255,.85);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  padding: 9px 10px; border-bottom: 2px solid #e2e8f0;
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.bills-compact-table td.bct {
  font-family: 'Inter', sans-serif;
  padding: 10px 10px; vertical-align: middle;
  border-bottom: 1px solid #f1f5f9; white-space: nowrap;
  font-size: 14px; font-weight: 500; color: #334155;
}
.bills-compact-table td.bct-party { font-weight: 700; color: #1e293b; max-width: 140px; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.bills-compact-table td.text-end { font-weight: 600; }
.bills-compact-table tbody tr:hover td { background: #f8fafc; }
.bills-compact-table tbody tr.bill-row-active td { background: #eff6ff !important; }
.bills-compact-table tbody tr.bill-row-paid td { opacity: .75; background: #f0fdf4; }
.bills-compact-table tbody tr.bill-row-paid td.bct:first-child { border-left: 3px solid #22c55e; }
.bills-compact-table tbody tr.bill-row-unpaid td.bct:first-child,
.bills-compact-table tbody tr.bill-row-partial td.bct:first-child { border-left: 3px solid #f59e0b; }
tr.bills-paid-divider td { background: #dcfce7 !important; color: #166534; font-family: var(--lilo-sys-font); font-size: 10px; font-weight: 700; text-align: center; padding: 4px 8px !important; border-top: 2px solid #22c55e; }

/* Status & amount colours in bills table */
.bills-compact-table .amount-green { color: #15803d; font-weight: 700; }
.bills-compact-table .amount-red   { color: #dc2626; font-weight: 700; }

/* ── Action buttons — bigger, readable ──────────────────────────── */
.bct-actions { white-space: nowrap; }
.bab {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px;
  border: none; cursor: pointer; font-size: 13px;
  transition: all .15s; margin-right: 3px;
}
.bab:hover { transform: scale(1.12); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.bab span { display: none; }
.bab-hist  { background: #3b82f6; color: #fff; }
.bab-edit  { background: #0ea5e9; color: #fff; }
.bab-pay   { background: #22c55e; color: #fff; }
.bab-print { background: #64748b; color: #fff; }
.bab-del   { background: #ef4444; color: #fff; }

/* ── Mobile / Phone responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  /* Stack layout vertically on mobile */
  .bills-3col-wrap { flex-direction: column !important; }
  .bills-col-parties { width: 100% !important; }
  .bills-party-scroll { max-height: 160px; overflow-y: auto; }

  /* Bigger tap targets on mobile */
  .bab { width: 34px; height: 34px; font-size: 14px; margin-right: 4px; }
  .bills-compact-table td.bct { font-size: 15px; padding: 11px 8px; }
  .bills-compact-table thead th { font-size: 10px; padding: 8px 6px; }

  /* Stat boxes 2-per-row on mobile */
  .lilo-stat-value { font-size: 16px; }
  .lilo-stat-box { padding: 11px 12px; gap: 10px; }
  .lilo-stat-icon { width: 34px; height: 34px; font-size: 14px; }

  /* Party names bigger on phone */
  .bills-party-item .bpi-name { font-size: 15px; }
  .bills-party-item .bpi-pending { font-size: 14px; }
  .bills-party-item { padding: 11px 12px; }

  /* Hide less important columns on small screens */
  .bills-compact-table th:nth-child(3),
  .bills-compact-table td:nth-child(3) { display: none; } /* Work */

  /* Bill modal full screen on mobile */
  .bill-modal-box { width: 100% !important; max-width: 100vw !important; border-radius: 0 !important; margin: 0 !important; min-height: 100vh; }
  .bill-modal-overlay { padding-top: 0 !important; align-items: flex-start !important; }
}

@media (max-width: 480px) {
  /* On very small phones, also hide Date column */
  .bills-compact-table th:nth-child(4),
  .bills-compact-table td:nth-child(4) { display: none; }
  .lilo-stat-value { font-size: 15px; }
}


/* ── Bill modal ─────────────────────────────────────────────────── */
.bill-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,22,35,.55); backdrop-filter: blur(4px);
  z-index: 999999 !important; align-items: flex-start; justify-content: center;
  padding-top: 30px;
  overflow-y: auto;
}
.bill-modal-overlay.active { display: flex; }
.bill-modal-box {
  background: #fff; border-radius: 12px;
  width: 660px; max-width: 96vw; max-height: 94vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
  animation: billModalIn .18s ease;
}
@keyframes billModalIn { from { opacity:0; transform: scale(.97) translateY(10px); } to { opacity:1; transform: scale(1) translateY(0); } }
.bill-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 18px; border-bottom: 1px solid #e2e8f0;
  position: sticky; top: 0; background: #fff; z-index: 1;
  border-radius: 12px 12px 0 0;
}
.bill-modal-header h5 { font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 700; color: #111827; margin: 0; }
.bill-modal-close {
  width: 28px; height: 28px; border-radius: 50%; border: none;
  background: #f1f5f9; color: #374151; font-size: 13px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.bill-modal-close:hover { background: #fee2e2; color: #b91c1c; }
.bill-modal-body { padding: 14px 18px; }
.bill-modal-footer {
  padding: 10px 18px; border-top: 1px solid #e2e8f0;
  display: flex; gap: 8px; justify-content: flex-end;
  position: sticky; bottom: 0; background: #fff;
  border-radius: 0 0 12px 12px;
}
.bm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.bm-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.bm-field label {
  display: block; font-family: var(--lilo-sys-font);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px;
  color: #374151; margin-bottom: 3px;
}
.bm-field input, .bm-field select, .bm-field textarea {
  width: 100%; padding: 6px 9px;
  border: 1.5px solid #d1d5db; border-radius: 6px;
  font-family: var(--lilo-sys-font); font-size: 13px; color: #111827;
  background: #fff; transition: border-color .15s;
}
.bm-field input:focus, .bm-field select:focus, .bm-field textarea:focus {
  border-color: #3b82f6; outline: none; background: #fff;
  box-shadow: 0 0 0 2px rgba(59,130,246,.12);
}
.bm-field input[readonly] { background: #f1f5f9; color: #374151; cursor: default; }
.bm-field-req { color: #ef4444; margin-left: 2px; }
.bm-section-title {
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700; color: #111827;
  margin: 12px 0 6px; padding-bottom: 4px;
  border-bottom: 2px solid #f1f5f9;
  display: flex; align-items: center; gap: 6px;
}
.bm-attach-row { display: flex; align-items: center; gap: 8px; }
.bm-attach-btn {
  padding: 5px 11px; border-radius: 6px;
  border: 1.5px dashed #9ca3af; background: #f9fafb;
  font-family: var(--lilo-sys-font); font-size: 12px; font-weight: 600;
  color: #374151; cursor: pointer; transition: all .15s;
}
.bm-attach-btn:hover { border-color: #3b82f6; color: #3b82f6; background: #eff6ff; }
.bm-view-btn {
  padding: 4px 10px; border-radius: 6px; border: none;
  background: #dbeafe; color: #1d4ed8;
  font-family: var(--lilo-sys-font); font-size: 12px; font-weight: 600; cursor: pointer;
  text-decoration: none;
}
.bm-status-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700; }
.bm-status-paid    { background: #dcfce7; color: #15803d; }
.bm-status-partial { background: #fff7ed; color: #c2410c; }
.bm-status-unpaid  { background: #fef2f2; color: #b91c1c; }
.bm-pay-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.bm-pay-table th { font-family: var(--lilo-sys-font); background: #f1f5f9; padding: 5px 7px; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: #374151; font-weight: 700; border-bottom: 1px solid #e2e8f0; }
.bm-pay-table td { font-family: 'Inter', sans-serif; font-size: 13px; color: #111827; padding: 5px 7px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.bm-pay-table tr:hover td { background: #f8fafc; }
.bm-pay-table tr:last-child td { border-bottom: none; }
.bm-add-pay-form { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.bm-add-pay-grid { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.bm-btn-primary {
  padding: 8px 20px; border-radius: 7px; border: none;
  background: linear-gradient(135deg,#3b82f6,#1d4ed8);
  color: #fff; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity .15s;
}
.bm-btn-primary:hover { opacity: .9; }
.bm-btn-secondary {
  padding: 8px 16px; border-radius: 7px;
  border: 1.5px solid #d1d5db; background: #fff;
  color: #374151; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.bm-btn-secondary:hover { border-color: #9ca3af; color: #111827; }
/* Edit/delete inline in pay table */
.bm-pay-edit-row td { background: #eff6ff !important; }
.bm-pay-edit-input { width:100%; padding:3px 6px; border:1.5px solid #3b82f6; border-radius:5px; font-size:13px; color:#111827; }

/* ── Report stats ────────────────────────────────────────────────── */
.cr-rpt-stat-box { border-radius: 10px; padding: 14px 16px; color: #fff; margin-bottom: 12px; }
.cr-rpt-stat-label { font-family: 'Inter', sans-serif; font-size: 14px; opacity: .9; font-weight: 600; }
.cr-rpt-stat-val { font-family: 'Inter', sans-serif; font-size: 28px; font-weight: 700; margin-top: 1px; }
.cr-rpt-blue  { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.cr-rpt-green { background: linear-gradient(135deg,#22c55e,#15803d); }
.cr-rpt-red   { background: linear-gradient(135deg,#ef4444,#b91c1c); }
.cr-rpt-grey  { background: linear-gradient(135deg,#64748b,#334155); }
.cr-rpt-grid  { display: grid; grid-template-columns: repeat(auto-fill,minmax(270px,1fr)); gap: 12px; margin-bottom: 12px; }
.cr-rpt-card  { border: 1px solid var(--lilo-border); border-radius: 10px; padding: 14px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); transition: box-shadow .2s; }
.cr-rpt-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); }
.cr-rpt-card-name { font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 700; color: var(--lilo-text); margin-bottom: 1px; }
.cr-rpt-card-sub  { font-family: var(--lilo-sys-font); font-size: 11px; color: var(--lilo-muted); margin-bottom: 8px; }
.cr-rpt-card-bar  { height: 6px; border-radius: 3px; background: #e2e8f0; margin-bottom: 8px; overflow: hidden; }
.cr-rpt-card-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg,#3b82f6,#22c55e); transition: width .4s; }
.cr-rpt-card-nums { display: flex; border-top: 1px solid #f1f5f9; padding-top: 8px; }
.cr-rpt-card-num  { flex: 1; text-align: center; }
.cr-rpt-card-num .label { font-family: var(--lilo-sys-font); font-size: 9px; text-transform: uppercase; color: var(--lilo-muted); font-weight: 700; letter-spacing: .4px; }
.cr-rpt-card-num .val   { font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; margin-top: 1px; }
.cr-rpt-card-num.billed  .val { color: #2563eb; }
.cr-rpt-card-num.paid    .val { color: #16a34a; }
.cr-rpt-card-num.balance .val { color: #dc2626; }
.cr-rpt-nobills { opacity: .55; border-style: dashed; }
.cr-rpt-clear   { border-color: #22c55e; border-width: 2px; }

/* ── Credit type badges ─────────────────────────────────────────── */
.credit-type-badge { display: inline-block; padding: 2px 9px; border-radius: 5px; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700; }
.credit-type-client   { background: #e0f2fe; color: #0369a1; }
.credit-type-partner  { background: #ede9fe; color: #5b21b6; }
.credit-type-interest { background: #fef9c3; color: #92400e; }
.credit-type-other    { background: #f3f4f6; color: #374151; }

/* ── Import drop zone ───────────────────────────────────────────── */
.import-drop-zone { border: 2px dashed #cbd5e1; border-radius: 8px; padding: 28px; text-align: center; cursor: pointer; transition: border-color .2s; }
.import-drop-zone:hover, .import-drop-zone.drag-over { border-color: var(--lilo-accent); background: #eff6ff; }
.import-preview-table { font-size: 12px; max-height: 280px; overflow-y: auto; }

/* ── Scrollbar ──────────────────────────────────────────────────── */
.lilo-wrap ::-webkit-scrollbar { width: 5px; height: 5px; }
.lilo-wrap ::-webkit-scrollbar-track { background: #f1f5f9; }
.lilo-wrap ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.lilo-wrap ::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .lilo-wrap .content-wrapper { margin-left: 0; }
  .lilo-wrap .content { padding: 10px; }
  .bills-3col-wrap { flex-direction: column; }
  .bills-col-parties { width: 100%; }
  .bm-grid-2, .bm-grid-3, .bm-add-pay-grid { grid-template-columns: 1fr 1fr; }

  /* Sidebar becomes a slide-in drawer on mobile instead of being permanently
     hidden with no way to bring it back. liloMobileMenuToggle() (wired to the
     hamburger button) adds/removes .lilo-sidebar-open on the wrapper to show it. */
  .lilo-wrap .main-sidebar {
    position: fixed !important; top: 0; left: 0; height: 100vh;
    transform: translateX(-100%) !important;
    transition: transform .25s ease;
    z-index: 1050 !important;
  }
  .lilo-wrap.lilo-sidebar-open .main-sidebar {
    transform: translateX(0) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  /* Dark backdrop behind the open drawer — tapping it closes the menu */
  .lilo-mobile-backdrop {
    display: none; position: fixed; inset: 0;
    background: rgba(15,23,42,.5); z-index: 1040;
  }
  .lilo-wrap.lilo-sidebar-open .lilo-mobile-backdrop { display: block; }
}

@media (min-width: 769px) {
  .lilo-mobile-backdrop { display: none !important; }
}

/* Bill modal — single column + bigger touch targets on phones (v4.1) */
@media (max-width: 480px) {
  .bm-grid-2, .bm-grid-3, .bm-add-pay-grid { grid-template-columns: 1fr !important; gap: 12px !important; }
  .bm-field label { font-size: 12px !important; }
  .bm-field input, .bm-field select, .bm-field textarea {
    font-size: 16px !important;
    padding: 11px 12px !important;
    min-height: 46px;
  }
  .bill-modal-header h5 { font-size: 15px !important; }
  .bill-modal-body { padding: 14px !important; }
  #bill-payments-tbody td, #bill-payments-thead th { font-size: 12px !important; }
}

/* ── Ledger add cash bar ────────────────────────────────────────── */
#add-cash-form { font-family: var(--lilo-sys-font); }
#add-cash-form label { font-family: var(--lilo-sys-font); }
#add-cash-form input { font-family: var(--lilo-sys-font); }
#add-cash-btn-wrap button { font-family: 'Inter', sans-serif; font-size: 15px; }

/* ── Ledger Notes cell (replaces Add Cash) ───────────────────── */
.ledger-note-cell { padding: 3px 5px !important; }
.ledger-note-wrap { display: flex; align-items: center; }
.ledger-note-input {
  width: 100%; min-width: 100px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  font-size: 11px; color: #111827;
  background: transparent;
  transition: border-color .12s, background .12s;
}
.ledger-note-input:hover { border-color: #d1d5db; background: #f9fafb; }
.ledger-note-input:focus { border-color: #3b82f6; background: #fff; outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,.1); }

/* ── ALL POPUPS: Force dark black fonts ─────────────────────── */
.modal-content,
.modal-body,
.modal-header,
.modal-footer,
.bill-modal-box,
.bill-modal-body,
.bill-modal-header,
.bill-modal-footer {
  color: #111827 !important;
}
.modal-content label,
.modal-body label,
.bill-modal-body label,
.bm-field label,
.form-label {
  color: #111827 !important;
}
.modal-content input,
.modal-content select,
.modal-content textarea,
.bm-field input,
.bm-field select,
.bm-field textarea {
  color: #111827 !important;
  background: #fff !important;
}
.modal-content input[readonly],
.bm-field input[readonly] {
  background: #f3f4f6 !important;
  color: #374151 !important;
}
/* Edit ledger modal header stays dark bg, white text */
#modal-edit-ledger .modal-header {
  color: #fff !important;
}
/* Section titles in bill modal */
.bm-section-title { color: #111827 !important; }
/* Table text in all modals */
.bm-pay-table td,
.bm-pay-table th,
.modal-body td,
.modal-body th { color: #111827 !important; }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR — light/white theme, compact spacing (v20)
═══════════════════════════════════════════════════════════════ */
.lilo-wrap { --lilo-sidebar-w: 220px; }

.lilo-wrap .lilo-nav-link:hover {
  transform: translateX(2px);
}

/* Colorful icon wrap — soft pastel badge, works on white sidebar */
.nav-icon-wrap {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  background: #f1f5f9;
  transition: all .15s;
}

.lilo-wrap .sidebar { padding-top: 2px !important; }

/* Per-page icon colors — pastel bg + saturated icon, readable on white */
[data-page="dashboard"]   .nav-icon-wrap { background: #fef3c7; color: #d97706; }
[data-page="payments"]    .nav-icon-wrap { background: #dcfce7; color: #16a34a; }
[data-page="bills"]       .nav-icon-wrap { background: #dbeafe; color: #2563eb; }
[data-page="credit"]      .nav-icon-wrap { background: #d1fae5; color: #059669; }
[data-page="expenses"]    .nav-icon-wrap { background: #fee2e2; color: #dc2626; }
[data-page="contractors"] .nav-icon-wrap { background: #fef3c7; color: #b45309; }
[data-page="followup"]    .nav-icon-wrap { background: #0f172a; color: #fff; }
[data-page="vendors"]     .nav-icon-wrap { background: #cffafe; color: #0e7490; }
[data-page="reports"]     .nav-icon-wrap { background: #fee2e2; color: #dc2626; }
[data-page="contractor-report"] .nav-icon-wrap { background: #ffedd5; color: #ea580c; }
[data-page="importexport"] .nav-icon-wrap { background: #f1f5f9; color: #64748b; }
[data-page="worktypes"]   .nav-icon-wrap { background: #f3e8ff; color: #9333ea; }
[data-page="settings"]    .nav-icon-wrap { background: #f1f5f9; color: #64748b; }

.lilo-wrap .lilo-nav-link.active .nav-icon-wrap { background: #dbeafe !important; }

/* ═══════════════════════════════════════════════════════════════
   PAYMENT EDIT MODAL — better UI, centered (v15 update)
═══════════════════════════════════════════════════════════════ */
#modal-edit-ledger .modal-dialog {
  max-width: 620px !important;
  margin: 5vh auto !important;
}

#modal-edit-ledger .modal-content {
  border-radius: 16px !important;
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0,0,0,.25) !important;
  border: none !important;
}

#modal-edit-ledger .modal-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
  padding: 18px 24px !important;
  border-bottom: none !important;
}

#modal-edit-ledger .modal-title {
  font-size: 16px !important;
  font-weight: 700 !important;
  letter-spacing: .3px;
}

#modal-edit-ledger .modal-body {
  padding: 24px !important;
  background: #f8fafc;
}

#modal-edit-ledger .form-label {
  font-size: 11.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: #475569 !important;
  margin-bottom: 5px !important;
}

#modal-edit-ledger .form-control,
#modal-edit-ledger .form-select {
  border-radius: 8px !important;
  border: 1.5px solid #e2e8f0 !important;
  font-size: 13.5px !important;
  padding: 8px 12px !important;
  background: #fff !important;
  color: #1e293b !important;
  font-weight: 500 !important;
  transition: border-color .15s, box-shadow .15s;
}

#modal-edit-ledger .form-control:focus,
#modal-edit-ledger .form-select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15) !important;
}

#modal-edit-ledger .modal-footer {
  background: #fff !important;
  padding: 16px 24px !important;
  border-top: 1px solid #e2e8f0 !important;
}

#modal-edit-ledger #edit-delete-btn {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1.5px solid #fca5a5 !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

#modal-edit-ledger #edit-delete-btn:hover {
  background: #ef4444 !important;
  color: #fff !important;
}

#modal-edit-ledger .btn-primary {
  background: linear-gradient(135deg,#3b82f6,#2563eb) !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  padding: 8px 20px !important;
  box-shadow: 0 4px 12px rgba(59,130,246,.3) !important;
}

#modal-edit-ledger .btn-secondary {
  background: #f1f5f9 !important;
  border: 1.5px solid #e2e8f0 !important;
  color: #475569 !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
}

/* Section dividers inside modal */
#modal-edit-ledger .row { margin-bottom: 0; }
#modal-edit-ledger .row.g-2 { gap: 0; }

/* Voucher section inside edit modal */
#modal-edit-ledger .mt-3 {
  border-radius: 10px !important;
  border: 1.5px dashed #cbd5e1 !important;
  background: #fff !important;
}

/* Hide old nav-icon rule for i tag — now handled by nav-icon-wrap span */
.lilo-wrap .lilo-nav-link .nav-icon { display: none !important; }
.lilo-wrap .lilo-nav-link .nav-icon-wrap i { font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   BILLS STATS — 5 boxes in one row (v17)
═══════════════════════════════════════════════════════════════ */
#bills-stats-row { flex-wrap: nowrap !important; }
#bills-stats-row .col { min-width: 140px; }
#bills-stats-row .lilo-stat-box { min-width: 0; }
#bills-stats-row .lilo-stat-value { font-size: 18px !important; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN SCREEN — ensure fonts load
═══════════════════════════════════════════════════════════════ */
#lilo-login-screen input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59,130,246,.15) !important;
  outline: none !important;
}
#lilo-login-screen button:hover {
  background: linear-gradient(135deg,#2563eb,#1d4ed8) !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(59,130,246,.4) !important;
}

/* ═══════════════════════════════════════════════════════════════
   BILLS STATS — FORCE all 5 boxes in ONE row (v18 fix)
═══════════════════════════════════════════════════════════════ */
#bills-stats-row {
  display: flex !important;
  flex-wrap: nowrap !important;
  flex-direction: row !important;
  overflow-x: auto !important;
  gap: 8px !important;
}
#bills-stats-row > [class*="col"] {
  flex: 1 1 0 !important;
  width: auto !important;
  max-width: none !important;
  min-width: 130px !important;
  padding-left: 4px !important;
  padding-right: 4px !important;
}
#bills-stats-row .lilo-stat-box {
  padding: 12px !important;
  min-width: 0 !important;
}
#bills-stats-row .lilo-stat-icon {
  width: 38px !important;
  height: 38px !important;
  font-size: 16px !important;
  flex-shrink: 0;
}
#bills-stats-row .lilo-stat-label {
  font-size: 10px !important;
  white-space: nowrap;
}
#bills-stats-row .lilo-stat-value {
  font-size: 17px !important;
  white-space: nowrap;
}
@media (max-width: 900px) {
  #bills-stats-row { overflow-x: auto !important; }
  #bills-stats-row > [class*="col"] { min-width: 150px !important; }
}

/* ── Mobile (v4.1): 2-column stat grid instead of horizontal scroll ── */
@media (max-width: 600px) {
  #bills-stats-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    overflow-x: visible !important;
    gap: 8px !important;
  }
  #bills-stats-row > [class*="col"] { min-width: 0 !important; width: 100% !important; max-width: 100% !important; flex: none !important; }
  #bills-stats-row .lilo-stat-box { margin-bottom: 0 !important; }
}

/* ═══════════════════════════════════════════════════════════════
   (sidebar spacing fully handled by v20 block above)
═══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   IMAGE VIEW MODAL — ensure above everything (v18 fix)
═══════════════════════════════════════════════════════════════ */
#modal-image { z-index: 100000001 !important; }
#modal-image .modal-dialog { z-index: 100000002 !important; }

/* ═══════════════════════════════════════════════════════════════
   VENDOR FILE ATTACHMENTS (v19)
═══════════════════════════════════════════════════════════════ */
.ven-file-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 8px;
  background: #e0f2fe; color: #0369a1;
  border: 1px solid #bae6fd;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  max-width: 160px;
}
.ven-file-chip a { color: #0369a1; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; display:inline-block; }
.ven-file-chip a:hover { text-decoration: underline; }
.ven-file-chip .ven-file-del { background: none; border: none; color: #ef4444; font-size: 13px; cursor: pointer; padding: 0; line-height: 1; flex-shrink:0; }
.ven-file-chip .ven-file-del:hover { color: #b91c1c; }

/* ═══════════════════════════════════════════════════════════════
   LEDGER — hide Bill No column from data rows too (removed from add-row header)
═══════════════════════════════════════════════════════════════ */
/* Bill No column is now removed from the add-row. Data rows still show it via JS. */

/* ═══════════════════════════════════════════════════════════════
   BILL REMOVE VOUCHER BUTTON (v19)
═══════════════════════════════════════════════════════════════ */
#bill-remove-voucher-btn {
  transition: background .15s, border-color .15s;
}
#bill-remove-voucher-btn:hover {
  background: #ef4444 !important;
  color: #fff !important;
  border-color: #ef4444 !important;
}

/* ═══════════════════════════════════════════════════════════════
   PARTY SPLIT PANEL — 30/70 Contractors & Vendors (v19)
═══════════════════════════════════════════════════════════════ */
.lilo-party-item {
  padding: 9px 10px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .1s;
  border-left: 3px solid transparent;
}
.lilo-party-item:hover { background: #f8fafc; }
.lilo-party-item.active { background: #eff6ff; border-left-color: #3b82f6; }
.lpi-row-wrap { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 28px; }
.lpi-inline { display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; min-width: 0; flex: 1; overflow: hidden; }
.lpi-name { font-size: 15px; font-weight: 700; color: #1e293b; white-space: nowrap; flex-shrink: 0; }
.lpi-cat-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0;
}
.lpi-phone { font-size: 11px; color: #64748b; white-space: nowrap; flex-shrink: 0; }
.lpi-actions { display: none; gap: 3px; flex-shrink: 0; }
.lilo-party-item:hover .lpi-actions,
.lilo-party-item.active .lpi-actions { display: flex; }
.lpi-btn-edit {
  background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe;
  border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer;
}
.lpi-btn-del {
  background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca;
  border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer;
}
.lpi-btn-move {
  background: #fef3c7; color: #b45309; border: 1px solid #fde68a;
  border-radius: 4px; padding: 2px 6px; font-size: 11px; cursor: pointer;
}

/* Party items rate table */
.pi-table thead th {
  font-size: 10.5px !important; font-weight: 700 !important;
  text-transform: uppercase; letter-spacing: .4px;
  padding: 7px 8px !important; white-space: nowrap;
  background: #1e293b !important; color: rgba(255,255,255,.85) !important;
  border: none !important;
}
.pi-table tbody td { padding: 7px 8px !important; vertical-align: middle; border-bottom: 1px solid #f1f5f9 !important; }
.pi-table tbody tr:hover td { background: #eff6ff !important; }
.pi-table tfoot td { padding: 8px 10px !important; border-top: 2px solid #e2e8f0 !important; }
.pi-num { text-align: right !important; font-variant-numeric: tabular-nums; font-weight: 600; }
.pi-total { color: #15803d !important; font-weight: 800 !important; }
.pi-input { font-size: 13px !important; font-weight: 700 !important; color: #111827 !important; text-align: right; min-width: 60px; }

/* Form fields in add row */
.pi-form-field { display: flex; flex-direction: column; gap: 2px; min-width: 80px; }
.pi-form-field label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: #64748b; letter-spacing: .4px; margin: 0; }

/* Item type badges */
.pi-type-badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.pi-type-sqft   { background:#e0f2fe; color:#0369a1; }
.pi-type-tonne  { background:#fef9c3; color:#92400e; }
.pi-type-bag    { background:#f3f4f6; color:#374151; }
.pi-type-unit   { background:#f0fdf4; color:#15803d; }
.pi-type-kg     { background:#fdf4ff; color:#7e22ce; }
.pi-type-tmt    { background:#fff1f2; color:#be123c; }
.pi-type-custom { background:#f8fafc; color:#475569; }

/* ═══════════════════════════════════════════════════════════════
   WORK TYPES PAGE (v19)
═══════════════════════════════════════════════════════════════ */
#wt-format-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.wt-format-card {
  display: flex; flex-direction: row; align-items: center; gap: 8px;
  padding: 6px 9px; border-radius: 7px;
  border: 2px solid #e2e8f0; background: #f8fafc;
  cursor: pointer; transition: all .12s;
  min-height: 0;
}
.wt-format-card:hover { border-color: #94a3b8; background: #fff; }
.wt-format-card.selected { border-color: #3b82f6 !important; background: #eff6ff !important; }
.wt-fmt-icon { font-size: 14px; flex-shrink: 0; width: 18px; text-align: center; }
.wt-fmt-text { display: flex; flex-direction: column; gap: 0; line-height: 1.2; min-width: 0; }
.wt-fmt-label { font-size: 12px; font-weight: 700; color: #1e293b; white-space: nowrap; }
.wt-fmt-desc  { font-size: 9px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sidebar icon for worktypes */
[data-page="worktypes"] .nav-icon-wrap { background: rgba(168,85,247,.18); color: #a855f7; }

/* Partner quick-pick buttons in Credit modal */
.cr-partner-btn {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 700;
  border: 1.5px solid #a7f3d0; background: #f0fdf4; color: #065f46;
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.cr-partner-btn:hover { background: #22c55e; color: #fff; border-color: #22c55e; }
.cr-partner-btn.active { background: #16a34a; color: #fff; border-color: #16a34a; }

/* ═══════════════════════════════════════════════════════════════
   MOBILE UPLOAD SHEET — camera / gallery choice (v4.1)
═══════════════════════════════════════════════════════════════ */
.lilo-upload-sheet-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,22,35,.5);
  z-index: 200000000;
  align-items: flex-end; justify-content: center;
}
.lilo-upload-sheet-overlay.active { display: flex; }
.lilo-upload-sheet {
  background: #fff; width: 100%; max-width: 480px;
  border-radius: 18px 18px 0 0;
  padding: 10px 16px 22px;
  animation: lusSlideUp .2s ease;
}
@keyframes lusSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.lus-handle { width: 36px; height: 4px; background: #e2e8f0; border-radius: 4px; margin: 6px auto 14px; }
.lus-title { font-family:'Inter',sans-serif; font-size: 13px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; padding: 0 4px 8px; }
.lus-option {
  width: 100%; display: flex; align-items: center; gap: 14px;
  padding: 14px 12px; background: none; border: none;
  border-top: 1px solid #f1f5f9;
  font-family: 'Inter', sans-serif; font-size: 16px; font-weight: 600; color: #111827;
  text-align: left; cursor: pointer;
}
.lus-option:active { background: #f8fafc; }
.lus-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}
.lus-icon-camera { background: #dbeafe; color: #1d4ed8; }
.lus-icon-gallery { background: #dcfce7; color: #15803d; }
.lus-cancel {
  width: 100%; margin-top: 12px; padding: 13px;
  background: #f1f5f9; border: none; border-radius: 12px;
  font-family: 'Inter', sans-serif; font-size: 15px; font-weight: 700; color: #475569;
}

/* Upload progress toast */
.lilo-upload-toast {
  display: none; position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  background: #111827; color: #fff;
  padding: 10px 18px; border-radius: 30px;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600;
  z-index: 200000001;
  align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.lilo-upload-toast.active { display: flex; }

/* Bigger, easier-to-tap attach buttons on mobile */
@media (max-width: 768px) {
  .bm-attach-btn {
    padding: 11px 16px !important;
    font-size: 15px !important;
    min-height: 46px;
    border-radius: 10px !important;
  }
  .bm-attach-row { gap: 10px !important; }
  #bill-remove-voucher-btn {
    padding: 11px 16px !important;
    font-size: 15px !important;
    min-height: 46px;
  }
  .bm-view-btn { font-size: 15px !important; padding: 11px 14px !important; min-height: 46px; display:inline-flex !important; align-items:center; }
  .btn-upload-voucher { font-size: 20px !important; padding: 10px !important; }
}

/* Invoice column button — opens linked bill */
.btn-invoice-link {
  width: 26px; height: 26px; border-radius: 6px;
  background: #fef3c7; color: #b45309; border: 1px solid #fde68a;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; cursor: pointer;
}
.btn-invoice-link:hover { background: #fde68a; }

/* Smaller date inputs in add-row — shrink the text/icon so the box isn't
   wider than needed before the calendar popup opens */
.lilo-ledger thead tr.add-row input[type="date"].ar-date-input {
  width: 100%;
  font-size: 11.5px !important;
  padding: 5px 3px !important;
  min-width: 0;
}
.lilo-ledger thead tr.add-row input[type="date"].ar-date-input::-webkit-calendar-picker-indicator {
  font-size: 12px;
  padding: 0 2px;
  margin-left: 1px;
}
.lilo-ledger thead tr.add-row input[type="date"].ar-date-input::-webkit-datetime-edit {
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════
   FOLLOW-UP TRACKER PAGE (v4.4)
═══════════════════════════════════════════════════════════════ */
.ft-section-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 10px;
}
.ft-section-title { display: flex; align-items: center; gap: 10px; }
.ft-section-icon {
  width: 32px; height: 32px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.ft-section-title h2 { font-size: 17px; font-weight: 700; color: #1e293b; margin: 0; }
.ft-count-badge {
  display: inline-block; margin-left: 8px;
  padding: 2px 9px; background: #e2e8f0; color: #475569;
  font-size: 11px; font-weight: 600; border-radius: 20px;
}
.ft-section-actions { display: flex; align-items: center; gap: 10px; }
.ft-search-wrap { position: relative; width: 220px; }
.ft-search-wrap input {
  width: 100%; padding: 8px 14px 8px 36px;
  border: 1px solid #e2e8f0; border-radius: 8px;
  font-size: 13px; background: #fff;
}
.ft-search-wrap input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,.15); }
.ft-search-wrap i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 12px; }

/* KPI cards — shorter / more compact (v4.4.1) */
.ft-kpi-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 9px; margin-bottom: 12px;
}
.ft-kpi-card {
  background: #fff; border: 1px solid #f1f5f9; border-radius: 10px;
  padding: 10px 12px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.ft-kpi-icon {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.ft-kpi-label { font-size: 11px; color: #64748b; font-weight: 700; margin: 0; line-height: 1.2; white-space: nowrap; }
.ft-kpi-value { font-size: 20px; font-weight: 800; color: #1e293b; margin: 0; line-height: 1.15; }
.ft-kpi-sub { font-size: 0; height: 0; margin: 0; overflow: hidden; } /* sub-caption hidden to save vertical space */

/* Table — tighter columns + rows for max rows-per-screen (v4.4.1) */
.ft-table-card { background: #fff; border: 1px solid #f1f5f9; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.03); }
.ft-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ft-table thead th {
  background: #fafbfc; color: #94a3b8;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px;
  padding: 7px 8px; text-align: left; border-bottom: 1px solid #f1f5f9; white-space: nowrap;
}
.ft-table tbody td { padding: 5px 8px; border-bottom: 1px solid #f8fafc; vertical-align: middle; line-height: 1.3; }
.ft-table tbody tr:hover { background: #fafbfc; }
.ft-table tbody tr:last-child td { border-bottom: none; }
/* Extra-compact variant used on the Follow-up Tracker page */
.ft-table-compact thead th { padding: 8px 9px; font-size: 11px; }
.ft-table-compact tbody td { padding: 6px 9px; font-size: 13.5px; }
.ft-table-compact .ft-avatar { width: 28px; height: 28px; font-size: 10.5px; }

.ft-avatar {
  width: 28px; height: 28px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.ft-cat-pill {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  background: #f0fdfa; color: #0d9488; font-size: 12px; font-weight: 600;
}
.ft-status-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; }
.ft-status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }

/* Clickable contractor/vendor name → opens rate-sheet popup */
.ft-name-cell { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.ft-name-link { font-weight: 600; color: #1e293b; transition: color .12s; }
.ft-name-cell:hover .ft-name-link { color: #2563eb; text-decoration: underline; }

/* Status picker in modal — same black-pill style as the Follow-up Tracker
   page's filter pills, for visual consistency between the two places that
   manage follow-up status. */
.ft-status-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.ft-status-picker-5 { display: flex; flex-wrap: wrap; gap: 8px; }
.ft-status-opt {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 16px 7px 8px; border-radius: 20px; border: 1.5px solid #475569;
  font-size: 13px; font-weight: 700; cursor: pointer; transition: all .12s;
  background: #0f172a; color: #fff;
}
.ft-status-opt input { display: none; }
.ft-status-opt i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: #475569; color: #fff; font-size: 11px; flex-shrink: 0;
}
.ft-status-opt:hover { box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ft-status-opt.ft-status-running { border-color: #22c55e; } .ft-status-opt.ft-status-running i { background: #22c55e; }
.ft-status-opt.ft-status-active  { border-color: #3b82f6; } .ft-status-opt.ft-status-active  i { background: #3b82f6; }
.ft-status-opt.ft-status-hold    { border-color: #ca8a04; } .ft-status-opt.ft-status-hold    i { background: #ca8a04; }
.ft-status-opt.ft-status-nr      { border-color: #f97316; } .ft-status-opt.ft-status-nr      i { background: #f97316; }
.ft-status-opt.ft-status-rejected{ border-color: #ef4444; } .ft-status-opt.ft-status-rejected i { background: #ef4444; }
.ft-status-opt.ft-status-running:has(input:checked) { background: #22c55e; border-color: #22c55e; }
.ft-status-opt.ft-status-active:has(input:checked)  { background: #3b82f6; border-color: #3b82f6; }
.ft-status-opt.ft-status-hold:has(input:checked)     { background: #ca8a04; border-color: #ca8a04; }
.ft-status-opt.ft-status-nr:has(input:checked)       { background: #f97316; border-color: #f97316; }
.ft-status-opt.ft-status-rejected:has(input:checked) { background: #ef4444; border-color: #ef4444; }
.ft-status-opt:has(input:checked) i { background: rgba(255,255,255,.3); }
/* Fallback (no :has() support) — JS toggles .ft-checked to match */
.ft-status-opt.ft-status-running.ft-checked  { background: #22c55e; border-color: #22c55e; }
.ft-status-opt.ft-status-active.ft-checked   { background: #3b82f6; border-color: #3b82f6; }
.ft-status-opt.ft-status-hold.ft-checked      { background: #ca8a04; border-color: #ca8a04; }
.ft-status-opt.ft-status-nr.ft-checked        { background: #f97316; border-color: #f97316; }
.ft-status-opt.ft-status-rejected.ft-checked  { background: #ef4444; border-color: #ef4444; }
.ft-status-opt.ft-checked i { background: rgba(255,255,255,.3); }

/* Mobile responsiveness */
@media (max-width: 1100px) {
  .ft-kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 768px) {
  .ft-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ft-section-head { flex-direction: column; align-items: flex-start; }
  .ft-search-wrap { width: 100%; }
  .ft-table { min-width: 930px; }
}
@media (max-width: 480px) {
  .ft-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .ft-kpi-card { padding: 10px; }
  .ft-status-picker, .ft-status-picker-5 { flex-direction: row; }
}

/* ═══════════════════════════════════════════════════════════════
   FOLLOW-UP TRACKER — fixes (v4.5.1)
   1. Action icons sit on ONE row (was stacking, wasting row height)
   2. Column widths: Name fixed-compact, others auto, Notes gets extra room
═══════════════════════════════════════════════════════════════ */
.ft-table-compact .ft-action-cell {
  display: flex; gap: 3px; flex-wrap: nowrap; white-space: nowrap;
}
.ft-table-compact .ft-action-cell .btn-action,
.ft-table-compact .btn-action {
  width: 24px; height: 24px; padding: 0 !important;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; flex-shrink: 0;
}

/* Column sizing — name fixed/compact, most columns auto-fit content,
   Notes column gets the most room since it carries the real follow-up info */
#ft-con-table, #ft-ven-table { table-layout: auto; width: 100%; }
#ft-con-table th:nth-child(3), #ft-ven-table th:nth-child(3) { width: 240px; max-width: 240px; } /* Name */
#ft-con-table td:nth-child(3), #ft-ven-table td:nth-child(3) { max-width: 240px; overflow: hidden; }
#ft-con-table td:nth-child(3) .ft-name-link,
#ft-ven-table td:nth-child(3) .ft-name-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; display: inline-block; }
#ft-con-table th:nth-child(4), #ft-ven-table th:nth-child(4) { width: 90px; }   /* Work Type / Category */
#ft-con-table th:nth-child(5), #ft-ven-table th:nth-child(5) { width: 130px; white-space: nowrap; } /* Phone */
#ft-con-table td:nth-child(5), #ft-ven-table td:nth-child(5) { white-space: nowrap; }
#ft-con-table th:nth-child(6), #ft-ven-table th:nth-child(6) { width: 70px; }  /* Status */
#ft-con-table th:nth-child(7), #ft-ven-table th:nth-child(7),
#ft-con-table th:nth-child(8), #ft-ven-table th:nth-child(8),
#ft-con-table th:nth-child(9), #ft-ven-table th:nth-child(9),
#ft-con-table th:nth-child(10), #ft-ven-table th:nth-child(10) { width: 96px; white-space: nowrap; } /* the 4 date columns */
#ft-con-table td:nth-child(7), #ft-ven-table td:nth-child(7),
#ft-con-table td:nth-child(8), #ft-ven-table td:nth-child(8),
#ft-con-table td:nth-child(9), #ft-ven-table td:nth-child(9),
#ft-con-table td:nth-child(10), #ft-ven-table td:nth-child(10) { white-space: nowrap; }
#ft-con-table th:nth-child(11), #ft-ven-table th:nth-child(11) { width: 50px; } /* Attachments */
#ft-con-table th:nth-child(12), #ft-ven-table th:nth-child(12) { width: auto; min-width: 220px; } /* Notes — gets the extra room */
#ft-con-table td:nth-child(12), #ft-ven-table td:nth-child(12) {
  max-width: none !important; white-space: normal !important;
  overflow: visible !important; text-overflow: initial !important;
}

/* Sortable column headers in Follow-up Tracker (v4.5.2) */
.ft-sortable { cursor: pointer; user-select: none; transition: color .12s; }
.ft-sortable:hover { color: #2563eb !important; }
.ft-sort-icon { font-size: 9px; margin-left: 3px; opacity: .4; }
.ft-sort-icon.ft-sort-active { opacity: 1; color: #2563eb; }

/* ═══════════════════════════════════════════════════════════════
   FOLLOW-UP TRACKER — clickable KPI filters + category pills (v4.8)
═══════════════════════════════════════════════════════════════ */
.ft-kpi-card { cursor: pointer; transition: all .12s; }
.ft-kpi-card:hover { border-color: #cbd5e1; box-shadow: 0 2px 6px rgba(0,0,0,.06); transform: translateY(-1px); }
.ft-kpi-card.ft-kpi-active {
  border-color: #3b82f6 !important;
  background: #eff6ff !important;
  box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}

/* Category / work-type filter pills */
.ft-cat-pills-wrap {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 12px; padding: 2px 0;
}
.ft-cat-pill-btn {
  --pill-color: #475569;
  padding: 6px 16px; border-radius: 20px;
  border: 1.5px solid var(--pill-color);
  background: #fff; color: var(--pill-color);
  font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: all .12s;
}
.ft-cat-pill-btn:hover { background: #f8fafc; }
.ft-cat-pill-btn.ft-cat-pill-active {
  background: var(--pill-color); color: #fff;
}

/* ═══════════════════════════════════════════════════════════════
   FOLLOW-UP TRACKER — small status filter pills (v4.8.1)
   Replaces the old big white KPI boxes — sits right after the Add button.
═══════════════════════════════════════════════════════════════ */
.ft-status-pills-wrap {
  display: flex; flex-wrap: wrap; gap: 6px; margin-left: 10px;
}
.ft-status-pill-btn {
  --pill-color: #475569;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px 5px 6px; border-radius: 20px;
  border: 1.5px solid var(--pill-color);
  background: #0f172a; color: #fff;
  font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
  transition: all .12s;
}
.ft-status-pill-btn:hover { box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.ft-status-pill-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 50%; background: var(--pill-color); color: #fff;
  font-size: 12px; font-weight: 800;
}
.ft-status-pill-btn.ft-status-pill-active {
  background: var(--pill-color); color: #fff; border-color: var(--pill-color);
}
.ft-status-pill-btn.ft-status-pill-active .ft-status-pill-count {
  background: rgba(255,255,255,.3); color: #fff;
}

@media (max-width: 1100px) {
  .ft-section-title { flex-wrap: wrap; }
  .ft-status-pills-wrap { margin-left: 0; width: 100%; margin-top: 6px; }
}

/* ═══════════════════════════════════════════════════════════════
   RATE SHEET embedded inside Contractor/Vendor edit modal (v4.10)
═══════════════════════════════════════════════════════════════ */
#con-ratesheet-body, #ven-ratesheet-body {
  max-height: 320px; overflow-y: auto;
  border: 1px solid #f1f5f9; border-radius: 8px;
}
#con-ratesheet-body .pi-table, #ven-ratesheet-body .pi-table {
  min-width: 0; /* allow it to shrink to the modal's width instead of forcing 700px scroll */
}

/* ═══════════════════════════════════════════════════════════════
   LILO CRM MODAL — Contractor / Vendor edit popup (v4.11)
   Built to match the exact HTML mockup the client provided.
═══════════════════════════════════════════════════════════════ */
.lilo-crm-modal { border-radius: 10px; overflow: hidden; border: none; }

/* Header */
.lcm-header {
  background: #fbbf24; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.lcm-header-blue { background: #2563eb; }
.lcm-header-title {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Inter', sans-serif; font-weight: 800;
  font-size: 14px; text-transform: uppercase; letter-spacing: .8px;
  color: #1e293b;
}
.lcm-header-blue .lcm-header-title { color: #fff; }
.lcm-header-title i { font-size: 17px; }
.lcm-close {
  background: none; border: none; font-size: 18px;
  color: #1e293b; cursor: pointer; line-height: 1;
}
.lcm-header-blue .lcm-close { color: #fff; }

/* Body */
.lcm-body { padding: 22px 24px; max-height: 72vh; overflow-y: auto; }
.lcm-label {
  display: block; font-size: 11px; font-weight: 800; color: #64748b;
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px;
}
.lcm-input {
  width: 100%; padding: 8px 11px;
  border: 1px solid #d1d5db; border-radius: 6px;
  font-family: 'Inter', sans-serif; font-size: 13.5px; color: #1e293b;
  background: #fff;
}
.lcm-input:focus { outline: none; border-color: #fbbf24; box-shadow: 0 0 0 2px rgba(251,191,36,.25); }
.lcm-header-blue ~ .lcm-body .lcm-input:focus,
#modal-vendor .lcm-input:focus { border-color: #2563eb; box-shadow: 0 0 0 2px rgba(37,99,235,.2); }
.lcm-input-sm { font-size: 12px; padding: 6px 10px; }
.lcm-hint { font-size: 10.5px; color: #94a3b8; margin: 5px 0 0; line-height: 1.4; }

.lcm-grid-12 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.lcm-col-4 { display: flex; flex-direction: column; }
.lcm-field { margin-bottom: 18px; }

.lcm-calc-badge {
  margin-top: 8px; padding: 7px 10px; border-radius: 6px;
  background: #fffbeb; border: 1px solid #fde68a;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px;
}
.lcm-calc-badge span { display: flex; align-items: center; gap: 5px; font-weight: 600; color: #92400e; }
.lcm-calc-badge strong { background: #fff; padding: 2px 8px; border-radius: 4px; border: 1px solid #fde68a; color: #1e293b; }
.lcm-calc-badge-blue { background: #ecfeff; border-color: #a5f3fc; }
.lcm-calc-badge-blue span { color: #0e7490; }
.lcm-calc-badge-blue strong { border-color: #a5f3fc; }

/* Attachments box (vendor only) */
.lcm-attach-box { background: #f8fafc; border: 1.5px dashed #cbd5e1; border-radius: 10px; padding: 12px 14px; margin-bottom: 18px; }
.lcm-attach-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.lcm-attach-head span { font-size: 13px; font-weight: 700; color: #475569; display: flex; align-items: center; gap: 6px; }
.lcm-add-item-btn-sm { padding: 5px 12px !important; font-size: 11px !important; }

/* Status badge row */
.lcm-status-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 0; margin-bottom: 16px;
  border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9;
}
.lcm-status-opt {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 6px; border-radius: 20px;
  font-size: 12px; font-weight: 800; color: #fff; cursor: pointer;
  border: 2px solid transparent; transition: all .12s;
}
.lcm-status-opt input { display: none; }
.lcm-status-count {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.lcm-status-running   { background: #047857; } .lcm-status-running .lcm-status-count   { color: #047857; }
.lcm-status-active    { background: #1e3a8a; } .lcm-status-active .lcm-status-count    { color: #1e3a8a; }
.lcm-status-hold       { background: #ea580c; } .lcm-status-hold .lcm-status-count      { color: #ea580c; }
.lcm-status-order      { background: #4338ca; } .lcm-status-order .lcm-status-count     { color: #4338ca; }
.lcm-status-nr         { background: #9a3412; } .lcm-status-nr .lcm-status-count        { color: #9a3412; }
.lcm-status-rejected   { background: #dc2626; } .lcm-status-rejected .lcm-status-count  { color: #dc2626; }
.lcm-status-reminders  { background: #3730a3; opacity:.55; cursor:not-allowed; } .lcm-status-reminders .lcm-status-count { color: #3730a3; }
.lcm-status-opt:has(input:checked) { border-color: rgba(255,255,255,.7); box-shadow: 0 0 0 2px rgba(0,0,0,.08); }
.lcm-status-opt.ft-checked { border-color: rgba(255,255,255,.7); box-shadow: 0 0 0 2px rgba(0,0,0,.08); }

/* Dates + follow-up notes 2-col layout */
.lcm-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 20px; }
.lcm-grid-2-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Rate Sheet table — dark slate header matching mockup */
.lcm-ratesheet { border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.lcm-ratesheet-head {
  background: #1e293b; color: #fff;
  padding: 9px 14px; display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px;
}
.lcm-ratesheet-head span { display: flex; align-items: center; gap: 7px; }
.lcm-add-item-btn {
  background: #22c55e; color: #fff; border: none; border-radius: 5px;
  padding: 5px 13px; font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.lcm-add-item-btn:hover { background: #16a34a; }
#con-ratesheet-body, #ven-ratesheet-body { border: none; border-radius: 0; }

/* Footer */
.lcm-footer { background: #f8fafc; padding: 14px 24px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; border-top: 1px solid #f1f5f9; }
.lcm-btn-move {
  padding: 9px 16px; border-radius: 6px; font-size: 12.5px; font-weight: 700;
  background: #fef3c7; color: #b45309; border: 1.5px solid #fde68a; cursor: pointer;
}
.lcm-btn-move:hover { background: #fde68a; }
.lcm-btn { padding: 9px 22px; border-radius: 6px; font-size: 13px; font-weight: 700; border: none; cursor: pointer; }
.lcm-btn-gray { background: #6b7280; color: #fff; }
.lcm-btn-gray:hover { background: #4b5563; }
.lcm-btn-yellow { background: #fbbf24; color: #1e293b; }
.lcm-btn-yellow:hover { background: #f59e0b; }
.lcm-btn-blue { background: #2563eb; color: #fff; }
.lcm-btn-blue:hover { background: #1d4ed8; }

@media (max-width: 768px) {
  .lcm-grid-12 { grid-template-columns: 1fr; gap: 14px; }
  .lcm-grid-2 { grid-template-columns: 1fr; gap: 14px; }
  .lcm-grid-2-inner { grid-template-columns: 1fr 1fr; }
  .lcm-body { padding: 16px; }
}

/* Quick-add "+" button next to the custom work type / category field
   inside the Contractor/Vendor edit modal (v4.22) */
.lcm-quick-add-btn {
  flex-shrink: 0; width: 32px; height: 32px;
  border-radius: 6px; border: 1.5px solid #cbd5e1; background: #fff;
  color: #475569; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lcm-quick-add-btn:hover { background: #f1f5f9; border-color: #94a3b8; }

/* Attachment indicator column on Follow-up Tracker tables (v4.25) */
.ft-attach-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 12px;
  background: #fef3c7; color: #b45309; border: 1px solid #fde68a;
  font-size: 11px; font-weight: 700; cursor: pointer;
}
.ft-attach-btn:hover { background: #fde68a; }
.ft-attach-btn i { font-size: 10px; }

/* Payments page — 1 Month / 3 Month / All date filter buttons (v4.27) */
.pay-date-filter-group {
  display: flex; gap: 6px; align-items: center;
}
.pay-date-filter-btn {
  padding: 6px 16px; border-radius: 20px;
  border: 1.5px solid #cbd5e1; background: #fff; color: #475569;
  font-size: 12.5px; font-weight: 700; cursor: pointer;
  transition: all .12s;
}
.pay-date-filter-btn:hover { border-color: #94a3b8; }
.pay-date-filter-btn.active {
  background: #1e293b; color: #fff; border-color: #1e293b;
}
