/* ==========================================================================
   MoneyLendingERP — Admin / App UI
   Shares the brand language of the marketing site (teal/blue, Poppins/Inter).
   CDN-based (Bootstrap 5 + Font Awesome + Google Fonts) — no build step,
   so it deploys to plain cPanel hosting as-is.
   ========================================================================== */
:root {
  --primary: #0F766E; --primary-dark: #0B5650; --secondary: #2563EB; --accent: #10B981;
  --bg: #F4F6FB; --surface: #FFFFFF; --text: #111827; --text-muted: #6B7280;
  --border: #E5E7EB; --sidebar: #0B1220; --sidebar-soft: #94a3b8;
  --grad-primary: linear-gradient(135deg, #0F766E 0%, #2563EB 100%);
  --radius: 16px; --radius-sm: 10px; --radius-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(16,24,40,.06); --shadow: 0 8px 24px rgba(16,24,40,.08);
  --font-head: 'Poppins', system-ui, sans-serif; --font-body: 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; }
/* Base type scale — keeps the UI compact & clean (all rem sizes scale from here) */
html { font-size: 15px; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); margin: 0; font-size: .95rem; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-head); font-weight: 700; letter-spacing: -.02em; }
a { text-decoration: none; }

/* ---- Brand mark --------------------------------------------------------- */
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: var(--grad-primary);
  display: grid; place-items: center; color: #fff; font-size: 1.05rem; flex-shrink: 0; }
.brand-name { font-family: var(--font-head); font-weight: 700; letter-spacing: -.02em; }
.brand-name b { color: var(--accent); }

/* ====================== AUTH (login) ===================================== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-aside { background: radial-gradient(700px 380px at 30% 10%, rgba(37,99,235,.35), transparent 60%), var(--sidebar);
  color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside .brand-name { color: #fff; font-size: 1.3rem; }
.auth-aside h1 { font-size: 2.1rem; line-height: 1.2; margin: 0 0 14px; }
.auth-aside p { color: #cbd5e1; font-size: 1.02rem; }
.auth-aside .feat { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; color: #e2e8f0; }
.auth-aside .feat i { width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.1);
  display: grid; place-items: center; color: var(--accent); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h2 { font-size: 1.7rem; margin: 0 0 4px; }
.auth-card .sub { color: var(--text-muted); margin-bottom: 28px; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; } .auth-aside { display: none; } }

/* ====================== APP SHELL ======================================== */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--sidebar); color: #cbd5e1; flex-shrink: 0;
  position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040;
  transition: transform .25s ease; }
.sidebar-head { padding: 22px 22px; display: flex; align-items: center; gap: 10px; }
.sidebar-head .brand-name { color: #fff; font-size: 1.12rem; }
.sidebar-section { padding: 8px 22px; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase;
  color: #64748b; margin-top: 14px; font-weight: 600; }
.sidebar-nav { list-style: none; padding: 6px 12px; margin: 0; flex: 1; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 11px;
  color: var(--sidebar-soft); font-weight: 500; font-size: .94rem; margin-bottom: 2px; transition: background .15s, color .15s; }
.sidebar-nav a i { width: 20px; text-align: center; font-size: 1rem; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar-foot { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,.08); }

.main { margin-left: 260px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1030; }
.topbar .page-title { font-size: 1.15rem; margin: 0; }
.topbar .crumb { font-size: .82rem; color: var(--text-muted); }
.content { padding: 28px; flex: 1; }

.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad-primary); color: #fff;
  display: grid; place-items: center; font-weight: 600; font-family: var(--font-head); }
.user-chip .u-name { font-weight: 600; font-size: .9rem; line-height: 1.1; }
.user-chip .u-role { font-size: .76rem; color: var(--text-muted); }

.menu-toggle { display: none; background: none; border: none; font-size: 1.3rem; color: var(--text); }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); position: fixed; top: 0; bottom: 0; left: 0; z-index: 1040; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .main { margin-left: 0; }
  .menu-toggle { display: inline-block; }
  .topbar { padding: 12px 16px; }
  .content { padding: 18px 14px; }
  /* keep table columns readable; scroll horizontally instead of cramping */
  .table-card .table { white-space: nowrap; }
  .table-card .table th, .table-card .table td { padding: 12px 14px; }
}

/* ====================== CARDS / STATS ==================================== */
.card-soft { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s; height: 100%; }
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat .ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 1.1rem; }
.stat .val { font-family: var(--font-head); font-weight: 700; font-size: 1.9rem; margin: 14px 0 0; }
.stat .lbl { color: var(--text-muted); font-size: .9rem; }
.ico-teal { background: var(--grad-primary); } .ico-blue { background: linear-gradient(135deg,#2563EB,#1D4FD7); }
.ico-green { background: linear-gradient(135deg,#10B981,#0F766E); } .ico-amber { background: linear-gradient(135deg,#F59E0B,#F97316); }

/* ====================== TABLES =========================================== */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-sm); }
.table-card .table { margin: 0; }
.table-card .table thead th { background: #f8fafc; border-bottom: 1px solid var(--border); color: var(--text-muted);
  font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 14px 18px; }
.table-card .table td { padding: 12px 18px; vertical-align: middle; border-color: #f1f5f9; font-size: .9rem; }
.t-name { font-weight: 600; font-size: .94rem; }
.t-sub { font-size: .82rem; color: var(--text-muted); }

/* ====================== BADGES / BUTTONS ================================= */
.badge-soft { font-size: .74rem; font-weight: 600; padding: 5px 12px; border-radius: var(--radius-pill); }
.bg-success-soft { background: rgba(16,185,129,.12); color: #047857; }
.bg-info-soft { background: rgba(37,99,235,.12); color: #1d4ed8; }
.bg-danger-soft { background: rgba(239,68,68,.12); color: #b91c1c; }
.bg-secondary-soft { background: #f1f5f9; color: #475569; }

.btn { font-family: var(--font-head); font-weight: 600; border-radius: var(--radius-pill); letter-spacing: -.01em;
  display: inline-flex; align-items: center; justify-content: center; align-self: center; white-space: nowrap; }
.btn-brand { background: var(--grad-primary); color: #fff; border: none; }
.btn-brand:hover { color: #fff; opacity: .94; transform: translateY(-1px); }
.btn-soft { background: #fff; border: 1.5px solid var(--border); color: var(--text); }
.btn-soft:hover { border-color: var(--primary); color: var(--primary); }

.form-control, .form-select { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 11px 14px; }
.form-control:focus, .form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(15,118,110,.12); }
.form-label { font-weight: 500; font-size: .88rem; margin-bottom: 6px; }
.section-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.section-card h5 { font-size: 1.05rem; margin-bottom: 2px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .ico { width: 72px; height: 72px; border-radius: 20px; background: #f1f5f9; color: var(--primary);
  display: grid; place-items: center; font-size: 1.7rem; margin: 0 auto 18px; }

.card-link-live { transition: transform .15s, box-shadow .15s, border-color .15s; }
.card-link-live:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary) !important; }

/* Print / Save-as-PDF: strip the app chrome, keep the content. */
@media print {
  .sidebar, .topbar, .d-print-none, .btn, form { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .table-card, .section-card, .stat { box-shadow: none !important; border-color: #ddd !important; break-inside: avoid; }
  body { background: #fff !important; }
}
