/* ═══════════════════════════════════════════════════════════════
   BillFlow — Modern UI  (Fluorescent Edition)
   ═══════════════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand */
  --brand:        #6C63FF;
  --brand-lt:     #f0effe;
  --brand-dark:   #4b44cc;

  /* Fluorescent accents */
  --neon-green:   #39FF14;
  --neon-pink:    #FF2D78;
  --neon-cyan:    #00F5FF;
  --neon-yellow:  #FFE600;
  --neon-orange:  #FF6B00;

  /* Semantic */
  --success:      #00C896;
  --success-lt:   #e0faf3;
  --danger:       #FF2D78;
  --danger-lt:    #ffedf4;
  --warning:      #FFB800;
  --warning-lt:   #fff8e1;
  --info:         #00C2FF;
  --info-lt:      #e0f7ff;

  /* Neutral */
  --text-primary:  #0f0f1a;
  --text-secondary:#5a5a7a;
  --text-muted:    #9898b0;
  --border:        #e8e8f0;
  --border-strong: #c8c8d8;
  --surface:       #f7f7fc;
  --surface-2:     #f0f0f8;
  --bg:            #f4f4fb;
  --white:         #ffffff;

  /* Sidebar */
  --sidebar-w:   230px;
  --sidebar-bg:  #0f0f1a;
  --sidebar-text:#b0b0cc;
  --sidebar-active:#6C63FF;

  /* Misc */
  --radius:      10px;
  --radius-lg:   14px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.06);
  --shadow:      0 4px 16px rgba(0,0,0,.08);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.12);
}

*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────────── */
.bf-wrapper { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.bf-sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}
.bf-sidebar::-webkit-scrollbar { width: 4px; }
.bf-sidebar::-webkit-scrollbar-thumb { background: #2a2a40; border-radius: 2px; }

.bf-brand {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
}
.bf-brand-icon {
  width: 32px; height: 32px;
  background: var(--brand);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  box-shadow: 0 0 12px rgba(108,99,255,.5);
}

/* Company switcher pill */
.bf-company-pill {
  margin: 10px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background .15s;
}
.bf-company-pill:hover { background: rgba(255,255,255,.1); }
.bf-company-pill strong { color: #ddd; font-size: 12px; display: block; }

.bf-nav { padding: 8px 0 60px; }

.bf-nav-section {
  padding: 16px 18px 5px;
  font-size: 10px;
  color: rgba(255,255,255,.25);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 600;
}

.bf-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 450;
  border-radius: 0;
  transition: background .1s, color .1s;
  position: relative;
}
.bf-nav-item i { font-size: 16px; opacity: .7; flex-shrink: 0; }
.bf-nav-item:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}
.bf-nav-item.active {
  background: rgba(108,99,255,.18);
  color: #fff;
  font-weight: 500;
}
.bf-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(108,99,255,.8);
}
.bf-nav-item.active i { opacity: 1; color: var(--brand); }

.bf-sidebar-footer {
  position: fixed;
  bottom: 0;
  width: var(--sidebar-w);
  padding: 12px 18px;
  background: rgba(15,15,26,.95);
  border-top: 1px solid rgba(255,255,255,.06);
  backdrop-filter: blur(8px);
}
.bf-user-pill {
  display: flex; align-items: center; gap: 10px;
}
.bf-user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.bf-user-name { font-size: 12px; color: #ccc; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-logout { color: rgba(255,255,255,.3); font-size: 16px; transition: color .15s; }
.bf-logout:hover { color: var(--danger); }

/* ── Main area ───────────────────────────────────────────────── */
.bf-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Flash messages ──────────────────────────────────────────── */
.bf-flash {
  border-radius: 0;
  border-left: none; border-right: none; border-top: none;
  font-size: 13px;
  padding: 10px 24px;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.bf-topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}
.bf-topbar h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  flex: 1;
  letter-spacing: -.3px;
  color: var(--text-primary);
}

/* ── Content area ────────────────────────────────────────────── */
.bf-content { padding: 24px; flex: 1; }

/* ── Cards ───────────────────────────────────────────────────── */
.bf-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.bf-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-primary);
}
.bf-card-body { padding: 20px; }

/* ── Metric cards ────────────────────────────────────────────── */
.bf-metric {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}
.bf-metric:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.bf-metric-accent {
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  transform: translate(30px, -30px);
  opacity: .08;
}
.bf-metric-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  margin-bottom: 8px;
}
.bf-metric-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.5px;
}
.bf-metric-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; }

/* Metric colour variants */
.bf-metric.m-purple { border-top: 3px solid var(--brand); }
.bf-metric.m-green  { border-top: 3px solid var(--success); }
.bf-metric.m-red    { border-top: 3px solid var(--danger); }
.bf-metric.m-yellow { border-top: 3px solid var(--warning); }
.bf-metric.m-cyan   { border-top: 3px solid var(--info); }

.bf-metric.m-purple .bf-metric-accent { background: var(--brand); }
.bf-metric.m-green  .bf-metric-accent { background: var(--success); }
.bf-metric.m-red    .bf-metric-accent { background: var(--danger); }
.bf-metric.m-yellow .bf-metric-accent { background: var(--warning); }

/* Text helpers */
.text-success-custom { color: var(--success) !important; }
.text-danger-custom  { color: var(--danger)  !important; }
.text-warning-custom { color: var(--warning) !important; }
.text-brand          { color: var(--brand)   !important; }

