:root {
  --primary: #E66239;
  --primary-hover: #cc5530;
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --font: 'Poppins', sans-serif;
}

* { font-family: var(--font); }
body { background: #f5f5f5; font-size: .875rem; color: #262626; }

/* ── Topbar ── */
.topbar {
  position: fixed; top: 0; right: 0; left: 0; z-index: 1040;
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem;
  margin-left: var(--sidebar-w);
  transition: margin-left .3s;
}
.topbar.full { margin-left: 60px; }
.topbar-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: #f5f5f5; color: #404040; text-decoration: none;
  transition: background .15s;
}
.topbar-icon:hover { background: #e5e5e5; color: #262626; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  background: #FB2C36; color: #fff;
  font-size: .6rem; font-weight: 700; line-height: 1;
  padding: 2px 4px; border-radius: 10px;
}
.topbar-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.sidebar-toggle {
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid #e5e5e5; background: #fafafa;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: #404040; font-size: 1.1rem;
  transition: background .15s;
}
.sidebar-toggle:hover { background: #f0f0f0; }

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 1045;
  width: var(--sidebar-w); height: 100vh;
  background: #fff; border-right: 1px solid #e5e5e5;
  display: flex; flex-direction: column;
  transition: width .3s, left .3s;
  overflow: hidden;
}
.sidebar.collapsed { width: 60px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-section,
.sidebar.collapsed .nav-link span:not(.badge),
.sidebar.collapsed .badge { display: none; }
.sidebar.collapsed .nav-link { padding: 10px 19px; margin: 1px 0; border-radius: 0; justify-content: center; }
.sidebar-logo {
  height: var(--topbar-h); padding: 0 16px;
  display: flex; align-items: center;
  border-bottom: 1px solid #e5e5e5; flex-shrink: 0;
}
.logo-text { font-size: .9rem; color: #262626; white-space: nowrap; }
.sidebar-nav { padding: 8px 0; overflow-y: auto; flex: 1; }
.nav-section {
  font-size: .65rem; color: #a3a3a3; font-weight: 600;
  padding: 14px 16px 4px; letter-spacing: .07em; white-space: nowrap;
}
.nav-link {
  color: #404040; font-size: .85rem; font-weight: 400;
  padding: 8px 12px; margin: 1px 8px; border-radius: 8px;
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
  text-decoration: none; transition: background .15s, color .15s;
}
.nav-link i { font-size: 17px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-link:hover { color: var(--primary); background: rgba(230,98,57,.08); }
.nav-link.active { color: var(--primary); background: rgba(230,98,57,.1); font-weight: 500; }
.text-danger-nav { color: #d00 !important; }
.text-danger-nav:hover { color: #a00 !important; background: rgba(200,0,0,.06) !important; }

/* ── Content ── */
.content {
  margin-left: var(--sidebar-w);
  padding-top: calc(var(--topbar-h) + 24px);
  padding-bottom: 40px;
  min-height: 100vh;
  transition: margin-left .3s;
}
.content.full { margin-left: 60px; }

/* ── Overlay ── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); backdrop-filter: blur(1px);
  z-index: 1040;
}
.overlay.show { display: block; }

@media (max-width: 991px) {
  .sidebar { left: -260px; }
  .sidebar.mobile-show { left: 0; }
  .topbar { margin-left: 0 !important; }
  .content { margin-left: 0 !important; }
}

/* ── Cards ── */
.card { border: 1px solid #e5e5e5; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-header { background: transparent; border-bottom: 1px solid #f0f0f0; }
.stat-card { border-radius: 12px; padding: 1.25rem; }
.icon-shape {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
}
.icon-sm  { width: 2rem;   height: 2rem;   font-size: .95rem; }
.icon-md  { width: 2.5rem; height: 2.5rem; font-size: 1.1rem; }
.icon-lg  { width: 3rem;   height: 3rem;   font-size: 1.3rem; }

/* ── Buttons ── */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover,.btn-primary:focus { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.text-primary { color: var(--primary) !important; }
.bg-primary   { background: var(--primary) !important; }
.border-primary { border-color: var(--primary) !important; }

/* ── Tables ── */
.table { font-size: .85rem; }
.table th { font-weight: 500; color: #525252; background: #fafafa; }
.table-hover tbody tr:hover { background: #fafafa; }
.table-actions a, .table-actions button { color: #737373; transition: color .15s; }
.table-actions a:hover, .table-actions button:hover { color: var(--primary); }

/* ── Badges ── */
.badge.status-normal   { background: rgba(0,201,81,.12);   color: #006d2c; border: 1px solid rgba(0,201,81,.25); }
.badge.status-low      { background: rgba(240,177,0,.12);  color: #7d5a00; border: 1px solid rgba(240,177,0,.3); }
.badge.status-out      { background: rgba(251,44,54,.1);   color: #a00;    border: 1px solid rgba(251,44,54,.2); }
.badge.role-admin      { background: rgba(230,98,57,.12);  color: #8b2500; border: 1px solid rgba(230,98,57,.25); }
.badge.role-staff      { background: rgba(100,100,100,.1); color: #444;    border: 1px solid #ddd; }

/* ── Login page ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f5f5f5; }
.login-card { width: 100%; max-width: 420px; border-radius: 16px; padding: 2.5rem; }
.login-logo { font-size: 1.4rem; font-weight: 700; color: var(--primary); }

/* ── Misc ── */
.avatar-upload { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; }
.barcode-canvas { max-width: 100%; }
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.35rem; font-weight: 600; margin-bottom: .2rem; }

/* ── Print ── */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { margin: 0 !important; padding: 0 !important; }
}
