/* ============================================================
   Finance Platform — Custom Styles
   ============================================================ */

:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1a1f2e;
  --sidebar-text: #a8b3c8;
  --sidebar-active: #ffffff;
  --sidebar-active-bg: #3b5bdb;
  --sidebar-hover-bg: rgba(255,255,255,0.07);
  --topbar-height: 60px;
  --primary: #3b5bdb;
  --border-color: #e9ecef;
}

/* ============================================================
   Layout
   ============================================================ */

body {
  background: #f0f2f5;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  overflow-x: hidden;
}

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a1f2e 0%, #3b5bdb 100%);
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.25s ease;
}

.sidebar-brand {
  padding: 18px 20px;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-company {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-company-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-section {
  padding: 16px 20px 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(168,179,200,0.5);
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
}
.nav-item:hover {
  color: #fff;
  background: var(--sidebar-hover-bg);
}
.nav-item.active {
  color: var(--sidebar-active);
  background: var(--sidebar-active-bg);
  font-weight: 600;
}
.nav-item i {
  font-size: 16px;
  width: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1039;
}
.sidebar-overlay.show { display: block; }

/* Main wrapper */
.main-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  color: #1a1f2e;
}

.user-avatar {
  width: 34px;
  height: 34px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.content-area {
  flex: 1;
  padding: 24px;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  padding: 14px 20px;
  font-weight: 600;
  border-radius: 10px 10px 0 0 !important;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}
.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: #1a1f2e;
  line-height: 1.1;
  margin-top: 4px;
}
.stat-label {
  font-size: 12px;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ============================================================
   Tables
   ============================================================ */

.table-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
  font-weight: 700;
  border-top: none;
  white-space: nowrap;
  padding: 12px 16px;
  background: #f8f9fa;
}
.table td {
  padding: 12px 16px;
  vertical-align: middle;
  color: #1a1f2e;
}
.table-hover tbody tr:hover {
  background: #f8f9ff;
}

.table-filter {
  background: #fff;
  border-bottom: 1px solid var(--border-color);
  padding: 14px 16px;
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
  font-weight: 600;
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
}

/* ============================================================
   Forms
   ============================================================ */

.form-label {
  font-weight: 600;
  font-size: 13px;
  color: #495057;
  margin-bottom: 4px;
}

.form-control, .form-select {
  border-color: #dee2e6;
  border-radius: 7px;
  font-size: 14px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,91,219,0.1);
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6c757d;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border-color);
}

/* ============================================================
   Items table (invoice/expense/quote lines)
   ============================================================ */

.items-table th {
  background: #f8f9fa;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6c757d;
  font-weight: 700;
  border-top: none;
  padding: 10px 8px;
}
.items-table td {
  padding: 6px 8px;
  vertical-align: middle;
}
.items-table .form-control, .items-table .form-select {
  font-size: 13px;
  padding: 5px 10px;
}

.items-totals {
  background: #f8f9fa;
  border-top: 2px solid var(--border-color);
  padding: 16px 20px;
  border-radius: 0 0 8px 8px;
}
.totals-row {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 6px;
  font-size: 14px;
}
.totals-row.total-final {
  font-size: 18px;
  font-weight: 800;
  color: #1a1f2e;
  border-top: 2px solid var(--border-color);
  padding-top: 10px;
  margin-top: 6px;
}
.totals-label { color: #6c757d; min-width: 120px; text-align: right; }
.totals-value { min-width: 130px; text-align: right; }

/* ============================================================
   Login page
   ============================================================ */

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo i {
  font-size: 48px;
  color: var(--primary);
}
.login-logo h2 {
  font-weight: 800;
  color: #1a1f2e;
  margin-top: 8px;
}

/* ============================================================
   Print / PDF
   ============================================================ */

.invoice-print-page {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  padding: 40px;
  font-size: 13px;
  color: #1a1f2e;
}

.invoice-header-logo {
  width: 120px;
}

.invoice-company-name {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
}

.invoice-number {
  font-size: 28px;
  font-weight: 900;
  color: #1a1f2e;
}

.invoice-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6c757d;
  font-weight: 700;
  margin-bottom: 4px;
}

.invoice-box {
  background: #f8f9fa;
  border-radius: 8px;
  padding: 16px;
}

.invoice-items th {
  background: #1a1f2e;
  color: #fff;
  font-size: 11px;
  text-transform: uppercase;
  padding: 10px 12px;
  border: none;
}
.invoice-items td {
  padding: 10px 12px;
  border-bottom: 1px solid #dee2e6;
}

.invoice-total-table td {
  padding: 5px 12px;
}
.invoice-total-table .final-total {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .invoice-print-page { padding: 0; box-shadow: none; }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 991px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0;
  }
}

/* Company cards */
.company-card {
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  background: #fff;
  cursor: pointer;
  transition: all 0.2s;
}
.company-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(59,91,219,0.15);
}
.company-card.active {
  border-color: var(--primary);
  background: #f0f3ff;
}
.company-flag {
  font-size: 36px;
}
.company-card-name {
  font-size: 18px;
  font-weight: 700;
  color: #1a1f2e;
}

/* Misc */
.breadcrumb-item + .breadcrumb-item::before { content: "›"; }
.cursor-pointer { cursor: pointer; }
.text-money { font-family: 'Courier New', monospace; font-weight: 700; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6c757d;
}
.empty-state i {
  font-size: 56px;
  opacity: 0.3;
  display: block;
  margin-bottom: 16px;
}