/* ── Tables ──────────────────────────────────────────────────── */
.bf-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bf-table th {
  background: var(--surface);
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.bf-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f2f2f8;
  vertical-align: middle;
  color: var(--text-primary);
}
.bf-table tr:last-child td { border-bottom: none; }
.bf-table tbody tr:hover td { background: #fafafd; }

/* ── Status badges ───────────────────────────────────────────── */
.bf-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge-paid      { background: #d0faf0; color: #006b50; }
.badge-pending   { background: #fff3cd; color: #7a5000; }
.badge-overdue   { background: #ffe0ec; color: #9e0040; }
.badge-partial   { background: #ede8ff; color: #3d2fa0; }
.badge-draft     { background: #ebebf5; color: #4a4a6a; }
.badge-cancelled { background: #f5e0e0; color: #7a1a1a; }

/* ── Forms ───────────────────────────────────────────────────── */
.bf-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: block;
  margin-bottom: 5px;
}
.form-control, .form-select {
  border-color: var(--border);
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(108,99,255,.12);
  outline: none;
}

/* ── Line items table ────────────────────────────────────────── */
.item-row td { padding: 5px 8px !important; }
.item-row input, .item-row select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  width: 100%;
  background: var(--white);
  color: var(--text-primary);
  font-family: inherit;
}
.item-row input:focus, .item-row select:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 2px rgba(108,99,255,.1);
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
}
.btn-primary:hover {
  background: var(--brand-dark) !important;
  border-color: var(--brand-dark) !important;
  box-shadow: 0 4px 12px rgba(108,99,255,.35) !important;
}
.btn-success {
  background: var(--success) !important;
  border-color: var(--success) !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
}
.btn { border-radius: 8px !important; font-weight: 500 !important; }
.btn-sm { font-size: 12.5px !important; }

.btn-wa {
  background: #25D366;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  transition: background .15s;
}
.btn-wa:hover { background: #1da852; color: #fff; }

.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background .12s, color .12s;
}
.btn-icon:hover { background: var(--surface); color: var(--text-primary); }

/* ── Neon glow button ────────────────────────────────────────── */
.btn-neon {
  background: transparent;
  border: 2px solid var(--neon-green);
  color: var(--neon-green);
  border-radius: 8px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  text-shadow: 0 0 8px var(--neon-green);
  box-shadow: 0 0 12px rgba(57,255,20,.3);
  transition: all .15s;
}
.btn-neon:hover {
  background: var(--neon-green);
  color: #0f0f1a;
  box-shadow: 0 0 20px rgba(57,255,20,.6);
}

/* ── Invoice PDF preview ─────────────────────────────────────── */
.invoice-preview {
  font-family: 'Inter', Arial, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}

/* ── Login page ──────────────────────────────────────────────── */
.bf-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  position: relative;
  overflow: hidden;
}
.bf-login-wrap::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108,99,255,.25) 0%, transparent 70%);
  top: -100px; left: -100px;
  pointer-events: none;
}
.bf-login-wrap::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(57,255,20,.1) 0%, transparent 70%);
  bottom: -80px; right: -80px;
  pointer-events: none;
}
.bf-login-box {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 44px 40px;
  width: 400px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  position: relative;
  z-index: 10;
}
.bf-login-logo {
  text-align: center;
  font-size: 40px;
  margin-bottom: 6px;
}
.bf-login-title {
  text-align: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 4px;
  letter-spacing: -.5px;
}
.bf-login-sub {
  text-align: center;
  color: rgba(255,255,255,.45);
  font-size: 13px;
  margin-bottom: 32px;
}
.bf-login-box .form-control {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  border-radius: 10px;
}
.bf-login-box .form-control::placeholder { color: rgba(255,255,255,.3); }
.bf-login-box .form-control:focus {
  background: rgba(255,255,255,.1);
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(108,99,255,.25);
  color: #fff;
}
.bf-login-box .bf-label { color: rgba(255,255,255,.5); }
.bf-login-box .btn-primary {
  background: var(--brand) !important;
  border: none !important;
  font-size: 14px !important;
  padding: 11px !important;
  box-shadow: 0 0 20px rgba(108,99,255,.4) !important;
}

/* ── Dashboard stats gradient ────────────────────────────────── */
.bf-stat-card {
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.bf-stat-card::after {
  content: '';
  position: absolute;
  right: -20px; bottom: -20px;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
}
.bf-stat-card .label { font-size: 11px; font-weight: 600; opacity: .75; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 8px; }
.bf-stat-card .val   { font-size: 28px; font-weight: 800; letter-spacing: -.5px; }
.bf-stat-card .sub   { font-size: 11.5px; opacity: .7; margin-top: 6px; }
.sc-purple { background: linear-gradient(135deg,#6C63FF 0%,#9B59B6 100%); }
.sc-green  { background: linear-gradient(135deg,#00C896 0%,#00a06e 100%); }
.sc-red    { background: linear-gradient(135deg,#FF2D78 0%,#c0124a 100%); }
.sc-orange { background: linear-gradient(135deg,#FF6B00 0%,#e05500 100%); }
.sc-cyan   { background: linear-gradient(135deg,#00C2FF 0%,#0090cc 100%); }

/* ── Utilities ───────────────────────────────────────────────── */
.text-money { font-weight: 600; font-variant-numeric: tabular-nums; }
.gap-2 { gap: 8px; }

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .bf-sidebar { transform: translateX(-100%); transition: transform .2s; }
  .bf-sidebar.open { transform: translateX(0); }
  .bf-main { margin-left: 0; }
  .bf-content { padding: 16px; }
}
