/* ===== Leogo Business Ledger ===== */

/* Hisaab-specific chrome (summary, settle, surplus, FAB) is hidden while
   the Leogo tab is active — Leogo has its own sub-nav and screens. */
body.leogo-mode .summary,
body.leogo-mode .settle,
body.leogo-mode .surplus-banner,
body.leogo-mode .warn-banner,
body.leogo-mode .fab { display: none; }

/* ---------- sub-nav pills ---------- */
.lg-subnav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px 16px;
  padding: 2px 16px 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.lg-subnav::-webkit-scrollbar { display: none; }

.lg-pill {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 11px 16px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.lg-pill.active {
  color: #0d0d0d;
  background: var(--gold);
  border-color: var(--gold);
}
.lg-pill:active { transform: scale(0.95); }

/* ---------- sections ---------- */
.lg-section { display: none; }
.lg-section.active { display: block; }

.lg-placeholder {
  text-align: center;
  padding: 56px 20px;
  color: #333;
  font-size: 14px;
}

/* generic panel card */
.lg-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}
.lg-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 14px;
}
.lg-panel-title .lg-panel-sub {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 3px;
}

/* ---------- forms (match the bottom-sheet form language) ---------- */
.lg-form { display: flex; flex-direction: column; gap: 14px; }
.lg-field { display: flex; flex-direction: column; gap: 7px; }
.lg-field label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.lg-form input,
.lg-form select,
.lg-form textarea {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-family: inherit;
  font-size: 16px;
  padding: 12px 14px;
  width: 100%;
}
.lg-form textarea { resize: vertical; min-height: 74px; line-height: 1.45; }
.lg-form input:focus,
.lg-form select:focus,
.lg-form textarea:focus { outline: none; border-color: var(--gold); }
.lg-row { display: flex; gap: 12px; }
.lg-row .lg-field { flex: 1; min-width: 0; }

.lg-btn {
  background: var(--gold);
  color: #0d0d0d;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  padding: 14px;
  min-height: 44px;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.lg-btn:active { transform: scale(0.98); }
.lg-btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.lg-btn[disabled] { opacity: 0.5; pointer-events: none; }

.lg-msg { min-height: 18px; font-size: 13px; }
.lg-msg.ok { color: var(--surplus); }
.lg-msg.err { color: #f87171; }

/* ---------- settings logo ---------- */
.lg-logo-row { display: flex; align-items: center; gap: 14px; }
.lg-logo-preview {
  width: 64px; height: 64px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #0d0d0d;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  color: #333; font-size: 11px;
}
.lg-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.lg-logo-actions { display: flex; flex-direction: column; gap: 8px; }
.lg-logo-actions .lg-btn { font-size: 13px; padding: 9px 16px; min-height: 38px; border-radius: 999px; }

/* ---------- clients ---------- */
.lgc-card { cursor: pointer; }
.lgc-svcline {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.4;
}
.lgc-bal {
  font-size: 12px;
  font-weight: 600;
  color: var(--surplus);
  white-space: nowrap;
}
.lgc-bal.due { color: var(--pending); }

.lgc-svc {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #1c1c1c;
}
.lgc-svc:last-of-type { border-bottom: none; }
.lgc-svc.off .lgc-svc-name { color: var(--muted); text-decoration: line-through; }
.lgc-svc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lgc-svc-name { font-size: 14px; font-weight: 500; color: var(--white); }
.lgc-svc-meta { font-size: 11px; color: var(--muted); }

.lgc-led {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #1c1c1c;
}
.lgc-led:last-child { border-bottom: none; }
.lgc-led-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lgc-led-name { font-size: 14px; color: var(--white); }
.lgc-led-date { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.lgc-led-nums { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.lgc-led-amt { font-size: 14px; font-weight: 600; }
.lgc-led-amt.inv { color: var(--white); }
.lgc-led-amt.pay { color: var(--surplus); }
.lgc-led-bal { font-size: 11px; color: var(--muted); }

/* ---------- invoices ---------- */
.lgi-card { cursor: pointer; }

.lgi-gst-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.lgi-toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--white); cursor: pointer; }
.lgi-toggle input { width: 18px; height: 18px; accent-color: var(--gold); }
.lgi-gst-kind { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; }

.lgi-item {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lgi-item input { background: var(--card); }
.lgi-item-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.lgi-item-amt { font-size: 14px; font-weight: 600; color: var(--invested); }

.lgi-totals {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.lgi-warn {
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.4);
  color: var(--pending);
  font-size: 12.5px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 10px;
  margin-top: 10px;
}
.lgi-warn b { color: var(--white); font-weight: 600; }
.lgi-trow {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}
.lgi-trow.grand {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  border-top: 1px solid var(--border);
  padding-top: 9px;
  margin-top: 3px;
}

.lgi-share-row { display: flex; gap: 10px; }
.lgi-share-row .lg-btn { flex: 1; font-size: 13px; padding: 12px; }
.lg-btn.wa {
  background: #25D366;
  color: #0d0d0d;
}

/* ---------- payments ---------- */
.lgp-alloc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #1c1c1c;
}
.lgp-alloc:last-child { border-bottom: none; }
.lgp-alloc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lgp-alloc-no { font-size: 13.5px; color: var(--white); }
.lgp-alloc-meta { font-size: 11px; color: var(--muted); }
.lgp-alloc-amt {
  width: 110px;
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-family: inherit;
  font-size: 15px;
  padding: 10px 12px;
  text-align: right;
}
.lgp-alloc-amt:focus { outline: none; border-color: var(--gold); }

/* ---------- EMI run-off chart ---------- */
.lgm-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 150px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.lgm-bar {
  flex: 1 0 26px;
  max-width: 44px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}
.lgm-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--gold), rgba(245, 197, 24, 0.55));
  border-radius: 5px 5px 2px 2px;
  min-height: 3px;
}
.lgm-bar-val { font-size: 9px; color: var(--muted); white-space: nowrap; }
.lgm-bar-label { font-size: 9px; color: var(--muted); white-space: nowrap; }

