:root {
  --sidebar-w: 250px;
  --navy: #0f1b2d;
  --navy-2: #16273f;
  --accent: #2563eb;
  --accent-2: #16a34a;
  --text-muted: #64748b;
  --border: #e5e9f0;
  --bg: #f4f6f9;
}

* { box-sizing: border-box; }

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

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

.app-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #cbd5e1;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1.25rem 1.25rem;
  font-weight: 700; font-size: 1.05rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { color: var(--accent); font-size: 1.3rem; }

.sidebar-nav { padding: .75rem .6rem; display: flex; flex-direction: column; gap: .15rem; }
.sidebar-nav .nav-link {
  color: #b8c4d6; padding: .6rem .85rem; border-radius: 8px;
  display: flex; align-items: center; gap: .7rem; font-size: .92rem;
  text-decoration: none; transition: background .15s, color .15s;
}
.sidebar-nav .nav-link i { width: 18px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--accent); color: #fff; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--border);
  padding: .7rem 1.5rem; position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-weight: 600; font-size: 1.05rem; }
.topbar-right { display: flex; align-items: center; }
.user-chip { font-size: .88rem; color: #334155; }
.role-pill {
  background: #eef2ff; color: var(--accent); border-radius: 20px;
  padding: .1rem .55rem; font-size: .72rem; text-transform: uppercase; margin-left: .3rem;
}

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

/* ---- Cards ---- */
.kpi-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 1rem 1.15rem;
}
.kpi-card .kpi-label { color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
.kpi-card .kpi-value { font-size: 1.55rem; font-weight: 700; margin-top: .25rem; }
.kpi-card .kpi-sub { font-size: .78rem; color: var(--text-muted); }

.panel {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 1.25rem;
}
.panel-title { font-weight: 600; margin-bottom: 1rem; }

/* ---- Tables ---- */
.table-clean thead th {
  background: #f8fafc; font-size: .78rem; text-transform: uppercase;
  letter-spacing: .03em; color: var(--text-muted); border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table-clean td { vertical-align: middle; font-size: .9rem; }

/* ---- Badges ---- */
.badge-success { background: #dcfce7; color: #15803d; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-danger { background: #fee2e2; color: #b91c1c; }
.badge-secondary { background: #f1f5f9; color: #64748b; }
.badge-success, .badge-info, .badge-danger, .badge-secondary {
  font-weight: 600; padding: .35em .6em; border-radius: 6px; font-size: .74rem;
}

/* ---- Auth pages ---- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
}
.auth-card {
  background: #fff; border-radius: 14px; padding: 2.2rem; width: 100%; max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

@media (max-width: 991px) {
  .app-sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; }
  .app-sidebar.open { left: 0; }
}
