/* CanApp Billing Dashboard CSS */
:root {
  --navy:    #0A0F1E;
  --navy2:   #111827;
  --navy3:   #1A2236;
  --blue:    #2D7EFF;
  --white:   #F0F4FF;
  --slate:   #8896B3;
  --green:   #3DD68C;
  --red:     #F87171;
  --amber:   #FBBF24;
  --border:  rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --radius:  10px;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --sidebar-width: 220px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: var(--font-body); background: var(--navy); color: var(--white); -webkit-font-smoothing: antialiased; font-size: 14px; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }

/* LOGIN */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--navy); }
.login-wrap { width: 100%; max-width: 380px; padding: 2rem; }
.login-logo { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; text-align: center; margin-bottom: 2rem; }
.login-logo span { color: var(--blue); }
.login-card { background: var(--navy2); border: 1px solid var(--border); border-radius: 14px; padding: 2rem; }
.login-card h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 1.5rem; }

/* LAYOUT */
.app-layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: var(--sidebar-width); flex-shrink: 0;
  background: #07090F; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto;
  padding: 1.2rem 0.8rem;
}
.sidebar-logo { font-family: var(--font-display); font-size: 1rem; font-weight: 700; padding: 0 0.6rem 1.2rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.sidebar-logo span { color: var(--blue); }
.nav-section { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--slate); padding: 0 0.6rem; margin: 0.8rem 0 0.4rem; }
.nav-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--slate); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.15s; margin-bottom: 2px; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.nav-item.active { background: rgba(45,126,255,0.15); color: var(--blue); }
.sidebar-spacer { flex: 1; }
.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.topbar { flex-shrink: 0; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; background: var(--navy2); border-bottom: 1px solid var(--border); }
.topbar-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; }
.page-content { flex: 1; padding: 1.5rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--navy2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.stat-num { font-family: var(--font-display); font-size: 1.8rem; font-weight: 800; line-height: 1; margin-bottom: 0.3rem; }
.stat-label { font-size: 11px; color: var(--slate); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-sub { font-size: 11px; color: var(--slate); margin-top: 0.2rem; }

/* CARDS */
.card { background: var(--navy2); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 1rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 1.2rem; border-bottom: 1px solid var(--border); }
.card-title { font-family: var(--font-display); font-size: 0.9rem; font-weight: 700; }
.card-body { padding: 1.2rem; }

/* TABLES */
.table-wrap { overflow-x: auto; }
.data-table th { padding: 0.6rem 1rem; text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--slate); background: var(--navy3); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table a { color: var(--blue); }
.data-table a:hover { text-decoration: underline; }

/* FORMS */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field label { font-size: 12px; font-weight: 600; color: var(--slate); }
.field input, .field select, .field textarea {
  background: var(--navy3); border: 1.5px solid var(--border2); border-radius: 8px;
  padding: 0.55rem 0.9rem; color: var(--white); font-family: var(--font-body); font-size: 14px;
  outline: none; transition: border-color 0.15s; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--blue); }
.field select option { background: var(--navy2); }
.field textarea { resize: vertical; min-height: 80px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 0.5rem 1.1rem; border-radius: 7px; border: none; cursor: pointer; font-family: var(--font-body); font-size: 13px; font-weight: 600; transition: all 0.15s; }
.btn:active { opacity: 0.8; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--white); border: 1px solid var(--border2); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: rgba(248,113,113,0.12); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }
.btn-success { background: rgba(61,214,140,0.12); color: var(--green); border: 1px solid rgba(61,214,140,0.25); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 12px; border-radius: 6px; }
.btn-full { width: 100%; justify-content: center; }

/* BADGES */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-active { background: rgba(61,214,140,0.12); color: var(--green); }
.badge-suspended { background: rgba(251,191,36,0.12); color: var(--amber); }
.badge-inactive, .badge-cancelled { background: rgba(255,255,255,0.06); color: var(--slate); }
.badge-paid { background: rgba(61,214,140,0.12); color: var(--green); }
.badge-unpaid, .badge-overdue { background: rgba(248,113,113,0.12); color: var(--red); }
.badge-partial { background: rgba(251,191,36,0.12); color: var(--amber); }
.badge-draft { background: rgba(255,255,255,0.06); color: var(--slate); }
.badge-sent { background: rgba(45,126,255,0.12); color: var(--blue); }

/* BALANCE */
.balance-positive { color: var(--green); font-weight: 700; }
.balance-negative { color: var(--red); font-weight: 700; }
.balance-zero { color: var(--slate); }

/* TX TYPE */
.tx-charge { color: var(--red); }
.tx-payment, .tx-credit { color: var(--green); }
.tx-adjustment { color: var(--amber); }

/* ALERTS */
.alert { padding: 0.75rem 1rem; border-radius: 8px; font-size: 13px; margin-bottom: 1rem; }
.alert-error { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.25); }
.alert-success { background: rgba(61,214,140,0.1); color: var(--green); border: 1px solid rgba(61,214,140,0.25); }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; flex-wrap: wrap; gap: 0.8rem; }
.page-header h1 { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; }
.breadcrumb { font-size: 12px; color: var(--slate); margin-bottom: 0.3rem; }
.breadcrumb a { color: var(--blue); }

/* CLIENT BALANCE CARD */
.balance-card { background: var(--navy3); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem 1.4rem; display: flex; align-items: center; gap: 1.5rem; margin-bottom: 1rem; }
.balance-amount { font-family: var(--font-display); font-size: 2.2rem; font-weight: 800; }
.balance-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate); margin-bottom: 0.2rem; }

/* MODAL */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 200; align-items: center; justify-content: center; }
.modal-overlay.open { display: flex; }
.modal { background: var(--navy2); border: 1px solid var(--border2); border-radius: 14px; padding: 1.5rem; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; margin: 1rem; }
.modal-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; margin-bottom: 1.2rem; }
.modal-actions { display: flex; gap: 0.75rem; margin-top: 1.2rem; }

/* EMPTY */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--slate); }
.empty-state-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.empty-state h4 { font-family: var(--font-display); font-size: 1rem; font-weight: 600; margin-bottom: 0.4rem; color: var(--white); }

/* INVOICE */
.invoice-box { background: #fff; color: #1a202c; border-radius: 10px; padding: 2rem; max-width: 700px; margin: 0 auto; font-family: var(--font-body); }
.invoice-box table td, .invoice-box table th { color: #1a202c; }

@media (max-width: 768px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .sidebar { display: none; }
  .row2, .row3 { grid-template-columns: 1fr; }
}
