/* =============================================================================
   Petty Cash Manager — Design System
   ============================================================================= */

:root {
  /* Sidebar */
  --sb-bg:         #0f172a;
  --sb-text:       #94a3b8;
  --sb-text-hover: #e2e8f0;
  --sb-active-bg:  rgba(59,130,246,0.15);
  --sb-active:     #60a5fa;
  --sb-hover-bg:   rgba(255,255,255,0.05);
  --sb-border:     rgba(255,255,255,0.07);
  --sb-heading:    #475569;
  --sb-width:      260px;

  /* Content */
  --body-bg:       #f1f5f9;
  --card-bg:       #ffffff;
  --border:        #e2e8f0;
  --text-primary:  #0f172a;
  --text-secondary:#64748b;
  --text-muted:    #94a3b8;

  /* Brand colours */
  --clr-primary:   #3b82f6;
  --clr-success:   #10b981;
  --clr-warning:   #f59e0b;
  --clr-danger:    #ef4444;
  --clr-info:      #06b6d4;
  --clr-orange:    #f97316;

  --topnav-h:      60px;
  --radius:        10px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.03);
}

/* ── Reset / Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: .9rem;
  background: var(--body-bg);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.pcm-sidebar {
  width: var(--sb-width);
  min-height: 100vh;
  background: var(--sb-bg);
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  border-right: 1px solid var(--sb-border);
}

.pcm-sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem 1.25rem 1rem;
  color: #f1f5f9;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -.01em;
  border-bottom: 1px solid var(--sb-border);
  white-space: nowrap;
  overflow: hidden;
}
.pcm-sidebar-brand i { font-size: 1.3rem; color: var(--clr-primary); }

/* Balance widget inside sidebar */
.pcm-sidebar-balance {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--sb-border);
  background: rgba(255,255,255,.03);
}
.pcm-balance-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sb-heading); margin-bottom: 2px; }
.pcm-balance-amount { font-size: 1.1rem; font-weight: 700; color: #e2e8f0; }
.text-success-light { color: #4ade80 !important; }
.text-danger-light  { color: #f87171 !important; }
.pcm-balance-status.low { font-size: .7rem; color: #fbbf24; margin-top: 2px; }

.pcm-sidebar-scroll { flex: 1; overflow-y: auto; padding: .75rem 0; }
.pcm-sidebar-scroll::-webkit-scrollbar { width: 4px; }
.pcm-sidebar-scroll::-webkit-scrollbar-thumb { background: var(--sb-border); border-radius: 2px; }

/* Navigation */
.pcm-nav { list-style: none; margin: 0; padding: 0; }

.pcm-nav-heading {
  padding: .9rem 1.25rem .35rem;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--sb-heading);
}

.pcm-nav-item a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem 1.25rem;
  color: var(--sb-text);
  text-decoration: none;
  border-radius: 6px;
  margin: 1px 8px;
  transition: all .15s ease;
  font-size: .86rem;
}
.pcm-nav-item a:hover { color: var(--sb-text-hover); background: var(--sb-hover-bg); }
.pcm-nav-item.active a { color: var(--sb-active); background: var(--sb-active-bg); font-weight: 600; }
.pcm-nav-item a i { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

/* Sidebar user footer */
.pcm-sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .85rem 1rem;
  border-top: 1px solid var(--sb-border);
  background: rgba(0,0,0,.15);
}
.pcm-user-info { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.pcm-user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pcm-user-name  { font-size: .82rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.pcm-user-role  { font-size: .72rem; color: var(--sb-heading); }
.pcm-logout-btn { color: var(--sb-text); font-size: 1.1rem; text-decoration: none; padding: .25rem .4rem; border-radius: 6px; transition: all .15s; }
.pcm-logout-btn:hover { color: #f87171; background: rgba(239,68,68,.1); }

/* ── Mobile Offcanvas ────────────────────────────────────────────────────── */
.pcm-offcanvas { background: var(--sb-bg) !important; width: 280px !important; }
.pcm-offcanvas .offcanvas-header { border-bottom: 1px solid var(--sb-border); }
.pcm-offcanvas .offcanvas-title { color: #f1f5f9; font-size: .95rem; font-weight: 700; }

/* ── Main Layout ─────────────────────────────────────────────────────────── */
.pcm-main {
  margin-left: var(--sb-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@media (max-width: 991.98px) {
  .pcm-main { margin-left: 0; }
}

/* ── Top Navbar ──────────────────────────────────────────────────────────── */
.pcm-topnav {
  height: var(--topnav-h);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}
.pcm-topnav-title { font-weight: 600; font-size: .95rem; color: var(--text-primary); }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: .4rem .5rem;
  border-radius: 8px;
  line-height: 1;
  transition: all .15s;
}
.btn-icon:hover { background: var(--body-bg); color: var(--text-primary); }

.topnav-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* Notification Bell */
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 18px; height: 18px;
  background: var(--clr-danger);
  color: #fff;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
  border: 2px solid #fff;
}

.pcm-notif-dropdown { width: 360px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: var(--radius); }
.pcm-notif-header { border-bottom: 1px solid var(--border); background: var(--body-bg); }
.pcm-notif-footer { border-top: 1px solid var(--border); background: var(--body-bg); }
.pcm-notif-item {
  display: flex;
  gap: .75rem;
  padding: .75rem 1rem;
  text-decoration: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.pcm-notif-item:hover { background: var(--body-bg); }
.pcm-notif-item.unread { background: #eff6ff; }
.pcm-notif-item.unread:hover { background: #dbeafe; }
.pcm-notif-icon { font-size: 1.2rem; margin-top: 1px; flex-shrink: 0; }
.pcm-notif-title { font-size: .82rem; font-weight: 600; }
.pcm-notif-msg   { font-size: .78rem; color: var(--text-secondary); margin-top: 1px; }
.pcm-notif-time  { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }

/* ── Content ─────────────────────────────────────────────────────────────── */
.pcm-content {
  flex: 1;
  padding: 1.5rem;
}
@media (max-width: 767.98px) {
  .pcm-content { padding: 1rem .75rem; }
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
}

/* Stat Cards */
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: var(--shadow); }
.stat-card-label { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: .3rem; }
.stat-card-value { font-size: 1.6rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.stat-card-sub   { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }
.stat-card-icon  { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table { font-size: .86rem; }
.table th { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom-width: 1px; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

.table-responsive { border-radius: var(--radius); }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { font-size: .72rem; font-weight: 600; padding: .3em .6em; border-radius: 6px; }

/* ── Page Header ─────────────────────────────────────────────────────────── */
.pcm-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.pcm-page-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.pcm-breadcrumb { font-size: .8rem; color: var(--text-muted); margin-top: .15rem; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-label { font-size: .82rem; font-weight: 600; color: var(--text-secondary); margin-bottom: .35rem; }
.form-control, .form-select {
  font-size: .88rem;
  border-color: var(--border);
  border-radius: 8px;
  padding: .5rem .75rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.input-group-text { font-size: .88rem; border-color: var(--border); background: var(--body-bg); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { font-size: .86rem; font-weight: 500; border-radius: 8px; padding: .45rem .9rem; transition: all .15s; }
.btn-primary   { background: var(--clr-primary); border-color: var(--clr-primary); }
.btn-primary:hover { background: #2563eb; border-color: #2563eb; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }

/* ── Cash Flow Colors ────────────────────────────────────────────────────── */
.text-cash-in    { color: var(--clr-success); }
.text-cash-out   { color: var(--clr-danger); }
.amount-in       { color: var(--clr-success); font-weight: 600; }
.amount-out      { color: var(--clr-danger);  font-weight: 600; }
.amount-neutral  { color: var(--text-primary); font-weight: 600; }

/* ── Status Float Card ───────────────────────────────────────────────────── */
.cash-status-card { border-radius: var(--radius); padding: 1.25rem; }
.cash-status-card .progress { height: 8px; border-radius: 4px; }

/* ── Ledger Table ────────────────────────────────────────────────────────── */
.ledger-type-badge { font-size: .7rem; font-weight: 600; padding: .25em .5em; border-radius: 5px; }

/* ── Advance Status Colors ───────────────────────────────────────────────── */
.bg-orange { background-color: var(--clr-orange) !important; }

/* ── Search/Filter Bar ───────────────────────────────────────────────────── */
.filter-bar { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.filter-bar .row { gap: .75rem 0; }

/* ── Void overlay ────────────────────────────────────────────────────────── */
tr.is-void td { opacity: .5; text-decoration: line-through; }

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.35);
}
.login-logo { font-size: 2rem; color: var(--clr-primary); margin-bottom: .5rem; }
.login-title { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); }
.login-sub   { color: var(--text-muted); font-size: .85rem; margin-top: .2rem; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.divider-label { text-align: center; position: relative; margin: 1.5rem 0; }
.divider-label::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; height: 1px; background: var(--border); }
.divider-label span { background: #fff; padding: 0 .75rem; position: relative; color: var(--text-muted); font-size: .8rem; }

.section-title { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; }

.empty-state { text-align: center; padding: 3rem 1rem; color: var(--text-muted); }
.empty-state i { font-size: 3rem; display: block; margin-bottom: .75rem; opacity: .4; }

@media print {
  .pcm-sidebar, .pcm-topnav, .pcm-offcanvas, .no-print { display: none !important; }
  .pcm-main { margin-left: 0 !important; }
  .pcm-content { padding: 0 !important; }
}
