/* ====================================================================
   LedgerPro - modern accounting UI
   ==================================================================== */
:root {
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e8ecf4;
  --bg: #f4f6fb;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef2ff;
  --sidebar-w: 264px;
  --radius: 16px;

  --bs-primary: #4f46e5;
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: #4f46e5;
  --bs-link-hover-color: #4338ca;
  --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-bg: #f4f6fb;
  --bs-body-color: #0f172a;
  --bs-border-color: #e8ecf4;
}

body { font-size: .92rem; -webkit-font-smoothing: antialiased; }
.min-w-0 { min-width: 0; }
.text-truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- buttons ---------- */
.btn { border-radius: 10px; font-weight: 500; }
.btn-primary {
  --bs-btn-bg: #4f46e5; --bs-btn-border-color: #4f46e5;
  --bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
  --bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
  --bs-btn-disabled-bg: #4f46e5; --bs-btn-disabled-border-color: #4f46e5;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .25);
}
.btn-outline-primary {
  --bs-btn-color: #4f46e5; --bs-btn-border-color: #c7d2fe;
  --bs-btn-hover-bg: #4f46e5; --bs-btn-hover-border-color: #4f46e5;
  --bs-btn-active-bg: #4338ca; --bs-btn-active-border-color: #4338ca;
}
.btn-light { --bs-btn-bg: #fff; --bs-btn-border-color: var(--line); --bs-btn-hover-bg: #f8fafc; --bs-btn-hover-border-color: #dbe2ef; }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-sm.btn-icon { width: 30px; height: 30px; border-radius: 8px; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, #0b1220 0%, #111a33 100%);
  display: flex; flex-direction: column; transition: transform .25s ease;
}
.brand {
  display: flex; align-items: center; gap: .7rem; padding: 1.25rem 1.4rem;
  color: #fff; font-weight: 700; font-size: 1.2rem; text-decoration: none; letter-spacing: -.01em;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #8b5cf6); box-shadow: 0 6px 16px rgba(99, 102, 241, .45);
}
.nav-scroll { flex: 1; overflow-y: auto; padding: .25rem .9rem 1rem; }
.nav-heading { color: #64748b; font-size: .68rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; padding: 1.1rem .7rem .4rem; }
.nav-link-item {
  display: flex; align-items: center; gap: .75rem; padding: .62rem .8rem; border-radius: 10px;
  color: #aab4c8; text-decoration: none; font-weight: 500; margin-bottom: 2px; transition: all .15s;
}
.nav-link-item i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.nav-link-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link-item.active { background: linear-gradient(135deg, #4f46e5, #6d5df0); color: #fff; box-shadow: 0 6px 16px rgba(79, 70, 229, .4); }
.sidebar-foot { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.2rem; border-top: 1px solid rgba(255, 255, 255, .07); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #a78bfa); color: #fff; font-weight: 600;
}
.avatar.sm { width: 28px; height: 28px; font-size: .8rem; }
.sidebar-backdrop { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 1035; }
.sidebar-backdrop.show { display: block; }

/* ---------- layout ---------- */
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
  padding: .8rem 1.75rem; background: rgba(244, 246, 251, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.page-title { font-size: 1.25rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
.content { padding: 1.75rem; flex: 1; }
.app-foot { padding: 1rem 1.75rem; color: var(--muted); font-size: .8rem; text-align: center; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: none; }
  .main { margin-left: 0; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
}

/* ---------- cards ---------- */
.card {
  border: 0; border-radius: var(--radius); background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .05);
}
.card-header { background: transparent; border-bottom: 1px solid var(--line); padding: 1rem 1.25rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

.kpi { position: relative; overflow: hidden; }
.kpi .kpi-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; }
.kpi .kpi-label { color: var(--muted); font-size: .8rem; font-weight: 500; }
.kpi .kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.kpi .kpi-sub { font-size: .78rem; color: var(--muted); }

.ico-primary { background: #eef2ff; color: #4f46e5; }
.ico-success { background: #ecfdf5; color: #059669; }
.ico-danger  { background: #fff1f2; color: #e11d48; }
.ico-warning { background: #fffbeb; color: #d97706; }
.ico-info    { background: #f0f9ff; color: #0284c7; }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .8rem 1rem; border-bottom-color: var(--line); vertical-align: middle; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  font-weight: 600; background: #f8fafc; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
.table .text-end, .table th.text-end { font-variant-numeric: tabular-nums; }
.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }
.row-link { color: var(--ink); text-decoration: none; font-weight: 600; }
.row-link:hover { color: var(--primary); }

/* ---------- badges ---------- */
.badge { font-weight: 600; padding: .4em .7em; border-radius: 8px; letter-spacing: .01em; }
.badge-soft-success   { background: #dcfce7; color: #15803d; }
.badge-soft-danger    { background: #ffe4e6; color: #be123c; }
.badge-soft-warning   { background: #fef3c7; color: #b45309; }
.badge-soft-info      { background: #e0f2fe; color: #0369a1; }
.badge-soft-primary   { background: #e0e7ff; color: #4338ca; }
.badge-soft-secondary { background: #e2e8f0; color: #475569; }

/* ---------- forms ---------- */
.form-control, .form-select { border-radius: 10px; border-color: #dbe2ef; padding: .55rem .8rem; }
.form-control:focus, .form-select:focus { border-color: #818cf8; box-shadow: 0 0 0 .22rem rgba(79, 70, 229, .15); }
.form-label { font-weight: 500; font-size: .82rem; color: #334155; margin-bottom: .3rem; }
.search-box { position: relative; }
.search-box i { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-box .form-control { padding-left: 2.3rem; }

.modal-content { border: 0; border-radius: 18px; box-shadow: 0 25px 60px rgba(15, 23, 42, .25); }
.modal-header { border-bottom: 1px solid var(--line); padding: 1.1rem 1.4rem; }
.modal-title { font-weight: 700; font-size: 1.05rem; }
.modal-body { padding: 1.4rem; }
.modal-footer { border-top: 1px solid var(--line); padding: 1rem 1.4rem; }

/* ---------- pills / filters ---------- */
.pill-nav { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill-nav a {
  padding: .4rem .9rem; border-radius: 999px; font-size: .82rem; font-weight: 500; text-decoration: none;
  color: var(--muted); background: #fff; border: 1px solid var(--line);
}
.pill-nav a:hover { color: var(--primary); border-color: #c7d2fe; }
.pill-nav a.active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(79, 70, 229, .25); }

/* ---------- notifications ---------- */
.bell-dot {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: #e11d48; color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid #f4f6fb;
}
.notif-menu { width: 360px; max-width: 92vw; border-radius: 14px; border: 0; box-shadow: 0 20px 50px rgba(15, 23, 42, .18); overflow: hidden; }
.notif-item { display: flex; gap: .75rem; padding: .8rem 1rem; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.notif-item:hover { background: #f8faff; }
.notif-ico { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; }
.notif-row.unread { background: #f8faff; border-left: 3px solid var(--primary); }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty i { font-size: 2.2rem; display: block; margin-bottom: .4rem; opacity: .6; }
.stat-line { display: flex; justify-content: space-between; padding: .55rem 0; border-bottom: 1px dashed var(--line); }
.stat-line:last-child { border-bottom: 0; }
.bar-track { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #8b5cf6); }
.balance-pos { color: #be123c; font-weight: 600; }
.balance-neg { color: #15803d; font-weight: 600; }

/* ---------- invoice line items ---------- */
.items-table thead th { padding: .55rem .6rem; }
.items-table td { padding: .4rem .5rem; }
.items-table .form-control-sm { border-radius: 8px; }
.totals-box { background: #f8faff; border: 1px solid #e0e7ff; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 10% -10%, #c7d2fe 0%, transparent 60%),
              radial-gradient(900px 500px at 110% 110%, #ddd6fe 0%, transparent 55%), #f4f6fb; }
.login-card { width: 100%; max-width: 420px; padding: 2.2rem; }

/* ---------- statements / print ---------- */
.doc-sheet { background: #fff; border-radius: var(--radius); padding: 2rem; box-shadow: 0 6px 20px rgba(16, 24, 40, .06); }
@media print {
  body { background: #fff !important; font-size: 11pt; }
  .sidebar, .topbar, .no-print, .app-foot, .sidebar-backdrop { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; }
  .card, .doc-sheet { box-shadow: none !important; border: 0 !important; }
  .table thead th { background: #f1f5f9 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
