:root {
  --ink: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --nav: #111827;
  --nav-2: #1f2937;
  --blue: #2563eb;
  --cyan: #06b6d4;
  --green: #16a34a;
  --orange: #f97316;
  --red: #dc2626;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, "Plus Jakarta Sans", system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--ink);
  background: var(--soft);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(17,24,39,.9), rgba(37,99,235,.72)),
    url("https://images.unsplash.com/photo-1551434678-e076c223a692?auto=format&fit=crop&w=1800&q=80") center/cover;
}
.login-panel {
  width: min(440px, 100%);
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 8px;
  padding: 34px;
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  font-weight: 800;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 278px;
  background: linear-gradient(180deg, var(--nav), var(--nav-2));
  color: #f9fafb;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 24px 18px;
  z-index: 10;
}
.sidebar-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 30px; }
.sidebar-brand strong { display: block; letter-spacing: .2px; }
.sidebar-brand span { display: block; color: #9ca3af; font-size: 12px; margin-top: 2px; }
.nav-link {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #d1d5db;
  padding: 11px 12px;
  border-radius: 8px;
  margin: 3px 0;
}
.nav-link:hover, .nav-link.active { background: rgba(255,255,255,.08); color: white; }
.main {
  margin-left: 278px;
  width: calc(100% - 278px);
  min-height: 100vh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 28px;
  background: rgba(246,248,251,.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 23px; margin: 0; }
.top-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search { width: min(380px, 42vw); }
.content { padding: 28px; }
.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 28px; font-weight: 800; margin-top: 8px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 0 0 14px; }
.section-title h2 { font-size: 17px; margin: 0; }
.btn {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  min-height: 40px;
}
.btn-primary { background: var(--blue); color: white; }
.btn-soft { background: #eef4ff; color: #1d4ed8; }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-ghost { background: transparent; color: var(--muted); }
.input, .select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 42px;
}
textarea { min-height: 105px; resize: vertical; }
label { display: block; font-size: 13px; color: #344054; margin-bottom: 7px; font-weight: 650; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: #f9fafb; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; background: #eef4ff; color: #1d4ed8; }
.badge.success { background: #dcfce7; color: #166534; }
.badge.warn { background: #ffedd5; color: #9a3412; }
.badge.danger { background: #fee2e2; color: #991b1b; }
.muted { color: var(--muted); }
.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.flash.success { background: #dcfce7; color: #166534; }
.flash.error { background: #fee2e2; color: #991b1b; }
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.mobile-toggle { display: none; }
.chart-box { height: 220px; }
.list { display: grid; gap: 10px; }
.list-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }

@media (max-width: 980px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .main { margin-left: 0; width: 100%; }
  .mobile-toggle { display: inline-flex; }
  .stats, .two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { width: 100%; }
}
@media (max-width: 640px) {
  .content, .topbar { padding: 18px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .stats, .two, .form-grid { grid-template-columns: 1fr; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tr { border-bottom: 1px solid var(--line); padding: 10px; }
  .table-wrap td { border: 0; padding: 8px 4px; }
  .table-wrap td::before { content: attr(data-label); display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
}
