:root {
  --primary: #3b4fd8;
  --primary-dark: #2b3aa8;
  --primary-light: #5b6ef5;
  --sidebar-bg: #1e2230;
  --sidebar-hover: #2a2f42;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text-main: #1e2230;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.13);
  --radius: 14px;

  --c-blue: #3b4fd8;
  --c-purple: #7c6fcd;
  --c-green: #1a7a4a;
  --c-orange: #e07b39;
  --c-red: #b84040;
  --c-teal: #0d6b7e;
  --c-indigo: #5b3ecb;
  --c-slate: #475569;
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", sans-serif;
  background: var(--bg);
  color: var(--text-main);
}

/* ---------- Layout shell ---------- */

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

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: #cbd0e0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  transition: transform .2s ease;
  z-index: 1030;
}

.sidebar-brand {
  padding: 1.4rem 1.25rem 1.1rem;
  display: flex;
  align-items: center;
  gap: .6rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand .icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: #fff; flex-shrink: 0;
}
.sidebar-brand .title { font-weight: 700; font-size: .98rem; color: #fff; line-height: 1.2; }
.sidebar-brand .subtitle { font-size: .72rem; color: #8b90a8; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: .75rem .6rem; }
.sidebar-nav .nav-link {
  color: #b6bad0; border-radius: 9px; padding: .6rem .8rem;
  font-size: .88rem; font-weight: 500; display: flex; align-items: center;
  gap: .65rem; margin-bottom: .15rem; transition: background .12s, color .12s;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
}

.sidebar-footer {
  padding: 1rem 1.1rem; border-top: 1px solid rgba(255,255,255,.08);
  font-size: .78rem; color: #8b90a8;
}

.main-area { flex: 1; margin-left: 260px; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: .75rem 1.5rem; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 1020;
}
.topbar .page-title { font-weight: 700; font-size: 1.05rem; margin: 0; }
.topbar .user-chip {
  display: flex; align-items: center; gap: .6rem;
  font-size: .85rem;
}
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .78rem; flex-shrink: 0;
}
.role-pill {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: .12rem .5rem; border-radius: 20px;
  background: #ede9ff; color: #5b3ecb;
}

.content-area { padding: 1.5rem; flex: 1; }

.sidebar-toggle-btn { display: none; }

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .sidebar-toggle-btn { display: inline-flex; }
  .sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1025;
  }
  .sidebar-backdrop.show { display: block; }
}

/* ---------- Cards / dashboard tiles ---------- */

.module-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1.5px solid var(--border);
  overflow: hidden; height: 100%; text-decoration: none; color: inherit;
  display: block; transition: transform .18s, box-shadow .18s;
}
.module-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); color: inherit; }
.module-card-icon {
  height: 84px; display: flex; align-items: center; justify-content: center;
  font-size: 1.9rem; color: #fff;
}
.module-card-body { padding: 1rem 1.15rem 1.25rem; }
.module-card-body h6 { font-weight: 700; margin-bottom: .25rem; }
.module-card-body p { color: var(--text-muted); font-size: .83rem; margin: 0; }

.bg-c-blue   { background: var(--c-blue); }
.bg-c-purple { background: var(--c-purple); }
.bg-c-green  { background: var(--c-green); }
.bg-c-orange { background: var(--c-orange); }
.bg-c-red    { background: var(--c-red); }
.bg-c-teal   { background: var(--c-teal); }
.bg-c-indigo { background: var(--c-indigo); }
.bg-c-slate  { background: var(--c-slate); }

.stat-card {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1.5px solid var(--border); padding: 1.1rem 1.3rem; height: 100%;
}
.stat-card .stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.stat-card .stat-label { color: var(--text-muted); font-size: .82rem; margin-top: .25rem; }
.stat-card .stat-icon {
  width: 42px; height: 42px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; color: #fff; font-size: 1.15rem;
}

.panel {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1.5px solid var(--border); overflow: hidden;
}
.panel-header {
  padding: 1rem 1.4rem; background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; font-weight: 700; display: flex; align-items: center; gap: .5rem;
}
.panel-body { padding: 1.4rem; }

.form-control, .form-select {
  border-radius: 9px; border: 1.5px solid var(--border); font-size: .9rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(91,110,245,.12);
}

.btn-brand {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; border: none; border-radius: 9px; font-weight: 600;
}
.btn-brand:hover { color: #fff; opacity: .92; }

.table thead th {
  background: #f3f4f8; color: var(--text-muted); font-size: .74rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1.5px solid var(--border); white-space: nowrap;
}
.table tbody tr:hover { background: #f7f8ff; }

.badge-locked { background: #fee2e2; color: #b91c1c; }
.badge-open   { background: #dcfce7; color: #16a34a; }

@media print {
  .no-print { display: none !important; }
}