/* ---------- dashboard ---------- */
.lgd-hero {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: linear-gradient(135deg, rgba(245, 197, 24, 0.12), rgba(245, 197, 24, 0.03));
  border: 1px solid rgba(245, 197, 24, 0.3);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.lgd-hero-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold);
  font-weight: 600;
}
.lgd-hero-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.lgd-hero-sub { font-size: 11.5px; color: var(--muted); }
.lgd-hero-note {
  font-size: 11.5px;
  color: var(--invested);
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid rgba(245, 197, 24, 0.15);
}

.pill-btn.wa-remind {
  color: #25D366;
  border-color: rgba(37, 211, 102, 0.4);
}

/* ---------- reports ---------- */
.lgr-month {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--white);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  flex: 1;
  min-width: 0;
}
.lgr-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.lgr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
.lgr-table th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 8px 8px 0;
  border-bottom: 1px solid var(--border);
}
.lgr-table td {
  padding: 8px 8px 8px 0;
  border-bottom: 1px solid #1c1c1c;
  color: var(--white);
}
.lgr-table tr:last-child td { border-bottom: none; }
.lgr-table .num { text-align: right; }

/* ---------- salary / payroll ---------- */
.lgsal-history {
  margin-top: 12px;
  border-top: 1px solid #1c1c1c;
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.lgsal-hist {
  display: grid;
  grid-template-columns: 60px 60px 1fr;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}
.lgsal-hist .lg-badge { justify-self: start; }

.lgsal-payform {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #0d0d0d;
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 10px;
}
.lgsal-payform label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.lgsal-paydate {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--white);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 9px;
}
.lgsal-payform-btns { display: flex; gap: 6px; }

/* ---------- staff (restricted) mode ---------- */
/* hide all admin chrome; only #staff-app shows */
body.staff-mode .surplus-banner,
body.staff-mode .summary,
body.staff-mode .settle,
body.staff-mode .warn-banner,
body.staff-mode .tabs,
body.staff-mode main,
body.staff-mode .fab,
body.staff-mode #history-btn,
body.staff-mode .pending-badge,
body.staff-mode .tagline { display: none !important; }

