:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 8px;
}

* {
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  margin: 0;
  background: var(--gray-50);
  color: var(--gray-700);
}

/* header */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 12px 24px;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
}

.topbar .title {
  font-weight: 600;
  font-size: 18px;
  color: var(--gray-900);
}

.top-actions { display: flex; gap: 8px; }

/* buttons */
.btn {
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: 0.2s;
}

.btn:hover { background: var(--gray-100); }
.btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn.primary:hover { background: var(--blue-dark); }
.btn.xs { font-size: 12px; padding: 4px 10px; }

/* layout */
.layout { display: flex; min-height: calc(100vh - 60px); }

/* sidebar */
.sidebar {
  width: 230px;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gray-700);
  padding: 12px 20px;
  text-decoration: none;
  transition: .2s;
}
.sidebar nav a:hover { background: var(--gray-100); }
.sidebar nav a.active { background: var(--blue); color: #fff; }
.sidebar-foot { padding: 16px; border-top: 1px solid var(--gray-200); background: var(--gray-50); }
.sidebar-foot input {
  width: 100%; border: 1px solid var(--gray-300); border-radius: var(--radius);
  padding: 6px 8px; font-size: 13px;
}
.sidebar-foot label { font-size: 12px; margin-bottom: 4px; display: block; color: var(--gray-700); }

/* content area */
.content { flex: 1; padding: 24px; overflow-y: auto; }

/* cards */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h3 { margin: 0; font-weight: 600; color: var(--gray-900); }

/* kpis */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  text-align: center;
  padding: 14px 10px;
}
.kpi-label { font-size: 12px; color: #6b7280; text-transform: uppercase; }
.kpi-value { font-size: 20px; color: var(--blue); font-weight: 600; }

/* tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-200); }
.table th { background: var(--gray-100); font-weight: 600; color: var(--gray-700); }
.table tr:hover td { background: var(--gray-50); }
.center { text-align: center; }
.muted { color: #6b7280; }

/* modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 500px;
  max-width: 95%;
  padding: 20px;
  box-shadow: 0 5px 20px rgba(0,0,0,.15);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.field label { display:block; font-size:13px; color:#6b7280; margin-bottom:4px; }
.field input {
  width:100%;
  border:1px solid var(--gray-300);
  border-radius:var(--radius);
  padding:6px 8px;
  font-size:13px;
}
.grid-2 { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:10px; }

/* badges & toast */
.badge {
  display:inline-block; padding:3px 8px; font-size:12px;
  border-radius:999px; background:var(--gray-200); color:var(--gray-700);
}
.badge.blue { background:#dbeafe; color:#1e3a8a; }
.badge.green { background:#dcfce7; color:#166534; }

.toast {
  position:fixed; bottom:20px; right:20px;
  background:var(--gray-900); color:#fff;
  padding:10px 14px; border-radius:var(--radius);
  font-size:13px; opacity:0; transition:0.3s;
}
.toast.show { opacity:1; }

/* footer */
.footer {
  text-align:center;
  padding:12px;
  border-top:1px solid var(--gray-200);
  background:#fff;
  font-size:13px;
  color:#6b7280;
}
