:root {
  --primary: #1a3c6e;
  --primary-light: #2d5a9e;
  --accent: #e8a33d;
  --bg: #f4f6fa;
  --danger: #d9534f;
  --success: #28a745;
  --sidebar-width: 230px;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  color: #2b2b2b;
  margin: 0;
}

.app-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary) 0%, #12294d 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
}

.sidebar-brand {
  padding: 22px 18px;
  font-size: 1.15rem;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand i { font-size: 1.4rem; color: var(--accent); }

.sidebar-nav { list-style: none; padding: 10px 0; margin: 0; flex: 1; }
.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
  transition: all .15s ease;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-nav li a.active {
  background: rgba(255,255,255,0.12);
  border-left: 3px solid var(--accent);
  color: #fff;
  font-weight: 600;
}
.sidebar-nav li a i { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 15px 20px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.5);
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  padding: 28px 32px;
  width: calc(100% - var(--sidebar-width));
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.page-header h2 { margin: 0; font-weight: 600; color: var(--primary); }

.card-kpi {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  border: none;
  height: 100%;
}
.card-kpi .kpi-label { font-size: 0.82rem; color: #888; text-transform: uppercase; letter-spacing: .03em; }
.card-kpi .kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--primary); margin-top: 4px; }
.card-kpi .kpi-icon {
  width: 46px; height: 46px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #fff;
}

.panel {
  background: #fff;
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  margin-bottom: 24px;
}

.table thead th {
  background: #f0f3f9;
  border-bottom: none;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: .02em;
  color: #555;
}

.badge-status-paid { background: var(--success); }
.badge-status-unpaid { background: var(--danger); }

.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }

.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #d1922f; border-color: #d1922f; color: #fff; }

.search-bar { max-width: 320px; }

.low-stock-row { background: #fdecea !important; }

#toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
}

.invoice-item-row td { vertical-align: middle; }

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