#staff-app[hidden] { display: none; }
#staff-app { padding-top: 6px; }

.staff-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 16px;
}
.staff-title { font-size: 18px; font-weight: 600; color: var(--white); display: flex; align-items: center; }
.staff-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: rgba(245, 197, 24, 0.12);
  padding: 3px 8px;
  border-radius: 999px;
  margin-left: 10px;
}
.staff-actions { display: flex; gap: 8px; margin-top: 12px; }
.staff-actions .pill-btn { flex: 1; text-align: center; }
.pill-btn.wa { color: #25D366; border-color: rgba(37, 211, 102, 0.4); }

.lock-switch {
  margin-top: 20px;
  background: transparent;
  border: none;
  color: var(--gold);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
}
.lock-switch:active { opacity: 0.7; }

/* ---------- manager mode ---------- */
/* Nothing personal is hidden any more: a manager has their OWN Big Purchases, Daily
   Expenses and surplus pool, all scoped server-side by owner, so the summary cards,
   surplus banner and Invest & Settle panel are theirs and must show. The class is
   kept as a styling hook and because applyRoleUI() still sets it; the Salary pill is
   removed from the DOM there rather than hidden here. */

/* ---------- status badges (used across Leogo screens) ---------- */
.lg-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
/* denser tint backgrounds + a readable grey for muted badges (was --muted #555,
   ~2.3:1 on dark — unreadable). Same hues, just legible. */
.lg-badge.draft   { color: #b3b3b3;        background: rgba(153, 153, 153, 0.18); }
.lg-badge.sent    { color: var(--pending); background: rgba(245, 166, 35, 0.20); }
.lg-badge.partial { color: #ff8c42;        background: rgba(255, 140, 66, 0.20); }
.lg-badge.paid    { color: var(--surplus); background: rgba(39, 201, 111, 0.18); }
.lg-badge.cancelled { color: #b3b3b3;      background: rgba(153, 153, 153, 0.16); text-decoration: line-through; }
.lg-badge.passthrough { color: #7aa2f7; background: rgba(122, 162, 247, 0.20); }
.lg-badge.overdue { color: #e05c5c;        background: rgba(224, 92, 92, 0.20); }
.lg-badge.written_off { color: #e0a05c;    background: rgba(224, 160, 92, 0.20); }
.lg-badge.inactive{ color: #b3b3b3;        background: rgba(153, 153, 153, 0.14); }
.lg-badge.active  { color: var(--invested);background: rgba(79, 195, 247, 0.18); }

/* activity log (Settings) */
.lg-act-row { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.06); font-size: 13px; line-height: 1.4; }
.lg-act-who { font-weight: 700; color: var(--white); margin-right: 6px; }
.lg-act-what { color: var(--muted); }
.lg-act-when { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }

/* ---- dashboard declutter ---- */
.lgd-hero-top { display: flex; align-items: center; gap: 8px; }
.lgd-info-btn { background: none; border: none; color: var(--muted); font-size: 15px; line-height: 1; padding: 2px 4px; cursor: pointer; }
.lgd-hero-sub { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.lgd-statline { display: flex; flex-wrap: wrap; gap: 14px 20px; padding: 12px 2px 16px; }
.lgd-stat { display: flex; flex-direction: column; gap: 2px; }
.lgd-stat-l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.lgd-stat-v { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lgd-out { padding: 11px 0; border-bottom: 1px solid #1c1c1c; cursor: pointer; }
.lgd-out:last-child { border-bottom: none; }
.lgd-out-line { display: flex; align-items: center; gap: 8px; }
.lgd-out-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; color: var(--white); }
.lgd-out-amt { font-size: 14px; font-weight: 600; color: var(--white); white-space: nowrap; }
.lgd-out-detail { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.lgd-gst-summary { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: none; border: none; color: var(--white); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 0; min-height: 44px; }
.lgd-gst-net { color: var(--pending); font-weight: 700; white-space: nowrap; }
.lgd-gst-detail { margin-top: 8px; display: flex; flex-direction: column; gap: 7px; }
